epoc32/include/mw/aknpopupsettingpage.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
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@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.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
* Support for popup setting item lists.  THe MAknQueryValue abstract type is 
williamr@2
    17
* used to carry the state of the selection. 
williamr@2
    18
*
williamr@2
    19
* This file also contains the definition for the contained editor of the setting page,
williamr@2
    20
* CAknPopupSettingList  
williamr@2
    21
*
williamr@2
    22
*
williamr@2
    23
*/
williamr@2
    24
williamr@2
    25
williamr@2
    26
#ifndef __AKNPOPUPSETTINGPAGE_H__
williamr@2
    27
#define __AKNPOPUPSETTINGPAGE_H__ 
williamr@2
    28
williamr@2
    29
williamr@2
    30
#include <aknqueryvalue.h>
williamr@2
    31
#include <aknqueryvaluetext.h>
williamr@2
    32
#include <aknlistboxsettingpage.h>
williamr@2
    33
williamr@2
    34
#include <AknDesCArrayDecorator.h>
williamr@2
    35
#include <AknListBoxLayoutDecorator.h>
williamr@2
    36
williamr@2
    37
class CAknPopupSettingList;
williamr@2
    38
class CAknPopupSettingListExtension;
williamr@2
    39
williamr@2
    40
/** 
williamr@2
    41
 * This interface should be implemented by classes that need to know
williamr@2
    42
 * about events occurring in the popup field control
williamr@2
    43
 */
williamr@2
    44
class MAknPopupSettingListObserver
williamr@2
    45
	{
williamr@2
    46
public:
williamr@2
    47
	/**
williamr@2
    48
	* Event types
williamr@2
    49
	*/
williamr@2
    50
	enum TAknPopupSettingListEvent
williamr@2
    51
		{
williamr@2
    52
		EAknPopupSettingSelectionAndRequestAccept,
williamr@2
    53
		EAknPopupSettingSelectionAndStayOpen,
williamr@2
    54
		EAknPopupSettingSelectionAndClose
williamr@2
    55
		};
williamr@2
    56
public:
williamr@2
    57
/**
williamr@2
    58
 * Handle events from the popup field control, such as when it changes between
williamr@2
    59
 * selection list mode and label mode.
williamr@2
    60
 *
williamr@2
    61
 * Implementations of this observer routine should perform a base call to this specific
williamr@2
    62
 * method, in order to pick up any default re-layout actions.
williamr@2
    63
 *
williamr@2
    64
 * @param aPopupSettingList pointer to the popup field control that generated the event
williamr@2
    65
 * @param aEventType the type of event
williamr@2
    66
 * @param aHint for possible future use
williamr@2
    67
 *
williamr@2
    68
 */
williamr@2
    69
	virtual void HandlePopupSettingListEventL(	CAknPopupSettingList* aPopupSettingList, 
williamr@2
    70
												TAknPopupSettingListEvent aEventType, 
williamr@2
    71
												TInt aHint)=0;
williamr@2
    72
	};
williamr@2
    73
williamr@2
    74
/**
williamr@2
    75
 *
williamr@2
    76
 * Represents menu list that appears in a popped up setting item
williamr@2
    77
 */
williamr@2
    78
class CAknPopupSettingList :
williamr@2
    79
	public CAknSetStyleListBox,
williamr@2
    80
	public MEikListBoxObserver
