26
|
1 |
/* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
* All rights reserved.
|
|
3 |
* This component and the accompanying materials are made available
|
|
4 |
* under the terms of "Eclipse Public License v1.0"
|
|
5 |
* which accompanies this distribution, and is available
|
|
6 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
*
|
|
8 |
* Initial Contributors:
|
|
9 |
* Nokia Corporation - initial contribution.
|
|
10 |
*
|
|
11 |
* Contributors:
|
|
12 |
*
|
|
13 |
* Description: Package private class implementing the S60 interfaces
|
|
14 |
* for TextEditor
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// PACKAGE
|
|
19 |
package com.nokia.mid.ui;
|
|
20 |
|
|
21 |
// INTERNAL IMPORTS
|
|
22 |
import com.nokia.mid.ui.impl.LCDUIPackageInvoker;
|
|
23 |
import com.nokia.mid.ui.impl.TextEditorListenerImpl;
|
|
24 |
import com.nokia.mid.ui.impl.TextEditorContainer;
|
|
25 |
|
|
26 |
// EXTERNAL IMPORTS
|
|
27 |
import com.nokia.mj.impl.rt.legacy.NativeError;
|
|
28 |
import com.nokia.mj.impl.rt.legacy.ToolkitInvoker;
|
|
29 |
import javax.microedition.lcdui.Canvas;
|
|
30 |
|
|
31 |
/*
|
|
32 |
*
|
|
33 |
*
|
|
34 |
* @since 1.4
|
|
35 |
*/
|
|
36 |
class TextEditorImpl
|
|
37 |
extends com.nokia.mid.ui.TextEditor
|
|
38 |
implements com.nokia.mid.ui.S60TextEditor
|
|
39 |
{
|
|
40 |
/*
|
|
41 |
* Indicates that all input methods are available.
|
|
42 |
* <p>
|
|
43 |
* Can be used in {@link #setDisabledTouchInputModes}.
|
|
44 |
*/
|
|
45 |
public static final int TOUCH_INPUT_ALL_AVAILABLE = 0;
|
|
46 |
|
|
47 |
/*
|
|
48 |
* Handwriting recognition
|
|
49 |
*/
|
|
50 |
public static final int TOUCH_INPUT_HWR = 1;
|
|
51 |
|
|
52 |
/*
|
|
53 |
* Virtual QWERTY keyboard
|
|
54 |
*/
|
|
55 |
public static final int TOUCH_INPUT_VKB = 2;
|
|
56 |
|
|
57 |
/*
|
|
58 |
* Full screen QWERTY keyboard
|
|
59 |
*/
|
|
60 |
public static final int TOUCH_INPUT_FSQ = 4;
|
|
61 |
|
|
62 |
/*
|
|
63 |
* Alphanumeric keyboard with ITU-T input
|
|
64 |
*/
|
|
65 |
public static final int TOUCH_INPUT_ITUT = 8;
|
|
66 |
|
|
67 |
/*
|
|
68 |
* Full screen handwriting recognition
|
|
69 |
*/
|
|
70 |
public static final int TOUCH_INPUT_FSC = 16;
|
|
71 |
|
|
72 |
/*
|
|
73 |
* Mini ITU-T for Japanese devices
|
|
74 |
*/
|
|
75 |
public static final int TOUCH_INPUT_MINI_ITUT = 32;
|
|
76 |
|
|
77 |
// Private static data.
|
|
78 |
private static final int INDICATOR_SIZE_COUNT = 2;
|
|
79 |
|
|
80 |
// Mask of all bits defined
|
|
81 |
private static final int MASK =
|
|
82 |
TOUCH_INPUT_HWR | TOUCH_INPUT_VKB | TOUCH_INPUT_FSQ |
|
|
83 |
TOUCH_INPUT_ITUT | TOUCH_INPUT_FSC | TOUCH_INPUT_MINI_ITUT;
|
|
84 |
|
|
85 |
// Indicates receiving of pointer events by the editor
|
|
86 |
private boolean iTouchEnabled;
|
|
87 |
|
|
88 |
/*
|
|
89 |
* <P>
|
|
90 |
* Creates a new <code>TextEditor</code> object with the given initial contents,
|
|
91 |
* maximum size in characters, constraints and editor size in pixels.
|
|
92 |
* </P>
|
|
93 |
*
|
|
94 |
* <P>
|
|
95 |
* If the text parameter is <code>null</code>, the <code>TextEditor</code> is
|
|
96 |
* created empty.
|
|
97 |
* </P>
|
|
98 |
*
|
|
99 |
* <P>
|
|
100 |
* The <code>maxSize</code> parameter must be greater than zero. An
|
|
101 |
* <code>IllegalArgumentException</code> is thrown if the length of the initial
|
|
102 |
* contents string exceeds <code>maxSize</code>. However, the implementation
|
|
103 |
* may assign a maximum size smaller than the application had requested. If
|
|
104 |
* this occurs, and if the length of the contents exceeds the newly assigned
|
|
105 |
* maximum size, the contents are truncated from the end in order to fit,
|
|
106 |
* and no exception is thrown.
|
|
107 |
* </P>
|
|
108 |
*
|
|
109 |
* @param aText
|
|
110 |
* the initial contents, or <code>null</code> if the
|
|
111 |
* <code>TextEditor</code> is to be created empty
|
|
112 |
* @param aMaxSize
|
|
113 |
* the maximum capacity in characters
|
|
114 |
* @param aConstraints
|
|
115 |
* see the input constraints in <code>TextField</code></a>
|
|
116 |
* @param aWidth
|
|
117 |
* the width of the bounding box, in pixels
|
|
118 |
* @param aHeight
|
|
119 |
* the height of the bounding box, in pixels
|
|
120 |
*
|
|
121 |
* @throws IllegalArgumentException
|
|
122 |
* if <code>aMaxSize</code> is zero or less
|
|
123 |
* @throws IllegalArgumentException
|
|
124 |
* if the value of the constraints parameter is invalid
|
|
125 |
* @throws IllegalArgumentException
|
|
126 |
* if <code>aText</code> is illegal for the specified
|
|
127 |
* constraints
|
|
128 |
* @throws IllegalArgumentException
|
|
129 |
* if the length of the string exceeds the requested maximum
|
|
130 |
* capacity
|
|
131 |
* @throws IllegalArgumentException
|
|
132 |
* if the width or height is less than one pixel
|
|
133 |
*/
|
|
134 |
TextEditorImpl(String aText, int aMaxSize, int aConstraints, int aWidth,
|
|
135 |
int aHeight)
|
|
136 |
{
|
|
137 |
super(aText, aMaxSize, aConstraints, aWidth, aHeight, false);
|
|
138 |
// Enabling receiving pointer events
|
|
139 |
iTouchEnabled = true;
|
|
140 |
}
|
|
141 |
|
|
142 |
/*
|
|
143 |
* <P>
|
|
144 |
* Creates a new empty <code>TextEditor</code> with the given maximum size in
|
|
145 |
* characters, constraints and editor size as number of visible rows.
|
|
146 |
* </P>
|
|
147 |
*
|
|
148 |
* <P>
|
|
149 |
* The <code>rows</code> parameter indicates the requested number of visible
|
|
150 |
* rows in the editor. TextEditor then assigns the initial
|
|
151 |
* height for the editor based on the requested number of rows and width of the
|
|
152 |
* editor.
|
|
153 |
* </P>
|
|
154 |
*
|
|
155 |
* <P>
|
|
156 |
* The <code>maxSize</code> parameter must be greater than zero. An
|
|
157 |
* <code>IllegalArgumentException</code> is thrown if the length of the initial
|
|
158 |
* contents string exceeds <code>maxSize</code>. However, the implementation
|
|
159 |
* may assign a maximum size smaller than the application had requested. If
|
|
160 |
* this occurs, and if the length of the contents exceeds the newly assigned
|
|
161 |
* maximum size, the contents are truncated from the end in order to fit,
|
|
162 |
* and no exception is thrown.
|
|
163 |
* </P>
|
|
164 |
*
|
|
165 |
* @param aMaxSize
|
|
166 |
* the maximum capacity in characters
|
|
167 |
* @param aConstraints
|
|
168 |
* see the input constraints in <code>TextField</code></a>
|
|
169 |
* @param aWidth
|
|
170 |
* the width of the bounding box, in pixels
|
|
171 |
* @param aRows
|
|
172 |
* the requested number of visible rows in the editor
|
|
173 |
*
|
|
174 |
* @throws IllegalArgumentException
|
|
175 |
* if <code>aMaxSize</code> or <code>rows</code> is zero or less
|
|
176 |
* @throws IllegalArgumentException
|
|
177 |
* if the value of the constraints parameter is invalid
|
|
178 |
* @throws IllegalArgumentException
|
|
179 |
* if the width is less than one pixel
|
|
180 |
*/
|
|
181 |
TextEditorImpl(int aMaxSize, int aConstraints, int aWidth, int aRows)
|
|
182 |
{
|
|
183 |
super(null, aMaxSize, aConstraints, aWidth, aRows, true);
|
|
184 |
// Enabling receiving pointer events
|
|
185 |
iTouchEnabled = true;
|
|
186 |
}
|
|
187 |
|
|
188 |
/*
|
|
189 |
* Set the parent object of this TextEditor. Typically in LCDUI the parent
|
|
190 |
* object would be Canvas or CustomItem. Setting the parameter to null
|
|
191 |
* removes the association to the parent.
|
|
192 |
* <p>
|
|
193 |
* @param aParent the parent object
|
|
194 |
* <p>
|
|
195 |
* @throws IllegalArgumentException
|
|
196 |
* if <code>aParent</code> is not a valid object with which a
|
|
197 |
* TextEditor can be associated
|
|
198 |
*/
|
|
199 |
public void setParent(Object aParent)
|
|
200 |
{
|
|
201 |
super.setParent(aParent);
|
|
202 |
// Update indicator location to their default position.
|
|
203 |
if (aParent != null)
|
|
204 |
{
|
|
205 |
setDefaultIndicators();
|
|
206 |
}
|
|
207 |
}
|
|
208 |
|
|
209 |
/*
|
|
210 |
* <P>
|
|
211 |
* If the default indicator location is not used then sets the drawing
|
|
212 |
* location for input indicators relative to the <code>TextEditor</code>'s
|
|
213 |
* parent.
|
|
214 |
* </P>
|
|
215 |
*
|
|
216 |
* <P>
|
|
217 |
* The anchor point given is relative to the upper left corner of the
|
|
218 |
* <code>Canvas</code>. The location may be outside the
|
|
219 |
* <code>TextEditor</code> boundaries. The z-order of the indicators is the
|
|
220 |
* same as <code>TextEditor</code> textual content. If indicators and the
|
|
221 |
* editor content overlap indicators are rendered on top of the editor
|
|
222 |
* content.
|
|
223 |
* </P>
|
|
224 |
*
|
|
225 |
* <P>
|
|
226 |
* The application should first query the size of the input indicators with
|
|
227 |
* {@link #getIndicatorSize} method to determine that the indicators will
|
|
228 |
* not be clipped outside the available display area when drawn to the
|
|
229 |
* requested location.
|
|
230 |
* </P>
|
|
231 |
*
|
|
232 |
* <P>
|
|
233 |
* If there are no indicators present, the usability of complex device
|
|
234 |
* specific input methods may be compromised.
|
|
235 |
* </P>
|
|
236 |
*
|
|
237 |
* @param x
|
|
238 |
* the x coordinate of the anchor point, in pixels.
|
|
239 |
* @param y
|
|
240 |
* the y coordinate of the anchor point, in pixels.
|
|
241 |
*
|
|
242 |
*/
|
|
243 |
public void setIndicatorLocation(int x, int y)
|
|
244 |
{
|
|
245 |
synchronized (iToolkit)
|
|
246 |
{
|
|
247 |
NativeError.check(_setIndicatorLocation(getToolkitHandle(),
|
|
248 |
iHandle, x, y));
|
|
249 |
}
|
|
250 |
}
|
|
251 |
|
|
252 |
/*
|
|
253 |
* <P>
|
|
254 |
* Resets the implementation provided input indicators to their default
|
|
255 |
* position.
|
|
256 |
* </P>
|
|
257 |
*
|
|
258 |
* <P>
|
|
259 |
* This position may be outside the area of parent in case the default
|
|
260 |
* position is in status area. In this case if the status area is missing
|
|
261 |
* (full screen mode Canvas) the default position is inside the parent area
|
|
262 |
* e.g. on top of the editor. When default position is in use the
|
|
263 |
* <code>TextEditor</code> automatically positions the indicators relative
|
|
264 |
* to the <code>TextEditor</code> even when <code>TextEditor</code> location
|
|
265 |
* is changed. However, client is responsible of making sure indicators are
|
|
266 |
* visible inside the parent area positioning <code>TextEditor</code> so
|
|
267 |
* that indicators fit to the visible area e.g. on top of the
|
|
268 |
* <code>TextEditor</code>. Positioning <code>TextEditor</code> directly on
|
|
269 |
* top of <code>Canvas</code> may mean that indicators in the default
|
|
270 |
* position are not visible.
|
|
271 |
* </P>
|
|
272 |
*
|
|
273 |
* @throws IllegalStateException
|
|
274 |
* If the <code>TextEditor</code> is not added to
|
|
275 |
* <code>Canvas</code>
|
|
276 |
*/
|
|
277 |
public void setDefaultIndicators()
|
|
278 |
{
|
|
279 |
synchronized (iToolkit)
|
|
280 |
{
|
|
281 |
Object parent = getParent();
|
|
282 |
boolean fullScreen = false;
|
|
283 |
|
|
284 |
if (parent instanceof Canvas)
|
|
285 |
{
|
|
286 |
fullScreen = iLCDUIPackageInvoker.isFullScreen((Canvas) parent);
|
|
287 |
}
|
|
288 |
|
|
289 |
NativeError.check(_setDefaultIndicators(getToolkitHandle(),
|
|
290 |
iHandle, fullScreen));
|
|
291 |
}
|
|
292 |
}
|
|
293 |
|
|
294 |
/*
|
|
295 |
* <P>
|
|
296 |
* By default indicators visibility is set to <code>true</code> and they are
|
|
297 |
* made visible when the associated <code>TextEditor</code> is focused.
|
|
298 |
* </P>
|
|
299 |
* <P>
|
|
300 |
* If the application controls the position of the indicators, those can be
|
|
301 |
* explicitly made not visible by calling
|
|
302 |
* <code>setIndicatorVisibility(false)</code>. Indicators are never visible
|
|
303 |
* if <code>TextEditor</code> itself is not visible so having indicator
|
|
304 |
* visibility set to <code>true</code> does not make them visible unless
|
|
305 |
* editor itself is set visible.
|
|
306 |
* </P>
|
|
307 |
*
|
|
308 |
* @param visible
|
|
309 |
* controls indicator visibility state
|
|
310 |
*
|
|
311 |
* @see #setIndicatorLocation(int, int)
|
|
312 |
* @see #setDefaultIndicators()
|
|
313 |
*/
|
|
314 |
public void setIndicatorVisibility(boolean visible)
|
|
315 |
{
|
|
316 |
synchronized (iToolkit)
|
|
317 |
{
|
|
318 |
NativeError.check(_setIndicatorVisibility(getToolkitHandle(),
|
|
319 |
iHandle, visible));
|
|
320 |
}
|
|
321 |
}
|
|
322 |
|
|
323 |
/*
|
|
324 |
* Gets the size of the area needed for drawing the input indicators.
|
|
325 |
* <p>
|
|
326 |
* The returned array contains two integers for width (array index 0) and
|
|
327 |
* height (array index 1) of the indicator graphics. Size (0,0) is returned
|
|
328 |
* if the device UI does not use any input indicators in the text editors or
|
|
329 |
* if the indicators are curretly positioned outside parent area e.g. in
|
|
330 |
* status area. This happens if {@link #setIndicatorLocation(int, int)
|
|
331 |
* setIndicatorLocation(int x, int y)} has not been ever called for the
|
|
332 |
* editor, or if {@link #setDefaultIndicators() setDefaultIndicators()} has
|
|
333 |
* been called.
|
|
334 |
* <p>
|
|
335 |
*
|
|
336 |
* @return the width and height of area needed for drawing input indicators
|
|
337 |
* @see #setDefaultIndicators()
|
|
338 |
*/
|
|
339 |
public int[] getIndicatorSize()
|
|
340 |
{
|
|
341 |
int[] size = new int[INDICATOR_SIZE_COUNT];
|
|
342 |
|
|
343 |
synchronized (iToolkit)
|
|
344 |
{
|
|
345 |
NativeError.check(_getIndicatorSize(getToolkitHandle(), iHandle,
|
|
346 |
size));
|
|
347 |
}
|
|
348 |
return size;
|
|
349 |
}
|
|
350 |
|
|
351 |
/*
|
|
352 |
* Disables one or multiple touch input modes from use.
|
|
353 |
* <p>
|
|
354 |
* User is not able to switch to the disable touch input modes. Multiple
|
|
355 |
* touch input modes may be combined together in <code>touchInputMode</code>
|
|
356 |
* parameter using bitwise or operator. The method does not have any impact
|
|
357 |
* if called in non-touch device. A device may not support all touch input
|
|
358 |
* modes specified. Specifying not supported input modes is silently
|
|
359 |
* ignored.
|
|
360 |
* <p>
|
|
361 |
* The possible values are defined in the class with TOUCH_INPUT_* starting
|
|
362 |
* constant values.
|
|
363 |
* <p>
|
|
364 |
*
|
|
365 |
* @param touchInputModes
|
|
366 |
* bitwise or combined list of disabled touch input modes
|
|
367 |
* @throws IllegalArgumentException
|
|
368 |
* if the given input modes are not valid.
|
|
369 |
* <p>
|
|
370 |
* @see #setPreferredTouchMode(int)
|
|
371 |
* @see #getDisabledTouchInputModes()
|
|
372 |
*/
|
|
373 |
public void setDisabledTouchInputModes(int touchInputModes)
|
|
374 |
{
|
|
375 |
// Validate touch input modes. There must not be additional modes
|
|
376 |
// 0 is valid.
|
|
377 |
// See com.nokia.mid.ui.s60.TextEditor.TOUCH_INPUT_ALL_AVAILABLE.
|
|
378 |
if ((touchInputModes & ~MASK) != 0)
|
|
379 |
{
|
|
380 |
throw new IllegalArgumentException();
|
|
381 |
}
|
|
382 |
|
|
383 |
synchronized (iToolkit)
|
|
384 |
{
|
|
385 |
NativeError.check(_setDisabledTouchInputModes(getToolkitHandle(),
|
|
386 |
iHandle, touchInputModes));
|
|
387 |
}
|
|
388 |
}
|
|
389 |
|
|
390 |
/*
|
|
391 |
* By default all supported touch input modes are available. Returns the
|
|
392 |
* disabled touch input modes set with {@link #setDisabledTouchInputModes}.
|
|
393 |
* <p>
|
|
394 |
* Note that the disabled touch input modes may be device specific so this
|
|
395 |
* method may return some modes as disabled by default.
|
|
396 |
* <p>
|
|
397 |
* Note that if the device does not support touch input this method returns
|
|
398 |
* all modes.
|
|
399 |
* <p>
|
|
400 |
*
|
|
401 |
* @return The disabled touch input modes.
|
|
402 |
* @see #setDisabledTouchInputModes(int)
|
|
403 |
* @see #setPreferredTouchMode(int)
|
|
404 |
*/
|
|
405 |
public int getDisabledTouchInputModes()
|
|
406 |
{
|
|
407 |
int disabled = 0;
|
|
408 |
|
|
409 |
synchronized (iToolkit)
|
|
410 |
{
|
|
411 |
disabled = _getDisabledTouchInputModes(getToolkitHandle(), iHandle);
|
|
412 |
}
|
|
413 |
|
|
414 |
NativeError.check(disabled);
|
|
415 |
return disabled;
|
|
416 |
}
|
|
417 |
|
|
418 |
/*
|
|
419 |
* Set the preferred touch input mode overriding the device default
|
|
420 |
* preferred mode. User may still change the touch input mode from touch
|
|
421 |
* input window to all available modes.
|
|
422 |
* <p>
|
|
423 |
* The possible values are defined in the class with TOUCH_INPUT_* starting
|
|
424 |
* constant values.
|
|
425 |
* <p>
|
|
426 |
* Note that if the device does not support touch input this method has no
|
|
427 |
* effect.
|
|
428 |
* <p>
|
|
429 |
*
|
|
430 |
* @param touchInputModes
|
|
431 |
* a touch input mode to be set as preferred one.
|
|
432 |
* @throws IllegalArgumentException
|
|
433 |
* if the input mode is not valid or if it contains multiple
|
|
434 |
* input modes as bit mask.
|
|
435 |
* @see #setDisabledTouchInputModes(int)
|
|
436 |
* @see #getPreferredTouchMode()
|
|
437 |
*
|
|
438 |
*/
|
|
439 |
public void setPreferredTouchMode(int touchInputModes)
|
|
440 |
{
|
|
441 |
int mask = touchInputModes & MASK;
|
|
442 |
// Validate touch input mode.
|
|
443 |
if (touchInputModes == 0 || (touchInputModes & ~MASK) != 0
|
|
444 |
|| (mask & (mask - 1)) != 0)
|
|
445 |
{
|
|
446 |
throw new IllegalArgumentException();
|
|
447 |
}
|
|
448 |
|
|
449 |
synchronized (iToolkit)
|
|
450 |
{
|
|
451 |
NativeError.check(_setPreferredTouchMode(getToolkitHandle(),
|
|
452 |
iHandle, touchInputModes));
|
|
453 |
}
|
|
454 |
}
|
|
455 |
|
|
456 |
/*
|
|
457 |
* Gets the preferred touch input mode.
|
|
458 |
* <p>
|
|
459 |
* Note that if the device does not support touch input this method returns
|
|
460 |
* <code>0</code>
|
|
461 |
* <p>
|
|
462 |
*
|
|
463 |
* @return The preferred touch input mode.
|
|
464 |
* <p>
|
|
465 |
* @see #setPreferredTouchMode(int)
|
|
466 |
* @see #setDisabledTouchInputModes(int)
|
|
467 |
*/
|
|
468 |
public int getPreferredTouchMode()
|
|
469 |
{
|
|
470 |
int preferredMode = 0;
|
|
471 |
|
|
472 |
synchronized (iToolkit)
|
|
473 |
{
|
|
474 |
preferredMode = _getPreferredTouchMode(getToolkitHandle(), iHandle);
|
|
475 |
}
|
|
476 |
|
|
477 |
NativeError.check(preferredMode);
|
|
478 |
return preferredMode;
|
|
479 |
}
|
|
480 |
|
|
481 |
/*
|
|
482 |
* Sets the caret in the Editor at x, y location.
|
|
483 |
*
|
|
484 |
* @param x
|
|
485 |
* The x coordinate of the wanted caret position.
|
|
486 |
*
|
|
487 |
* @param y
|
|
488 |
* The y coordinate of the wanted caret position.
|
|
489 |
*/
|
|
490 |
public void setCaretXY(int x, int y)
|
|
491 |
{
|
|
492 |
synchronized (iToolkit)
|
|
493 |
{
|
|
494 |
NativeError.check(_setCaretXY(getToolkitHandle(),
|
|
495 |
iHandle, x, y));
|
|
496 |
}
|
|
497 |
}
|
|
498 |
|
|
499 |
/*
|
|
500 |
* Specifies whether or not the editor will receive touch-events.
|
|
501 |
* <p>
|
|
502 |
* This is enabled by default.
|
|
503 |
* An editor with touch-event disabled won't be able to perform any
|
|
504 |
* touch-related functionality such as scrolling or positioning the
|
|
505 |
* cursor. It may however still be controlled via the
|
|
506 |
* virtual keypad/control-panel if that is enabled, or receive other +
|
|
507 |
* input e.g. via physical keys
|
|
508 |
* <p>
|
|
509 |
* @param enabled
|
|
510 |
* true to enabled touch-event, false to disable
|
|
511 |
*/
|
|
512 |
public void setTouchEnabled(boolean enabled)
|
|
513 |
{
|
|
514 |
if (iTouchEnabled != enabled)
|
|
515 |
{
|
|
516 |
synchronized (iToolkit)
|
|
517 |
{
|
|
518 |
_setTouchEnabled(getToolkitHandle(), iHandle, enabled);
|
|
519 |
iTouchEnabled = enabled;
|
|
520 |
}
|
|
521 |
}
|
|
522 |
}
|
|
523 |
|
|
524 |
/*
|
|
525 |
* Gets the current touch-enabled state
|
|
526 |
* <p>
|
|
527 |
* @return true if the editor is touch-enabled, false otherwise
|
|
528 |
*/
|
|
529 |
public boolean isTouchEnabled()
|
|
530 |
{
|
|
531 |
return iTouchEnabled;
|
|
532 |
}
|
|
533 |
|
|
534 |
/*
|
|
535 |
* Hidden default constructor.
|
|
536 |
*/
|
|
537 |
private TextEditorImpl()
|
|
538 |
{
|
|
539 |
}
|
|
540 |
|
|
541 |
// Private methods.
|
|
542 |
|
|
543 |
/*
|
|
544 |
* Sets the visibility status of the indicator of the editor.
|
|
545 |
*
|
|
546 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
547 |
*
|
|
548 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
549 |
*
|
|
550 |
* @param aVisible The visibility status of the indicator.
|
|
551 |
*
|
|
552 |
* @return NativeError.KErrNone if the operation was successful. Otherwise,
|
|
553 |
* a system-wide error code is returned.
|
|
554 |
*/
|
|
555 |
private native int _setIndicatorVisibility(
|
|
556 |
int aToolkitHandle,
|
|
557 |
int aNativePeerHandle,
|
|
558 |
boolean aVisible);
|
|
559 |
|
|
560 |
/*
|
|
561 |
* Sets the position of the indicator.
|
|
562 |
*
|
|
563 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
564 |
*
|
|
565 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
566 |
*
|
|
567 |
* @param aX The x coordinate of the anchor point.
|
|
568 |
*
|
|
569 |
* @param aY The y coordinate of the anchor point.
|
|
570 |
*
|
|
571 |
* @return NativeError.KErrNone if the operation was successful. Otherwise,
|
|
572 |
* a system-wide error code is returned.
|
|
573 |
*/
|
|
574 |
private native int _setIndicatorLocation(
|
|
575 |
int aToolkitHandle,
|
|
576 |
int aNativePeerHandle,
|
|
577 |
int aX,
|
|
578 |
int aY);
|
|
579 |
|
|
580 |
/*
|
|
581 |
* Gets the size of the area needed for drawing the input indicators.
|
|
582 |
*
|
|
583 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
584 |
*
|
|
585 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
586 |
*
|
|
587 |
* @param aSize On return, contains the size of the indicator (w,h).
|
|
588 |
*
|
|
589 |
* @return NativeError.KErrNone if the operation was successful. Otherwise,
|
|
590 |
* a system-wide error code is returned.
|
|
591 |
*/
|
|
592 |
private native int _getIndicatorSize(
|
|
593 |
int aToolkitHandle,
|
|
594 |
int aNativePeerHandle,
|
|
595 |
int[] aSize);
|
|
596 |
|
|
597 |
/*
|
|
598 |
* Resets the default input indicators to be used.
|
|
599 |
*
|
|
600 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
601 |
*
|
|
602 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
603 |
*
|
|
604 |
* @param aParentFullScreen Indicates if parent is the size of the whole
|
|
605 |
* screen.
|
|
606 |
*
|
|
607 |
* @return NativeError.KErrNone if the operation was successful. Otherwise,
|
|
608 |
* a system-wide error code is returned.
|
|
609 |
*/
|
|
610 |
private native int _setDefaultIndicators(
|
|
611 |
int aToolkitHandle,
|
|
612 |
int aNativePeerHandle,
|
|
613 |
boolean aParentFullScreen);
|
|
614 |
|
|
615 |
/*
|
|
616 |
* Sets the disabled touch input modes.
|
|
617 |
*
|
|
618 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
619 |
*
|
|
620 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
621 |
*
|
|
622 |
* @param aTouchInputModes The disabled touch input modes.
|
|
623 |
*
|
|
624 |
* @return NativeError.KErrNone if the operation was successful. Otherwise,
|
|
625 |
* a system-wide error code is returned.
|
|
626 |
*/
|
|
627 |
private native int _setDisabledTouchInputModes(
|
|
628 |
int aToolkitHandle,
|
|
629 |
int aNativePeerHandle,
|
|
630 |
int aTouchInputModes);
|
|
631 |
|
|
632 |
/*
|
|
633 |
* Gets the disabled touch input mode.
|
|
634 |
*
|
|
635 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
636 |
*
|
|
637 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
638 |
*
|
|
639 |
* @param aTouchInputMode The preferred touch input mode.
|
|
640 |
*
|
|
641 |
* @return The disabled touch input modes if the operation was successful.
|
|
642 |
* Otherwise, a system-wide error code is returned.
|
|
643 |
*/
|
|
644 |
private native int _getDisabledTouchInputModes(
|
|
645 |
int aToolkitHandle,
|
|
646 |
int aNativePeerHandle);
|
|
647 |
|
|
648 |
/*
|
|
649 |
* Sets the preferred touch input mode.
|
|
650 |
*
|
|
651 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
652 |
*
|
|
653 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
654 |
*
|
|
655 |
* @param aTouchInputMode The preferred touch input mode.
|
|
656 |
*
|
|
657 |
* @return NativeError.KErrNone if the operation was successful. Otherwise,
|
|
658 |
* a system-wide error code is returned.
|
|
659 |
*/
|
|
660 |
private native int _setPreferredTouchMode(
|
|
661 |
int aToolkitHandle,
|
|
662 |
int aNativePeerHandle,
|
|
663 |
int aTouchInputMode);
|
|
664 |
|
|
665 |
/*
|
|
666 |
* Gets the preferred touch input mode.
|
|
667 |
*
|
|
668 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
669 |
*
|
|
670 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
671 |
*
|
|
672 |
* @return The preferred touch input mode if the operation was successful.
|
|
673 |
* Otherwise, a system-wide error code is returned.
|
|
674 |
*/
|
|
675 |
private native int _getPreferredTouchMode(
|
|
676 |
int aToolkitHandle,
|
|
677 |
int aNativePeerHandle);
|
|
678 |
|
|
679 |
/*
|
|
680 |
* Sets the caret in the Editor at x, y location.
|
|
681 |
*
|
|
682 |
* @param aToolkitHandle A handle to the LCDUI toolkit.
|
|
683 |
*
|
|
684 |
* @param aNativePeerHandle A handle to the native side peer object.
|
|
685 |
*
|
|
686 |
* @param x
|
|
687 |
* The x coordinate of the wanted caret position.
|
|
688 |
*
|
|
689 |
* @param y
|
|
690 |
* The y coordinate of the wanted caret position.
|
|
691 |
*/
|
|
692 |
public native int _setCaretXY(
|
|
693 |
int aToolkitHandle,
|
|
694 |
int aNativePeerHandle,
|
|
695 |
int x,
|
|
696 |
int y);
|
|
697 |
|
|
698 |
/*
|
|
699 |
* Specifies whether or not the editor will receive touch-events.
|
|
700 |
*
|
|
701 |
* This is enabled by default.
|
|
702 |
* An editor with touch-event disabled won't be able to perform any
|
|
703 |
* touch-related functionality such as scrolling or positioning the
|
|
704 |
* cursor. It may however still be controlled via the
|
|
705 |
* virtual keypad/control-panel if that is enabled, or receive other +
|
|
706 |
* input e.g. via physical keys
|
|
707 |
*
|
|
708 |
* @param aEnabled
|
|
709 |
* true to enabled touch-event, false to disable
|
|
710 |
*/
|
|
711 |
private native int _setTouchEnabled(int aToolkitHandle,
|
|
712 |
int aNativePeerHandle, boolean aEnabled);
|
|
713 |
}
|
|
714 |
|
|
715 |
// End of file
|