1 /* |
|
2 * Copyright (c) 2003-2005 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 "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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * class description for CGSListBox & CGSListBoxItemTextArray. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef GS_LIST_BOX_H |
|
22 #define GS_LIST_BOX_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <e32std.h> |
|
26 #include <barsread.h> |
|
27 #include <coemain.h> |
|
28 |
|
29 class CAknRadioButtonSettingPage; |
|
30 class CEikListBox; |
|
31 |
|
32 |
|
33 /*================================================ |
|
34 * CGSListboxEntry: class to map feature->item index when selected |
|
35 * from a listbox. This is required when there are features which are |
|
36 * dynamically shown/hidden. |
|
37 ================================================*/ |
|
38 class CGSListboxEntry : public CBase |
|
39 { |
|
40 public: |
|
41 IMPORT_C static CGSListboxEntry* NewLC( TResourceReader& aReader ); |
|
42 IMPORT_C static CGSListboxEntry* NewLC( TInt aFeatureId ); |
|
43 IMPORT_C static CGSListboxEntry* NewLC( |
|
44 TUint32 aResId, CCoeEnv& aEnv, TInt aFeatureId ); |
|
45 IMPORT_C ~CGSListboxEntry(); |
|
46 |
|
47 public: // Accessors |
|
48 IMPORT_C TInt FeatureId() const; |
|
49 IMPORT_C const TDesC& Caption() const; |
|
50 IMPORT_C TInt Type() const; |
|
51 |
|
52 public: // Manipulators |
|
53 IMPORT_C void SetDynamicTextL( const TDesC& aText ); |
|
54 IMPORT_C void SetDynamicTextDoublePaneL( const TDesC& aText ); |
|
55 |
|
56 private: |
|
57 CGSListboxEntry(); |
|
58 void ConstructL( TResourceReader& aReader ); |
|
59 void ConstructL( TUint32 aResId, CCoeEnv& aEnv, TInt aFeatureId ); |
|
60 |
|
61 private: |
|
62 inline TInt StaticTextLength() const { return iStaticTextLength; } |
|
63 |
|
64 private: |
|
65 |
|
66 /** |
|
67 * The length of the static text which does not change |
|
68 */ |
|
69 TInt iStaticTextLength; |
|
70 |
|
71 /** |
|
72 * The static text and dynamic text combined. We can always |
|
73 * change the dynamic part due to the fact that we know |
|
74 * the length (prefix) of the static part. |
|
75 */ |
|
76 HBufC* iCaption; |
|
77 |
|
78 /** |
|
79 * One of either EGSListBoxItemTypeIsAlwaysVisible or |
|
80 * EGSListBoxItemTypeIsDynamic |
|
81 */ |
|
82 TInt iType; |
|
83 |
|
84 /** |
|
85 * The id of this feature |
|
86 */ |
|
87 TInt iFeatureId; |
|
88 |
|
89 /** |
|
90 * Maximum Length of the Dynamic text which doesnot change.. |
|
91 * This has been added after inclusion Double Pane List Box |
|
92 */ |
|
93 TInt iDynamicTextSize; |
|
94 }; |
|
95 |
|
96 |
|
97 |
|
98 /*================================================ |
|
99 ================================================*/ |
|
100 class CGSItemTextArray : public CBase, public MDesCArray |
|
101 { |
|
102 public: |
|
103 enum TVisibility |
|
104 { |
|
105 EInvisible = 0, |
|
106 EVisible = 1 |
|
107 }; |
|
108 |
|
109 public: |
|
110 IMPORT_C static CGSItemTextArray* NewL( |
|
111 TUint32 aResId, |
|
112 CCoeEnv& aEnv ); |
|
113 ~CGSItemTextArray(); |
|
114 |
|
115 protected: |
|
116 CGSItemTextArray(); |
|
117 void ConstructL( TUint32 aResId, CCoeEnv& aEnv ); |
|
118 void ConstructL( TUint32 aResId, CCoeEnv& aEnv, TInt aCount ); |
|
119 |
|
120 public: // From MDesCArray |
|
121 IMPORT_C TInt MdcaCount() const; |
|
122 IMPORT_C TPtrC MdcaPoint( TInt aIndex ) const; |
|
123 |
|
124 public: // API |
|
125 |
|
126 /** |
|
127 * Used to add dynamic text to the end of an existing model item |
|
128 */ |
|
129 IMPORT_C void SetDynamicTextL( TInt aFeatureId, |
|
130 const TDesC& aAdditionalText ); |
|
131 |
|
132 /** |
|
133 * Used to add dynamic text to the end of an existing model item |
|
134 * When Double Pane List box is used CAknDoubleStyleListBox |
|
135 */ |
|
136 IMPORT_C void SetDynamicTextDoublePaneL( TInt aFeatureId, |
|
137 const TDesC& aAdditionalText ); |
|
138 |
|
139 /** |
|
140 * Specify that this item should be visible / invisible in the |
|
141 * iCurrentlyDisplayedEntries array |
|
142 */ |
|
143 IMPORT_C void SetItemVisibilityL( TInt aFeatureId, |
|
144 TVisibility aVisibility ); |
|
145 |
|
146 /** |
|
147 * Access the id of the currently selected feature |
|
148 */ |
|
149 IMPORT_C virtual TInt CurrentFeature() const; |
|
150 |
|
151 /** |
|
152 * Set the currently selected feature id |
|
153 */ |
|
154 IMPORT_C TInt IndexForFeatureIdL(TInt aFeatureId) const; |
|
155 |
|
156 /** |
|
157 * Returns the feature id corresponding to an index |
|
158 */ |
|
159 IMPORT_C TInt FeatureIdByIndex(TInt aIndex) const; |
|
160 |
|
161 /** |
|
162 * |
|
163 */ |
|
164 IMPORT_C const CGSListboxEntry* FeatureByIdL( TInt aFeatureId ) const; |
|
165 |
|
166 /** |
|
167 * |
|
168 */ |
|
169 IMPORT_C static HBufC* GetItemCaptionFromFeatureIdLC(TUint32 aResourceId, TInt aFeatureId, CCoeEnv& aCone); |
|
170 |
|
171 |
|
172 private: |
|
173 static TBool CompareEntries( const CGSListboxEntry& aLeft, |
|
174 const CGSListboxEntry& aRight ); |
|
175 |
|
176 |
|
177 protected: |
|
178 |
|
179 /** |
|
180 * All the entries which may potentially be contained within the listbox |
|
181 * model. This array is owned and destroyed by this class. |
|
182 */ |
|
183 RPointerArray< CGSListboxEntry > iAllEntries; |
|
184 |
|
185 /** |
|
186 * The entries which are currently displayed within the listbox. These |
|
187 * pointers are actually owned in the iAllEntries array and therefore |
|
188 * this array must not be 'ResetAndDestroyed()' (but rather just Reset()) |
|
189 * from within this class' destructor. |
|
190 */ |
|
191 RPointerArray< CGSListboxEntry > iCurrentlyDisplayedEntries; |
|
192 }; |
|
193 |
|
194 |
|
195 /*================================================ |
|
196 ================================================*/ |
|
197 class CGSRadioButtonSettingPageItemTextArray : public CGSItemTextArray |
|
198 { |
|
199 public: |
|
200 IMPORT_C static CGSRadioButtonSettingPageItemTextArray* NewL( |
|
201 TUint32 aResId, |
|
202 CCoeEnv& aEnv, |
|
203 CAknRadioButtonSettingPage* aSettingPage = NULL |
|
204 ); |
|
205 |
|
206 private: |
|
207 CGSRadioButtonSettingPageItemTextArray( CAknRadioButtonSettingPage* aSettingPage ); |
|
208 |
|
209 public: // FROM CGSItemTextArray |
|
210 IMPORT_C TInt CurrentFeature() const; |
|
211 |
|
212 public: // New API |
|
213 IMPORT_C void SetRadioButtonSettingPage( CAknRadioButtonSettingPage& aPage ); |
|
214 |
|
215 private: |
|
216 |
|
217 /** |
|
218 * Underlying setting page |
|
219 */ |
|
220 CAknRadioButtonSettingPage* iSettingPage; |
|
221 }; |
|
222 |
|
223 |
|
224 |
|
225 /*================================================ |
|
226 * CGSListBoxItemTextArray: This class acts as a wrapper class for |
|
227 * CGSListboxEntry. Instance of this class is created from the |
|
228 * calling function. |
|
229 ================================================*/ |
|
230 class CGSListBoxItemTextArray : public CGSItemTextArray |
|
231 { |
|
232 public: |
|
233 IMPORT_C static CGSListBoxItemTextArray* NewL( |
|
234 TUint32 aResId, |
|
235 CEikListBox& aListBox, |
|
236 CCoeEnv& aEnv ); |
|
237 IMPORT_C static CGSListBoxItemTextArray* NewL( |
|
238 TUint32 aResId, |
|
239 CEikListBox& aListBox, |
|
240 CCoeEnv& aEnv, |
|
241 TInt aCount ); |
|
242 |
|
243 private: |
|
244 CGSListBoxItemTextArray( CEikListBox& aListBox ); |
|
245 |
|
246 public: // FROM CGSItemTextArray |
|
247 IMPORT_C TInt CurrentFeature() const; |
|
248 |
|
249 private: |
|
250 |
|
251 /** |
|
252 * Underlying listbox |
|
253 */ |
|
254 CEikListBox& iListBox; |
|
255 }; |
|
256 |
|
257 #endif //GS_LIST_BOX_H |
|