|
1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * Selection popup dialog header file. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef _SELECTIONPOPUP_H |
|
22 #define _SELECTIONPOPUP_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <coecntrl.h> |
|
26 #include <AknDialog.h> |
|
27 #include <AknUtils.h> |
|
28 |
|
29 #include "PreviewControlBase.h" |
|
30 |
|
31 class CFbsBitmap; |
|
32 //class TAknLayoutText; |
|
33 |
|
34 NONSHARABLE_CLASS( CSelectionPopup ):public CPreviewControlBase |
|
35 { |
|
36 |
|
37 public: |
|
38 |
|
39 /** Default constructor, cannot leave. |
|
40 * |
|
41 * @since S60 5.0 |
|
42 * @param - |
|
43 * @return - |
|
44 */ |
|
45 CSelectionPopup(); |
|
46 |
|
47 /** Destructor |
|
48 * |
|
49 * @since S60 5.0 |
|
50 * @param - |
|
51 * @return - |
|
52 */ |
|
53 ~CSelectionPopup (); |
|
54 |
|
55 /** Second phase constructor |
|
56 * |
|
57 * @since S60 5.0 |
|
58 * @param aParent - Parent control |
|
59 * @return - |
|
60 */ |
|
61 void ConstructL ( CCoeControl* aParent ); |
|
62 |
|
63 /** OfferKeyEventL |
|
64 * |
|
65 * @see CCoeControl |
|
66 */ |
|
67 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
68 TEventCode aType ); |
|
69 |
|
70 /** HandlePointerEventL |
|
71 * |
|
72 * @see CCoeControl |
|
73 */ |
|
74 void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
75 |
|
76 public: //new methods |
|
77 |
|
78 /** GridRect |
|
79 * |
|
80 * Returns popup component's rectangle area |
|
81 * |
|
82 * @since S60 5.0 |
|
83 * @param - |
|
84 * @return TRect The area of the popup |
|
85 */ |
|
86 TRect GridRect() const; |
|
87 |
|
88 /** HighlightedItemPressed |
|
89 * |
|
90 * This function can be used to check whether user has pressed (by stylus) |
|
91 * currently highlighted color item. |
|
92 * |
|
93 * @since S60 5.0 |
|
94 * @param aPosition position value to be checked. |
|
95 * @return ETrue if aPosition is in the rect area of currently highlighted |
|
96 * plugin item, EFalse otherwise. |
|
97 */ |
|
98 TBool HighlightedItemPressed( TPoint aPosition ) const; |
|
99 |
|
100 /** SetSelectedValue |
|
101 * |
|
102 * Set currently highlighted item |
|
103 * |
|
104 * @param aSelected selected item index. |
|
105 * @since S60 5.0 |
|
106 */ |
|
107 void SetSelectedValue( TInt aSelected ); |
|
108 |
|
109 /** GetSelectedValue |
|
110 * |
|
111 * Returns current highlighted item value |
|
112 * |
|
113 * @since S60 5.0 |
|
114 * @return TInt Currently selected value |
|
115 */ |
|
116 TInt GetSelectedValue() const; |
|
117 |
|
118 private: |
|
119 |
|
120 /** CreateColorBitmapsL |
|
121 * |
|
122 * Creates a bitmap array |
|
123 * |
|
124 * @since S60 5.0 |
|
125 * @param aSize Size that color bitmaps should be created to |
|
126 * @return - |
|
127 */ |
|
128 void CreateColorBitmapsL( TSize aSize ); |
|
129 |
|
130 protected: |
|
131 |
|
132 /** SizeChanged |
|
133 * |
|
134 * @see CCoeControl |
|
135 */ |
|
136 virtual void SizeChanged(); |
|
137 |
|
138 /** Draw |
|
139 * |
|
140 * @see CCoeControl |
|
141 */ |
|
142 virtual void Draw( const TRect& aRect ) const; |
|
143 |
|
144 |
|
145 private: |
|
146 |
|
147 // Popup graphic bitmaps |
|
148 CFbsBitmap* iPopupCenter; |
|
149 CFbsBitmap* iPopupCenterMask; |
|
150 CFbsBitmap* iPopupCornerTL; |
|
151 CFbsBitmap* iPopupCornerTLMask; |
|
152 CFbsBitmap* iPopupCornerTR; |
|
153 CFbsBitmap* iPopupCornerTRMask; |
|
154 CFbsBitmap* iPopupCornerBL; |
|
155 CFbsBitmap* iPopupCornerBLMask; |
|
156 CFbsBitmap* iPopupCornerBR; |
|
157 CFbsBitmap* iPopupCornerBRMask; |
|
158 CFbsBitmap* iPopupSideL; |
|
159 CFbsBitmap* iPopupSideLMask; |
|
160 CFbsBitmap* iPopupSideR; |
|
161 CFbsBitmap* iPopupSideRMask; |
|
162 CFbsBitmap* iPopupSideT; |
|
163 CFbsBitmap* iPopupSideTMask; |
|
164 CFbsBitmap* iPopupSideB; |
|
165 CFbsBitmap* iPopupSideBMask; |
|
166 |
|
167 // Popup rects |
|
168 TRect iPopupCenterRect; |
|
169 TRect iPopupCornerTLRect; |
|
170 TRect iPopupCornerTRRect; |
|
171 TRect iPopupCornerBLRect; |
|
172 TRect iPopupCornerBRRect; |
|
173 TRect iPopupSideLRect; |
|
174 TRect iPopupSideRRect; |
|
175 TRect iPopupSideTRect; |
|
176 TRect iPopupSideBRect; |
|
177 TRect iHeadingRect; |
|
178 |
|
179 // Format and layout information of the heading text |
|
180 TAknLayoutText iLayoutTextHeading; |
|
181 |
|
182 // Contains rectangles of all grid highlight items |
|
183 RArray< TRect > iHighlightRectsArray; |
|
184 |
|
185 // Contains rectangles of all grid color items |
|
186 RArray< TRect > iGridRectsArray; |
|
187 |
|
188 // Color bitmaps |
|
189 RPointerArray < CFbsBitmap > iColorBitmapsArray; |
|
190 |
|
191 // Used values |
|
192 RArray< TInt > iItemArray; |
|
193 |
|
194 TInt iCurrentItem; |
|
195 |
|
196 |
|
197 }; |
|
198 |
|
199 |
|
200 NONSHARABLE_CLASS( CSelectionDialog ): public CAknDialog |
|
201 { |
|
202 public: |
|
203 |
|
204 /** RunDlgLD |
|
205 * |
|
206 * @param aBitmap - background bitmap |
|
207 * @param aRect - Rect for the dialog |
|
208 * @param aSelection - Selected value to be returned |
|
209 * @return - ExecuteLD() return value |
|
210 */ |
|
211 static TInt RunDlgLD( const CFbsBitmap* aBitmap, |
|
212 const TRect& aRect, |
|
213 TInt& aSelection ); |
|
214 |
|
215 |
|
216 virtual ~CSelectionDialog(); |
|
217 |
|
218 /** OkToExitL |
|
219 * |
|
220 * From CAknDialog update member variables . |
|
221 * @param aButtonId The ID of the button that was activated. |
|
222 * @return Should return ETrue if the dialog should exit, |
|
223 * and EFalse if it should not |
|
224 */ |
|
225 TBool OkToExitL( TInt aButtonId ); |
|
226 |
|
227 /** Draw |
|
228 * |
|
229 * |
|
230 * @see CAknDialog |
|
231 * |
|
232 */ |
|
233 void Draw(const TRect& aRect) const; |
|
234 |
|
235 /** SizeChanged |
|
236 * |
|
237 * |
|
238 * @see CCoeControl |
|
239 * |
|
240 */ |
|
241 virtual void SizeChanged(); |
|
242 |
|
243 /** OfferKeyEventL |
|
244 * |
|
245 * @see CCoeControl |
|
246 * |
|
247 */ |
|
248 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
249 |
|
250 /** HandlePointerEventL |
|
251 * |
|
252 * @see CCoeControl |
|
253 */ |
|
254 virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
255 |
|
256 /** PreLayoutDynInitL |
|
257 * |
|
258 * @see CEikDialog |
|
259 * |
|
260 */ |
|
261 virtual void PreLayoutDynInitL(); |
|
262 |
|
263 /** CountComponentControls |
|
264 * |
|
265 * @see CCoeControl |
|
266 * |
|
267 */ |
|
268 TInt CountComponentControls() const; |
|
269 |
|
270 /** ComponentControl |
|
271 * |
|
272 * @see CCoeControl |
|
273 * |
|
274 */ |
|
275 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
|
276 |
|
277 private: // implementation |
|
278 |
|
279 CSelectionDialog( TInt& aSelectino ); |
|
280 void ConstructL( const CFbsBitmap* aBitmap, const TRect& aRect); |
|
281 |
|
282 private: |
|
283 |
|
284 // Own: popup component |
|
285 CSelectionPopup* iPopup; |
|
286 |
|
287 // Ref: Selected color |
|
288 TInt& iCurrentValue; |
|
289 |
|
290 }; |
|
291 |
|
292 #endif // _SELECTIONPOPUP_H |