epoc32/include/mw/aknqueryvalue.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
// AknQueryValue.h
williamr@2
    19
//
williamr@2
    20
// Copyright (c) 2001 Symbian Ltd.  All rights reserved.
williamr@2
    21
//
williamr@2
    22
williamr@2
    23
#if !defined(__AKNQUERYVALUE_H__)
williamr@2
    24
#define __AKNQUERYVALUE_H__
williamr@2
    25
williamr@2
    26
williamr@2
    27
#include <eikenv.h>
williamr@2
    28
#include <babitflags.h>
williamr@2
    29
williamr@2
    30
class MDesCArray;
williamr@2
    31
williamr@2
    32
/**
williamr@2
    33
 * Mixin class representing a value that is accessed as text.
williamr@2
    34
 * <p> The Value can be changed by creating an editor dialog, 
williamr@2
    35
 * which may be either a query or a setting page
williamr@2
    36
 * or optionally by choosing an entry from an array of values. 
williamr@2
    37
 * The array can be accessed as a descriptor array, and the value 
williamr@2
    38
 * can be accessed as a descriptor.
williamr@2
    39
 */
williamr@2
    40
class MAknQueryValue
williamr@2
    41
	{
williamr@2
    42
public:
williamr@2
    43
	/**
williamr@2
    44
	 * Possible modes are query & setting page 
williamr@2
    45
	 * 
williamr@2
    46
	 */
williamr@2
    47
	enum TMode
williamr@2
    48
		{
williamr@2
    49
		EQueryMode,
williamr@2
    50
		ESettingPageMode
williamr@2
    51
		};
williamr@2
    52
protected:
williamr@2
    53
	/**
williamr@2
    54
	 * If EAutoAppendBitIndex is set, 
williamr@2
    55
	 * the query value auto appends new values
williamr@2
    56
	 */
williamr@2
    57
	enum TFlagBits
williamr@2
    58
		{
williamr@2
    59
		ESettingPageModeBitIndex = 0,
williamr@2
    60
		EAutoAppendBitIndex
williamr@2
    61
		};
williamr@2
    62
public:
williamr@2
    63
	virtual ~MAknQueryValue() {}
williamr@2
    64
	
williamr@2
    65
	/**
williamr@2
    66
	 * Returns the array as a descriptor array, 
williamr@2
    67
	 * ownership will be not passed 
williamr@2
    68
	 */	
williamr@2
    69
	virtual const MDesCArray* MdcArray() const = 0;
williamr@2
    70
	
williamr@2
    71
    /**
williamr@2
    72
     * This should be implemented so that it returns the current value as text
williamr@2
    73
     * 
williamr@2
    74
     * @return	descriptor representing current value, new 
williamr@2
    75
     * descriptor is created and left on cleanup stack, ownership passed back to client
williamr@2
    76
    */	
williamr@2
    77
	virtual HBufC* CurrentValueTextLC() = 0;
williamr@2
    78
	
williamr@2
    79
	/**
williamr@2
    80
     * Returns the index in the array of the current value. 
williamr@2
    81
     * If no matches, returns zero
williamr@2
    82
     *
williamr@2
    83
    */
williamr@2
    84
	virtual TInt CurrentValueIndex() const = 0;
williamr@2
    85
	
williamr@2
    86
	/**
williamr@2
    87
     * Changes the current value to correspond to a value in the array.
williamr@2
    88
     *
williamr@2
    89
     * @param aIndex	index in array of value to set as current
williamr@2
    90
    */
williamr@2
    91
	virtual void SetCurrentValueIndex(const TInt aIndex) = 0;
williamr@2
    92
	
williamr@2
    93
    /**
williamr@2
    94
     * Creates an editor within context. If the value is edited and OK'd,
williamr@2
    95
     * the new value will be set as the current value. Otherwise the current value 
williamr@2
    96
     * remains unchanged.
williamr@2
    97
     *
williamr@2
    98
     * @return	ETrue if current value was altered; EFalse otherwise
williamr@2
    99
     */	
williamr@2
   100
	virtual TBool CreateEditorL() = 0;
williamr@2
   101
	
williamr@2
   102
	/**
williamr@2
   103
	 * Set QueryMode to be whether query or settingpage -mode
williamr@2
   104
	 *
williamr@2
   105
     * @param aMode	value from <p>TMode	 
williamr@2
   106
	 */
williamr@2
   107
	virtual void SetQueryMode( MAknQueryValue::TMode aMode ) = 0;
williamr@2
   108
williamr@2
   109
	/**
williamr@2
   110
	 * Override the default resource IDs used if a Setting Page mode query is put up.
williamr@2
   111
	 * All Queryvalue implementations should have default resource set up. Hence this
williamr@2
   112
	 * need not be called unless non-default resource is required.
williamr@2
   113
	 *
williamr@2
   114
	 * THE IMPLEMENTATION OF THESE RESOURCE OVERRIDES IS RESERVED FOR FUTURE VERSIONS
williamr@2
   115
	 * OF SERIES 60. NOT CURRENTLY FUNCTIONAL. DO NOT USE.
williamr@2
   116
	 *
williamr@2
   117
	 * The rules for usage of these ids is the same as that for the CAknSettingPage constructors
williamr@2
   118
	 * that take both these resources
williamr@2
   119
	 *		Editor Resource		Setting Page Resource
williamr@2
   120
	 *			present				present				Both are used (but text & number overridden)
williamr@2
   121
	 *			 = 0					present				Editor resource is used via SP resource 
williamr@2
   122
	 *			present					= 0					default SP resource for the query type is used + this editor resource
williamr@2
   123
	 *
williamr@2
   124
	 * The type of the editor resource is fixed. If editor resource override is being
williamr@2
   125
	 * used, then the resource must be for that control type of editor used in the
williamr@2
   126
	 * CAknQueryValueXXXX class.
williamr@2
   127
	 * 
williamr@2
   128
	 * @param aSettingPageResourceId		AVKON_SETTING_PAGE resource ID to use
williamr@2
   129
	 * @param aSettingPageEditorResourceId	Editor resource ID to use (takes precedence)
williamr@2
   130
	 *
williamr@2
   131
	 */
williamr@2
   132
	virtual void SetSettingPageResourceIds( 
williamr@2
   133
		TInt aSettingPageResourceId, 
williamr@2
   134
		TInt aSettingPageEditorResourceId ) = 0;
williamr@2
   135
	
williamr@2
   136
	/**
williamr@2
   137
	 * Set the QueryValue to append a new user value, if distinct from former value 
williamr@2
   138
	 *
williamr@2
   139
     * @param aAppend	set/unset flag EAutoAppendBitIndex	 
williamr@2
   140
	 */
williamr@2
   141
	virtual void SetAutoAppend( TBool aAppend ) = 0;
williamr@2
   142
williamr@2
   143
protected:
williamr@2
   144
	/**
williamr@2
   145
	 * Method to add the current value to the QueryValueArray if it is new.
williamr@2
   146
	 * The new value is not owned by QueryValue object, but is "given away"
williamr@2
   147
	 *
williamr@2
   148
	 */
williamr@2
   149
	virtual void AppendValueIfNewL() = 0;
williamr@2
   150
private:
williamr@2
   151
	IMPORT_C virtual void Reserved_MAknQueryValue();
williamr@2
   152
   };
