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 |
* Description: Interface for S60 Text Editor
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// PACKAGE
|
|
19 |
package com.nokia.mid.ui;
|
|
20 |
|
|
21 |
/**
|
|
22 |
* <P>
|
|
23 |
* S60 platform specific extensions to <code>TextEditor</code>. These methods
|
|
24 |
* are only available in Java Runtime for Symbian.
|
|
25 |
* </P>
|
|
26 |
*
|
|
27 |
* <P>
|
|
28 |
* <code>TextEditor</code> does not support DSA over its area. Playing video or
|
|
29 |
* using camera over <code>TextEditor</code> area can lead to artifacts on
|
|
30 |
* screen.
|
|
31 |
* </P>
|
|
32 |
*
|
|
33 |
* <h3>Editing state indicators</h3>
|
|
34 |
* <p>
|
|
35 |
* By default, the implementation uses platform specific indicators for the
|
|
36 |
* <code>
|
|
37 |
* TextEditor</code>. Typically these indicators are shown in the status pane
|
|
38 |
* and the visibility is related to the focus of the associated
|
|
39 |
* <code>TextEditor</code>. When the associated editor is focused, the platform
|
|
40 |
* displays the editing state indicators for the user and when focus is lost
|
|
41 |
* from the editor the indicators are hidden.
|
|
42 |
* </p>
|
|
43 |
* <p>
|
|
44 |
* The application can also choose to control the input indicators if needed. In
|
|
45 |
* this case, the visibility and position needs to be controlled separately when
|
|
46 |
* focusing the associated editor. It should be noted that if no indicators are
|
|
47 |
* shown to the user, the usability maybe diminished especially with complex
|
|
48 |
* input methods.
|
|
49 |
* </p>
|
|
50 |
* <p>
|
|
51 |
* When using custom indicator position, the background color of the indicator
|
|
52 |
* area is equal to the associated <code>TextEditor</code>'s background color.
|
|
53 |
* </p>
|
|
54 |
*
|
|
55 |
* <h3>Touch input methods</h3>
|
|
56 |
* <p>
|
|
57 |
* The application has a possibility to control the touch input methods with
|
|
58 |
* this class. It is possible to set the disabled touch input modes and the
|
|
59 |
* preferred touch mode if needed. It must be noted that supported touch input
|
|
60 |
* modes depend on the used device thus some of the touch modes cannot be set as
|
|
61 |
* preferred or enabled.
|
|
62 |
* </p>
|
|
63 |
*
|
|
64 |
* <h3>Touch screen virtual keyboard</h3>
|
|
65 |
* <p>
|
|
66 |
* In touch-only devices when user taps on a text editor touch screen
|
|
67 |
* virtual keyboard is opened. The keyboard takes part of the screen space, so
|
|
68 |
* canvas is smaller when virtual keyboard is visible.
|
|
69 |
* Application is notified about this by events, so it can react on this
|
|
70 |
* change and resize, move TextEditor to the visible area and adjust the
|
|
71 |
* whole Canvas.
|
|
72 |
* </p>
|
|
73 |
*
|
|
74 |
* <h3>Touch settings</h3>
|
|
75 |
* <p>
|
|
76 |
* The TextEditor receives touch events in touch devices. This can be
|
|
77 |
* disabled/enabled by {@link com.nokia.mid.ui.S60TextEditor#setTouchEnabled(boolean)}
|
|
78 |
* An editor with touch-event disabled won't be able to perform any
|
|
79 |
* touch-related functionality.
|
|
80 |
* </p>
|
|
81 |
* @see TextEditor
|
|
82 |
* @since 1.4
|
|
83 |
*/
|
|
84 |
public abstract interface S60TextEditor
|
|
85 |
{
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Indicates that all input methods are available.
|
|
89 |
* <p>
|
|
90 |
* Can be used in {@link #setDisabledTouchInputModes}.
|
|
91 |
*/
|
|
92 |
public static final int TOUCH_INPUT_ALL_AVAILABLE = 0;
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Handwriting recognition
|
|
96 |
*/
|
|
97 |
public static final int TOUCH_INPUT_HWR = 1;
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Virtual QWERTY keyboard
|
|
101 |
*/
|
|
102 |
public static final int TOUCH_INPUT_VKB = 2;
|
|
103 |
|
|
104 |
/**
|
|
105 |
* Full screen QWERTY keyboard
|
|
106 |
*/
|
|
107 |
public static final int TOUCH_INPUT_FSQ = 4;
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Alphanumeric keyboard with ITU-T input
|
|
111 |
*/
|
|
112 |
public static final int TOUCH_INPUT_ITUT = 8;
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Full screen handwriting recognition
|
|
116 |
*/
|
|
117 |
public static final int TOUCH_INPUT_FSC = 16;
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Mini ITU-T for Japanese devices
|
|
121 |
*/
|
|
122 |
public static final int TOUCH_INPUT_MINI_ITUT = 32;
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Indicates that the touch screen virtual keyboard is opened.
|
|
126 |
*/
|
|
127 |
public static final int ACTION_VIRTUAL_KEYBOARD_OPEN = 0x1000;
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Indicates that the touch screen virtual keyboard is closed.
|
|
131 |
*/
|
|
132 |
public static final int ACTION_VIRTUAL_KEYBOARD_CLOSE = 0x2000;
|
|
133 |
|
|
134 |
/**
|
|
135 |
* <P>
|
|
136 |
* If the default indicator location is not used then sets the drawing
|
|
137 |
* location for input indicators relative to the <code>TextEditor</code>'s
|
|
138 |
* parent.
|
|
139 |
* </P>
|
|
140 |
*
|
|
141 |
* <P>
|
|
142 |
* The anchor point given is relative to the upper left corner of the
|
|
143 |
* <code>Canvas</code>. The location may be outside the
|
|
144 |
* <code>TextEditor</code> boundaries. The z-order of the indicators is the
|
|
145 |
* same as <code>TextEditor</code> textual content. If indicators and the
|
|
146 |
* editor content overlap indicators are rendered on top of the editor
|
|
147 |
* content.
|
|
148 |
* </P>
|
|
149 |
*
|
|
150 |
* <P>
|
|
151 |
* The application should first query the size of the input indicators with
|
|
152 |
* {@link #getIndicatorSize} method to determine that the indicators will
|
|
153 |
* not be clipped outside the available display area when drawn to the
|
|
154 |
* requested location.
|
|
155 |
* </P>
|
|
156 |
*
|
|
157 |
* <P>
|
|
158 |
* If there are no indicators present, the usability of complex device
|
|
159 |
* specific input methods may be compromised.
|
|
160 |
* </P>
|
|
161 |
*
|
|
162 |
* @param x
|
|
163 |
* the x coordinate of the anchor point, in pixels.
|
|
164 |
* @param y
|
|
165 |
* the y coordinate of the anchor point, in pixels.
|
|
166 |
*
|
|
167 |
*/
|
|
168 |
public void setIndicatorLocation(int x, int y);
|
|
169 |
|
|
170 |
/**
|
|
171 |
* <P>
|
|
172 |
* Resets the implementation provided input indicators to their default
|
|
173 |
* position.
|
|
174 |
* </P>
|
|
175 |
*
|
|
176 |
* <P>
|
|
177 |
* This position may be outside the area of parent in case the default
|
|
178 |
* position is in status area. In this case if the status area is missing
|
|
179 |
* (full screen mode Canvas) the default position is inside the parent area
|
|
180 |
* e.g. on top of the editor. When default position is in use the
|
|
181 |
* <code>TextEditor</code> automatically positions the indicators relative
|
|
182 |
* to the <code>TextEditor</code> even when <code>TextEditor</code> location
|
|
183 |
* is changed. However, client is responsible of making sure indicators are
|
|
184 |
* visible inside the parent area positioning <code>TextEditor</code> so
|
|
185 |
* that indicators fit to the visible area e.g. on top of the
|
|
186 |
* <code>TextEditor</code>. Positioning <code>TextEditor</code> directly on
|
|
187 |
* top of <code>Canvas</code> may mean that indicators in the default
|
|
188 |
* position are not visible.
|
|
189 |
* </P>
|
|
190 |
*
|
|
191 |
* @throws IllegalStateException
|
|
192 |
* If the <code>TextEditor</code> is not added to
|
|
193 |
* <code>Canvas</code>
|
|
194 |
*/
|
|
195 |
public void setDefaultIndicators();
|
|
196 |
|
|
197 |
/**
|
|
198 |
* <P>
|
|
199 |
* By default indicators visibility is set to <code>true</code> and they are
|
|
200 |
* made visible when the associated <code>TextEditor</code> is focused.
|
|
201 |
* </P>
|
|
202 |
* <P>
|
|
203 |
* If the application controls the position of the indicators, those can be
|
|
204 |
* explicitly made not visible by calling
|
|
205 |
* <code>setIndicatorVisibility(false)</code>. Indicators are never visible
|
|
206 |
* if <code>TextEditor</code> itself is not visible so having indicator
|
|
207 |
* visibility set to <code>true</code> does not make them visible unless
|
|
208 |
* editor itself is set visible.
|
|
209 |
* </P>
|
|
210 |
*
|
|
211 |
* @param visible
|
|
212 |
* controls indicator visibility state
|
|
213 |
*
|
|
214 |
* @see #setIndicatorLocation(int, int)
|
|
215 |
* @see #setDefaultIndicators()
|
|
216 |
*/
|
|
217 |
public void setIndicatorVisibility(boolean visible);
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Gets the size of the area needed for drawing the input indicators.
|
|
221 |
* <p>
|
|
222 |
* The returned array contains two integers for width (array index 0) and
|
|
223 |
* height (array index 1) of the indicator graphics. Size (0,0) is returned
|
|
224 |
* if the device UI does not use any input indicators in the text editors or
|
|
225 |
* if the indicators are curretly positioned outside parent area e.g. in
|
|
226 |
* status area. This happens if {@link #setIndicatorLocation(int, int)
|
|
227 |
* setIndicatorLocation(int x, int y)} has not been ever called for the
|
|
228 |
* editor, or if {@link #setDefaultIndicators() setDefaultIndicators()} has
|
|
229 |
* been called.
|
|
230 |
* <p>
|
|
231 |
*
|
|
232 |
* @return the width and height of area needed for drawing input indicators
|
|
233 |
* @see #setDefaultIndicators()
|
|
234 |
*/
|
|
235 |
public int[] getIndicatorSize();
|
|
236 |
|
|
237 |
/**
|
|
238 |
* Disables one or multiple touch input modes from use.
|
|
239 |
* <p>
|
|
240 |
* User is not able to switch to the disable touch input modes. Multiple
|
|
241 |
* touch input modes may be combined together in <code>touchInputMode</code>
|
|
242 |
* parameter using bitwise or operator. The method does not have any impact
|
|
243 |
* if called in non-touch device. A device may not support all touch input
|
|
244 |
* modes specified. Specifying not supported input modes is silently
|
|
245 |
* ignored.
|
|
246 |
* <p>
|
|
247 |
* The possible values are defined in the class with TOUCH_INPUT_* starting
|
|
248 |
* constant values.
|
|
249 |
* <p>
|
|
250 |
*
|
|
251 |
* @param touchInputModes
|
|
252 |
* bitwise or combined list of disabled touch input modes
|
|
253 |
* @throws IllegalArgumentException
|
|
254 |
* if the given input modes are not valid.
|
|
255 |
* <p>
|
|
256 |
* @see #setPreferredTouchMode(int)
|
|
257 |
* @see #getDisabledTouchInputModes()
|
|
258 |
*/
|
|
259 |
public void setDisabledTouchInputModes(int touchInputModes);
|
|
260 |
|
|
261 |
/**
|
|
262 |
* By default all supported touch input modes are available. Returns the
|
|
263 |
* disabled touch input modes set with {@link #setDisabledTouchInputModes}.
|
|
264 |
* <p>
|
|
265 |
* Note that the disabled touch input modes may be device specific so this
|
|
266 |
* method may return some modes as disabled by default.
|
|
267 |
* <p>
|
|
268 |
* Note that if the device does not support touch input this method returns
|
|
269 |
* all modes.
|
|
270 |
* <p>
|
|
271 |
*
|
|
272 |
* @return The disabled touch input modes.
|
|
273 |
* @see #setDisabledTouchInputModes(int)
|
|
274 |
* @see #setPreferredTouchMode(int)
|
|
275 |
*/
|
|
276 |
public int getDisabledTouchInputModes();
|
|
277 |
|
|
278 |
/**
|
|
279 |
* Set the preferred touch input mode overriding the device default
|
|
280 |
* preferred mode. User may still change the touch input mode from touch
|
|
281 |
* input window to all available modes.
|
|
282 |
* <p>
|
|
283 |
* The possible values are defined in the class with TOUCH_INPUT_* starting
|
|
284 |
* constant values.
|
|
285 |
* <p>
|
|
286 |
* Note that if the device does not support touch input this method has no
|
|
287 |
* effect.
|
|
288 |
* <p>
|
|
289 |
*
|
|
290 |
* @param touchInputModes
|
|
291 |
* a touch input mode to be set as preferred one.
|
|
292 |
* @throws IllegalArgumentException
|
|
293 |
* if the input mode is not valid or if it contains multiple
|
|
294 |
* input modes as bit mask.
|
|
295 |
* @see #setDisabledTouchInputModes(int)
|
|
296 |
* @see #getPreferredTouchMode()
|
|
297 |
*
|
|
298 |
*/
|
|
299 |
public void setPreferredTouchMode(int touchInputModes);
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Gets the preferred touch input mode.
|
|
303 |
* <p>
|
|
304 |
* Note that if the device does not support touch input this method returns
|
|
305 |
* <code>0</code>
|
|
306 |
* <p>
|
|
307 |
*
|
|
308 |
* @return The preferred touch input mode.
|
|
309 |
* <p>
|
|
310 |
* @see #setPreferredTouchMode(int)
|
|
311 |
* @see #setDisabledTouchInputModes(int)
|
|
312 |
*/
|
|
313 |
public int getPreferredTouchMode();
|
|
314 |
|
|
315 |
/**
|
|
316 |
* Sets the caret in the Editor at x, y location.
|
|
317 |
*
|
|
318 |
* @param x
|
|
319 |
* The x coordinate of the wanted caret position.
|
|
320 |
*
|
|
321 |
* @param y
|
|
322 |
* The y coordinate of the wanted caret position.
|
|
323 |
*/
|
|
324 |
public void setCaretXY(int x, int y);
|
|
325 |
|
|
326 |
/**
|
|
327 |
* Specifies whether or not the editor will receive touch-events.
|
|
328 |
* <p>
|
|
329 |
* This is enabled by default.
|
|
330 |
* An editor with touch-event disabled won't be able to perform any
|
|
331 |
* touch-related functionality such as scrolling or positioning the
|
|
332 |
* cursor. It may however still be controlled via the
|
|
333 |
* virtual keypad/control-panel if that is enabled, or receive other +
|
|
334 |
* input e.g. via physical keys
|
|
335 |
* <p>
|
|
336 |
* @param enabled
|
|
337 |
* true to enabled touch-event, false to disable
|
|
338 |
*/
|
|
339 |
public void setTouchEnabled(boolean enabled);
|
|
340 |
|
|
341 |
/**
|
|
342 |
* Gets the current touch-enabled state
|
|
343 |
* <p>
|
|
344 |
* @return true if the editor is touch-enabled, false otherwise
|
|
345 |
*/
|
|
346 |
public boolean isTouchEnabled();
|
|
347 |
}
|
|
348 |
|
|
349 |
// End of file
|