66
|
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 |
* Defines the Text Editor native side component
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CMIDTEXTEDITOR_H
|
|
20 |
#define CMIDTEXTEDITOR_H
|
|
21 |
|
|
22 |
// EXTERNAL INCLUDES
|
|
23 |
#include <e32base.h>
|
|
24 |
|
|
25 |
// INTERNAL INCLUDES
|
|
26 |
#include <MMIDTextEditor.h>
|
|
27 |
#include <MMIDCustomComponent.h>
|
|
28 |
#include <MMIDScalable.h>
|
|
29 |
|
|
30 |
#ifdef RD_TACTILE_FEEDBACK
|
|
31 |
#include <peninputclient.h>
|
|
32 |
#endif // RD_TACTILE_FEEDBACK
|
|
33 |
|
|
34 |
#include <coecobs.h>
|
|
35 |
#include <reflcdui.h>
|
|
36 |
|
|
37 |
// FORWARD DECLARATIONS
|
|
38 |
class CMIDTextEditorEdwin;
|
|
39 |
class CMIDEditingStateIndicator;
|
|
40 |
class CMIDEdwinUtils;
|
|
41 |
class CCoeControl;
|
|
42 |
class MMIDCustomComponentContainer;
|
|
43 |
class CMIDUtils;
|
|
44 |
class MMIDFont;
|
|
45 |
|
|
46 |
// CLASS DESCRIPTION
|
|
47 |
/**
|
|
48 |
* Defines the Text Editor native side component.
|
|
49 |
*/
|
|
50 |
NONSHARABLE_CLASS(CMIDTextEditor) :
|
|
51 |
public CBase,
|
|
52 |
public MMIDTextEditor,
|
|
53 |
public MMIDCustomComponent,
|
|
54 |
public MDirectContent,
|
|
55 |
public MCoeControlObserver,
|
|
56 |
public MMIDScalable
|
|
57 |
{
|
|
58 |
public: // Type definitions
|
|
59 |
|
|
60 |
class TCtorParams
|
|
61 |
{
|
|
62 |
public:
|
|
63 |
// Maximum size of the editor.
|
|
64 |
TInt iMaxSize;
|
|
65 |
// The width of the editor in pixels.
|
|
66 |
TInt iWidth;
|
|
67 |
// The height of the editor in pixels or in rows.
|
|
68 |
TInt iHeight;
|
|
69 |
// Indicates if the size is in pixels or in rows.
|
|
70 |
TBool iHeightInRows;
|
|
71 |
// The shared CMIDUtils instance. Not owned.
|
|
72 |
CMIDUtils* iUtils;
|
|
73 |
|
|
74 |
TCtorParams::TCtorParams() :
|
|
75 |
iMaxSize(0),
|
|
76 |
iWidth(0),
|
|
77 |
iHeight(0),
|
|
78 |
iHeightInRows(EFalse),
|
|
79 |
iUtils(NULL) {}
|
|
80 |
};
|
|
81 |
|
|
82 |
public: // Constructors and destructor
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Two-phased constructor. Creates an instance from this class
|
|
86 |
* The caller takes the ownership of the returned instance
|
|
87 |
*
|
|
88 |
* @param aParams The construction parameters of this class.
|
|
89 |
* @return New instance from this class
|
|
90 |
*/
|
|
91 |
static CMIDTextEditor* NewL(const TCtorParams& aParams);
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Destructor.
|
|
95 |
*/
|
|
96 |
virtual ~CMIDTextEditor();
|
|
97 |
|
|
98 |
public: // From MMIDCustomComponent
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Returns the count of controls in this custom component.
|
|
102 |
*
|
|
103 |
* Note that the count must not change during the lifetime
|
|
104 |
* of the object. The count of all components is updated
|
|
105 |
* when it is added to the custom component container.
|
|
106 |
*
|
|
107 |
* This is done in order to improve the performance when counting
|
|
108 |
* countrols.
|
|
109 |
*
|
|
110 |
* @return The count of controls in this custom component.
|
|
111 |
* @since S60 5.0
|
|
112 |
*/
|
|
113 |
TInt CustomComponentControlCount() const;
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Returns an UI control of this custom component.
|
|
117 |
*
|
|
118 |
* The index specifies which component is requested. The method
|
|
119 |
* works similar to CCoeControl::ComponentControl() method. The
|
|
120 |
* ownership of the control is NOT transferred to the caller.
|
|
121 |
*
|
|
122 |
* @param aIndex The index of the control to be retrieved.
|
|
123 |
* @return The UI control of this custom component.
|
|
124 |
* @since S60 5.0
|
|
125 |
*/
|
|
126 |
CCoeControl* CustomComponentControl(TInt aIndex);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Indicates that the container is about to be disposed.
|
|
130 |
*
|
|
131 |
* The custom component does not have to remove itself
|
|
132 |
* from the container since the container removes all components
|
|
133 |
* when disposing.
|
|
134 |
*
|
|
135 |
* @since S60 5.0
|
|
136 |
*/
|
|
137 |
void CustomComponentContainerDisposing();
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Handles traversing.
|
|
141 |
*
|
|
142 |
* Used when pressing key down and up.
|
|
143 |
*
|
|
144 |
* @param aEvent Key Event.
|
|
145 |
* @since S60 5.0
|
|
146 |
*/
|
|
147 |
void TraverseL(const TKeyEvent& aEvent);
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Processes the received pointer event.
|
|
151 |
*
|
|
152 |
* @param aPointerEvent The pointer event. iPosition will be reset to the
|
|
153 |
* parent window position. iParentPosition will be invalid for the
|
|
154 |
* container.
|
|
155 |
* @since S60 5.0
|
|
156 |
*/
|
|
157 |
void ProcessPointerEventL(const TPointerEvent& aPointerEvent);
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Gets the current touch-enabled state
|
|
161 |
*
|
|
162 |
* @return true if the editor is touch-enabled, false otherwise
|
|
163 |
* @since S60 5.0
|
|
164 |
*/
|
|
165 |
TBool IsTouchEnabled();
|
|
166 |
|
|
167 |
public: // From MMIDTextEditor
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Specifies whether or not the editor will receive touch-events.
|
|
171 |
*
|
|
172 |
* @param enabled true to enabled touch-event, false to disable
|
|
173 |
* @since S60 5.0
|
|
174 |
*/
|
|
175 |
void SetTouchEnabled(TBool aEnabled);
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Sets the observer for this text editor component.
|
|
179 |
*
|
|
180 |
* The observer is notified when an action is about to happen
|
|
181 |
* in the text editor.
|
|
182 |
*
|
|
183 |
* The ownership of the object is not transferred to this component.
|
|
184 |
*
|
|
185 |
* @param aObserver The text editor observer or <code>NULL</code>
|
|
186 |
* if the observer should be removed.
|
|
187 |
* @since S60 5.0
|
|
188 |
*/
|
|
189 |
void SetObserver(MMIDTextEditorObserver* aObserver);
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Sets the size of this text editor.
|
|
193 |
*
|
|
194 |
* Note: Calling this function may result in a call to
|
|
195 |
* CMIDTextEditorEdwin::SizeChanged().
|
|
196 |
*
|
|
197 |
* @param aWidth
|
|
198 |
* The width of the editor in pixels.
|
|
199 |
* @param aHeight
|
|
200 |
* The height of the editor in pixels.
|
|
201 |
* @since S60 5.0
|
|
202 |
*/
|
|
203 |
void SetEditorSize(TInt aWidth, TInt aHeight);
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Returns the size of this editor.
|
|
207 |
*
|
|
208 |
* @return The size of this editor.
|
|
209 |
* @since S60 5.0
|
|
210 |
*/
|
|
211 |
TSize EditorSize() const;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Sets the parent of this text editor component. The parent must
|
|
215 |
* implement the custom component container interface in order to
|
|
216 |
* provide necessary services for registering custom UI components.
|
|
217 |
*
|
|
218 |
* The ownership of the parent is not transffered to this object.
|
|
219 |
*
|
|
220 |
* @param aComponentContainer The parent MIDP custom component
|
|
221 |
* container.
|
|
222 |
* @since S60 5.0
|
|
223 |
*/
|
|
224 |
void SetParentL(MMIDCustomComponentContainer* aComponentContainer);
|
|
225 |
|
|
226 |
/**
|
|
227 |
* Sets the direct container of this text editor component.
|
|
228 |
*
|
|
229 |
* Note that the text editor does not necessary need to have direct
|
|
230 |
* container. If the parent component is responsible for somekind of
|
|
231 |
* custom drawing using direct screena access, this method can be used
|
|
232 |
* to register the direct container.
|
|
233 |
*
|
|
234 |
* The text editor adds itself to the direct container so that it
|
|
235 |
* is not able to draw on top of the text editor when direct content
|
|
236 |
* is added to the screen.
|
|
237 |
*
|
|
238 |
* @param aDirectContainer The direct container of this compoennt if
|
|
239 |
* any. <code>NULL</code> removes the current container.
|
|
240 |
* @since S60 5.0
|
|
241 |
*/
|
|
242 |
void SetDirectContainerL(MDirectContainer* aDirectContainer);
|
|
243 |
|
|
244 |
/**
|
|
245 |
* Sets the elevation of this text editor component.
|
|
246 |
*
|
|
247 |
* If the specified elevation exeeds to amount of items in the
|
|
248 |
* custom component container, the item becomes the topmost item
|
|
249 |
* in the custom component stack.
|
|
250 |
*
|
|
251 |
* Note that the elevation requsted may not be the actual elevation
|
|
252 |
* of the item (if, for example, the elevation is higher than the
|
|
253 |
* amount of all items, the elevation is set to the top).
|
|
254 |
*
|
|
255 |
* @param aElevation The new elevation (Z-position) of this item.
|
|
256 |
* @since S60 5.0
|
|
257 |
*/
|
|
258 |
void SetElevationL(TInt aElevation);
|
|
259 |
|
|
260 |
/**
|
|
261 |
* Returns the elevation of this text editor component.
|
|
262 |
*
|
|
263 |
* @return The elevation of this text editor component.
|
|
264 |
* @since S60 5.0
|
|
265 |
*/
|
|
266 |
TInt Elevation();
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Sets this text editor component visible if it is hidden.
|
|
270 |
*
|
|
271 |
* Depending on the current status of the text editor, this operation
|
|
272 |
* is no-op if there is nothing to do. (i.e. the text editor is set
|
|
273 |
* hidden when it is already hidden).
|
|
274 |
*
|
|
275 |
* @param aVisible Indicates the visibility status of the text editor.
|
|
276 |
* @since S60 5.0
|
|
277 |
*/
|
|
278 |
void SetVisibleL(TBool aVisible);
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Returns the visibility status of the editor.
|
|
282 |
*
|
|
283 |
* @return <code>ETrue</code> if the editor is visible and
|
|
284 |
* <code>EFalse</code> if not.
|
|
285 |
* @since S60 5.0
|
|
286 |
*/
|
|
287 |
TBool IsVisible() const;
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Sets the position of this text editor component.
|
|
291 |
*
|
|
292 |
* Note: Calling this function results in a call to
|
|
293 |
* CMIDTextEditorEdwin::PositionChanged().
|
|
294 |
*
|
|
295 |
* @param aX The x coordinate of the anchor point.
|
|
296 |
* @param aY The y coordinate of the anchor point.
|
|
297 |
* @since S60 5.0
|
|
298 |
*/
|
|
299 |
void SetPosition(TInt aX, TInt aY);
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Sets the focus status of this text editor component.
|
|
303 |
*
|
|
304 |
* Setting the fucus to a text editor starts the editor to capture key
|
|
305 |
* events. The key events are comsumed by the editor and the parent
|
|
306 |
* will not possibly receive events at that time.
|
|
307 |
*
|
|
308 |
* @param aFocusState If <code>true</code>, the text editor component
|
|
309 |
* will start capturing key events from its parent. If
|
|
310 |
* <code>false</code> the focues is removed from this text
|
|
311 |
* editor.
|
|
312 |
* @since S60 5.0
|
|
313 |
*/
|
|
314 |
void SetFocusStateL(TBool aFocusState);
|
|
315 |
|
|
316 |
/**
|
|
317 |
* Gets the focus status of this text editor component.
|
|
318 |
*
|
|
319 |
* @return focus state of text component.
|
|
320 |
* @since S60 5.0
|
|
321 |
*/
|
|
322 |
TInt GetFocusState();
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Returns the content of this text editor in a new <code>HBufC</code>
|
|
326 |
* descriptor. The ownership of the returned value is transferred to
|
|
327 |
* the caller.
|
|
328 |
*
|
|
329 |
* @param The content of the editor in a new <code>HBufC</code>
|
|
330 |
* descriptor.
|
|
331 |
* @since S60 5.0
|
|
332 |
*/
|
|
333 |
HBufC* ContentL();
|
|
334 |
|
|
335 |
/**
|
|
336 |
* Sets a new content to this text editor.
|
|
337 |
*
|
|
338 |
* The content replaces any previous content in this text editor.
|
|
339 |
* Note that if the current set of text constraints does not allow
|
|
340 |
* the new content, the method leaves with <code>KErrArgument</code>.
|
|
341 |
*
|
|
342 |
* @param aContent The new content for this text editor.
|
|
343 |
* @since S60 5.0
|
|
344 |
*/
|
|
345 |
void SetContentL(const TDesC& aContent);
|
|
346 |
|
|
347 |
/**
|
|
348 |
* Inserts a content into the current content of this text editor.
|
|
349 |
*
|
|
350 |
* The content is inserted just prior to the character indicated by
|
|
351 |
* the position parameter, where zero specifies the first character of
|
|
352 |
* the content in this text editor.
|
|
353 |
*
|
|
354 |
* If position is less than or equal to zero, the insertion occurs at
|
|
355 |
* the beginning of the content. If position is greater than or equal
|
|
356 |
* to the current size of the content, the insertion occurs
|
|
357 |
* immediately after the end of the content.
|
|
358 |
*
|
|
359 |
* @param aContent The content to be inserted.
|
|
360 |
* @param aPosition The position at which the insertion starts.
|
|
361 |
* @since S60 5.0
|
|
362 |
*/
|
|
363 |
void InsertContentL(const TDesC& aContent, TInt aPosition);
|
|
364 |
|
|
365 |
/**
|
|
366 |
* Deletes the content from this text editor.
|
|
367 |
*
|
|
368 |
* The content is deleted based on the given offset and length. If the
|
|
369 |
* resulting content is not valid for the current set of constraints,
|
|
370 |
* this method leaves with <code>KErrArgument</code>
|
|
371 |
*
|
|
372 |
* The offset and length must specify a valid range within the
|
|
373 |
* content.
|
|
374 |
*
|
|
375 |
* @param aOffset The beginning of the region to be deleted.
|
|
376 |
* @param aLength The number of characters to be deleted.
|
|
377 |
* @since S60 5.0
|
|
378 |
*/
|
|
379 |
void DeleteContentL(TInt aOffset, TInt aLength);
|
|
380 |
|
|
381 |
/**
|
|
382 |
* Returns the length of the current content in this text editor.
|
|
383 |
*
|
|
384 |
* @return The length of the current content.
|
|
385 |
* @since S60 5.0
|
|
386 |
*/
|
|
387 |
TInt ContentLength() const;
|
|
388 |
|
|
389 |
/**
|
|
390 |
* Returns the height of the full content in this text editor.
|
|
391 |
*
|
|
392 |
* @return The height of the full content.
|
|
393 |
* @since S60 5.0
|
|
394 |
*/
|
|
395 |
TInt ContentHeight() const;
|
|
396 |
|
|
397 |
/**
|
|
398 |
* Returns the line margin height of this text editor.
|
|
399 |
*
|
|
400 |
* @return The line margin height of this text editor.
|
|
401 |
* @since S60 5.0
|
|
402 |
*/
|
|
403 |
TInt LineMarginHeight() const;
|
|
404 |
|
|
405 |
/**
|
|
406 |
* Returns the topmost pixel position of the topmost visible line in
|
|
407 |
* the editor.
|
|
408 |
*
|
|
409 |
* The returned y coordinate value must be relative to the whole
|
|
410 |
* content height, not just the visible part.
|
|
411 |
*
|
|
412 |
* @return The topmost pixel position of the visible content.
|
|
413 |
* @since S60 5.0
|
|
414 |
*/
|
|
415 |
TInt VisibleContentPosition() const;
|
|
416 |
|
|
417 |
/**
|
|
418 |
* Sets the selection in this text editor.
|
|
419 |
*
|
|
420 |
* The selection begins from <code>aIndex</code> and continues
|
|
421 |
* the amount of characters specified by <code>aLength</code>.
|
|
422 |
*
|
|
423 |
* The selected area is highlighted with current highlight
|
|
424 |
* colors.
|
|
425 |
*
|
|
426 |
* The index and length must specify a valid range within the content.
|
|
427 |
*
|
|
428 |
* @param aIndex The beginning of the range to be selected.
|
|
429 |
* @param aLength The length of the range to be selected.
|
|
430 |
* @since S60 5.0
|
|
431 |
*/
|
|
432 |
void SetSelectionL(TInt aIndex, TInt aLength);
|
|
433 |
|
|
434 |
/**
|
|
435 |
* Returns the current selection in this text editor in a new
|
|
436 |
* <code>HBufC</code> descriptor.
|
|
437 |
*
|
|
438 |
* The ownership of the returned value is transferred to the caller.
|
|
439 |
*
|
|
440 |
* @return The current selection int the editor in a new
|
|
441 |
* <code>HBufC</code> descriptor.
|
|
442 |
* @since S60 5.0
|
|
443 |
*/
|
|
444 |
HBufC* SelectionL();
|
|
445 |
|
|
446 |
/**
|
|
447 |
* Sets the constraints of this text editor. If the constraints are
|
|
448 |
* not valid for the current content of the editor, the content is set
|
|
449 |
* to empty.
|
|
450 |
*
|
|
451 |
* @param aConstraints The new set of constraints. Note that
|
|
452 |
* validation of the input must be done in the client side
|
|
453 |
* (i.e. in the Java side).
|
|
454 |
* @since S60 5.0
|
|
455 |
*/
|
|
456 |
void SetConstraintsL(TUint aConstraints);
|
|
457 |
|
|
458 |
/**
|
|
459 |
* Sets the multiline status of this text editor component.
|
|
460 |
*
|
|
461 |
* TextEditor is by default single-line editor, which means that user
|
|
462 |
* is not possible to insert line breaks to the editor. A possible Enter
|
|
463 |
* (or similar) key event should be passed in this case to the parent object
|
|
464 |
* as a normal key event for client to handle it as appropriately. A single-line
|
|
465 |
* editor will have horizontal scrolling of text if it is possible to enter text
|
|
466 |
* that does not fit to the editor. This may happen if maximum size is large enough
|
|
467 |
* for the width of the editor.
|
|
468 |
* In multi-line editor user is able to insert line breaks but also word
|
|
469 |
* wrapping is enabled automatically on word boundaries.
|
|
470 |
*
|
|
471 |
* @param aMultiline <code>true</code> if multi-line editor,
|
|
472 |
* <code>false</code> if single-line editor.
|
|
473 |
*/
|
|
474 |
void SetMultilineL(TBool aMultiline);
|
|
475 |
|
|
476 |
/**
|
|
477 |
* Gets the multiline status of this text editor component.
|
|
478 |
*
|
|
479 |
* @return <code>true</code> if multi-line editor,
|
|
480 |
* <code>false</code> if single-line editor.
|
|
481 |
*/
|
|
482 |
virtual TBool IsMultiline();
|
|
483 |
|
|
484 |
/**
|
|
485 |
* Sets a hint to the implementation as to the input mode that should
|
|
486 |
* be used when the user initiates editing of this text editor.
|
|
487 |
*
|
|
488 |
* The character subset parameter names and subset of Unicode characters
|
|
489 |
* that is used by the implementation to choose an initial input mode.
|
|
490 |
*
|
|
491 |
* If an empty string is passed, the implementation uses the default
|
|
492 |
* character set.
|
|
493 |
*
|
|
494 |
* @param aCharacterSubset The character subset for the initial input
|
|
495 |
* mode.
|
|
496 |
* @since S60 5.0
|
|
497 |
*/
|
|
498 |
void SetInitialInputModeL(const TDesC& aCharacterSubset);
|
|
499 |
|
|
500 |
/**
|
|
501 |
* Sets the maximum size of this text editor.
|
|
502 |
*
|
|
503 |
* If the maximum size is less than the length of the current content,
|
|
504 |
* the content is truncated from the end to fit into the new maximum
|
|
505 |
* size.
|
|
506 |
*
|
|
507 |
* If the content is truncated and the resulting new content is not
|
|
508 |
* valid for the current input constraints, this method leaves with
|
|
509 |
* <code>KErrArgument</code>.
|
|
510 |
*
|
|
511 |
* @param aMaxSize The new maximum size for this text editor.
|
|
512 |
* @return The actual size that the editor accepted. May be smaller
|
|
513 |
* than the requested maximum size.
|
|
514 |
* @since S60 5.0
|
|
515 |
*/
|
|
516 |
TInt SetMaxSizeL(TInt aMaxSize);
|
|
517 |
|
|
518 |
/**
|
|
519 |
* Sets a new position for the cursor within this text editor.
|
|
520 |
*
|
|
521 |
* Note that the index must be valid (i.e. within the limit
|
|
522 |
* of the current content length).
|
|
523 |
*
|
|
524 |
* @param aIndex The new index for the cursor.
|
|
525 |
* @since S60 5.0
|
|
526 |
*/
|
|
527 |
void SetCursorPositionL(TInt aIndex);
|
|
528 |
|
|
529 |
/**
|
|
530 |
* Returns the current position of the cursor in the text editor.
|
|
531 |
*
|
|
532 |
* @return The current position of the cursor in the text editor.
|
|
533 |
* @since S60 5.0
|
|
534 |
*/
|
|
535 |
TInt CursorPosition() const;
|
|
536 |
|
|
537 |
/**
|
|
538 |
* Sets the color for the specified color type defined in TColorType.
|
|
539 |
*
|
|
540 |
* @param aColor The color to be set.
|
|
541 |
* @param aColorType The type of the color to be set.
|
|
542 |
* @since S60 5.0
|
|
543 |
*/
|
|
544 |
void SetColorL(const TRgb& aColor, TColorType aColorType);
|
|
545 |
|
|
546 |
/**
|
|
547 |
* Gets the color of the specified color type defined in TColorType.
|
|
548 |
*
|
|
549 |
* @param aColorType The type of the color to get.
|
|
550 |
*
|
|
551 |
* @return The color of the type.
|
|
552 |
* @since S60 5.0
|
|
553 |
*/
|
|
554 |
TInt GetColor(TColorType aColorType);
|
|
555 |
|
|
556 |
/**
|
|
557 |
* Sets a new font for this text editor.
|
|
558 |
*
|
|
559 |
* @param aFont The new font.
|
|
560 |
* @since S60 5.0
|
|
561 |
*/
|
|
562 |
void SetFontL(MMIDFont* aFont);
|
|
563 |
|
|
564 |
/**
|
|
565 |
* Sets the preferred touch input mode.
|
|
566 |
*
|
|
567 |
* The modes must map to values defined in Pen Input Client API.
|
|
568 |
* The specified touch input mode becomes the preferred touch input
|
|
569 |
* mode for the current application.
|
|
570 |
*
|
|
571 |
* @see AknFepGlobalEnums.h
|
|
572 |
*
|
|
573 |
* @param aInputMode. The preferred touch input mode.
|
|
574 |
* @since S60 5.0
|
|
575 |
*/
|
|
576 |
void SetPreferredTouchInputMode(TInt aInputMode);
|
|
577 |
|
|
578 |
/**
|
|
579 |
* Gets the preferred touch input mode which is currently active.
|
|
580 |
*
|
|
581 |
* @see AknFepGlobalEnums.h
|
|
582 |
*
|
|
583 |
* @return The preferred touch input mode.
|
|
584 |
* @since S60 5.0
|
|
585 |
*/
|
|
586 |
TInt PreferredTouchInputMode();
|
|
587 |
|
|
588 |
/**
|
|
589 |
* Sets the disabled touch input modes.
|
|
590 |
*
|
|
591 |
* The modes must map to values defined in Pen Input Client API.
|
|
592 |
* The specified modes are disabled from the on screen touch
|
|
593 |
* input UI and cannot be selected by the user.
|
|
594 |
*
|
|
595 |
* @see AknFepGlobalEnums.h
|
|
596 |
*
|
|
597 |
* @param aInputModes The modes to be disabled.
|
|
598 |
* @since S60 5.0
|
|
599 |
*/
|
|
600 |
void SetDisabledTouchInputModes(TInt aInputModes);
|
|
601 |
|
|
602 |
/**
|
|
603 |
* Gets the disabled touch input modes which are currently not
|
|
604 |
* available in the touch input UI.
|
|
605 |
*
|
|
606 |
* @see AknFepGlobalEnums.h
|
|
607 |
*
|
|
608 |
* @return The disabled touch input modes.
|
|
609 |
* @since S60 5.0
|
|
610 |
*/
|
|
611 |
TInt DisabledTouchInputModes();
|
|
612 |
|
|
613 |
/**
|
|
614 |
* Sets the custom indicator's visibility.
|
|
615 |
*
|
|
616 |
* Note that the visibility of the indiator cannot be
|
|
617 |
* controlled if the editor is not visible. In that case
|
|
618 |
* this method is a no-op.
|
|
619 |
*
|
|
620 |
* @param aVisible Defines the visibility of the custom indicator.
|
|
621 |
* @since S60 5.0
|
|
622 |
*/
|
|
623 |
void SetIndicatorVisibilityL(TBool aVisible);
|
|
624 |
|
|
625 |
/**
|
|
626 |
* Sets the custom indicator's position.
|
|
627 |
*
|
|
628 |
* Position is relative to the parent object of this text editor.
|
|
629 |
*
|
|
630 |
* @param aX The x coordinate of the anchor point.
|
|
631 |
* @param aY The y coordinate of the anchor point.
|
|
632 |
* @since S60 5.0
|
|
633 |
*/
|
|
634 |
void SetIndicatorPosition(TInt aX, TInt aY);
|
|
635 |
|
|
636 |
/**
|
|
637 |
* Returns the size of the area needed for drawing the custom
|
|
638 |
* editing state indicator.
|
|
639 |
*
|
|
640 |
* Currently, the size cannot be adjusted through this interface.
|
|
641 |
*
|
|
642 |
* @return The size of the custom editing state indicator.
|
|
643 |
* @since S60 5.0
|
|
644 |
*/
|
|
645 |
TSize IndicatorSize() const;
|
|
646 |
|
|
647 |
/**
|
|
648 |
* Sets the editor to use default indicator container.
|
|
649 |
*
|
|
650 |
* @since S60 5.0
|
|
651 |
*/
|
|
652 |
void SetDefaultIndicatorsL();
|
|
653 |
|
|
654 |
public: // From MMIDScalable
|
|
655 |
|
|
656 |
TBool IsScalingOn() const;
|
|
657 |
|
|
658 |
public: // own methods
|
|
659 |
|
|
660 |
/**
|
|
661 |
* Handles fullscreen state of parent Canvas.
|
|
662 |
*
|
|
663 |
* @since S60 5.0
|
|
664 |
*/
|
|
665 |
void HandleFullscreenModeChange();
|
|
666 |
|
|
667 |
/**
|
|
668 |
* Handles changes of screen orientation.
|
|
669 |
*
|
|
670 |
* @since S60 5.0
|
|
671 |
*/
|
|
672 |
void HandleResolutionChange();
|
|
673 |
|
|
674 |
/**
|
|
675 |
* Handles system resource change messages.
|
|
676 |
*
|
|
677 |
* @param aType A message UID value.
|
|
678 |
*
|
|
679 |
* @since S60 5.0
|
|
680 |
*/
|
|
681 |
void HandleResourceChange(TInt aType);
|
|
682 |
|
|
683 |
/**
|
|
684 |
* Handles switching from foreground to background and vice versa.
|
|
685 |
*
|
|
686 |
* @param aForeground Flag if it switches to foreground or to backgound.
|
|
687 |
*
|
|
688 |
* @since S60 5.0
|
|
689 |
*/
|
|
690 |
void HandleForeground(TBool aForeground);
|
|
691 |
|
|
692 |
/**
|
|
693 |
* Sets the caret in the Editor at x, y location.
|
|
694 |
*
|
|
695 |
* @param x
|
|
696 |
* The x coordinate of the wanted caret position.
|
|
697 |
*
|
|
698 |
* @param y
|
|
699 |
* The y coordinate of the wanted caret position.
|
|
700 |
*/
|
|
701 |
void SetCaretXYL(TInt aX, TInt aY);
|
|
702 |
|
|
703 |
public: // From MMIDComponent
|
|
704 |
|
|
705 |
/**
|
|
706 |
* Invoked by the framework to clean up any resources used by the
|
|
707 |
* implementation.
|
|
708 |
*
|
|
709 |
* Typically, the implementation will do "delete this" but is clearly
|
|
710 |
* not restricted to
|
|
711 |
*
|
|
712 |
* @since S60 5.0
|
|
713 |
*/
|
|
714 |
void Dispose();
|
|
715 |
|
|
716 |
public: // From MDirectContent
|
|
717 |
|
|
718 |
/**
|
|
719 |
* Notify content that container window rect is available.
|
|
720 |
*
|
|
721 |
* @param aRect Rwindow rect on which content can be displayed
|
|
722 |
* @since S60 5.2
|
|
723 |
*/
|
|
724 |
void MdcContainerWindowRectChanged(const TRect& /*aRect*/);
|
|
725 |
|
|
726 |
/**
|
|
727 |
* Notify content that container visiblity has changed. The content
|
|
728 |
* must not be displayed when it's container is invisible.
|
|
729 |
*
|
|
730 |
* @param aVisible ETrue if the container is visible, EFalse if it is
|
|
731 |
* invisible.
|
|
732 |
* @since S60 5.0
|
|
733 |
*/
|
|
734 |
void MdcContainerVisibilityChanged(TBool aVisible);
|
|
735 |
|
|
736 |
/**
|
|
737 |
* Notify content that the container bounds have changed.
|
|
738 |
*
|
|
739 |
* @param aRect Maximum area the content can occupy in screen
|
|
740 |
* co-ordinates. The content should be clipped to this area.
|
|
741 |
* @since S60 5.0
|
|
742 |
*/
|
|
743 |
void MdcContentBoundsChanged(const TRect& aRect);
|
|
744 |
|
|
745 |
/**
|
|
746 |
* Notify content that its display area has changed.
|
|
747 |
* This should only be called when the content is displayed on an
|
|
748 |
* Item.
|
|
749 |
*
|
|
750 |
* @param aDisplayRect Display area in Item co-ordinates.
|
|
751 |
* @param aScreenRect Display area in screen co-ordinates.
|
|
752 |
* @since S60 5.0
|
|
753 |
*/
|
|
754 |
void MdcItemContentRectChanged(
|
|
755 |
const TRect& aContentRect, const TRect& aScreenRect);
|
|
756 |
|
|
757 |
/**
|
|
758 |
* Notify content that container is about to be destoryed.
|
|
759 |
*
|
|
760 |
* @since S60 5.0
|
|
761 |
*/
|
|
762 |
void MdcContainerDestroyed();
|
|
763 |
|
|
764 |
/**
|
|
765 |
* Aborts DSA.
|
|
766 |
*
|
|
767 |
* @since S60 5.0
|
|
768 |
*/
|
|
769 |
void MdcAbortDSA();
|
|
770 |
|
|
771 |
/**
|
|
772 |
* Resumes DSA.
|
|
773 |
*
|
|
774 |
* @since S60 5.0
|
|
775 |
*/
|
|
776 |
void MdcResumeDSA();
|
|
777 |
|
|
778 |
|
|
779 |
public: // From MCoeControlObserver
|
|
780 |
|
|
781 |
/**
|
|
782 |
* Handles an event from an observed control.
|
|
783 |
*
|
|
784 |
* This function is called when a control for which this control is
|
|
785 |
* the observer calls CCoeControl::ReportEventL(). It should be
|
|
786 |
* implemented by the observer control, and should handle all events
|
|
787 |
* sent by controls it observes.
|
|
788 |
*
|
|
789 |
* @param aControl The control that sent the event.
|
|
790 |
* @param aEventType The event type.
|
|
791 |
* @since S60 5.0
|
|
792 |
*/
|
|
793 |
void HandleControlEventL(
|
|
794 |
CCoeControl* aControl,
|
|
795 |
TCoeEvent aEventType);
|
|
796 |
|
|
797 |
private: // New methods
|
|
798 |
|
|
799 |
/**
|
|
800 |
* Updates the indicator's position based on the editor's current
|
|
801 |
* position.
|
|
802 |
*
|
|
803 |
* Nothing is done if indicator position is user defined.
|
|
804 |
*
|
|
805 |
* @since S60 5.0
|
|
806 |
*/
|
|
807 |
void UpdateIndicatorPosition();
|
|
808 |
|
|
809 |
/**
|
|
810 |
* Returns a converted content.
|
|
811 |
*
|
|
812 |
* The method performs locale, language and phone number specific
|
|
813 |
* conversion for the given text. The ownership is transferred to
|
|
814 |
* the caller.
|
|
815 |
*
|
|
816 |
* The returned value is left to the cleanup stack.
|
|
817 |
*
|
|
818 |
* @param aContent The content to be converted.
|
|
819 |
* @return The converted content.
|
|
820 |
* @since S60 5.0
|
|
821 |
*/
|
|
822 |
HBufC* ConvertedContentLC(const TDesC& aContent);
|
|
823 |
|
|
824 |
/**
|
|
825 |
* This method is called when some change affects scaling
|
|
826 |
* of CanvasGraphicsItem.
|
|
827 |
*
|
|
828 |
* @param aChange Indicator what change was occurred.
|
|
829 |
* @since S60 5.0
|
|
830 |
*/
|
|
831 |
void HandleChangeForScaling(TChange aChange);
|
|
832 |
|
|
833 |
private: // Construtors
|
|
834 |
|
|
835 |
/**
|
|
836 |
* Returns result of connecting to pen input server
|
|
837 |
*
|
|
838 |
* @return ETrue if connected, EFalse otherwise.
|
|
839 |
* @since S60 5.0
|
|
840 |
*/
|
|
841 |
TBool isConnected();
|
|
842 |
|
|
843 |
/**
|
|
844 |
* C++ constructor.
|
|
845 |
*/
|
|
846 |
CMIDTextEditor();
|
|
847 |
|
|
848 |
/**
|
|
849 |
* Second phase constructor
|
|
850 |
*
|
|
851 |
* @param aParams The construction parameters of this class.
|
|
852 |
*/
|
|
853 |
void ConstructL(const TCtorParams& aParams);
|
|
854 |
|
|
855 |
private: // Data
|
|
856 |
|
|
857 |
// The current set of constraints.
|
|
858 |
TUint iConstraints;
|
|
859 |
// True if editor was created with row count and size is not changed.
|
|
860 |
TBool iRowCountActive;
|
|
861 |
// Row count that has been used to initialize the text editor.
|
|
862 |
TUint iRowCount;
|
|
863 |
// Editing state indicator container. Owned.
|
|
864 |
CMIDEditingStateIndicator* iEditingStateIndicator;
|
|
865 |
// Text editor control. Owned.
|
|
866 |
CMIDTextEditorEdwin* iTextEdwin;
|
|
867 |
// Editor window utils. Owned.
|
|
868 |
CMIDEdwinUtils* iEdwinUtils;
|
|
869 |
// Container for this object. Not owned.
|
|
870 |
MMIDCustomComponentContainer* iComponentContainer;
|
|
871 |
// Container for the direct content. Not owned.
|
|
872 |
MDirectContainer* iDirectContainer;
|
|
873 |
// Text editor observer. Not owned.
|
|
874 |
MMIDTextEditorObserver* iObserver;
|
|
875 |
// Text editor focus state.
|
|
876 |
TBool iFocusState;
|
|
877 |
// Indicates receiveing of pointer events on focused editor.
|
|
878 |
TBool iTouchEnabled;
|
|
879 |
// The shared CMIDUtils instance. Not owned.
|
|
880 |
CMIDUtils* iUtils;
|
|
881 |
// Nonscaled CMIDFont. This is needed for corect scaling. Owned.
|
|
882 |
MMIDFont* iNonScaledFont;
|
|
883 |
// Nonscaled position of CMIDTextEditor. This is needed for corect scaling.
|
|
884 |
TPoint iNonScaledPosition;
|
|
885 |
// Nonscaled editor size. This is needed for correct scaling.
|
|
886 |
TSize iNonScaledEditorSize;
|
|
887 |
|
|
888 |
#ifdef RD_JAVA_S60_RELEASE_9_2
|
|
889 |
// Indicates state of partial VKB
|
|
890 |
TBool iPartialVKBOpen;
|
|
891 |
#endif
|
|
892 |
|
|
893 |
#ifdef RD_TACTILE_FEEDBACK
|
|
894 |
// True if editor is already connected to the pen input server
|
|
895 |
TBool iPenInputServerConnected;
|
|
896 |
// Pen input client for touch input handling.
|
|
897 |
RPeninputServer iPenServer;
|
|
898 |
#endif // RD_TACTILE_FEEDBACK
|
|
899 |
};
|
|
900 |
|
|
901 |
#endif // CMIDTEXTEDITOR_H
|
|
902 |
|
|
903 |
// End of file
|