|
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 * Effect plugin selection dialog that shows icons of available |
|
17 * plugins. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef PLUGINGRID_H |
|
23 #define PLUGINGRID_H |
|
24 |
|
25 #include <eikdialg.h> |
|
26 #include <AknDialog.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CFbsBitmap; |
|
30 class CPluginInfo; |
|
31 class CAknInfoPopupNoteController; |
|
32 #ifdef RD_TACTILE_FEEDBACK |
|
33 class MTouchFeedback; |
|
34 #endif /* RD_TACTILE_FEEDBACK */ |
|
35 |
|
36 typedef RPointerArray<CPluginInfo> RPluginArray; |
|
37 |
|
38 class CPluginGrid : public CCoeControl |
|
39 { |
|
40 |
|
41 public: |
|
42 |
|
43 /** Default constructor, cannot leave. |
|
44 * |
|
45 * @param - |
|
46 * @return - |
|
47 */ |
|
48 CPluginGrid (CFbsBitmap** aBitmap, |
|
49 const RPluginArray* aItems); |
|
50 |
|
51 /** Destructor |
|
52 * |
|
53 * @param - |
|
54 * @return - |
|
55 */ |
|
56 virtual ~CPluginGrid (); |
|
57 |
|
58 /** Second phase constructor |
|
59 * |
|
60 * @param - |
|
61 * @return - |
|
62 */ |
|
63 void ConstructL (); |
|
64 |
|
65 /** GetSelectedItemIndex |
|
66 * |
|
67 * @param - |
|
68 * @return - Current item |
|
69 */ |
|
70 TInt GetSelectedItemIndex() const; |
|
71 |
|
72 /** OfferKeyEventL |
|
73 * |
|
74 * @see CCoeControl |
|
75 */ |
|
76 virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
77 TEventCode aType ); |
|
78 /** HandlePointerEventL |
|
79 * |
|
80 * @see CCoeControl |
|
81 */ |
|
82 virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
83 |
|
84 public: //new methods |
|
85 |
|
86 /** GridRect |
|
87 * |
|
88 * Returns grids rectangle area |
|
89 * |
|
90 * @since S60 5.0 |
|
91 * @param - |
|
92 * @return TRect The area of the grid component (text field not included) |
|
93 */ |
|
94 TRect GridRect() const; |
|
95 |
|
96 /** HighlightedItemPressed |
|
97 * |
|
98 * This function can be used to check whether user has pressed (by stylus) |
|
99 * currently highlighted plugin item. |
|
100 * |
|
101 * @since S60 5.0 |
|
102 * @param aPosition position value to be checked. |
|
103 * @return ETrue if aPosition is in the rect area of currently highlighted |
|
104 * plugin item, EFalse otherwise. |
|
105 */ |
|
106 TBool HighlightedItemPressed( TPoint aPosition ) const; |
|
107 |
|
108 /** ShowTooltip |
|
109 * |
|
110 * Shows a tooltip text on the screen next to the currently |
|
111 * highlighted grid item. |
|
112 * |
|
113 * @since S60 5.0 |
|
114 * @param aPopupController - pointer to popup note controller |
|
115 * @param aCallingControl - pointer to a calling control |
|
116 * @return - |
|
117 */ |
|
118 void ShowTooltip( CAknInfoPopupNoteController* aPopupController, |
|
119 CCoeControl* aCallingControl ); |
|
120 |
|
121 /** CountComponentControls |
|
122 * |
|
123 * @see CCoeControl |
|
124 * |
|
125 */ |
|
126 TInt CountComponentControls() const; |
|
127 |
|
128 /** ComponentControl |
|
129 * |
|
130 * @see CCoeControl |
|
131 * |
|
132 */ |
|
133 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
|
134 |
|
135 /** SizeChanged |
|
136 * |
|
137 * @see CCoeControl |
|
138 */ |
|
139 virtual void SizeChanged(); |
|
140 |
|
141 protected: |
|
142 |
|
143 /** Draw |
|
144 * |
|
145 * @see CCoeControl |
|
146 */ |
|
147 virtual void Draw( const TRect& aRect ) const; |
|
148 |
|
149 private: |
|
150 |
|
151 // Background image |
|
152 CFbsBitmap** iBitmap; |
|
153 // Plugin info array |
|
154 const RPluginArray* iPluginItems; |
|
155 // Current item index |
|
156 TInt iCurrentItem; |
|
157 // popup graphics |
|
158 RPointerArray<CEikImage> iBorders; |
|
159 // highlight graphics |
|
160 RPointerArray<CEikImage> iHighlight; |
|
161 // plugin icons |
|
162 RPointerArray<CEikImage> iIcons; |
|
163 // title text |
|
164 CEikLabel* iText; |
|
165 |
|
166 // Grid resolutions |
|
167 TInt iNumberOfRows; |
|
168 TInt iNumberOfColumns; |
|
169 |
|
170 // Grid layout |
|
171 TSize iCellSize; |
|
172 TRect iTouchGridRect; |
|
173 TPoint iHighlightPos; |
|
174 TRect iParentRect; |
|
175 |
|
176 }; |
|
177 |
|
178 |
|
179 class CPluginSelectionDialog : public CAknDialog |
|
180 { |
|
181 public: |
|
182 |
|
183 /** RunDlgLD |
|
184 * |
|
185 * @param aBitmap - background bitmap |
|
186 * @param aSelectedItem - selected item |
|
187 * @param aItems - Plugin info item array |
|
188 * @param aRect - Rect for the dialog |
|
189 * @return - ExecuteLD() return value |
|
190 */ |
|
191 static TInt RunDlgLD(CFbsBitmap** aBitmap, |
|
192 TInt& aSelectedItem, |
|
193 const RPluginArray* aItems, |
|
194 const TRect& aRect); |
|
195 |
|
196 /** Constructor |
|
197 * |
|
198 * @param aBitmap - background bitmap |
|
199 * @param aSelectedItem - selected item |
|
200 * @param aItems - Plugin info item array |
|
201 * @return - |
|
202 */ |
|
203 CPluginSelectionDialog(CFbsBitmap** aBitmap, |
|
204 TInt& aSelectedItem, |
|
205 const RPluginArray* aItems); |
|
206 |
|
207 /** Destructor |
|
208 * |
|
209 * @param - |
|
210 * @return - |
|
211 */ |
|
212 virtual ~CPluginSelectionDialog(); |
|
213 |
|
214 /** 2nd phase constructor |
|
215 * |
|
216 * @param aRect - Rect for the dialog |
|
217 * @return - |
|
218 */ |
|
219 void ConstructL(const TRect& aRect); |
|
220 |
|
221 /** OkToExitL |
|
222 * |
|
223 * From CAknDialog update member variables . |
|
224 * @param aButtonId The ID of the button that was activated. |
|
225 * @return Should return ETrue if the dialog should exit, |
|
226 * and EFalse if it should not |
|
227 */ |
|
228 TBool OkToExitL( TInt aButtonId ); |
|
229 |
|
230 /** Draw |
|
231 * |
|
232 * |
|
233 * @see CAknDialog |
|
234 * |
|
235 */ |
|
236 void Draw(const TRect& aRect) const; |
|
237 |
|
238 /** SizeChanged |
|
239 * |
|
240 * |
|
241 * @see CCoeControl |
|
242 * |
|
243 */ |
|
244 virtual void SizeChanged(); |
|
245 |
|
246 /** OfferKeyEventL |
|
247 * |
|
248 * @see CCoeControl |
|
249 * |
|
250 */ |
|
251 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
252 |
|
253 /** HandlePointerEventL |
|
254 * |
|
255 * @see CCoeControl |
|
256 */ |
|
257 virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); |
|
258 |
|
259 /** CountComponentControls |
|
260 * |
|
261 * @see CCoeControl |
|
262 * |
|
263 */ |
|
264 TInt CountComponentControls() const; |
|
265 |
|
266 /** ComponentControl |
|
267 * |
|
268 * @see CCoeControl |
|
269 * |
|
270 */ |
|
271 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
|
272 |
|
273 private: |
|
274 /// Background bitmap |
|
275 CFbsBitmap** iBitmap; |
|
276 /// Plugin info array |
|
277 const RPluginArray* iItems; |
|
278 /// Selected item |
|
279 TInt& iSelectedItem; |
|
280 /// Selection grid |
|
281 CPluginGrid* iGrid; |
|
282 // Popup controller |
|
283 CAknInfoPopupNoteController* iPopupController; |
|
284 |
|
285 // Feedback for screen touch: |
|
286 #ifdef RD_TACTILE_FEEDBACK |
|
287 MTouchFeedback* iTouchFeedBack; |
|
288 #endif /* RD_TACTILE_FEEDBACK */ |
|
289 |
|
290 }; |
|
291 |
|
292 |
|
293 #endif |
|
294 |
|
295 // End of File |