epoc32/include/mw/aknradiobuttonsettingpage.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
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     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
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *	  Support for Radio Button setting page 
    16 *
    17 */
    18 
    19 
    20 #ifndef __AKNRADIOBUTTONSETTINGPAGE_H__
    21 #define __AKNRADIOBUTTONSETTINGPAGE_H__ 
    22 
    23 // For coecontrol
    24 #include <coecntrl.h>
    25 #include <eikdef.h>
    26 
    27 #include <aknlistboxsettingpage.h>
    28 
    29 class CAknRadioButtonSettingPageExtension;
    30 
    31 /** 
    32 *  This class sets out a radio button listbox within a setting page.
    33 *  
    34 */
    35 class CAknRadioButtonSettingPage : public CAknListBoxSettingPage
    36 {
    37 public:
    38 	IMPORT_C CAknRadioButtonSettingPage(
    39 		TInt aResourceID, 
    40 		TInt& aCurrentSelectionIndex, 
    41 		const MDesCArray* aItemArray );
    42  /**
    43  * Constructor that allows separate setting page and editor resources
    44  *
    45  * In all cases the number (if supplied i.e. <> 0 ) is used.  
    46  *
    47  *		Editor Resource 	Setting Page Resource
    48  *			present 			present 			Both are used (but text & number overridden)
    49  *			 = 0				present 			Editor resource is used via SP resource
    50  *			present 			= 0 				Default Avkon SP resource if used
    51  *			 = 0				= 0 				Not permitted 
    52  *
    53  * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
    54  * cannot initialize such a member without allocation or having an internal dummy buffer.
    55  * Note that the setting title provided here must be owned by the client.
    56  *
    57  * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other 
    58  * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
    59  * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the 
    60  * specific API for setting them, WILL override resource.
    61  * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
    62  * 
    63  * @param aSettingTitleText Text at top of setting pane; EXTERNALLY OWNED
    64  * @param aSettingNumber		Number at top left (if present)
    65  * @param aControlType			Determines the type constructed and how its resource is read
    66  * @param aEditorResourceId Editor resource to use in the setting page (if present)
    67  * @param aSettingPageResourceId		Setting Page to use (if present)
    68  * @param aCurrentSelectionIndex	The currently selected index
    69  * @param aItemArray			List of option texts and their selection states
    70  */
    71 	IMPORT_C CAknRadioButtonSettingPage(	const TDesC* aSettingTitleText, 
    72 								TInt aSettingNumber, 
    73 								TInt aControlType,
    74 								TInt aEditorResourceId, 
    75 								TInt aSettingPageResourceId,
    76 								TInt& aCurrentSelectionIndex, 
    77 								const MDesCArray* aItemArray );
    78 
    79 	/** 
    80 	* 2nd stage contruction for this type.  Calls CAknSettingPage::BaseConstuctL() where the object is constructed
    81 	* from resource.
    82 	*/
    83 	IMPORT_C virtual void ConstructL();
    84 
    85 	/** 
    86 	* Type specific access to the hosted "editor"
    87 	*
    88 	* @return	pointer to contained listbox
    89 	*/
    90 	IMPORT_C CAknSetStyleListBox* ListBoxControl() const; 
    91 
    92 	/** 
    93 	* From MEikListBoxObserver
    94 	* @param	listbox generating the event
    95 	* @param	type of listbox event
    96 	*/
    97 	IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox,
    98 				 MEikListBoxObserver::TListBoxEvent aEventType);
    99 
   100 	/**
   101 	* Method to update the item array after a change in content and to re-select 
   102 	* the "pushed in" index
   103 	* @param CDesCArrayFlat*	aItemArray	The new item array; array of texts
   104 	* @param TInt					aPushed		A valid 0-based index.  -1 is also legal
   105 	* indicating nothing is pushed
   106 	*/
   107 	IMPORT_C void SetItemArrayAndSelectionL( const MDesCArray* aItemArray, TInt aPushed );
   108 
   109     /**
   110     * From CCoeControl 
   111     * Handles Radiobuttonlist's PointerEvent 
   112     *    
   113     * @param aPointerEvent PointerEvent to be handled
   114     */     
   115     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   116     
   117     IMPORT_C void HandleResourceChange(TInt aType);
   118 
   119 protected:
   120 /**
   121 * C++ destructor
   122 */
   123 	IMPORT_C virtual ~CAknRadioButtonSettingPage();
   124 
   125 /**
   126 * Called when the external setting is to be updated
   127 */
   128 	IMPORT_C virtual void UpdateSettingL();
   129 
   130 /**
   131 * Called immediately prior to activation, but after all construction
   132 */
   133 	IMPORT_C void DynamicInitL();
   134 
   135 /**
   136  * This method overrides the default implementation in order to do the special 
   137  * processing of selecting an item
   138  *
   139  */
   140 	IMPORT_C virtual void SelectCurrentItemL();
   141 
   142 private:
   143 	/**
   144 	* Method to move the selection to position aPushed
   145 	*
   146 	*/
   147 	void SetRadioButtonSelectionL( TInt aPushed );
   148 
   149 	/**
   150 	* Internal method to re-generate the internal, "decorated" text array used in the
   151 	* real listbox. 
   152 	*/
   153 	void GenerateInternalArrayAndGiveToListBoxL();
   154 
   155     void InitialiseRadioButtonBitmapsL();
   156 
   157 //
   158 // CoeControl Framework and reserved methods
   159 //
   160 protected:
   161 
   162 /**
   163  * Writes the internal state of the control and its components to aStream.
   164  * Does nothing in release mode.
   165  * Designed to be overidden and base called by subclasses.
   166  *
   167  * @param	aWriteSteam		A connected write stream
   168  */	
   169 	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
   170 
   171 private: 
   172 /**
   173  *	Reserved method derived from CCoeControl
   174  */
   175 	IMPORT_C virtual void Reserved_2();
   176 
   177 private:
   178     /**
   179     * From CAknControl
   180     */
   181     IMPORT_C void* ExtensionInterface( TUid aInterface );
   182 
   183 /**
   184  * New reserved methods for CAknSettingPage hierarchy
   185  */ 
   186 private: 
   187 	IMPORT_C virtual void CAknSettingPage_Reserved_1();
   188 	IMPORT_C virtual void CAknSettingPage_Reserved_2();
   189 
   190 private:
   191 /**
   192  * New reserved method from CAknListBoxSettingPage 
   193  *
   194  */
   195 	IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
   196 
   197 
   198 private:
   199 	// Back up copy of the selection index
   200 	TInt iOldSelectionIndex;
   201 	
   202 	// Extension, replaces CDesCArrayFlat* iInternalItemArray
   203 	CAknRadioButtonSettingPageExtension* iExtension;
   204 
   205 	// The objects pointed to or referenced by these are not owned
   206 	TInt& iCurrentSelectionIndex; 
   207 	const MDesCArray* iItemArray; 
   208 
   209 };
   210 
   211 #endif