|
1 /* |
|
2 * Copyright (c) 2009 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: The class of handwriting box container. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_PENINPUTHWRBOXGROUP_H |
|
20 #define C_PENINPUTHWRBOXGROUP_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <peninputlayoutbasecontrol.h> |
|
24 #include <peninputlayoutctrlgroup.h> |
|
25 #include <peninputlayouthwrwnd.h> |
|
26 #include <peninputlayoutminterface.h> |
|
27 |
|
28 /* FORWARD DECLARATIONS */ |
|
29 class TResourceReader; |
|
30 |
|
31 /** |
|
32 * HWR(Hand Writing Recognition) box container class. |
|
33 * |
|
34 * This class holds one or more handwriting boxes, processes event |
|
35 * sent from hwr boxes and managers boxes UI. |
|
36 * |
|
37 * @lib peninputhwrboxjp.lib |
|
38 * @since S60 v3.2 |
|
39 */ |
|
40 class CPeninputHwrBoxGroup: public CControlGroup, |
|
41 public MEventObserver |
|
42 { |
|
43 public: |
|
44 |
|
45 |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * CPeninputHwrBoxGroup creates aBoxCount HWR boxes. |
|
49 * After creating a new CPeninputHwrBoxGroup and SetTransparency |
|
50 * must be called. |
|
51 * @param aUiLayout Ui layout instance from CFepUiLayout |
|
52 * @param aBoxGroupId The box group control id |
|
53 * @param aBoxCount The count of contained HWR box |
|
54 * @return The instance of CPeninputHwrBoxGroup |
|
55 */ |
|
56 static CPeninputHwrBoxGroup* NewL(CFepUiLayout* aUiLayout, |
|
57 TInt aBoxGroupId, |
|
58 TInt aBoxCount); |
|
59 |
|
60 /** |
|
61 * Two-phased constructor. |
|
62 * CPeninputHwrBoxGroup creates aBoxCount HWR boxes. |
|
63 * After creating a new CPeninputHwrBoxGroup and SetTransparency |
|
64 * must be called. |
|
65 * @param aUiLayout Ui layout instance from CFepUiLayout |
|
66 * @param aBoxGroupId The box group control id |
|
67 * @param aBoxCount The count of contained HWR box |
|
68 * @return The instance of CPeninputHwrBoxGroup |
|
69 */ |
|
70 static CPeninputHwrBoxGroup* NewLC(CFepUiLayout* aUiLayout, |
|
71 TInt aBoxGroupId, |
|
72 TInt aBoxCount); |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 virtual ~CPeninputHwrBoxGroup(); |
|
77 |
|
78 /** |
|
79 * From CFepUiBaseCtrl |
|
80 * Handle pointer down event |
|
81 * |
|
82 * @since S60 V4.0 |
|
83 * @param aPoint The point position relative the layout |
|
84 * @return The control which handles the event. |
|
85 */ |
|
86 CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPt); |
|
87 |
|
88 /** |
|
89 * From CFepUiBaseCtrl |
|
90 * Handle pointer move event |
|
91 * |
|
92 * @since S60 V4.0 |
|
93 * @param aPoint The point position relative the layout |
|
94 * @return The control which handles the event. |
|
95 */ |
|
96 CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint); |
|
97 |
|
98 /** |
|
99 * From CFepUiBaseCtrl |
|
100 * Handle pointer up event |
|
101 * |
|
102 * @since S60 V4.0 |
|
103 * @param aPoint The point position relative the layout |
|
104 * @return The control which handles the event. |
|
105 */ |
|
106 CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint); |
|
107 |
|
108 /** |
|
109 * From CFepUiBaseCtrl |
|
110 * Handle pointer levae event. |
|
111 * This will be called only when it's got pointer down event before and |
|
112 * now pointer leaves without pointer up event |
|
113 * |
|
114 * @since S60 V4.0 |
|
115 * @param aPoint current pointer position |
|
116 */ |
|
117 void HandlePointerLeave(const TPoint& aPoint); |
|
118 |
|
119 /** |
|
120 * From CFepUiBaseCtrl |
|
121 * Handle pointer enter event. |
|
122 * This will be called only when it's got pointer down event before and |
|
123 * pointer leaves but now comes back without pointer up event. |
|
124 * |
|
125 * @since S60 V4.0 |
|
126 * @param aPoint current pointer position |
|
127 */ |
|
128 void HandlePointerEnter(const TPoint& aPoint); |
|
129 |
|
130 /** |
|
131 * Return the HWR box count in the container |
|
132 * |
|
133 * @since S60 v3.2 |
|
134 * @return Number of HWR box in the container |
|
135 */ |
|
136 TInt BoxCount(); |
|
137 |
|
138 /** |
|
139 * Clear current handwriting trail if any. There is only one |
|
140 * box is writing at a time. CancelWriting only clear current |
|
141 * writing box's trail. |
|
142 * |
|
143 * @since S60 v3.2 |
|
144 * @return None |
|
145 */ |
|
146 void CancelWriting(); |
|
147 |
|
148 /** |
|
149 * Return current active box pen stroke list array. |
|
150 * |
|
151 * @since S60 v3.2 |
|
152 * @return Reference of stroke list array |
|
153 */ |
|
154 const RArray<TPoint>& StrokeList(); |
|
155 |
|
156 /** |
|
157 * Hand size change event. |
|
158 * this function is called by parent control which knows the |
|
159 * box container position. |
|
160 * |
|
161 * @since S60 v3.2 |
|
162 * @param aRect The new position rectangle |
|
163 * @return None |
|
164 */ |
|
165 void SizeChanged(const TRect& aRect); |
|
166 |
|
167 /** |
|
168 * Iterate to set each HWR box backgound color. |
|
169 * |
|
170 * @since S60 v3.2 |
|
171 * Iterate to set each HWR box backgound color. |
|
172 * @return None |
|
173 */ |
|
174 void SetBoxBackColor(const TRgb& aCol); |
|
175 |
|
176 /** |
|
177 * Iterate to set each HWR box frame color. |
|
178 * |
|
179 * @since S60 v3.2 |
|
180 * @param aCol New frame color |
|
181 * @return None |
|
182 */ |
|
183 void SetBoxFrameColor(const TRgb& aCol); |
|
184 |
|
185 /** |
|
186 * Iterate to set each HWR box stroke end mark. |
|
187 * |
|
188 * @since S60 v3.2 |
|
189 * @param aEndMark The stroke end mark |
|
190 * @return None |
|
191 */ |
|
192 void SetStrokeEndMark(const TPoint& aEndMark); |
|
193 |
|
194 /** |
|
195 * Set transparent level of HWR box. |
|
196 * |
|
197 * @since S60 v3.2 |
|
198 * @param aActiveTrans, The active box(current writing) tranparency |
|
199 * @param aInactiveTrans, The inactive box transparency |
|
200 * @return None |
|
201 */ |
|
202 void SetTransparency(const TUint8 aActiveTrans, const TUint8 aInactiveTrans); |
|
203 |
|
204 /** |
|
205 * Get transparent level of HWR box for active box transparency. |
|
206 * |
|
207 * @since S60 v3.2 |
|
208 * @return The active box transparency. |
|
209 */ |
|
210 inline TUint8 ActiveTransparency() const; |
|
211 |
|
212 /** |
|
213 * Get transparent level of HWR box for inactive box transparency. |
|
214 * |
|
215 * @since S60 v3.2 |
|
216 * @return The inactive box transparency. |
|
217 */ |
|
218 inline TUint8 InactiveTransparency() const; |
|
219 |
|
220 protected: |
|
221 |
|
222 /** |
|
223 * From base class MEventObserver |
|
224 * |
|
225 * Handle event |
|
226 * @since S60 v3.2 |
|
227 * @param aEventType The event type |
|
228 * @param aCtrlId The control who sends the event |
|
229 * @param aEventData The event data |
|
230 * @return None |
|
231 */ |
|
232 virtual void HandleControlEvent(TInt aEventType, |
|
233 CFepUiBaseCtrl* aCtrl, |
|
234 const TDesC& aEventData); |
|
235 private: |
|
236 |
|
237 /** |
|
238 * C++ default constructor. |
|
239 * |
|
240 * @param aUiLayout Ui layout instance from CFepUiLayout |
|
241 * @param aBoxGroupId The box group control id |
|
242 */ |
|
243 CPeninputHwrBoxGroup(CFepUiLayout* aUiLayout, TInt aBoxGroupId); |
|
244 |
|
245 /** |
|
246 * By default Symbian 2nd phase constructor is private. |
|
247 * |
|
248 * @param aCandidateWnd Candidate window observer |
|
249 * @param aBoxCount the count of contained HWR box |
|
250 * @return None |
|
251 */ |
|
252 void ConstructL(TInt aBoxCount); |
|
253 |
|
254 public: |
|
255 /** |
|
256 * Iterate to set each HWR box writting speed. |
|
257 * |
|
258 * @since S60 v3.2 |
|
259 * @param aCharDelay The submit character timer in micro seconds |
|
260 * @return None |
|
261 */ |
|
262 void SetWritingSpeed(const TTimeIntervalMicroSeconds32& aCharDelay); |
|
263 |
|
264 /** |
|
265 * Iterate to set each HWR box writting speed. |
|
266 * |
|
267 * @since S60 v3.2 |
|
268 * @param aCharDelay The submit character timer in micro seconds |
|
269 * @return None |
|
270 */ |
|
271 void SetStrokeDelay(const TTimeIntervalMicroSeconds32& aCharDelay); |
|
272 |
|
273 /** |
|
274 * Iterate to set each HWR box trail drawing pen size. |
|
275 * |
|
276 * @since S60 v3.2 |
|
277 * @param aSize New pen size |
|
278 * @return None |
|
279 */ |
|
280 void SetBoxPenSize(const TSize& aSize); |
|
281 |
|
282 /** |
|
283 * Iterate to set each HWR box trail drawing pen color. |
|
284 * |
|
285 * @since S60 v3.2 |
|
286 * @param aCol New pen color |
|
287 * @return None |
|
288 */ |
|
289 void SetBoxPenColor(const TRgb& aCol); |
|
290 |
|
291 /** |
|
292 * Handle EEventHwrStrokeStarted event. The message is reported each time |
|
293 * pen down in the HWR box area. |
|
294 * @since S60 v3.2 |
|
295 * @param aBoxFrom The box which generates the message |
|
296 * @return None |
|
297 */ |
|
298 void OnStrokeStarted(CTransparentHwrWnd* aBoxFrom); |
|
299 |
|
300 /** |
|
301 * Handle EEventHwrStrokeFinished event. The message is reported when |
|
302 * StrokeTimer times out. |
|
303 * @since S60 v3.2 |
|
304 * @param aBoxFrom The box which generates the message |
|
305 * @return None |
|
306 */ |
|
307 void OnStrokeFinished(CTransparentHwrWnd* aBoxFrom); |
|
308 |
|
309 /** |
|
310 * Handle EEventHwrCharacterTimerOut event. The message is reported when |
|
311 * CharacterTimer times out. |
|
312 * @since S60 v3.2 |
|
313 * @param aBoxFrom The box which generates the message |
|
314 * @return None |
|
315 */ |
|
316 void OnStrokeCharacterTimerOut(CTransparentHwrWnd* aBoxFrom); |
|
317 |
|
318 /** |
|
319 * Handle EEventHwrStrokeCanceled event. The message is reported when |
|
320 * manually cancel writing. |
|
321 * @since S60 v3.2 |
|
322 * @param aBoxFrom The box which generates the message |
|
323 * @return None |
|
324 */ |
|
325 void OnStrokeCanceled(const CTransparentHwrWnd* aBoxFrom); |
|
326 |
|
327 /** |
|
328 * Explicit refresh HWR boxes UI. |
|
329 * |
|
330 * @return None |
|
331 */ |
|
332 void RefreshUI(CTransparentHwrWnd* aBox = NULL); |
|
333 |
|
334 /** |
|
335 * Set dimmed. |
|
336 * |
|
337 * @since S60 V4.0 |
|
338 * @param aFlag Dim status. Default value is ETrue. |
|
339 */ |
|
340 void SetDimmed(TBool aDimFlag); |
|
341 |
|
342 private: // data |
|
343 |
|
344 /** |
|
345 * The background transparent alpha value(percentage). |
|
346 * The value is between 0-255, 0 mean totally invisible, 100 means opaque |
|
347 * iActiveMask Current writing box background transparency |
|
348 * iInactiveMask None writing box background transparency |
|
349 */ |
|
350 TUint8 iActiveTrans; |
|
351 |
|
352 TUint8 iInactiveTrans; |
|
353 |
|
354 /** |
|
355 * Current wrting box pointer. Not own. |
|
356 * NULL means no box in writing state. |
|
357 */ |
|
358 CTransparentHwrWnd* iActiveBox; |
|
359 |
|
360 /** |
|
361 * dim status |
|
362 */ |
|
363 TBool iDimmed; |
|
364 }; |
|
365 |
|
366 #include "peninputhwrboxgroup.inl" |
|
367 |
|
368 #endif // C_PENINPUTHWRBOXGROUP_H |
|
369 |
|
370 //End Of File |