epoc32/include/mw/aknradiobuttonsettingpage.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/aknradiobuttonsettingpage.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/aknradiobuttonsettingpage.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,211 @@
     1.4 -aknradiobuttonsettingpage.h
     1.5 +/*
     1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* 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
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description: 
    1.19 +*	  Support for Radio Button setting page 
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +#ifndef __AKNRADIOBUTTONSETTINGPAGE_H__
    1.25 +#define __AKNRADIOBUTTONSETTINGPAGE_H__ 
    1.26 +
    1.27 +// For coecontrol
    1.28 +#include <coecntrl.h>
    1.29 +#include <eikdef.h>
    1.30 +
    1.31 +#include <aknlistboxsettingpage.h>
    1.32 +
    1.33 +class CAknRadioButtonSettingPageExtension;
    1.34 +
    1.35 +/** 
    1.36 +*  This class sets out a radio button listbox within a setting page.
    1.37 +*  
    1.38 +*/
    1.39 +class CAknRadioButtonSettingPage : public CAknListBoxSettingPage
    1.40 +{
    1.41 +public:
    1.42 +	IMPORT_C CAknRadioButtonSettingPage(
    1.43 +		TInt aResourceID, 
    1.44 +		TInt& aCurrentSelectionIndex, 
    1.45 +		const MDesCArray* aItemArray );
    1.46 + /**
    1.47 + * Constructor that allows separate setting page and editor resources
    1.48 + *
    1.49 + * In all cases the number (if supplied i.e. <> 0 ) is used.  
    1.50 + *
    1.51 + *		Editor Resource 	Setting Page Resource
    1.52 + *			present 			present 			Both are used (but text & number overridden)
    1.53 + *			 = 0				present 			Editor resource is used via SP resource
    1.54 + *			present 			= 0 				Default Avkon SP resource if used
    1.55 + *			 = 0				= 0 				Not permitted 
    1.56 + *
    1.57 + * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor
    1.58 + * cannot initialize such a member without allocation or having an internal dummy buffer.
    1.59 + * Note that the setting title provided here must be owned by the client.
    1.60 + *
    1.61 + * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other 
    1.62 + * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource 
    1.63 + * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the 
    1.64 + * specific API for setting them, WILL override resource.
    1.65 + * It is assumed that number from resource is very rare.  Special text is somewhat more likely.
    1.66 + * 
    1.67 + * @param aSettingTitleText Text at top of setting pane; EXTERNALLY OWNED
    1.68 + * @param aSettingNumber		Number at top left (if present)
    1.69 + * @param aControlType			Determines the type constructed and how its resource is read
    1.70 + * @param aEditorResourceId Editor resource to use in the setting page (if present)
    1.71 + * @param aSettingPageResourceId		Setting Page to use (if present)
    1.72 + * @param aCurrentSelectionIndex	The currently selected index
    1.73 + * @param aItemArray			List of option texts and their selection states
    1.74 + */
    1.75 +	IMPORT_C CAknRadioButtonSettingPage(	const TDesC* aSettingTitleText, 
    1.76 +								TInt aSettingNumber, 
    1.77 +								TInt aControlType,
    1.78 +								TInt aEditorResourceId, 
    1.79 +								TInt aSettingPageResourceId,
    1.80 +								TInt& aCurrentSelectionIndex, 
    1.81 +								const MDesCArray* aItemArray );
    1.82 +
    1.83 +	/** 
    1.84 +	* 2nd stage contruction for this type.  Calls CAknSettingPage::BaseConstuctL() where the object is constructed
    1.85 +	* from resource.
    1.86 +	*/
    1.87 +	IMPORT_C virtual void ConstructL();
    1.88 +
    1.89 +	/** 
    1.90 +	* Type specific access to the hosted "editor"
    1.91 +	*
    1.92 +	* @return	pointer to contained listbox
    1.93 +	*/
    1.94 +	IMPORT_C CAknSetStyleListBox* ListBoxControl() const; 
    1.95 +
    1.96 +	/** 
    1.97 +	* From MEikListBoxObserver
    1.98 +	* @param	listbox generating the event
    1.99 +	* @param	type of listbox event
   1.100 +	*/
   1.101 +	IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox,
   1.102 +				 MEikListBoxObserver::TListBoxEvent aEventType);
   1.103 +
   1.104 +	/**
   1.105 +	* Method to update the item array after a change in content and to re-select 
   1.106 +	* the "pushed in" index
   1.107 +	* @param CDesCArrayFlat*	aItemArray	The new item array; array of texts
   1.108 +	* @param TInt					aPushed		A valid 0-based index.  -1 is also legal
   1.109 +	* indicating nothing is pushed
   1.110 +	*/
   1.111 +	IMPORT_C void SetItemArrayAndSelectionL( const MDesCArray* aItemArray, TInt aPushed );
   1.112 +
   1.113 +    /**
   1.114 +    * From CCoeControl 
   1.115 +    * Handles Radiobuttonlist's PointerEvent 
   1.116 +    *    
   1.117 +    * @param aPointerEvent PointerEvent to be handled
   1.118 +    */     
   1.119 +    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
   1.120 +    
   1.121 +    IMPORT_C void HandleResourceChange(TInt aType);
   1.122 +
   1.123 +protected:
   1.124 +/**
   1.125 +* C++ destructor
   1.126 +*/
   1.127 +	IMPORT_C virtual ~CAknRadioButtonSettingPage();
   1.128 +
   1.129 +/**
   1.130 +* Called when the external setting is to be updated
   1.131 +*/
   1.132 +	IMPORT_C virtual void UpdateSettingL();
   1.133 +
   1.134 +/**
   1.135 +* Called immediately prior to activation, but after all construction
   1.136 +*/
   1.137 +	IMPORT_C void DynamicInitL();
   1.138 +
   1.139 +/**
   1.140 + * This method overrides the default implementation in order to do the special 
   1.141 + * processing of selecting an item
   1.142 + *
   1.143 + */
   1.144 +	IMPORT_C virtual void SelectCurrentItemL();
   1.145 +
   1.146 +private:
   1.147 +	/**
   1.148 +	* Method to move the selection to position aPushed
   1.149 +	*
   1.150 +	*/
   1.151 +	void SetRadioButtonSelectionL( TInt aPushed );
   1.152 +
   1.153 +	/**
   1.154 +	* Internal method to re-generate the internal, "decorated" text array used in the
   1.155 +	* real listbox. 
   1.156 +	*/
   1.157 +	void GenerateInternalArrayAndGiveToListBoxL();
   1.158 +
   1.159 +    void InitialiseRadioButtonBitmapsL();
   1.160 +
   1.161 +//
   1.162 +// CoeControl Framework and reserved methods
   1.163 +//
   1.164 +protected:
   1.165 +
   1.166 +/**
   1.167 + * Writes the internal state of the control and its components to aStream.
   1.168 + * Does nothing in release mode.
   1.169 + * Designed to be overidden and base called by subclasses.
   1.170 + *
   1.171 + * @param	aWriteSteam		A connected write stream
   1.172 + */	
   1.173 +	IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
   1.174 +
   1.175 +private: 
   1.176 +/**
   1.177 + *	Reserved method derived from CCoeControl
   1.178 + */
   1.179 +	IMPORT_C virtual void Reserved_2();
   1.180 +
   1.181 +private:
   1.182 +    /**
   1.183 +    * From CAknControl
   1.184 +    */
   1.185 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.186 +
   1.187 +/**
   1.188 + * New reserved methods for CAknSettingPage hierarchy
   1.189 + */ 
   1.190 +private: 
   1.191 +	IMPORT_C virtual void CAknSettingPage_Reserved_1();
   1.192 +	IMPORT_C virtual void CAknSettingPage_Reserved_2();
   1.193 +
   1.194 +private:
   1.195 +/**
   1.196 + * New reserved method from CAknListBoxSettingPage 
   1.197 + *
   1.198 + */
   1.199 +	IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
   1.200 +
   1.201 +
   1.202 +private:
   1.203 +	// Back up copy of the selection index
   1.204 +	TInt iOldSelectionIndex;
   1.205 +	
   1.206 +	// Extension, replaces CDesCArrayFlat* iInternalItemArray
   1.207 +	CAknRadioButtonSettingPageExtension* iExtension;
   1.208 +
   1.209 +	// The objects pointed to or referenced by these are not owned
   1.210 +	TInt& iCurrentSelectionIndex; 
   1.211 +	const MDesCArray* iItemArray; 
   1.212 +
   1.213 +};
   1.214 +
   1.215 +#endif