williamr@2
   153
williamr@2
   154
/** 
williamr@2
   155
 * Pure virtual class that adds some standard functionality for queries
williamr@2
   156
 *
williamr@2
   157
 */
williamr@2
   158
class CAknQueryValue : public CBase, public MAknQueryValue
williamr@2
   159
	{
williamr@2
   160
public:
williamr@2
   161
	/**
williamr@2
   162
	 * Set QueryMode to be whether query or settingpage -mode
williamr@2
   163
	 *
williamr@2
   164
     * @param aMode	value from <p>TMode	 
williamr@2
   165
	 */
williamr@2
   166
	IMPORT_C virtual void SetQueryMode( MAknQueryValue::TMode aMode );
williamr@2
   167
	
williamr@2
   168
	/**
williamr@2
   169
	 * Override the default resource IDs used if a Setting Page mode query is put up.
williamr@2
   170
	 * 
williamr@2
   171
	 * @param aSettingPageResourceId		AVKON_SETTING_PAGE resource ID to use
williamr@2
   172
	 * @param aSettingPageEditorResourceId	Editor resource ID to use (takes precedence)
williamr@2
   173
	 *
williamr@2
   174
	 */	
williamr@2
   175
	IMPORT_C virtual void SetSettingPageResourceIds( TInt aSettingPageResourceId, TInt aSettingPageEditorResourceId );
williamr@2
   176
	
williamr@2
   177
	/**
williamr@2
   178
	 * Set the QueryValue to append a new user value, if distinct from former value 
williamr@2
   179
	 *
williamr@2
   180
     * @param aAppend	set/unset flag EAutoAppendBitIndex	 
williamr@2
   181
	 */	
williamr@2
   182
	IMPORT_C virtual void SetAutoAppend( TBool aAppend );
williamr@2
   183
	
williamr@2
   184
	/**
williamr@2
   185
	 * Method to add the current value to the QueryValueArray if it is new.
williamr@2
   186
	 * The new value is not owned by QueryValue object, but is "given away"
williamr@2
   187
	 *
williamr@2
   188
	 */	
williamr@2
   189
	IMPORT_C virtual void AppendValueIfNewL();
williamr@2
   190
protected:
williamr@2
   191
	/**
williamr@2
   192
	 * Check if given index is valid within descriptor array
williamr@2
   193
	 *
williamr@2
   194
     * @param aIndex   index to be checked	 	 
williamr@2
   195
	 */
williamr@2
   196
	TBool IsValidIndex(TInt aIndex) 
williamr@2
   197
	{
williamr@2
   198
	if (MdcArray()->MdcaCount() < 1) return ETrue;
williamr@2
   199
	if (aIndex < 0 || aIndex >= MdcArray()->MdcaCount())
williamr@2
   200
	    return EFalse;
williamr@2
   201
	return ETrue;
williamr@2
   202
	}
williamr@2
   203
williamr@2
   204
protected:
williamr@2
   205
    /** 
williamr@2
   206
     * Flags that determine behavior
williamr@2
   207
     *
williamr@2
   208
     */
williamr@2
   209
	TBitFlags16	iFlags;
williamr@2
   210
    /** 
williamr@2
   211
     * Resource id for setting page
williamr@2
   212
     *
williamr@2
   213
     */
williamr@2
   214
	TInt iSettingPageResourceId;
williamr@2
   215
    /** 
williamr@2
   216
     * Resource id for editor in setting page
williamr@2
   217
     *
williamr@2
   218
     */	
williamr@2
   219
	TInt iSettingPageEditorResourceId;
williamr@2
   220
private:
williamr@2
   221
	TInt iSpare;
williamr@2
   222
// from MAknQueryValue
williamr@2
   223
	IMPORT_C void Reserved_MAknQueryValue();
williamr@2
   224
	};
williamr@2
   225
williamr@2
   226
#endif // __AKNQUERYVALUE_H__
williamr@2
   227