|
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 "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: Listbox for select element. |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef CBROWSERSELECTELEMENTLISTBOX_H |
|
21 #define CBROWSERSELECTELEMENTLISTBOX_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <aknlists.h> |
|
25 #include <BrCtlDialogsProvider.h> |
|
26 |
|
27 // CLASSES |
|
28 |
|
29 class TBrCtlSelectElementFilterTextArray: public MDesCArray |
|
30 { |
|
31 /** |
|
32 * Construction |
|
33 */ |
|
34 public: |
|
35 TBrCtlSelectElementFilterTextArray( |
|
36 const CArrayFix<TBrCtlSelectOptionData>& aOptions ); |
|
37 |
|
38 public: // from MDesCArray |
|
39 |
|
40 /** |
|
41 * Get number of items in the array. |
|
42 * @return Number of items. |
|
43 */ |
|
44 TInt MdcaCount() const; |
|
45 |
|
46 /** |
|
47 * Text to be displayed for this item. |
|
48 * @param aIndex Index of item. |
|
49 * @return TPtrC for this item text. |
|
50 */ |
|
51 TPtrC MdcaPoint( TInt aIndex ) const; |
|
52 |
|
53 /** |
|
54 * The model uses this class. |
|
55 */ |
|
56 friend class CBrowserSelectElementModel; |
|
57 |
|
58 private: // data |
|
59 |
|
60 /** |
|
61 * Pointer to real data. Not owned. |
|
62 */ |
|
63 const CArrayFix<TBrCtlSelectOptionData>& iOptions; |
|
64 }; |
|
65 |
|
66 class TBrCtlSelectElementItemTextArray: public MDesCArray |
|
67 { |
|
68 public: |
|
69 /** |
|
70 * Contructor. |
|
71 */ |
|
72 TBrCtlSelectElementItemTextArray( |
|
73 const CArrayFix<TBrCtlSelectOptionData>& aOptions ); |
|
74 |
|
75 /** |
|
76 * Destructor. |
|
77 */ |
|
78 ~TBrCtlSelectElementItemTextArray(); |
|
79 |
|
80 public: // from MDesCArray |
|
81 |
|
82 /** |
|
83 * Get number of items in the array. |
|
84 * @return Number of items. |
|
85 */ |
|
86 TInt MdcaCount() const; |
|
87 |
|
88 /** |
|
89 * Text to be displayed for this item. |
|
90 * @param aIndex Index of item. |
|
91 * @return TPtrC for this item text. |
|
92 */ |
|
93 TPtrC MdcaPoint( TInt aIndex ) const; |
|
94 |
|
95 void FormatTextL( const TBrCtlSelectOptionData& optionData ); |
|
96 |
|
97 HBufC* AddPrefixLC( const TDesC& aText, TBool aIsOptionGroup ) const; |
|
98 |
|
99 /** |
|
100 * The model uses this class. |
|
101 */ |
|
102 friend class CBrowserSelectElementModel; |
|
103 |
|
104 private: // data |
|
105 |
|
106 const CArrayFix<TBrCtlSelectOptionData>& iOptions; //Pointer to real data. Not owned. |
|
107 HBufC* iText; |
|
108 }; |
|
109 |
|
110 |
|
111 /** |
|
112 * Implements the WML selection list. |
|
113 */ |
|
114 class CBrowserSelectElementListBox : |
|
115 public CAknSingleGraphicPopupMenuStyleListBox |
|
116 { |
|
117 public: // Constructors and destructor |
|
118 |
|
119 CBrowserSelectElementListBox( |
|
120 const TBrCtlSelectOptionType aBrCtlSelectOptionType, |
|
121 const CArrayFix<TBrCtlSelectOptionData>& aOptions ); |
|
122 |
|
123 /** |
|
124 * C++ default constructor. |
|
125 * @param aParent The parent control. |
|
126 * @param aElement The select element. |
|
127 */ |
|
128 void ConstructL( const CCoeControl& aParent ); |
|
129 |
|
130 public: // Functions from CAknSingleGraphicStyleListBox |
|
131 |
|
132 /** |
|
133 * Creates its own itemdrawer. |
|
134 */ |
|
135 void CreateItemDrawerL(); |
|
136 |
|
137 /** |
|
138 * Handles key events. |
|
139 * @param aKeyEvent The key event. |
|
140 * @param aType The type. |
|
141 * @return Response. |
|
142 */ |
|
143 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
144 TEventCode aType ); |
|
145 |
|
146 /** |
|
147 * Calls the base class's method if its possible. |
|
148 * @param aDrawNow Enable redraw. |
|
149 */ |
|
150 void FocusChanged( TDrawNow aDrawNow ); |
|
151 |
|
152 /** |
|
153 * Calls AdjustHighlight. |
|
154 */ |
|
155 void SizeChanged(); |
|
156 |
|
157 void HighlightSelectableItem(); |
|
158 |
|
159 /** |
|
160 * Sets the selection, and moves the highlight to the right position. |
|
161 */ |
|
162 void SetSelectionIndexesL(); |
|
163 |
|
164 void HandleResourceChangeL( TInt aType ); |
|
165 /** |
|
166 * HandlePointerEventL |
|
167 * From CCoeControl |
|
168 * |
|
169 */ |
|
170 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
171 |
|
172 |
|
173 private: // New functions |
|
174 |
|
175 /** |
|
176 * Moves the highlight to the first visible selected item |
|
177 * or the first item. |
|
178 */ |
|
179 void AdjustHighlight(); |
|
180 |
|
181 private: |
|
182 |
|
183 const CArrayFix<TBrCtlSelectOptionData>& iOptions; |
|
184 |
|
185 const TBrCtlSelectOptionType iBrCtlSelectOptionType; |
|
186 |
|
187 TBool iHasNotMoved;//show whether the user has pressed any key |
|
188 }; |
|
189 |
|
190 #endif |
|
191 |
|
192 // End of File |