1 aknlistboxsettingpage.h |
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Pure virtual class for a common ancestor for setting pages with listboxes |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __AKNLISTBOXSETTINGPAGE_H__ |
|
21 #define __AKNLISTBOXSETTINGPAGE_H__ |
|
22 |
|
23 #include <aknsettingpage.h> |
|
24 |
|
25 #include <aknutils.h> |
|
26 #include <eikslb.h> |
|
27 #include <eiklbo.h> |
|
28 #include <eiklbx.h> |
|
29 #include <eikclb.h> |
|
30 #include <eikclbd.h> |
|
31 #include <eiktxlbm.h> |
|
32 #include <coecobs.h> |
|
33 #include <aknlists.h> |
|
34 |
|
35 /** |
|
36 * |
|
37 * Intermediate setting page class to soak up common listbox setting page code |
|
38 * |
|
39 * This class has the responsibility of performing the listbox layout and setting |
|
40 * out some of the API for listbox setting pages. |
|
41 * |
|
42 */ |
|
43 class CAknListBoxSettingPage : public CAknSettingPage, public MEikListBoxObserver |
|
44 { |
|
45 |
|
46 public: |
|
47 /** |
|
48 * Type-specific control access method with a null implementation |
|
49 * |
|
50 */ |
|
51 virtual CAknSetStyleListBox* ListBoxControl() const = 0; |
|
52 |
|
53 /** |
|
54 * Default empty implementation of the listbox observer handling routine |
|
55 */ |
|
56 IMPORT_C virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); |
|
57 |
|
58 protected: |
|
59 |
|
60 /** |
|
61 * Pass-through constructor |
|
62 * @param aSettingPageResourceId resource id for CAknSettingPage::BaseConstructL() |
|
63 * |
|
64 */ |
|
65 CAknListBoxSettingPage( TInt aSettingPageResourceId ); |
|
66 |
|
67 /** |
|
68 * Pass-through constructor |
|
69 * |
|
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. |
|
73 * |
|
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 |
|
79 * |
|
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. |
|
83 * |
|
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. |
|
89 * |
|
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 |
|
95 */ |
|
96 CAknListBoxSettingPage( const TDesC* aSettingTitleText, |
|
97 TInt aSettingNumber, |
|
98 TInt aControlType, |
|
99 TInt aEditorResourceId, |
|
100 TInt aSettingPageResourceId = 0 ); |
|
101 |
|
102 |
|
103 /** |
|
104 * This standard implementation uses ListBoxControl to access the listbox and |
|
105 * check the number of items. If 0, validity is set to EFalse |
|
106 * |
|
107 */ |
|
108 IMPORT_C void CheckAndSetDataValidity(); |
|
109 |
|
110 /** |
|
111 * Implementation to remove go to "invalid" cba when data is invalid |
|
112 */ |
|
113 IMPORT_C void UpdateCbaL(); |
|
114 |
|
115 |
|
116 /** |
|
117 * From CCoeControl: |
|
118 * Routine called by Cone framework whenever there has been a size change on this |
|
119 * control |
|
120 */ |
|
121 IMPORT_C void SizeChanged(); |
|
122 |
|
123 /** |
|
124 * From CCoeControl: |
|
125 * Common draw routine for the listboxes |
|
126 * |
|
127 * @param aRect rectangle within which to draw |
|
128 */ |
|
129 IMPORT_C void Draw(const TRect& aRect) const; |
|
130 |
|
131 // |
|
132 // New methods in this class |
|
133 // |
|
134 |
|
135 /** |
|
136 * Obtain initial selection policy for popup setting item editing |
|
137 * |
|
138 * @since 2.0 |
|
139 * @return TBool EFalse iff focus is not initially to be set to the selected item |
|
140 */ |
|
141 static TBool FocusToSelectedItem(); |
|
142 |
|
143 /** |
|
144 * Obtain initial selection policy for popup setting item editing |
|
145 * |
|
146 * @since 2.0 |
|
147 * @return TBool EFalse iff focus is initially to be set to the selected item |
|
148 */ |
|
149 static TBool FocusToFirstItem(); |
|
150 |
|
151 |
|
152 /** |
|
153 * Create colorskinned icon and add it to icon array. Utility for |
|
154 * radiobutton, popup & checkbox setting page lists |
|
155 * |
|
156 * @since 3.1 |
|
157 */ |
|
158 public: |
|
159 static void CreateIconAndAddToArrayL( CArrayPtr<CGulIcon>*& aIconArray, |
|
160 const TAknsItemID& aId, |
|
161 const TInt aColorIndex, |
|
162 const TDesC& aBmpFile, |
|
163 const TInt32 aBmp, |
|
164 const TInt32 aBmpM ); |
|
165 |
|
166 private: |
|
167 /** |
|
168 */ |
|
169 IMPORT_C virtual void CAknListBoxSettingPage_Reserved_1(); |
|
170 |
|
171 protected: |
|
172 |
|
173 /** |
|
174 * Layout for the extra piece of white (sometimes) at the bottom of the listbox |
|
175 * |
|
176 */ |
|
177 TAknLayoutRect iAreaExtension; |
|
178 }; |
|
179 |
|
180 #endif |