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 "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Pure virtual class for a common ancestor for setting pages with listboxes
20 #ifndef __AKNLISTBOXSETTINGPAGE_H__
21 #define __AKNLISTBOXSETTINGPAGE_H__
23 #include <aknsettingpage.h>
37 * Intermediate setting page class to soak up common listbox setting page code
39 * This class has the responsibility of performing the listbox layout and setting
40 * out some of the API for listbox setting pages.
43 class CAknListBoxSettingPage : public CAknSettingPage, public MEikListBoxObserver
48 * Type-specific control access method with a null implementation
51 virtual CAknSetStyleListBox* ListBoxControl() const = 0;
54 * Default empty implementation of the listbox observer handling routine
56 IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
61 * Pass-through constructor
62 * @param aSettingPageResourceId resource id for CAknSettingPage::BaseConstructL()
65 CAknListBoxSettingPage( TInt aSettingPageResourceId );
68 * Pass-through constructor
70 * Generic constructor allowing either editor-resource constuction or setting page
71 * resource based constuction
72 * In all cases the number (if supplied i.e. <> 0 ) is used.
74 * Editor Resource Setting Page Resource
75 * present present Both are used (but text & number overridden)
76 * = 0 present Editor resource is used via SP resource
77 * present = 0 Default Avkon SP resource if used
78 * = 0 = 0 Not permitted
80 * Note: THe first argument is a TDesC* (rather than TDesC&) because the other constructor
81 * cannot initialize such a member without allocation or having an internal dummy buffer.
82 * Note that the setting title provided here must be owned by the client.
84 * Rules for text and numbers: The rules are the same for both: (non-zero length) text or number other
85 * than EAknSettingPageNoOrdinalDisplayed if given in this constructor will not override resource
86 * (unless that is zero length or EAknSettingPageNoOrdinalDisplayed). Note, however, that text or number given via the
87 * specific API for setting them, WILL override resource.
88 * It is assumed that number from resource is very rare. Special text is somewhat more likely.
90 * @param aSettingTitleText externally-owned title text
91 * @param aSettingNumber the setting number to be displayed
92 * @param aControlType control type enumeration for the control to be constructed by type
93 * @param aEditorResourceId resource Id at which to read the control's resource
94 * @param aSettingPageResourceId optional setting page resource Id; See notes above about resource combinations
96 CAknListBoxSettingPage( const TDesC* aSettingTitleText,
99 TInt aEditorResourceId,
100 TInt aSettingPageResourceId = 0 );
104 * This standard implementation uses ListBoxControl to access the listbox and
105 * check the number of items. If 0, validity is set to EFalse
108 IMPORT_C void CheckAndSetDataValidity();
111 * Implementation to remove go to "invalid" cba when data is invalid
113 IMPORT_C void UpdateCbaL();
118 * Routine called by Cone framework whenever there has been a size change on this
121 IMPORT_C void SizeChanged();
125 * Common draw routine for the listboxes
127 * @param aRect rectangle within which to draw
129 IMPORT_C void Draw(const TRect& aRect) const;
132 // New methods in this class
136 * Obtain initial selection policy for popup setting item editing
139 * @return TBool EFalse iff focus is not initially to be set to the selected item
141 static TBool FocusToSelectedItem();
144 * Obtain initial selection policy for popup setting item editing
147 * @return TBool EFalse iff focus is initially to be set to the selected item
149 static TBool FocusToFirstItem();
153 * Create colorskinned icon and add it to icon array. Utility for
154 * radiobutton, popup & checkbox setting page lists
159 static void CreateIconAndAddToArrayL( CArrayPtr<CGulIcon>*& aIconArray,
160 const TAknsItemID& aId,
161 const TInt aColorIndex,
162 const TDesC& aBmpFile,
164 const TInt32 aBmpM );
169 IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1();
174 * Layout for the extra piece of white (sometimes) at the bottom of the listbox
177 TAknLayoutRect iAreaExtension;