epoc32/include/mw/aknpopupsettingpage.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
* 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@4
    30
#include <AknQueryValue.h>
williamr@4
    31
#include <AknQueryValueText.h>
williamr@4
    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@4
   152
    /**
williamr@4
   153
     * Selects current item.
williamr@4
   154
     * 
williamr@4
   155
     * @internal
williamr@4
   156
     */
williamr@4
   157
    void SelectCurrentItemL();
williamr@4
   158
    
williamr@4
   159
    /**
williamr@4
   160
	 * Returns index of currently selected list item.
williamr@4
   161
	 *
williamr@4
   162
	 * @return Currently selected item's index.
williamr@4
   163
	 */
williamr@4
   164
    TInt CurrentSelection() const;
williamr@4
   165
williamr@2
   166
public: 
williamr@2
   167
/** 
williamr@2
   168
 * from CCoeControl
williamr@2
   169
 * Construct from resources.
williamr@2
   170
 * @param aReader	constucted and positioned TResourceReader&
williamr@2
   171
 */
williamr@2
   172
	IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   173
williamr@2
   174
protected:
williamr@2
   175
williamr@2
   176
/**
williamr@2
   177
 * Create the popup list. 
williamr@2
   178
 *
williamr@2
   179
 */
williamr@2
   180
	IMPORT_C void CreateMenuListL();
williamr@2
   181
williamr@2
   182
/**
williamr@2
   183
 * Causes the list of pre-defined values to appear. 
williamr@2
   184
 * Use this method to activate the pop-up field from a menu option command. 
williamr@2
   185
 * Note that the desired control must have the focus before it can be activated.
williamr@2
   186
 *
williamr@2
   187
 */
williamr@2
   188
	IMPORT_C void ActivateMenuListL();
williamr@2
   189
williamr@2
   190
/**
williamr@2
   191
 *
williamr@2
   192
 * This routine sets up the text arrays for the menu list
williamr@2
   193
 *
williamr@2
   194
 */
williamr@2
   195
	IMPORT_C void ConfigureMenuListL();
williamr@2
   196
williamr@2
   197
/**
williamr@2
   198
 * All this does now is remove this from the stack
williamr@2
   199
 *
williamr@2
   200
 */
williamr@2
   201
	IMPORT_C void DestroyMenuList();
williamr@2
   202
williamr@2
   203
public:
williamr@2
   204
    /**
williamr@2
   205
    * From CCoeControl. Handles pointer event
williamr@2
   206
    * @param aPointerEvent Pointer event to be handled
williamr@2
   207
    */
williamr@2
   208
    IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@2
   209
    
williamr@2
   210
    IMPORT_C void HandleResourceChange(TInt aType);
williamr@2
   211
williamr@2
   212
private:
williamr@2
   213
    /**
williamr@2
   214
    * From CAknControl
williamr@2
   215
    */
williamr@2
   216
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   217
williamr@2
   218
protected: 
williamr@2
   219
/**
williamr@2
   220
 * From MEikListBoxObserver
williamr@2
   221
 * Processes key events from the listbox. Responds to EEventEnterKeyPressed to accept
williamr@2
   222
 * the pop-up.
williamr@2
   223
 *
williamr@2
   224
 * @param	aListBox	Listbox being observed
williamr@2
   225
 * @param	aEventType	Event observed
williamr@2
   226
 *
williamr@2
   227
 *
williamr@2
   228
 * This implementation is vestige of former implementation when the listbox was wrapped up,
williamr@2
   229
 * not derived from. Currently observing itself..
williamr@2
   230
 *
williamr@2
   231
 */
williamr@2
   232
	IMPORT_C void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
williamr@2
   233
williamr@2
   234
private: // from CCoeControl
williamr@2
   235
	IMPORT_C void Reserved_1();
williamr@2
   236
	IMPORT_C void Reserved_2();
williamr@2
   237
private: 
williamr@2
   238
	void CommonConstructL();
williamr@2
   239
	void SetUpSelectionListL();
