|
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: |
|
15 * |
|
16 */ |
|
17 #ifndef PENINPUTHWRARABICWINDOW_H_ |
|
18 #define PENINPUTHWRARABICWINDOW_H_ |
|
19 |
|
20 // System includes |
|
21 #include <peninputlayoutwindow.h> |
|
22 |
|
23 // Forward declarations |
|
24 class CFepUiBaseCtrl; |
|
25 class CAknFepCtrlRangeBar; |
|
26 class CAknFepCtrlEventButton; |
|
27 class CTransparentHwrWndExt; |
|
28 class CPeninputLayoutInputmodelChoice; |
|
29 class CFepLayoutMultiLineIcf; |
|
30 class CFepCtrlDropdownList; |
|
31 class CPeninputSyncBitmapRotator; |
|
32 |
|
33 // Constants |
|
34 const TInt KMaxFileLength = 80; |
|
35 |
|
36 /** |
|
37 * Hwr layout window class |
|
38 * This class define methods to deal with window layout and |
|
39 * handle events sent to this window |
|
40 * |
|
41 * @lib peninputgenerichwr.lib |
|
42 * @since S60 v5.0 |
|
43 */ |
|
44 class CPeninputHwrBxAbWnd : public CPeninputLayoutWindow |
|
45 { |
|
46 |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Two-phased constructor |
|
51 * |
|
52 * @since S60 v5.0 |
|
53 * @param aUiLayout The plugin ui layout |
|
54 * @param aLayoutContext The hwr layout context |
|
55 * @return The pointer to CPeninputHwrBxAbWnd object |
|
56 */ |
|
57 static CPeninputHwrBxAbWnd* NewL( CFepUiLayout* aUiLayout, |
|
58 MPeninputLayoutContext* aLayoutContext ); |
|
59 |
|
60 /** |
|
61 * Destructor |
|
62 * |
|
63 * @since S60 v5.0 |
|
64 * @return None |
|
65 */ |
|
66 virtual ~CPeninputHwrBxAbWnd(); |
|
67 |
|
68 /** |
|
69 * Do when case changed |
|
70 * |
|
71 * @since S60 v5.0 |
|
72 * @param aNewCase The new case |
|
73 * @return None |
|
74 */ |
|
75 void DoCaseChange( TInt aNewCase ); |
|
76 |
|
77 // From base class CPeninputLayoutWindow |
|
78 |
|
79 /** |
|
80 * From CPeninputLayoutWindow |
|
81 * Handle control event |
|
82 * |
|
83 * @since S60 v5.0 |
|
84 * @param aEventType The event type |
|
85 * @param aCtrl The control who sends the event |
|
86 * @param aEventData The event data |
|
87 * @return None |
|
88 */ |
|
89 void HandleControlEvent( TInt aEventType, |
|
90 CFepUiBaseCtrl* aCtrl, |
|
91 const TDesC& aEventData ); |
|
92 |
|
93 /** |
|
94 * From CPeninputLayoutWindow |
|
95 * Get id of window config resource |
|
96 * |
|
97 * @since S60 v5.0 |
|
98 * @return The id of window config resource |
|
99 */ |
|
100 TInt GetWindowConfigResId(); |
|
101 |
|
102 /** |
|
103 * From CPeninputLayoutWindow |
|
104 * Get id of window resource |
|
105 * |
|
106 * @since S60 v5.0 |
|
107 * @return The id of window resource |
|
108 */ |
|
109 TInt GetWindowResId(); |
|
110 |
|
111 /** |
|
112 * From CPeninputLayoutWindow |
|
113 * Get file name of window config resource |
|
114 * |
|
115 * @since S60 v5.0 |
|
116 * @param aLangID The id of language |
|
117 * @return The file name of window config resource |
|
118 */ |
|
119 const TDesC& GetWindowConfigResFileName( TInt aLangID ); |
|
120 |
|
121 /** |
|
122 * From CPeninputLayoutWindow |
|
123 * Get file name of window resource |
|
124 * |
|
125 * @since S60 v5.0 |
|
126 * @return The file name of window resource |
|
127 */ |
|
128 const TDesC& GetWindowResFileName(); |
|
129 |
|
130 /** |
|
131 * From CPeninputLayoutWindow |
|
132 * Re-organize all controls in the assigned client area layout |
|
133 * |
|
134 * @since S60 v5.0 |
|
135 * @param aClientLayoutId The id of client area layout |
|
136 * @return None |
|
137 */ |
|
138 void ReorganizeControls( TInt aClientLayoutId, TBool aNeedReset=ETrue ); |
|
139 |
|
140 /** |
|
141 * From CPeninputLayoutWindow |
|
142 * Change unit size |
|
143 * |
|
144 * @since S60 v5.0 |
|
145 * @return The window rect |
|
146 */ |
|
147 const TRect ChangeUnitSize(); |
|
148 |
|
149 /** |
|
150 * From CPeninputLayoutWindow |
|
151 * Change size of client area |
|
152 * |
|
153 * @since S60 v5.0 |
|
154 * @param aLeftTopPoint The left top point of client area |
|
155 * @return None |
|
156 */ |
|
157 void ChangeClientSize(); |
|
158 |
|
159 /** |
|
160 * From CPeninputLayoutWindow |
|
161 * Construct all controls specified in resource |
|
162 * |
|
163 * @since S60 v5.0 |
|
164 * @return None |
|
165 */ |
|
166 void CreateAllControlsL(); |
|
167 |
|
168 /** |
|
169 * From CPeninputLayoutWindow |
|
170 * Set control fonts. Fonts info comes from resource |
|
171 * |
|
172 * @since S60 v5.0 |
|
173 * @return None |
|
174 */ |
|
175 void SetControlsFont(); |
|
176 |
|
177 /** |
|
178 * From CPeninputLayoutWindow |
|
179 * Pop up choice list |
|
180 * |
|
181 * @since S60 v5.0 |
|
182 * @return None |
|
183 */ |
|
184 void PopupChoiceList(); |
|
185 |
|
186 /** |
|
187 * ConstructFromResourceL load settings from resource. |
|
188 * Before calling this function, the resource id should be set |
|
189 * |
|
190 * @since S60 v5.0 |
|
191 * @return None |
|
192 */ |
|
193 void ConstructFromResourceL(); |
|
194 |
|
195 void OnLanguageChange(); |
|
196 |
|
197 void Move(const TPoint& aOffset); |
|
198 |
|
199 /** |
|
200 * Handle EEventHwrStrokeStarted event. The message is reported each time |
|
201 * pen down in the HWR box area |
|
202 * |
|
203 * @since S60 v5.0 |
|
204 * @return None |
|
205 */ |
|
206 void OnStrokeStarted(); |
|
207 |
|
208 /** |
|
209 * Handle EEventHwrStrokeFinished event. The message is reported when |
|
210 * StrokeTimer times out |
|
211 * |
|
212 * @since S60 v5.0 |
|
213 * @return None |
|
214 */ |
|
215 void OnStrokeFinished(); |
|
216 |
|
217 /** |
|
218 * Handle EEventHwrCharacterTimerOut event. The message is reported when |
|
219 * CharacterTimer times out |
|
220 * |
|
221 * @since S60 v5.0 |
|
222 * @return None |
|
223 */ |
|
224 void OnStrokeCharacterTimerOut(); |
|
225 |
|
226 /** |
|
227 * Handle EEventHwrStrokeCanceled event. The message is reported when |
|
228 * manually cancel writing |
|
229 * |
|
230 * @since S60 v5.0 |
|
231 * @return None |
|
232 */ |
|
233 void OnStrokeCanceled(); |
|
234 |
|
235 CTransparentHwrWndExt* getCTransparentHwrWndExt() {return iHwBox;} |
|
236 void GetCandidate(TInt aIndex, TDes& aCharCode) const; |
|
237 void CancelWriting(); |
|
238 void ClearAndCloseDropdownList(); |
|
239 void ResetAndShowDropdownList(); |
|
240 void HandleBackspaceKeyEvent(); |
|
241 TBool IsAddingSpace(HBufC* aRes); |
|
242 protected: |
|
243 |
|
244 /** |
|
245 * Constructor |
|
246 * |
|
247 * @since S60 v5.0 |
|
248 * @param aUiLayout The plugin ui layout |
|
249 * @param aLayoutContext The hwr layout context |
|
250 * @return None |
|
251 */ |
|
252 CPeninputHwrBxAbWnd( CFepUiLayout* aUiLayout, |
|
253 MPeninputLayoutContext* aLayoutContext ); |
|
254 |
|
255 /** |
|
256 * Second-phase constructor |
|
257 * |
|
258 * @since S60 v5.0 |
|
259 * @return None |
|
260 */ |
|
261 void ConstructL(); |
|
262 |
|
263 virtual TBool IsMultiLineIcf(); |
|
264 |
|
265 virtual TBool IsCanChangeRange(TInt aRange); |
|
266 |
|
267 virtual void ChangeToPreviousRange(TInt aRange); |
|
268 private: |
|
269 |
|
270 /** |
|
271 * Add range bar into client area |
|
272 * |
|
273 * @since S60 v5.0 |
|
274 * @return None |
|
275 */ |
|
276 void AddRangeBarL(); |
|
277 |
|
278 /** |
|
279 * Add button to client area |
|
280 * |
|
281 * @since S60 v5.0 |
|
282 * @param aControlId The control id |
|
283 * @param aEventId The control's event id |
|
284 * @param aResId The control's resource id |
|
285 * @param aUnicode The control's unicode |
|
286 * @param aIsRepeat The TBool indicating whether the |
|
287 * control is repeated or not |
|
288 * @return The pointer to CAknFepCtrlEventButton object |
|
289 */ |
|
290 CAknFepCtrlEventButton* AddButtonL( const TInt aControlId, |
|
291 const TInt aEventId, |
|
292 const TInt aResId, |
|
293 const TInt aUnicode = 0, |
|
294 const TBool aIsRepeat = EFalse ); |
|
295 |
|
296 /** |
|
297 * Add hwr box to client area |
|
298 * |
|
299 * @since S60 v5.0 |
|
300 * @return None |
|
301 */ |
|
302 void AddHwBoxL(); |
|
303 |
|
304 /** |
|
305 * Add dropdown list to client area |
|
306 * |
|
307 * @since S60 v5.0 |
|
308 * @return None |
|
309 */ |
|
310 void AddDropdownListL(TBool aLandscapeStyle); |
|
311 |
|
312 /** |
|
313 * Read unit size, shadow size of hwr window |
|
314 * |
|
315 * @since S60 v3.2 |
|
316 * @return None |
|
317 */ |
|
318 void ReadLafInfo(TBool aLandscapeStyle); |
|
319 |
|
320 /** |
|
321 * Set frame color of hwr write box |
|
322 * |
|
323 * @since S60 v5.0 |
|
324 * @return None |
|
325 */ |
|
326 void SetHwBoxFrameBackColor(); |
|
327 |
|
328 |
|
329 /** |
|
330 * Draw guide line |
|
331 * |
|
332 * @since S60 v5.0 |
|
333 * @return None |
|
334 */ |
|
335 void DrawGuideLine(); |
|
336 |
|
337 /** |
|
338 * Calculate guide line position |
|
339 * |
|
340 * @since S60 v5.0 |
|
341 * @return None |
|
342 */ |
|
343 void CalculateGuideLinePos(); |
|
344 |
|
345 /** |
|
346 * Popup input mode switch list |
|
347 * |
|
348 * @since S60 v5.0 |
|
349 * @return None |
|
350 */ |
|
351 void PopupSwitchWindow(); |
|
352 |
|
353 void OnDeActivate(); |
|
354 |
|
355 void SubmitRecognitionResult( HBufC* aRes ); |
|
356 void AddBackspaceButtonL(); |
|
357 void MirrorBackspaceButtonResL(); |
|
358 private: |
|
359 |
|
360 /** |
|
361 * The handwriting box |
|
362 * Not own |
|
363 */ |
|
364 CTransparentHwrWndExt* iHwBox; |
|
365 |
|
366 /** |
|
367 * The range bar |
|
368 * Not own |
|
369 */ |
|
370 CAknFepCtrlRangeBar* iRangeBar; |
|
371 |
|
372 /** |
|
373 * The language switch button |
|
374 * Not own |
|
375 */ |
|
376 CAknFepCtrlEventButton* iLangSwitchBtn; |
|
377 |
|
378 /** |
|
379 * The resource file name |
|
380 */ |
|
381 TBuf<KMaxFileLength> iResourceFilename; |
|
382 |
|
383 /** |
|
384 * The array to hold stroke points |
|
385 */ |
|
386 RArray<TPoint> iStrokeArray; |
|
387 |
|
388 /** |
|
389 * The array to hold recognize result |
|
390 */ |
|
391 RPointerArray<HBufC> iRecogResult; |
|
392 |
|
393 HBufC* iLastResult; |
|
394 |
|
395 /** |
|
396 * Normal transparency factor of hwr write box |
|
397 */ |
|
398 TInt iNormalTransFactor; |
|
399 |
|
400 /** |
|
401 * Writting transparency factor of hwr write box |
|
402 */ |
|
403 TInt iWriteTransFactor; |
|
404 |
|
405 TBool iDisableCaseChange; |
|
406 TInt iCachedCase; |
|
407 |
|
408 /** |
|
409 * The unit width |
|
410 */ |
|
411 TInt iUnitWidth; |
|
412 |
|
413 /** |
|
414 * The unit height |
|
415 */ |
|
416 TInt iUnitHeight; |
|
417 |
|
418 /** |
|
419 * Size of top left shadow corner |
|
420 */ |
|
421 TSize iShadowTl; |
|
422 |
|
423 /** |
|
424 * Size of bottom right shadow corner |
|
425 */ |
|
426 TSize iShadowBr; |
|
427 |
|
428 TRect iHwrWndRect; |
|
429 |
|
430 TPoint iGuideLineTopTl; |
|
431 TPoint iGuideLineTopBr; |
|
432 TPoint iGuideLineBottomTl; |
|
433 TPoint iGuideLineBottomBr; |
|
434 TBool iGuideLineSet; |
|
435 TBool iCharacterStart; |
|
436 |
|
437 CPeninputLayoutInputmodelChoice* iModeSwitchChoice; |
|
438 |
|
439 /** |
|
440 * The drop down list control (Own) |
|
441 */ |
|
442 CFepCtrlDropdownList* iDropdownList; |
|
443 /** |
|
444 * Bitmap rotator |
|
445 */ |
|
446 CPeninputSyncBitmapRotator* iBmpRotator; |
|
447 TBool iBackspaceMirrored; |
|
448 }; |
|
449 |
|
450 #endif /*PENINPUTHWRARABICWINDOW_H_*/ |