|
1 /* |
|
2 * Copyright (c) 2002-2007 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: header file of input context field for japanese. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CFEPINPUTCONTEXTFIELDJP_H |
|
20 #define C_CFEPINPUTCONTEXTFIELDJP_H |
|
21 |
|
22 |
|
23 #include <peninputinputcontextfield.h> |
|
24 #include <AknPictographDrawerInterface.h> |
|
25 #include <AknPictographInterface.h> |
|
26 #include <coecntrl.h> |
|
27 |
|
28 /** |
|
29 * Class for Edwin-like editing area |
|
30 * CFepInputContextFieldJp |
|
31 * |
|
32 * @lib ?library |
|
33 * @lib peninputlayoutcontrol.lib |
|
34 * @since S60 v3.2 |
|
35 */ |
|
36 class CFepInputContextFieldJp : public CFepInputContextField, |
|
37 public MAknPictographAnimatorCallBack |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** The conversion state in input context field */ |
|
43 enum TTransitoryInputAreaState |
|
44 { |
|
45 ETransitoryInputAreaStandby, |
|
46 ETransitoryInputAreaNextSegmentWait, |
|
47 ETransitoryInputAreaConverting, |
|
48 ETransitoryInputAreaSwitching |
|
49 }; |
|
50 |
|
51 /** The drawing colors */ |
|
52 enum TContextFieldDrawColorJp |
|
53 { |
|
54 EFirstTargetColors, |
|
55 ETransitoryInputAreaColors |
|
56 }; |
|
57 |
|
58 /** The input context field error codes */ |
|
59 enum TInputContextFieldJpErrorCode |
|
60 { |
|
61 EStartInlineAlready = -3000, |
|
62 EUpdateInlineNotReady, |
|
63 ECommitInlineNotReady, |
|
64 ESetCursorPositionNotReady, |
|
65 EDoUpdateInlineNotReady |
|
66 }; |
|
67 |
|
68 /** In this class, the three offsets beside the above-mentioned is used. |
|
69 * The top left position of app editor becomes a standard |
|
70 * ( E ). |
|
71 * The line head position on app editor is iRelativePos |
|
72 * ( RO ). |
|
73 * The iDisplayText's top position on iRelativePos is iDisplayTextOffset |
|
74 * ( DTO ). |
|
75 * The iConversionArea's top position on app editor is iConversionOffset |
|
76 * ( CO ). |
|
77 */ |
|
78 |
|
79 public: // Methods |
|
80 |
|
81 /** |
|
82 * Static constructor. |
|
83 * |
|
84 * @since S60 v3.2 |
|
85 * @param aRect Control area |
|
86 * @param aUiLayout The layout which contains this control |
|
87 * @param aControlId The control Id |
|
88 * @return An instance of CFepInputContextFieldJp |
|
89 */ |
|
90 IMPORT_C static CFepInputContextFieldJp* NewL( TRect aRect, |
|
91 CFepUiLayout* aUiLayout, |
|
92 TInt aControlId ); |
|
93 |
|
94 // Constructors and destructor |
|
95 /** |
|
96 * Destructor. |
|
97 * |
|
98 * @since S60 v3.2 |
|
99 */ |
|
100 IMPORT_C virtual ~CFepInputContextFieldJp(); |
|
101 |
|
102 /** |
|
103 * Sets the text to the editor |
|
104 * |
|
105 * @since S60 v3.2 |
|
106 * @param aData The text data |
|
107 */ |
|
108 IMPORT_C void SetTextL( const TFepInputContextFieldData& aData ); |
|
109 |
|
110 /** |
|
111 * Starting of transitory input |
|
112 * |
|
113 * @since S60 v3.2 |
|
114 */ |
|
115 IMPORT_C void StartInlineL(); |
|
116 |
|
117 /** |
|
118 * Updating of transitory input area, and Inserting of one |
|
119 * |
|
120 * @since S60 v3.2 |
|
121 * @param aText The conversion text data |
|
122 * @param aDivisionPoint The division point in conversion text |
|
123 * or the cursor position in conversion text |
|
124 * (offset = iConversionOffset) |
|
125 * @param aState The state of TTransitoryInputAreaState |
|
126 */ |
|
127 // Replace |
|
128 IMPORT_C void UpdateInlineL( TDesC& aText, |
|
129 const TInt aDivisionPoint, |
|
130 const TTransitoryInputAreaState aState |
|
131 = ETransitoryInputAreaConverting ); |
|
132 |
|
133 /** |
|
134 * Commiting of first target of transitory input area |
|
135 * |
|
136 * @since S60 v3.2 |
|
137 */ |
|
138 IMPORT_C void CommitInlineL(); |
|
139 |
|
140 /** |
|
141 * commiting of all characters of transitory input area |
|
142 * |
|
143 * @since S60 v3.2 |
|
144 */ |
|
145 IMPORT_C void CompleteInlineL(); |
|
146 |
|
147 /** |
|
148 * Forced termination or cancel of transitory input |
|
149 * |
|
150 * @since S60 v3.2 |
|
151 */ |
|
152 IMPORT_C void CancelInlineL(); |
|
153 |
|
154 /** |
|
155 * Set cursor position only transitory input state |
|
156 * |
|
157 * @since S60 v3.2 |
|
158 * @param aPosition The position ( CO ) |
|
159 */ |
|
160 IMPORT_C void SetCursorPosition( const TInt aPosition ); |
|
161 |
|
162 /** |
|
163 * Return one character before cursor position |
|
164 * only non transitory input state |
|
165 * |
|
166 * @since S60 v3.2 |
|
167 * @return The character on cursor |
|
168 */ |
|
169 IMPORT_C TChar CharacterOnCursor(); |
|
170 |
|
171 /** |
|
172 * Return one character before cursor position |
|
173 * only non transitory input state |
|
174 * |
|
175 * @since S60 v3.2 |
|
176 * @return The character on cursor |
|
177 */ |
|
178 IMPORT_C TChar CharacterAroundCursor( const TInt aMovingIndex = 0 ); |
|
179 |
|
180 /** |
|
181 * Return the cursor position |
|
182 * |
|
183 * @since S60 v3.2 |
|
184 * @return The cursor position ( CO ) |
|
185 */ |
|
186 IMPORT_C TInt CursorPosition() const; |
|
187 |
|
188 /** |
|
189 * Return the dividing position |
|
190 * |
|
191 * @since S60 v3.2 |
|
192 * @return The dividing position ( CO ) |
|
193 */ |
|
194 IMPORT_C TInt DivisionPoint() const; |
|
195 |
|
196 private: // Methods |
|
197 |
|
198 /** |
|
199 * C++ default constructor. |
|
200 * |
|
201 * @since S60 v3.2 |
|
202 * @param aRect The control area |
|
203 * @param aUiLayout The layout which contains this control |
|
204 * @param aControlId control Id |
|
205 */ |
|
206 CFepInputContextFieldJp( TRect aRect, |
|
207 CFepUiLayout* aUiLayout, |
|
208 TInt aControlId ); |
|
209 |
|
210 /** |
|
211 * 2nd phase constructor. |
|
212 * |
|
213 * @since S60 v3.2 |
|
214 */ |
|
215 void ConstructL(); |
|
216 |
|
217 /** |
|
218 * Draw selected text |
|
219 * |
|
220 * @since S60 v3.2 |
|
221 */ |
|
222 void DrawConversion(); |
|
223 |
|
224 /** |
|
225 * Draw selected text |
|
226 * |
|
227 * @since S60 v3.2 |
|
228 * @param aStartPos The start position for drawing area ( DTO ) |
|
229 * @param aEndPos The end position for drawing area ( DTO ) |
|
230 * @param aConversion drawing state of TContextFieldDrawColorJp |
|
231 */ |
|
232 void DoDrawConversion( const TInt aStartPos, |
|
233 const TInt aEndPos, |
|
234 const TContextFieldDrawColorJp aConversion ); |
|
235 |
|
236 /** |
|
237 * Update transitory input area in japanese common |
|
238 * |
|
239 * @since S60 v3.2 |
|
240 * @param aCursorPosition The cursor position ( E ) |
|
241 * @param aDivisionPoint The division point in conversion text ( CO ) |
|
242 */ |
|
243 void DoUpdateInline( const TInt aCursorPosition, |
|
244 const TInt aDivisionPoint ); |
|
245 |
|
246 /** |
|
247 * Reculculate offset of input context field for japanese, |
|
248 * when cursor position move. |
|
249 * |
|
250 * @since S60 v3.2 |
|
251 */ |
|
252 void CalculateDisplayTransitoryText(); |
|
253 |
|
254 /** |
|
255 * Calculate width in pixels of selecting area in iBuffer. |
|
256 * |
|
257 * @since S60 v3.2 |
|
258 * @param aStartPos The position of selecting start in iBuffer. |
|
259 * @param aEndPos The position of selecting end in iBuffer. |
|
260 * @return The width in pixels of selecting area in iBuffer. |
|
261 */ |
|
262 TInt BufferWidthInPixels( TInt aStartPos, TInt aEndPos ) const; |
|
263 |
|
264 /** |
|
265 * Set parent member data. |
|
266 * |
|
267 * @since S60 v3.2 |
|
268 * @param aLineHead The position of line head. |
|
269 * @param aDisplayOffset The position of display offset in Editor. |
|
270 */ |
|
271 void SetDisplayData( TInt aLineHead, TInt aDisplayOffset ); |
|
272 |
|
273 /** |
|
274 * Reset parent member data. |
|
275 * |
|
276 * @since S60 v3.2 |
|
277 * @param aDrawFlag The flag whether draw or not. |
|
278 */ |
|
279 void ResetInputContextFieldDataL( TBool aDrawFlag ); |
|
280 |
|
281 /** |
|
282 * Reset member data. |
|
283 * |
|
284 * @since S60 v3.2 |
|
285 * @param aState The state of transitory input area. |
|
286 * @param aPosition The position of display offset in Editor. |
|
287 */ |
|
288 void ResetConversion( TTransitoryInputAreaState aState, TInt aPosition ); |
|
289 |
|
290 /** |
|
291 * The argument returns whether it is the right side from transitory |
|
292 * input area. |
|
293 * |
|
294 * @since S60 v3.2 |
|
295 * @param aX The x coordinates position of pointer. |
|
296 * @return The argument returns whether it is the right side from |
|
297 * transitory input area. |
|
298 */ |
|
299 TBool IsRightFromConversion( TInt aX ) const; |
|
300 |
|
301 // from base class CFepUiBaseCtrl |
|
302 |
|
303 /** |
|
304 * From CFepUiBaseCtrl |
|
305 * Handle pointer up event |
|
306 * |
|
307 * @since S60 v3.2 |
|
308 * @param aPoint The point position relative the layout |
|
309 * @return The control which handles the event. |
|
310 */ |
|
311 CFepUiBaseCtrl* HandlePointerUpEventL( const TPoint& aPoint ); |
|
312 |
|
313 /** |
|
314 * From CFepUiBaseCtrl |
|
315 * Handle pointer down event |
|
316 * |
|
317 * @since S60 v3.2 |
|
318 * @param aPoint The point position relative the layout |
|
319 * @return The control which handles the event. |
|
320 */ |
|
321 CFepUiBaseCtrl* HandlePointerDownEventL( const TPoint& aPoint ); |
|
322 |
|
323 /** |
|
324 * From CFepUiBaseCtrl |
|
325 * Handle pointer move event |
|
326 * |
|
327 * @since S60 v3.2 |
|
328 * @param aPoint The point position relative the layout |
|
329 * @return The control which handles the event. |
|
330 */ |
|
331 CFepUiBaseCtrl* HandlePointerMoveEventL( const TPoint& aPoint ); |
|
332 |
|
333 // from base class CFepLayoutEditAreaBase |
|
334 |
|
335 /** |
|
336 * From CFepLayoutEditAreaBase |
|
337 * Draws the text buffer into the given graphic context |
|
338 * |
|
339 * @since S60 v3.2 |
|
340 * @param aGc The graphic context |
|
341 * @param aRect Invalid rectangle. Edit area is redrawn only if |
|
342 * the invalid rectangle intersects with the rectangle of the edit area |
|
343 */ |
|
344 void DrawContent( CBitmapContext* aGc, const TRect& aRect ); |
|
345 |
|
346 // from base class MAknPictographAnimatorCallBack |
|
347 void DrawPictographArea(); |
|
348 |
|
349 // for pictograph |
|
350 static TInt StaticPictographCallBack( TAny* aPtr ); |
|
351 void PictographCallBack(); |
|
352 void SetPictographCallBackL( TCallBack& aCallBack ); |
|
353 |
|
354 private: // data |
|
355 |
|
356 /** |
|
357 * The offset of conversion text of contextfield ( E ) |
|
358 */ |
|
359 TInt iConversionOffset; |
|
360 |
|
361 /** |
|
362 * The dividing point ( CO ) |
|
363 */ |
|
364 TInt iDivisionPoint; |
|
365 |
|
366 /** |
|
367 * The iDisplayTextOffset before conversing ( RO ) |
|
368 */ |
|
369 TInt iPreDisplayTextOffset; |
|
370 |
|
371 /** |
|
372 * Conversing area ( E ) |
|
373 */ |
|
374 TCursorSelection iConversionArea; |
|
375 |
|
376 /** |
|
377 * The state of conversion |
|
378 */ |
|
379 TTransitoryInputAreaState iConvertingState; |
|
380 |
|
381 /** |
|
382 * The input context field data before conversing |
|
383 */ |
|
384 TFepInputContextFieldData iPreConversionData; |
|
385 |
|
386 /** |
|
387 * The flag for all complete of transitory input area. |
|
388 */ |
|
389 TBool iAllCompleteFlag; |
|
390 |
|
391 /** |
|
392 * The iBuffer before conversing |
|
393 * Own. |
|
394 */ |
|
395 HBufC* iPreBuffer; |
|
396 |
|
397 /** |
|
398 * for Pictograph |
|
399 */ |
|
400 CAknPictographInterface* iPictoInterface; |
|
401 TCallBack iPictoCallBack; |
|
402 CCoeControl* iDummyControl; |
|
403 }; |
|
404 |
|
405 #endif // C_CFEPINPUTCONTEXTFIELDJP_H |
|
406 |
|
407 // End of File |