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: * Pure virtual class for a common ancestor for setting pages with listboxes williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __AKNLISTBOXSETTINGPAGE_H__ williamr@2: #define __AKNLISTBOXSETTINGPAGE_H__ williamr@2: williamr@2: #include williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: /** williamr@2: * williamr@2: * Intermediate setting page class to soak up common listbox setting page code williamr@2: * williamr@2: * This class has the responsibility of performing the listbox layout and setting williamr@2: * out some of the API for listbox setting pages. williamr@2: * williamr@2: */ williamr@2: class CAknListBoxSettingPage : public CAknSettingPage, public MEikListBoxObserver williamr@2: { williamr@2: williamr@2: public: williamr@2: /** williamr@2: * Type-specific control access method with a null implementation williamr@2: * williamr@2: */ williamr@2: virtual CAknSetStyleListBox* ListBoxControl() const = 0; williamr@2: williamr@2: /** williamr@2: * Default empty implementation of the listbox observer handling routine williamr@2: */ williamr@2: IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Pass-through constructor williamr@2: * @param aSettingPageResourceId resource id for CAknSettingPage::BaseConstructL() williamr@2: * williamr@2: */ williamr@2: CAknListBoxSettingPage( TInt aSettingPageResourceId ); williamr@2: williamr@2: /** williamr@2: * Pass-through constructor williamr@2: * williamr@2: * Generic constructor allowing either editor-resource constuction or setting page williamr@2: * resource based constuction 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 externally-owned title text williamr@2: * @param aSettingNumber the setting number to be displayed williamr@2: * @param aControlType control type enumeration for the control to be constructed by type williamr@2: * @param aEditorResourceId resource Id at which to read the control's resource williamr@2: * @param aSettingPageResourceId optional setting page resource Id; See notes above about resource combinations williamr@2: */ williamr@2: CAknListBoxSettingPage( const TDesC* aSettingTitleText, williamr@2: TInt aSettingNumber, williamr@2: TInt aControlType, williamr@2: TInt aEditorResourceId, williamr@2: TInt aSettingPageResourceId = 0 ); williamr@2: williamr@2: williamr@2: /** williamr@2: * This standard implementation uses ListBoxControl to access the listbox and williamr@2: * check the number of items. If 0, validity is set to EFalse williamr@2: * williamr@2: */ williamr@2: IMPORT_C void CheckAndSetDataValidity(); williamr@2: williamr@2: /** williamr@2: * Implementation to remove go to "invalid" cba when data is invalid williamr@2: */ williamr@2: IMPORT_C void UpdateCbaL(); williamr@2: williamr@2: williamr@2: /** williamr@2: * From CCoeControl: williamr@2: * Routine called by Cone framework whenever there has been a size change on this williamr@2: * control williamr@2: */ williamr@2: IMPORT_C void SizeChanged(); williamr@2: williamr@2: /** williamr@2: * From CCoeControl: williamr@2: * Common draw routine for the listboxes williamr@2: * williamr@2: * @param aRect rectangle within which to draw williamr@2: */ williamr@2: IMPORT_C void Draw(const TRect& aRect) const; williamr@2: williamr@2: // williamr@2: // New methods in this class williamr@2: // williamr@2: williamr@2: /** williamr@2: * Obtain initial selection policy for popup setting item editing williamr@2: * williamr@2: * @since 2.0 williamr@2: * @return TBool EFalse iff focus is not initially to be set to the selected item williamr@2: */ williamr@2: static TBool FocusToSelectedItem(); williamr@2: williamr@2: /** williamr@2: * Obtain initial selection policy for popup setting item editing williamr@2: * williamr@2: * @since 2.0 williamr@2: * @return TBool EFalse iff focus is initially to be set to the selected item williamr@2: */ williamr@2: static TBool FocusToFirstItem(); williamr@2: williamr@2: williamr@2: /** williamr@2: * Create colorskinned icon and add it to icon array. Utility for williamr@2: * radiobutton, popup & checkbox setting page lists williamr@2: * williamr@2: * @since 3.1 williamr@2: */ williamr@2: public: williamr@2: static void CreateIconAndAddToArrayL( CArrayPtr*& aIconArray, williamr@2: const TAknsItemID& aId, williamr@2: const TInt aColorIndex, williamr@2: const TDesC& aBmpFile, williamr@2: const TInt32 aBmp, williamr@2: const TInt32 aBmpM ); williamr@2: williamr@2: private: williamr@2: /** williamr@2: */ williamr@2: IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1(); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Layout for the extra piece of white (sometimes) at the bottom of the listbox williamr@2: * williamr@2: */ williamr@2: TAknLayoutRect iAreaExtension; williamr@2: }; williamr@2: williamr@2: #endif