2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using static Interop.InputMethod;
21 namespace Tizen.Uix.InputMethod
24 /// Enumeration for Input Panel Layout
26 public enum InputPanelLayout
95 /// Enumeration for Layout Variation
97 public enum LayoutVariation
100 /// The plain normal layout
104 /// Filename layout; symbols such as '/', '\*', '\', '|', '<', '>', '?', '"' and ':' should be disabled
108 /// The name of a person
112 /// The plain normal number layout
114 NumberOnlyNormal = 0,
116 /// The number layout to allow a negative sign
120 /// The number layout to allow decimal point to provide fractional value
124 /// The number layout to allow decimal point and negative sign
126 NumberOnlySignedAndDecimal,
128 /// The normal password layout
132 /// The password layout to allow only number
142 /// Enumeration for AutoCapital Type
144 public enum AutoCapitalization
169 /// Enumeration for InputPanel ReturnKey Type
171 public enum InputPanelReturnKey
216 /// Enumeration for InputHints
218 public enum InputHints
243 /// Enumeration for BiDi Direction
245 public enum BiDirection
266 /// Enumeration for InputPanel Language
268 public enum InputPanelLanguage
285 /// This class represents the context of InputMethodEditor
287 public class InputMethodContext
289 private IntPtr _handle;
290 internal InputMethodContext(IntPtr handle)
296 /// Gets the layout information.
298 public InputPanelLayout Layout
302 InputPanelLayout layout;
303 ErrorCode error = ImeContextGetLayout(_handle, out layout);
304 if (error != ErrorCode.None)
306 Log.Error(LogTag, "GetLayout Failed with error " + error);
307 return InputPanelLayout.Undefined;
314 /// Gets the layout variation information.
316 public LayoutVariation LayoutVariation
320 LayoutVariation layoutVariation;
321 ErrorCode error = ImeContextGetLayoutVariation(_handle, out layoutVariation);
322 if (error != ErrorCode.None)
324 Log.Error(LogTag, "GetLayoutVariation Failed with error " + error);
325 return LayoutVariation.Undefined;
327 return layoutVariation;
332 /// Gets the cursor position information.
334 public int CursorPositionition
339 ErrorCode error = ImeContextGetCursorPositionition(_handle, out cursorPosition);
340 if (error != ErrorCode.None)
342 Log.Error(LogTag, "GetCursorPositionition Failed with error " + error);
345 return cursorPosition;
350 /// Gets the autocapital type information.
352 public AutoCapitalization AutoCapitalization
356 AutoCapitalization autoCapitalType;
357 ErrorCode error = ImeContextGetAutocapitalType(_handle, out autoCapitalType);
358 if (error != ErrorCode.None)
360 Log.Error(LogTag, "GetAutoCapitalization Failed with error " + error);
361 return AutoCapitalization.Undefined;
363 return autoCapitalType;
368 /// Gets the Return key label type information.
370 public InputPanelReturnKey ReturnKey
374 InputPanelReturnKey returnKeyType;
375 ErrorCode error = ImeContextGetReturnKey(_handle, out returnKeyType);
376 if (error != ErrorCode.None)
378 Log.Error(LogTag, "GetReturnKey Failed with error " + error);
379 return InputPanelReturnKey.Undefined;
381 return returnKeyType;
386 /// Gets the Return key state information.
388 public bool ReturnKeyState
393 ErrorCode error = ImeContextGetReturnKeyState(_handle, out returnKeyState);
394 if (error != ErrorCode.None)
396 Log.Error(LogTag, "GetReturnKeyState Failed with error " + error);
399 return returnKeyState;
404 /// Gets the prediction mode information.
406 public bool PredictionMode
411 ErrorCode error = ImeContextGetPredictionMode(_handle, out predictionMode);
412 if (error != ErrorCode.None)
414 Log.Error(LogTag, "GetPredictionMode Failed with error " + error);
417 return predictionMode;
422 /// Gets the password mode information.
424 public bool PasswordMode
429 ErrorCode error = ImeContextGetPasswordMode(_handle, out passwordMode);
430 if (error != ErrorCode.None)
432 Log.Error(LogTag, "GetPasswordMode Failed with error " + error);
440 /// Gets the input hint information.
442 public InputHints InputHint
446 InputHints inputHint;
447 ErrorCode error = ImeContextGetInputHint(_handle, out inputHint);
448 if (error != ErrorCode.None)
450 Log.Error(LogTag, "GetInputHint Failed with error " + error);
451 return InputHints.Undefined;
458 /// Gets the text bidirectional information.
460 public BiDirection BiDirection
464 BiDirection biDiDirection;
465 ErrorCode error = ImeContextGetBidiDirection(_handle, out biDiDirection);
466 if (error != ErrorCode.None)
468 Log.Error(LogTag, "GetBiDirection Failed with error " + error);
469 return BiDirection.Undefined;
471 return biDiDirection;
476 /// Gets the preferred language information.
478 public InputPanelLanguage Language
482 InputPanelLanguage langauge;
483 ErrorCode error = ImeContextGetLanguage(_handle, out langauge);
484 if (error != ErrorCode.None)
486 Log.Error(LogTag, "GetLanguage Failed with error " + error);
487 return InputPanelLanguage.Undefined;