williamr@2
    81
	{
williamr@2
    82
williamr@2
    83
protected:
williamr@2
    84
williamr@2
    85
williamr@2
    86
public:
williamr@2
    87
 /** 
williamr@2
    88
 * Standard constructor.
williamr@2
    89
 */
williamr@2
    90
	IMPORT_C CAknPopupSettingList();
williamr@2
    91
williamr@2
    92
/** 
williamr@2
    93
 * Destructor.
williamr@2
    94
 *
williamr@2
    95
 */
williamr@2
    96
	IMPORT_C ~CAknPopupSettingList();
williamr@2
    97
williamr@2
    98
/** 
williamr@2
    99
 * 2nd phase construction
williamr@2
   100
 *
williamr@2
   101
 */
williamr@2
   102
	IMPORT_C void ConstructL();
williamr@2
   103
williamr@2
   104
/**
williamr@2
   105
 * Sets flag that enables user defined entry. Note that flag can also be set from resources, 
williamr@2
   106
 * but this method allows behaviour to be changed at runtime.
williamr@2
   107
 *
williamr@2
   108
 * @param aAllows	if ETrue, set flag; if EFalse, clear flag.
williamr@2
   109
 */
williamr@2
   110
	IMPORT_C void SetAllowsUserDefinedEntry(TBool aAllows);
williamr@2
   111
williamr@2
   112
williamr@2
   113
/**
williamr@2
   114
 * Used by the client to set the query value used to represent the user defined 
williamr@2
   115
 * value belonging to this popup field control.
williamr@2
   116
 *
williamr@2
   117
 * @param aValue	pointer to value, ownership is not passed
williamr@2
   118
 *
williamr@2
   119
 */
williamr@2
   120
	IMPORT_C void SetQueryValueL(MAknQueryValue* aValue);
williamr@2
   121
williamr@2
   122
williamr@2
   123
/**
williamr@2
   124
 * Set the flag which determines whether the indicators are shown
williamr@2
   125
 * In practice the indicators have the appearance of radio buttons
williamr@2
   126
 *
williamr@2
   127
 * @param aShowIndicators	
williamr@2
   128
 *		If ETrue, indicators are displayed; 
williamr@2
   129
 *		if EFalse, indicators are not displayed
williamr@2
   130
 *
williamr@2
   131
 */
williamr@2
   132
	IMPORT_C void SetShowIndicators(TBool aShowIndicators);
williamr@2
   133
williamr@2
   134
/**
williamr@2
   135
 * number of lines used
williamr@2
   136
 *
williamr@2
   137
 * @return number of lines being currently displayed by control, which is determined 
williamr@2
   138
 *		by the number of entries on the selection list, and whether the selection list is active.
williamr@2
   139
 *		NOTE that the number is limited by KAknMaxLinesOnOnePage
williamr@2
   140
 *
williamr@2
   141
 */
williamr@2
   142
	IMPORT_C TInt NumLines() const;
williamr@2
   143
williamr@2
   144
/**
williamr@2
   145
 * set an observer of this class to receive events from popup setting list
williamr@2
   146
 * 
williamr@2
   147
 * @param aObserver pointer to the class that implements the observer interface,
williamr@2
   148
 *
williamr@2
   149
 */
williamr@2
   150
	IMPORT_C void SetPopupSettingListObserver(MAknPopupSettingListObserver* aObserver);
williamr@2
   151
williamr@2
   152
public: 
williamr@2
   153
/** 
williamr@2
   154
 * from CCoeControl
williamr@2
   155
 * Construct from resources.
williamr@2
   156
 * @param aReader	constucted and positioned TResourceReader&
williamr@2
   157
 */
williamr@2
   158
	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   159
williamr@2
   160
protected:
williamr@2
   161
williamr@2
   162
/**
williamr@2
   163
 * Create the popup list. 
williamr@2
   164
 *
williamr@2
   165
 */
williamr@2
   166
	IMPORT_C void CreateMenuListL();
williamr@2
   167
williamr@2
   168
/**
williamr@2
   169
 * Causes the list of pre-defined values to appear. 
williamr@2
   170
 * Use this method to activate the pop-up field from a menu option command. 
williamr@2
   171
 * Note that the desired control must have the focus before it can be activated.
williamr@2
   172
 *
williamr@2
   173
 */
williamr@2
   174
	IMPORT_C void ActivateMenuListL();
williamr@2
   175
williamr@2
   176
/**
williamr@2
   177
 *
williamr@2
   178
 * This routine sets up the text arrays for the menu list
williamr@2
   179
 *
williamr@2
   180
 */
williamr@2
   181
	IMPORT_C void ConfigureMenuListL();
williamr@2
   182
williamr@2
   183
/**
williamr@2
   184
 * All this does now is remove this from the stack
williamr@2
   185
 *
williamr@2
   186
 */
williamr@2
   187
	IMPORT_C void DestroyMenuList();
williamr@2
   188
williamr@2
   189
public:
williamr@2
   190
    /**
williamr@2
   191
    * From CCoeControl. Handles pointer event
williamr@2
   192
    * @param aPointerEvent Pointer event to be handled
williamr@2
   193
    */
williamr@2
   194
    IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@2
   195
    
williamr@2
   196
    IMPORT_C void HandleResourceChange(TInt aType);
williamr@2
   197
williamr@2
   198
private:
williamr@2
   199
    /**
williamr@2
   200
    * From CAknControl
williamr@2
   201
    */
williamr@2
   202
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   203
williamr@2
   204
protected: 
williamr@2
   205
/**
williamr@2
   206
 * From MEikListBoxObserver
williamr@2
   207
 * Processes key events from the listbox. Responds to EEventEnterKeyPressed to accept
williamr@2
   208
 * the pop-up.
williamr@2
   209
 *
williamr@2
   210
 * @param	aListBox	Listbox being observed
williamr@2
   211
 * @param	aEventType	Event observed
williamr@2
   212
 *
williamr@2
   213
 *
williamr@2
   214
 * This implementation is vestige of former implementation when the listbox was wrapped up,
williamr@2
   215
 * not derived from. Currently observing itself..
williamr@2
   216
 *
williamr@2
   217
 */
williamr@2
   218
	IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
williamr@2
   219
williamr@2
   220
private: // from CCoeControl
williamr@2
   221
	IMPORT_C void Reserved_1();
williamr@2
   222
	IMPORT_C void Reserved_2();
williamr@2
   223
private: 
williamr@2
   224
	void CommonConstructL();
williamr@2
   225
	void SetUpSelectionListL();
williamr@2
   226
/** 
williamr@2
   227
 * Set up the bitmap array for the "not pushed" and "pushed in" states
williamr@2
   228
 *
williamr@2
   229
 */
williamr@2
   230
	void InitialiseRadioButtonBitmapsL();
williamr@2
   231
private: 
williamr@2
   232
/**
williamr@2
   233
 * Configures the decoration according to the currently set flags.
williamr@2
   234
 * Should be called whenever the flags are changed. 
williamr@2
   235
 *
williamr@2
   236
 */
williamr@2
   237
	void ConfigureDecorator();
williamr@2
   238
/**
williamr@2
   239
 * Configures the layout decoration according to the "has buttons" flag
williamr@2
   240
 * Should be called whenever the flags are changed. 
williamr@2
   241
 *
williamr@2
   242
 */
williamr@2
   243
	void ConstructLayoutDecoratorL();
williamr@2
   244
williamr@2
   245
private:
williamr@2
   246
	// the following members are owned
williamr@2
   247
williamr@2
   248
	TAknDesCArrayDecorator iDecorator;
williamr@2
   249
	CAknListBoxLayoutDecorator* iLayoutDecorator;
williamr@2
   250
williamr@2
   251
	// the following fields are reflected in the POPUP_SETTING_LIST resource structure
williamr@2
   252
	TInt iFlags;
williamr@2
   253
	HBufC* iOtherText;
williamr@2
   254
	
williamr@2
   255
	TInt iCurrentSelection;
williamr@2
   256
	// elements to hold info regarding "new Item"- produced setting page
williamr@2
   257
	TInt iNewItemSettingPageResourceId;
williamr@2
   258
	TInt iNewItemEditorType;
williamr@2
   259
	TInt iNewItemEditorControlResourceId;
williamr@2
   260
williamr@2
   261
	// the following members are not owned
williamr@2
   262
	MAknQueryValue* iValue;
williamr@2
   263
	MAknPopupSettingListObserver* iPopupSettingListObserver;
williamr@2
   264
williamr@2
   265
	//TInt iSpare_1;
williamr@2
   266
	CAknPopupSettingListExtension* iExtension;
williamr@2
   267
	};
