2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Support for Radio Button setting page
20 #ifndef __AKNRADIOBUTTONSETTINGPAGE_H__
21 #define __AKNRADIOBUTTONSETTINGPAGE_H__
27 #include <aknlistboxsettingpage.h>
29 class CAknRadioButtonSettingPageExtension;
32 * This class sets out a radio button listbox within a setting page.
35 class CAknRadioButtonSettingPage : public CAknListBoxSettingPage
38 IMPORT_C CAknRadioButtonSettingPage(
40 TInt& aCurrentSelectionIndex,
41 const MDesCArray* aItemArray );
43 * Constructor that allows separate setting page and editor resources
45 * In all cases the number (if supplied i.e. <> 0 ) is used.
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
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.
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.
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
71 IMPORT_C CAknRadioButtonSettingPage( const TDesC* aSettingTitleText,
74 TInt aEditorResourceId,
75 TInt aSettingPageResourceId,
76 TInt& aCurrentSelectionIndex,
77 const MDesCArray* aItemArray );
80 * 2nd stage contruction for this type. Calls CAknSettingPage::BaseConstuctL() where the object is constructed
83 IMPORT_C virtual void ConstructL();
86 * Type specific access to the hosted "editor"
88 * @return pointer to contained listbox
90 IMPORT_C CAknSetStyleListBox* ListBoxControl() const;
93 * From MEikListBoxObserver
94 * @param listbox generating the event
95 * @param type of listbox event
97 IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox,
98 MEikListBoxObserver::TListBoxEvent aEventType);
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
107 IMPORT_C void SetItemArrayAndSelectionL( const MDesCArray* aItemArray, TInt aPushed );
111 * Handles Radiobuttonlist's PointerEvent
113 * @param aPointerEvent PointerEvent to be handled
115 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
117 IMPORT_C void HandleResourceChange(TInt aType);
123 IMPORT_C virtual ~CAknRadioButtonSettingPage();
126 * Called when the external setting is to be updated
128 IMPORT_C virtual void UpdateSettingL();
131 * Called immediately prior to activation, but after all construction
133 IMPORT_C void DynamicInitL();
136 * This method overrides the default implementation in order to do the special
137 * processing of selecting an item
140 IMPORT_C virtual void SelectCurrentItemL();
144 * Method to move the selection to position aPushed
147 void SetRadioButtonSelectionL( TInt aPushed );
150 * Internal method to re-generate the internal, "decorated" text array used in the
153 void GenerateInternalArrayAndGiveToListBoxL();
155 void InitialiseRadioButtonBitmapsL();
158 // CoeControl Framework and reserved methods
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.
167 * @param aWriteSteam A connected write stream
169 IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const;
173 * Reserved method derived from CCoeControl
175 IMPORT_C virtual void Reserved_2();
181 IMPORT_C void* ExtensionInterface( TUid aInterface );
184 * New reserved methods for CAknSettingPage hierarchy
187 IMPORT_C virtual void CAknSettingPage_Reserved_1();
188 IMPORT_C virtual void CAknSettingPage_Reserved_2();
192 * New reserved method from CAknListBoxSettingPage
195 IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
199 // Back up copy of the selection index
200 TInt iOldSelectionIndex;
202 // Extension, replaces CDesCArrayFlat* iInternalItemArray
203 CAknRadioButtonSettingPageExtension* iExtension;
205 // The objects pointed to or referenced by these are not owned
206 TInt& iCurrentSelectionIndex;
207 const MDesCArray* iItemArray;