williamr@2
   240
/** 
williamr@2
   241
 * Set up the bitmap array for the "not pushed" and "pushed in" states
williamr@2
   242
 *
williamr@2
   243
 */
williamr@2
   244
	void InitialiseRadioButtonBitmapsL();
williamr@2
   245
private: 
williamr@2
   246
/**
williamr@2
   247
 * Configures the decoration according to the currently set flags.
williamr@2
   248
 * Should be called whenever the flags are changed. 
williamr@2
   249
 *
williamr@2
   250
 */
williamr@2
   251
	void ConfigureDecorator();
williamr@2
   252
/**
williamr@2
   253
 * Configures the layout decoration according to the "has buttons" flag
williamr@2
   254
 * Should be called whenever the flags are changed. 
williamr@2
   255
 *
williamr@2
   256
 */
williamr@2
   257
	void ConstructLayoutDecoratorL();
williamr@2
   258
williamr@2
   259
private:
williamr@2
   260
	// the following members are owned
williamr@2
   261
williamr@2
   262
	TAknDesCArrayDecorator iDecorator;
williamr@2
   263
	CAknListBoxLayoutDecorator* iLayoutDecorator;
williamr@2
   264
williamr@2
   265
	// the following fields are reflected in the POPUP_SETTING_LIST resource structure
williamr@2
   266
	TInt iFlags;
williamr@2
   267
	HBufC* iOtherText;
williamr@2
   268
	
williamr@2
   269
	TInt iCurrentSelection;
williamr@2
   270
	// elements to hold info regarding "new Item"- produced setting page
williamr@2
   271
	TInt iNewItemSettingPageResourceId;
williamr@2
   272
	TInt iNewItemEditorType;
williamr@2
   273
	TInt iNewItemEditorControlResourceId;
williamr@2
   274
williamr@2
   275
	// the following members are not owned
williamr@2
   276
	MAknQueryValue* iValue;
williamr@2
   277
	MAknPopupSettingListObserver* iPopupSettingListObserver;
williamr@2
   278
williamr@2
   279
	//TInt iSpare_1;
williamr@2
   280
	CAknPopupSettingListExtension* iExtension;
williamr@2
   281
	};
williamr@2
   282
williamr@2
   283
williamr@2
   284
/**
williamr@2
   285
* Interface for the setting page containing a menu list with a Query value data model 
williamr@2
   286
* This is the more generic of the list-style setting pages. 
williamr@2
   287
*
williamr@2
   288
*/
williamr@2
   289
class CAknPopupSettingPage : 
williamr@2
   290
	public CAknListBoxSettingPage, 
williamr@2
   291
	public MAknPopupSettingListObserver
