williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * 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: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Support for Radio Button setting page williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __AKNRADIOBUTTONSETTINGPAGE_H__ williamr@2: #define __AKNRADIOBUTTONSETTINGPAGE_H__ williamr@2: williamr@2: // For coecontrol williamr@2: #include williamr@2: #include williamr@2: williamr@2: #include williamr@2: williamr@2: class CAknRadioButtonSettingPageExtension; williamr@2: williamr@2: /** williamr@2: * This class sets out a radio button listbox within a setting page. williamr@2: * williamr@2: */ williamr@2: class CAknRadioButtonSettingPage : public CAknListBoxSettingPage williamr@2: { williamr@2: public: williamr@2: IMPORT_C CAknRadioButtonSettingPage( williamr@2: TInt aResourceID, williamr@2: TInt& aCurrentSelectionIndex, williamr@2: const MDesCArray* aItemArray ); williamr@2: /** williamr@2: * Constructor that allows separate setting page and editor resources williamr@2: * williamr@2: * In all cases the number (if supplied i.e. <> 0 ) is used. williamr@2: * williamr@2: * Editor Resource Setting Page Resource williamr@2: * present present Both are used (but text & number overridden) williamr@2: * = 0 present Editor resource is used via SP resource williamr@2: * present = 0 Default Avkon SP resource if used williamr@2: * = 0 = 0 Not permitted williamr@2: * williamr@2: * Note: The first argument is a TDesC* (rather than TDesC&) because the other constructor williamr@2: * cannot initialize such a member without allocation or having an internal dummy buffer. williamr@2: * Note that the setting title provided here must be owned by the client. williamr@2: * williamr@2: * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other williamr@2: * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource williamr@2: * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the williamr@2: * specific API for setting them, WILL override resource. williamr@2: * It is assumed that number from resource is very rare. Special text is somewhat more likely. williamr@2: * williamr@2: * @param aSettingTitleText Text at top of setting pane; EXTERNALLY OWNED williamr@2: * @param aSettingNumber Number at top left (if present) williamr@2: * @param aControlType Determines the type constructed and how its resource is read williamr@2: * @param aEditorResourceId Editor resource to use in the setting page (if present) williamr@2: * @param aSettingPageResourceId Setting Page to use (if present) williamr@2: * @param aCurrentSelectionIndex The currently selected index williamr@2: * @param aItemArray List of option texts and their selection states williamr@2: */ williamr@2: IMPORT_C CAknRadioButtonSettingPage( const TDesC* aSettingTitleText, williamr@2: TInt aSettingNumber, williamr@2: TInt aControlType, williamr@2: TInt aEditorResourceId, williamr@2: TInt aSettingPageResourceId, williamr@2: TInt& aCurrentSelectionIndex, williamr@2: const MDesCArray* aItemArray ); williamr@2: williamr@2: /** williamr@2: * 2nd stage contruction for this type. Calls CAknSettingPage::BaseConstuctL() where the object is constructed williamr@2: * from resource. williamr@2: */ williamr@2: IMPORT_C virtual void ConstructL(); williamr@2: williamr@2: /** williamr@2: * Type specific access to the hosted "editor" williamr@2: * williamr@2: * @return pointer to contained listbox williamr@2: */ williamr@2: IMPORT_C CAknSetStyleListBox* ListBoxControl() const; williamr@2: williamr@2: /** williamr@2: * From MEikListBoxObserver williamr@2: * @param listbox generating the event williamr@2: * @param type of listbox event williamr@2: */ williamr@2: IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, williamr@2: MEikListBoxObserver::TListBoxEvent aEventType); williamr@2: williamr@2: /** williamr@2: * Method to update the item array after a change in content and to re-select williamr@2: * the "pushed in" index williamr@2: * @param CDesCArrayFlat* aItemArray The new item array; array of texts williamr@2: * @param TInt aPushed A valid 0-based index. -1 is also legal williamr@2: * indicating nothing is pushed williamr@2: */ williamr@2: IMPORT_C void SetItemArrayAndSelectionL( const MDesCArray* aItemArray, TInt aPushed ); williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * Handles Radiobuttonlist's PointerEvent williamr@2: * williamr@2: * @param aPointerEvent PointerEvent to be handled williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: IMPORT_C void HandleResourceChange(TInt aType); williamr@2: williamr@2: protected: williamr@2: /** williamr@2: * C++ destructor williamr@2: */ williamr@2: IMPORT_C virtual ~CAknRadioButtonSettingPage(); williamr@2: williamr@2: /** williamr@2: * Called when the external setting is to be updated williamr@2: */ williamr@2: IMPORT_C virtual void UpdateSettingL(); williamr@2: williamr@2: /** williamr@2: * Called immediately prior to activation, but after all construction williamr@2: */ williamr@2: IMPORT_C void DynamicInitL(); williamr@2: williamr@2: /** williamr@2: * This method overrides the default implementation in order to do the special williamr@2: * processing of selecting an item williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void SelectCurrentItemL(); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * Method to move the selection to position aPushed williamr@2: * williamr@2: */ williamr@2: void SetRadioButtonSelectionL( TInt aPushed ); williamr@2: williamr@2: /** williamr@2: * Internal method to re-generate the internal, "decorated" text array used in the williamr@2: * real listbox. williamr@2: */ williamr@2: void GenerateInternalArrayAndGiveToListBoxL(); williamr@2: williamr@2: void InitialiseRadioButtonBitmapsL(); williamr@2: williamr@2: // williamr@2: // CoeControl Framework and reserved methods williamr@2: // williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Writes the internal state of the control and its components to aStream. williamr@2: * Does nothing in release mode. williamr@2: * Designed to be overidden and base called by subclasses. williamr@2: * williamr@2: * @param aWriteSteam A connected write stream williamr@2: */ williamr@2: IMPORT_C virtual void WriteInternalStateL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: private: williamr@2: /** williamr@2: * Reserved method derived from CCoeControl williamr@2: */ williamr@2: IMPORT_C virtual void Reserved_2(); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: /** williamr@2: * New reserved methods for CAknSettingPage hierarchy williamr@2: */ williamr@2: private: williamr@2: IMPORT_C virtual void CAknSettingPage_Reserved_1(); williamr@2: IMPORT_C virtual void CAknSettingPage_Reserved_2(); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * New reserved method from CAknListBoxSettingPage williamr@2: * williamr@2: */ williamr@2: IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1(); williamr@2: williamr@2: williamr@2: private: williamr@2: // Back up copy of the selection index williamr@2: TInt iOldSelectionIndex; williamr@2: williamr@2: // Extension, replaces CDesCArrayFlat* iInternalItemArray williamr@2: CAknRadioButtonSettingPageExtension* iExtension; williamr@2: williamr@2: // The objects pointed to or referenced by these are not owned williamr@2: TInt& iCurrentSelectionIndex; williamr@2: const MDesCArray* iItemArray; williamr@2: williamr@2: }; williamr@2: williamr@2: #endif