williamr@2
   268
williamr@2
   269
williamr@2
   270
/**
williamr@2
   271
* Interface for the setting page containing a menu list with a Query value data model 
williamr@2
   272
* This is the more generic of the list-style setting pages. 
williamr@2
   273
*
williamr@2
   274
*/
williamr@2
   275
class CAknPopupSettingPage : 
williamr@2
   276
	public CAknListBoxSettingPage, 
williamr@2
   277
	public MAknPopupSettingListObserver
williamr@2
   278
	{
williamr@2
   279
williamr@2
   280
public:
williamr@2
   281
	/**
williamr@2
   282
	* C++ constructor.  This constructor uses just the setting page resource Id to 
williamr@2
   283
	* construct the setting page, using listbox resource contained in the setting page 
williamr@2
   284
	* resource.
williamr@2
   285
	* @param	aResourceId		a resource identifier for a AVKON_SETTING_PAGE resource
williamr@2
   286
	* @param	aQueryValue		a reference to a query value object
williamr@2
   287
	*/
williamr@2
   288
	IMPORT_C CAknPopupSettingPage(TInt aResourceID, MAknQueryValue& aQueryValue );
williamr@2
   289
williamr@2
   290
	/**
williamr@2
   291
	 * Constructor that allows separate setting page and editor resources
williamr@2
   292
	 * 
williamr@2
   293
	 * This constructor allows the use of setting page using only the editor resource.  Other combinations are also possible
williamr@2
   294
	 *
williamr@2
   295
	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
williamr@2
   296
	 *
williamr@2
   297
	 *		Editor Resource		Setting Page Resource
williamr@2
   298
	 *			present				present				Both are used (but text & number overridden)
williamr@2
   299
	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
williamr@2
   300
	 *			present				= 0					Default Avkon SP resource if used + this editor resource
williamr@2
   301
	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
williamr@2
   302
	 *	 i) control type is present, 
williamr@2
   303
	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
williamr@2
   304
	 *
williamr@2
   305
	 * Note: THe first argument is a TDesC* (rather than TDesC&) because the other constructor
williamr@2
   306
	 * cannot initialize such a member without allocation or having an internal dummy buffer.
williamr@2
   307
	 *
williamr@2
   308
	 * Rules for text and numbers: The rules are the same for both:  (non-zero length) text or number other 
williamr@2
   309
	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
williamr@2
   310
	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed).  Note, however, that text or number given via the 
williamr@2
   311
	 * specific API for setting them, WILL override resource.
williamr@2
   312
	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
williamr@2
   313
	 * 
williamr@2
   314
	 * @param aSettingTitleText	Text at top of setting pane
williamr@2
   315
	 * @param aSettingNumber		Number at top left (if present)
williamr@2
   316
	 * @param aControlType			Determines the type constructed and how its resource is read
williamr@2
   317
	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
williamr@2
   318
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   319
	 * @param aQueryValue			reference to a query value object
williamr@2
   320
	 */
williamr@2
   321
	IMPORT_C CAknPopupSettingPage(	const TDesC* aSettingTitleText, 
williamr@2
   322
								TInt aSettingNumber, 
williamr@2
   323
								TInt aControlType,
williamr@2
   324
								TInt aEditorResourceId, 
williamr@2
   325
								TInt aSettingPageResourceId,
williamr@2
   326
								MAknQueryValue& aQueryValue);
williamr@2
   327
williamr@2
   328
	/**
williamr@2
   329
	* 2nd stage construction method.  Type specific work is done here; most of the setting
williamr@2
   330
	* page constuction is performed in a call the base contstruction of CAknSettingPage
williamr@2
   331
	*
williamr@2
   332
	*/
williamr@2
   333
	IMPORT_C virtual void ConstructL();
williamr@2
   334
williamr@2
   335
/**
williamr@2
   336
 * Access to the contained listbox (inside popup setting list)
williamr@2
   337
 *
williamr@2
   338
 * @return	CAknSetStyleListBox* pointer to the listbox used in the setting page; Does not transfer ownership
williamr@2
   339
 */
williamr@2
   340
	IMPORT_C CAknSetStyleListBox* ListBoxControl() const;
williamr@2
   341
williamr@2
   342
/** 
williamr@2
   343
 * Access to the editor control
williamr@2
   344
 * 
williamr@2
   345
 * @return	CAknPopupSettingList* a reference to the contained "editor" as a listbox; no ownership transferred
williamr@2
   346
 */
williamr@2
   347
	IMPORT_C CAknPopupSettingList* PopupSettingListBox() const;
williamr@2
   348
williamr@2
   349
/**
williamr@2
   350
 *  From MAknPopupSettingListObserver
williamr@2
   351
 * Handle events from the popup field control, such as when it changes between
williamr@2
   352
 * selection list mode and label mode.
williamr@2
   353
 *
williamr@2
   354
 * @param aPopupSettingList pointer to the popup field control that generated the event
williamr@2
   355
 * @param aEventType the type of event
williamr@2
   356
 * @param aHint for possible future use
williamr@2
   357
 *
williamr@2
   358
 */
williamr@2
   359
	IMPORT_C virtual void HandlePopupSettingListEventL(CAknPopupSettingList* aPopupSettingList, 
williamr@2
   360
		TAknPopupSettingListEvent aEventType, TInt aHint);
williamr@2
   361
williamr@2
   362
/**
williamr@2
   363
* Can be used dynamically to set a new query value.  This manages the setting up of the new
williamr@2
   364
* PopupSettingList and its listbox, and also the resizing and redrawing of the setting page
williamr@2
   365
* Note that all former query value objects and its associated arrays are owned by the client
williamr@2
   366
* and if no longer used, should be deleted.
williamr@2
   367
* 
williamr@2
   368
* @param MAknQueryValue* aQueryValue - the new value; no transfer of ownership
williamr@2
   369
*/
williamr@2
   370
	IMPORT_C void UpdateQueryValueL( MAknQueryValue* aQueryValue );
williamr@2
   371
williamr@2
   372
/**
williamr@2
   373
 *	From CCoeControl
williamr@2
   374
 */
williamr@2
   375
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   376
    
williamr@2
   377
protected:
williamr@2
   378
/**
williamr@2
   379
* C++ destructor
williamr@2
   380
*/
williamr@2
   381
	IMPORT_C virtual ~CAknPopupSettingPage();
williamr@2
   382
williamr@2
   383
/**
williamr@2
   384
 * This is required to give access to the QueryValue data member from 
williamr@2
   385
 * re-implementations of the popup setting page
williamr@2
   386
 *
williamr@2
   387
 * @return MAknQueryValue* a pointer to the query value object
williamr@2
   388
 *
williamr@2
   389
 */
williamr@2
   390
	IMPORT_C MAknQueryValue* QueryValue() const;
williamr@2
   391
williamr@2
   392
/**
williamr@2
   393
 * This method should be implemented in listbox classes to move the selection in 
williamr@2
   394
 * listbox editors prior to exiting from the setting page
williamr@2
   395
 *
williamr@2
   396
 */
williamr@2
   397
	IMPORT_C virtual void SelectCurrentItemL();
williamr@2
   398
williamr@2
   399
//
williamr@2
   400
// CoeControl Framework and reserved methods
williamr@2
   401
//
williamr@2
   402
protected:
williamr@2
   403
williamr@2
   404
/**
williamr@2
   405
 * Writes the internal state of the control and its components to aStream.
williamr@2
   406
 * Does nothing in release mode.
williamr@2
   407
 * Designed to be overidden and base called by subclasses.
williamr@2
   408
 *
williamr@2
   409
 * @param	aWriteSteam		A connected write stream
williamr@2
   410
 */	
williamr@2
   411
	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   412
williamr@2
   413
/**
williamr@2
   414
 *	Reserved method derived from CCoeControl
williamr@2
   415
 */
williamr@2
   416
	IMPORT_C virtual void Reserved_2();
williamr@2
   417
williamr@2
   418
private:
williamr@2
   419
    /**
williamr@2
   420
    * From CAknControl
williamr@2
   421
    */
williamr@2
   422
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   423
williamr@2
   424
/**
williamr@2
   425
 * New reserved methods for CAknSettingPage hierarchy
williamr@2
   426
 */ 
williamr@2
   427
private: 
williamr@2
   428
	IMPORT_C virtual void CAknSettingPage_Reserved_1();
williamr@2
   429
	IMPORT_C virtual void CAknSettingPage_Reserved_2();
williamr@2
   430
williamr@2
   431
private:
williamr@2
   432
/**
williamr@2
   433
 * New reserved method from CAknListBoxSettingPage 
williamr@2
   434
 *
williamr@2
   435
 */
williamr@2
   436
	IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
williamr@2
   437
williamr@2
   438
private:
williamr@2
   439
williamr@2
   440
	// The objects pointed to or referenced by this is not owned
williamr@2
   441
	MAknQueryValue& iQueryValue;
williamr@2
   442
williamr@2
   443
	TInt iSpare_1;
williamr@2
   444
	TInt iSpare_2;
williamr@2
   445
williamr@2
   446
};
williamr@2
   447
williamr@2
   448
#endif