williamr@2
   292
	{
williamr@2
   293
williamr@2
   294
public:
williamr@2
   295
	/**
williamr@2
   296
	* C++ constructor.  This constructor uses just the setting page resource Id to 
williamr@2
   297
	* construct the setting page, using listbox resource contained in the setting page 
williamr@2
   298
	* resource.
williamr@2
   299
	* @param	aResourceId		a resource identifier for a AVKON_SETTING_PAGE resource
williamr@2
   300
	* @param	aQueryValue		a reference to a query value object
williamr@2
   301
	*/
williamr@2
   302
	IMPORT_C CAknPopupSettingPage(TInt aResourceID, MAknQueryValue& aQueryValue );
williamr@2
   303
williamr@2
   304
	/**
williamr@2
   305
	 * Constructor that allows separate setting page and editor resources
williamr@2
   306
	 * 
williamr@2
   307
	 * This constructor allows the use of setting page using only the editor resource.  Other combinations are also possible
williamr@2
   308
	 *
williamr@2
   309
	 * In all cases the number (if supplied i.e. <> 0 ) is used.  
williamr@2
   310
	 *
williamr@2
   311
	 *		Editor Resource		Setting Page Resource
williamr@2
   312
	 *			present				present				Both are used (but text & number overridden)
williamr@2
   313
	 *			 = 0					present				Editor resource is used via SP resource (Effectively like the other constructor)
williamr@2
   314
	 *			present				= 0					Default Avkon SP resource if used + this editor resource
williamr@2
   315
	 *			 = 0					= 0					uses default resource for both SP and editor. This is OK if:
williamr@2
   316
	 *	 i) control type is present, 
williamr@2
   317
	 *  ii) a default resource exists ( OK for text, integer, date, time, duration )
williamr@2
   318
	 *
williamr@2
   319
	 * Note: THe first argument is a TDesC* (rather than TDesC&) because the other constructor
williamr@2
   320
	 * cannot initialize such a member without allocation or having an internal dummy buffer.
williamr@2
   321
	 *
williamr@2
   322
	 * Rules for text and numbers: The rules are the same for both:  (non-zero length) text or number other 
williamr@2
   323
	 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
williamr@2
   324
	 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed).  Note, however, that text or number given via the 
williamr@2
   325
	 * specific API for setting them, WILL override resource.
williamr@2
   326
	 * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
williamr@2
   327
	 * 
williamr@2
   328
	 * @param aSettingTitleText	Text at top of setting pane
williamr@2
   329
	 * @param aSettingNumber		Number at top left (if present)
williamr@2
   330
	 * @param aControlType			Determines the type constructed and how its resource is read
williamr@2
   331
	 * @param aEditorResourceId	Editor resource to use in the setting page (if present)
williamr@2
   332
	 * @param aSettingPageResourceId		Setting Page to use (if present)
williamr@2
   333
	 * @param aQueryValue			reference to a query value object
williamr@2
   334
	 */
williamr@2
   335
	IMPORT_C CAknPopupSettingPage(	const TDesC* aSettingTitleText, 
williamr@2
   336
								TInt aSettingNumber, 
williamr@2
   337
								TInt aControlType,
williamr@2
   338
								TInt aEditorResourceId, 
williamr@2
   339
								TInt aSettingPageResourceId,
williamr@2
   340
								MAknQueryValue& aQueryValue);
williamr@2
   341
williamr@2
   342
	/**
williamr@2
   343
	* 2nd stage construction method.  Type specific work is done here; most of the setting
williamr@2
   344
	* page constuction is performed in a call the base contstruction of CAknSettingPage
williamr@2
   345
	*
williamr@2
   346
	*/
williamr@2
   347
	IMPORT_C virtual void ConstructL();
williamr@2
   348
williamr@2
   349
/**
williamr@2
   350
 * Access to the contained listbox (inside popup setting list)
williamr@2
   351
 *
williamr@2
   352
 * @return	CAknSetStyleListBox* pointer to the listbox used in the setting page; Does not transfer ownership
williamr@2
   353
 */
williamr@2
   354
	IMPORT_C CAknSetStyleListBox* ListBoxControl() const;
williamr@2
   355
williamr@2
   356
/** 
williamr@2
   357
 * Access to the editor control
williamr@2
   358
 * 
williamr@2
   359
 * @return	CAknPopupSettingList* a reference to the contained "editor" as a listbox; no ownership transferred
williamr@2
   360
 */
williamr@2
   361
	IMPORT_C CAknPopupSettingList* PopupSettingListBox() const;
williamr@2
   362
williamr@2
   363
/**
williamr@2
   364
 *  From MAknPopupSettingListObserver
williamr@2
   365
 * Handle events from the popup field control, such as when it changes between
williamr@2
   366
 * selection list mode and label mode.
williamr@2
   367
 *
williamr@2
   368
 * @param aPopupSettingList pointer to the popup field control that generated the event
williamr@2
   369
 * @param aEventType the type of event
williamr@2
   370
 * @param aHint for possible future use
williamr@2
   371
 *
williamr@2
   372
 */
williamr@2
   373
	IMPORT_C virtual void HandlePopupSettingListEventL(CAknPopupSettingList* aPopupSettingList, 
williamr@2
   374
		TAknPopupSettingListEvent aEventType, TInt aHint);
williamr@2
   375
williamr@2
   376
/**
williamr@2
   377
* Can be used dynamically to set a new query value.  This manages the setting up of the new
williamr@2
   378
* PopupSettingList and its listbox, and also the resizing and redrawing of the setting page
williamr@2
   379
* Note that all former query value objects and its associated arrays are owned by the client
williamr@2
   380
* and if no longer used, should be deleted.
williamr@2
   381
* 
williamr@2
   382
* @param MAknQueryValue* aQueryValue - the new value; no transfer of ownership
williamr@2
   383
*/
williamr@2
   384
	IMPORT_C void UpdateQueryValueL( MAknQueryValue* aQueryValue );
williamr@2
   385
williamr@2
   386
/**
williamr@2
   387
 *	From CCoeControl
williamr@2
   388
 */
williamr@2
   389
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   390
    
williamr@2
   391
protected:
williamr@2
   392
/**
williamr@2
   393
* C++ destructor
williamr@2
   394
*/
williamr@2
   395
	IMPORT_C virtual ~CAknPopupSettingPage();
williamr@2
   396
williamr@2
   397
/**
williamr@2
   398
 * This is required to give access to the QueryValue data member from 
williamr@2
   399
 * re-implementations of the popup setting page
williamr@2
   400
 *
williamr@2
   401
 * @return MAknQueryValue* a pointer to the query value object
williamr@2
   402
 *
williamr@2
   403
 */
williamr@2
   404
	IMPORT_C MAknQueryValue* QueryValue() const;
williamr@2
   405
williamr@2
   406
/**
williamr@2
   407
 * This method should be implemented in listbox classes to move the selection in 
williamr@2
   408
 * listbox editors prior to exiting from the setting page
williamr@2
   409
 *
williamr@2
   410
 */
williamr@2
   411
	IMPORT_C virtual void SelectCurrentItemL();
williamr@2
   412
williamr@2
   413
//
williamr@2
   414
// CoeControl Framework and reserved methods
williamr@2
   415
//
williamr@2
   416
protected:
williamr@2
   417
williamr@2
   418
/**
williamr@2
   419
 * Writes the internal state of the control and its components to aStream.
williamr@2
   420
 * Does nothing in release mode.
williamr@2
   421
 * Designed to be overidden and base called by subclasses.
williamr@2
   422
 *
williamr@2
   423
 * @param	aWriteSteam		A connected write stream
williamr@2
   424
 */	
williamr@2
   425
	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   426
williamr@2
   427
/**
williamr@2
   428
 *	Reserved method derived from CCoeControl
williamr@2
   429
 */
williamr@2
   430
	IMPORT_C virtual void Reserved_2();
williamr@2
   431
williamr@2
   432
private:
williamr@2
   433
    /**
williamr@2
   434
    * From CAknControl
williamr@2
   435
    */
williamr@2
   436
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   437
williamr@2
   438
/**
williamr@2
   439
 * New reserved methods for CAknSettingPage hierarchy
williamr@2
   440
 */ 
williamr@2
   441
private: 
williamr@2
   442
	IMPORT_C virtual void CAknSettingPage_Reserved_1();
williamr@2
   443
	IMPORT_C virtual void CAknSettingPage_Reserved_2();
williamr@2
   444
williamr@2
   445
private:
williamr@2
   446
/**
williamr@2
   447
 * New reserved method from CAknListBoxSettingPage 
williamr@2
   448
 *
williamr@2
   449
 */
williamr@2
   450
	IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
williamr@2
   451
williamr@2
   452
private:
williamr@2
   453
williamr@2
   454
	// The objects pointed to or referenced by this is not owned
williamr@2
   455
	MAknQueryValue& iQueryValue;
williamr@2
   456
williamr@2
   457
	TInt iSpare_1;
williamr@2
   458
	TInt iSpare_2;
williamr@2
   459
williamr@2
   460
};
williamr@2
   461
williamr@2
   462
#endif