-/*\r
-* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved\r
-*\r
-* Licensed under the Apache License, Version 2.0 (the License);\r
-* you may not use this file except in compliance with the License.\r
-* You may obtain a copy of the License at\r
-*\r
-* http://www.apache.org/licenses/LICENSE-2.0\r
-*\r
-* Unless required by applicable law or agreed to in writing, software\r
-* distributed under the License is distributed on an AS IS BASIS,\r
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-* See the License for the specific language governing permissions and\r
-* limitations under the License.\r
-*/\r
-\r
-\r
-using System;\r
-using System.Collections.Generic;\r
-using System.Runtime.InteropServices;\r
-using static Interop.InputMethod;\r
-\r
-namespace Tizen.Uix.InputMethod\r
-{\r
- /// <summary>\r
- /// Enumeration of the key codes.\r
- /// If keycode & 0xff000000 == 0x01000000 then this key code is directly encoded 24-bit UCS character.The UCS value is keycode & 0x00ffffff.\r
- /// Defines the list of keys supported by the system.Note that certain keys may not be available on all devices.\r
- /// </summary>\r
- public enum KeyCode\r
- {\r
- /// <summary>\r
- /// The backspace key\r
- /// </summary>\r
- IME_KEY_BackSpace = 0xFF08,\r
- /// <summary>\r
- /// The tab key\r
- /// </summary>\r
- IME_KEY_Tab = 0xFF09,\r
- /// <summary>\r
- /// The linefeed key\r
- /// </summary>\r
- IME_KEY_Linefeed = 0xFF0A,\r
- /// <summary>\r
- /// The clear key\r
- /// </summary>\r
- IME_KEY_Clear = 0xFF0B,\r
- /// <summary>\r
- /// The return key\r
- /// </summary>\r
- IME_KEY_Return = 0xFF0D,\r
- /// <summary>\r
- /// The pause key\r
- /// </summary>\r
- IME_KEY_Pause = 0xFF13,\r
- /// <summary>\r
- /// The scroll lock key\r
- /// </summary>\r
- IME_KEY_Scroll_Lock = 0xFF14,\r
- /// <summary>\r
- /// The sys req key\r
- /// </summary>\r
- IME_KEY_Sys_Req = 0xFF15,\r
- /// <summary>\r
- /// The escape key\r
- /// </summary>\r
- IME_KEY_Escape = 0xFF1B,\r
- /// <summary>\r
- /// The delete key\r
- /// </summary>\r
- IME_KEY_Delete = 0xFFFF,\r
-\r
- /* Cursor control & motion */\r
- /// <summary>\r
- /// The home key\r
- /// </summary>\r
- IME_KEY_Home = 0xFF50,\r
- /// <summary>\r
- /// The left directional key\r
- /// </summary>\r
- IME_KEY_Left = 0xFF51,\r
- /// <summary>\r
- /// The up directional key\r
- /// </summary>\r
- IME_KEY_Up = 0xFF52,\r
- /// <summary>\r
- /// The right directional key\r
- /// </summary>\r
- IME_KEY_Right = 0xFF53,\r
- /// <summary>\r
- /// The down directional key\r
- /// </summary>\r
- IME_KEY_Down = 0xFF54,\r
- /// <summary>\r
- /// The prior, previous key\r
- /// </summary>\r
- IME_KEY_Prior = 0xFF55,\r
- /// <summary>\r
- /// The page up key\r
- /// </summary>\r
- IME_KEY_Page_Up = 0xFF55,\r
- /// <summary>\r
- /// The next key\r
- /// </summary>\r
- IME_KEY_Next = 0xFF56,\r
- /// <summary>\r
- /// The page down key\r
- /// </summary>\r
- IME_KEY_Page_Down = 0xFF56,\r
- /// <summary>\r
- /// The end key\r
- /// </summary>\r
- IME_KEY_End = 0xFF57,\r
- /// <summary>\r
- /// The begin key\r
- /// </summary>\r
- IME_KEY_Begin = 0xFF58,\r
-\r
- /* Misc Functions */\r
- /// <summary>\r
- /// The select key\r
- /// </summary>\r
- IME_KEY_Select = 0xFF60,\r
- /// <summary>\r
- /// The print key\r
- /// </summary>\r
- IME_KEY_Print = 0xFF61,\r
- /// <summary>\r
- /// The execute, run, do key\r
- /// </summary>\r
- IME_KEY_Execute = 0xFF62,\r
- /// <summary>\r
- /// The insert key\r
- /// </summary>\r
- IME_KEY_Insert = 0xFF63,\r
- /// <summary>\r
- /// The undo key\r
- /// </summary>\r
- IME_KEY_Undo = 0xFF65,\r
- /// <summary>\r
- /// The redo key\r
- /// </summary>\r
- IME_KEY_Redo = 0xFF66,\r
- /// <summary>\r
- /// The menu key\r
- /// </summary>\r
- IME_KEY_Menu = 0xFF67,\r
- /// <summary>\r
- /// The find key\r
- /// </summary>\r
- IME_KEY_Find = 0xFF68,\r
- /// <summary>\r
- /// The cancel, stop, abort, exit key\r
- /// </summary>\r
- IME_KEY_Cancel = 0xFF69,\r
- /// <summary>\r
- /// The help key\r
- /// </summary>\r
- IME_KEY_Help = 0xFF6A,\r
- /// <summary>\r
- /// The break key\r
- /// </summary>\r
- IME_KEY_Break = 0xFF6B,\r
- /// <summary>\r
- /// The character set switch key\r
- /// </summary>\r
- IME_KEY_Mode_switch = 0xFF7E,\r
- /// <summary>\r
- /// The num lock key\r
- /// </summary>\r
- IME_KEY_Num_Lock = 0xFF7F,\r
-\r
- /* Keypad */\r
- /// <summary>\r
- /// The Numpad space key\r
- /// </summary>\r
- IME_KEY_KP_Space = 0xFF80,\r
- /// <summary>\r
- /// The Numpad tab key\r
- /// </summary>\r
- IME_KEY_KP_Tab = 0xFF89,\r
- /// <summary>\r
- /// The Numpad enter key\r
- /// </summary>\r
- IME_KEY_KP_Enter = 0xFF8D,\r
- /// <summary>\r
- /// The Numpad function 1 key\r
- /// </summary>\r
- IME_KEY_KP_F1 = 0xFF91,\r
- /// <summary>\r
- /// The Numpad function 2 key\r
- /// </summary>\r
- IME_KEY_KP_F2 = 0xFF92,\r
- /// <summary>\r
- /// The Numpad function 3 key\r
- /// </summary>\r
- IME_KEY_KP_F3 = 0xFF93,\r
- /// <summary>\r
- /// The Numpad function 4 key\r
- /// </summary>\r
- IME_KEY_KP_F4 = 0xFF94,\r
- /// <summary>\r
- /// The Numpad home key\r
- /// </summary>\r
- IME_KEY_KP_Home = 0xFF95,\r
- /// <summary>\r
- /// The Numpad left key\r
- /// </summary>\r
- IME_KEY_KP_Left = 0xFF96,\r
- /// <summary>\r
- /// The Numpad up key\r
- /// </summary>\r
- IME_KEY_KP_Up = 0xFF97,\r
- /// <summary>\r
- /// The Numpad right key\r
- /// </summary>\r
- IME_KEY_KP_Right = 0xFF98,\r
- /// <summary>\r
- /// The Numpad down key\r
- /// </summary>\r
- IME_KEY_KP_Down = 0xFF99,\r
- /// <summary>\r
- /// The Numpad prior, previous key\r
- /// </summary>\r
- IME_KEY_KP_Prior = 0xFF9A,\r
- /// <summary>\r
- /// The Numpad page up key\r
- /// </summary>\r
- IME_KEY_KP_Page_Up = 0xFF9A,\r
- /// <summary>\r
- /// The Numpad next key\r
- /// </summary>\r
- IME_KEY_KP_Next = 0xFF9B,\r
- /// <summary>\r
- /// The Numpad page down key\r
- /// </summary>\r
- IME_KEY_KP_Page_Down = 0xFF9B,\r
- /// <summary>\r
- /// The Numpad end key\r
- /// </summary>\r
- IME_KEY_KP_End = 0xFF9C,\r
- /// <summary>\r
- /// The Numpad begin key\r
- /// </summary>\r
- IME_KEY_KP_Begin = 0xFF9D,\r
- /// <summary>\r
- /// The Numpad insert key\r
- /// </summary>\r
- IME_KEY_KP_Insert = 0xFF9E,\r
- /// <summary>\r
- /// The Numpad delete key\r
- /// </summary>\r
- IME_KEY_KP_Delete = 0xFF9F,\r
- /// <summary>\r
- /// The Numpad equal key\r
- /// </summary>\r
- IME_KEY_KP_Equal = 0xFFBD,\r
- /// <summary>\r
- /// The Numpad multiply key\r
- /// </summary>\r
- IME_KEY_KP_Multiply = 0xFFAA,\r
- /// <summary>\r
- /// The Numpad add key\r
- /// </summary>\r
- IME_KEY_KP_Add = 0xFFAB,\r
- /// <summary>\r
- /// The Numpad separator key\r
- /// </summary>\r
- IME_KEY_KP_Separator = 0xFFAC,\r
- /// <summary>\r
- /// The Numpad subtract key\r
- /// </summary>\r
- IME_KEY_KP_Subtract = 0xFFAD,\r
- /// <summary>\r
- /// The Numpad decimal key\r
- /// </summary>\r
- IME_KEY_KP_Decimal = 0xFFAE,\r
- /// <summary>\r
- /// The Numpad divide key\r
- /// </summary>\r
- IME_KEY_KP_Divide = 0xFFAF,\r
- /// <summary>\r
- /// The Numpad 0 key\r
- /// </summary>\r
- IME_KEY_KP_0 = 0xFFB0,\r
- /// <summary>\r
- /// The Numpad 1 key\r
- /// </summary>\r
- IME_KEY_KP_1 = 0xFFB1,\r
- /// <summary>\r
- /// The Numpad 2 key\r
- /// </summary>\r
- IME_KEY_KP_2 = 0xFFB2,\r
- /// <summary>\r
- /// The Numpad 3 key\r
- /// </summary>\r
- IME_KEY_KP_3 = 0xFFB3,\r
- /// <summary>\r
- /// The Numpad 4 key\r
- /// </summary>\r
- IME_KEY_KP_4 = 0xFFB4,\r
- /// <summary>\r
- /// The Numpad 5 key\r
- /// </summary>\r
- IME_KEY_KP_5 = 0xFFB5,\r
- /// <summary>\r
- /// The Numpad 6 key\r
- /// </summary>\r
- IME_KEY_KP_6 = 0xFFB6,\r
- /// <summary>\r
- /// The Numpad 7 key\r
- /// </summary>\r
- IME_KEY_KP_7 = 0xFFB7,\r
- /// <summary>\r
- /// The Numpad 8 key\r
- /// </summary>\r
- IME_KEY_KP_8 = 0xFFB8,\r
- /// <summary>\r
- /// The Numpad 9 key\r
- /// </summary>\r
- IME_KEY_KP_9 = 0xFFB9,\r
-\r
- /* Auxilliary Functions */\r
- /// <summary>\r
- /// The function 1 key\r
- /// </summary>\r
- IME_KEY_F1 = 0xFFBE,\r
- /// <summary>\r
- /// The function 2 key\r
- /// </summary>\r
- IME_KEY_F2 = 0xFFBF,\r
- /// <summary>\r
- /// The function 3 key\r
- /// </summary>\r
- IME_KEY_F3 = 0xFFC0,\r
- /// <summary>\r
- /// The function 4 key\r
- /// </summary>\r
- IME_KEY_F4 = 0xFFC1,\r
- /// <summary>\r
- /// The function 5 key\r
- /// </summary>\r
- IME_KEY_F5 = 0xFFC2,\r
- /// <summary>\r
- /// The function 6 key\r
- /// </summary>\r
- IME_KEY_F6 = 0xFFC3,\r
- /// <summary>\r
- /// The function 7 key\r
- /// </summary>\r
- IME_KEY_F7 = 0xFFC4,\r
- /// <summary>\r
- /// The function 8 key\r
- /// </summary>\r
- IME_KEY_F8 = 0xFFC5,\r
- /// <summary>\r
- /// The function 9 key\r
- /// </summary>\r
- IME_KEY_F9 = 0xFFC6,\r
- /// <summary>\r
- /// The function 10 key\r
- /// </summary>\r
- IME_KEY_F10 = 0xFFC7,\r
- /// <summary>\r
- /// The function 11 key\r
- /// </summary>\r
- IME_KEY_F11 = 0xFFC8,\r
- /// <summary>\r
- /// The function 12 key\r
- /// </summary>\r
- IME_KEY_F12 = 0xFFC9,\r
- /// <summary>\r
- /// The function 13 key\r
- /// </summary>\r
- IME_KEY_F13 = 0xFFCA,\r
- /// <summary>\r
- /// The function 14 key\r
- /// </summary>\r
- IME_KEY_F14 = 0xFFCB,\r
- /// <summary>\r
- /// The function 15 key\r
- /// </summary>\r
- IME_KEY_F15 = 0xFFCC,\r
- /// <summary>\r
- /// The function 16 key\r
- /// </summary>\r
- IME_KEY_F16 = 0xFFCD,\r
- /// <summary>\r
- /// The function 17 key\r
- /// </summary>\r
- IME_KEY_F17 = 0xFFCE,\r
- /// <summary>\r
- /// The function 18 key\r
- /// </summary>\r
- IME_KEY_F18 = 0xFFCF,\r
- /// <summary>\r
- /// The function 19 key\r
- /// </summary>\r
- IME_KEY_F19 = 0xFFD0,\r
- /// <summary>\r
- /// The function 20 key\r
- /// </summary>\r
- IME_KEY_F20 = 0xFFD1,\r
- /// <summary>\r
- /// The function 21 key\r
- /// </summary>\r
- IME_KEY_F21 = 0xFFD2,\r
- /// <summary>\r
- /// The function 22 key\r
- /// </summary>\r
- IME_KEY_F22 = 0xFFD3,\r
- /// <summary>\r
- /// The function 23 key\r
- /// </summary>\r
- IME_KEY_F23 = 0xFFD4,\r
- /// <summary>\r
- /// The function 24 key\r
- /// </summary>\r
- IME_KEY_F24 = 0xFFD5,\r
- /// <summary>\r
- /// The function 25 key\r
- /// </summary>\r
- IME_KEY_F25 = 0xFFD6,\r
- /// <summary>\r
- /// The function 26 key\r
- /// </summary>\r
- IME_KEY_F26 = 0xFFD7,\r
- /// <summary>\r
- /// The function 27 key\r
- /// </summary>\r
- IME_KEY_F27 = 0xFFD8,\r
- /// <summary>\r
- /// The function 28 key\r
- /// </summary>\r
- IME_KEY_F28 = 0xFFD9,\r
- /// <summary>\r
- /// The function 29 key\r
- /// </summary>\r
- IME_KEY_F29 = 0xFFDA,\r
- /// <summary>\r
- /// The function 30 key\r
- /// </summary>\r
- IME_KEY_F30 = 0xFFDB,\r
- /// <summary>\r
- /// The function 31 key\r
- /// </summary>\r
- IME_KEY_F31 = 0xFFDC,\r
- /// <summary>\r
- /// The function 32 key\r
- /// </summary>\r
- IME_KEY_F32 = 0xFFDD,\r
- /// <summary>\r
- /// The function 33 key\r
- /// </summary>\r
- IME_KEY_F33 = 0xFFDE,\r
- /// <summary>\r
- /// The function 34 key\r
- /// </summary>\r
- IME_KEY_F34 = 0xFFDF,\r
- /// <summary>\r
- /// The function 35 key\r
- /// </summary>\r
- IME_KEY_F35 = 0xFFE0,\r
-\r
- /* Modifier keys */\r
- /// <summary>\r
- /// The left shift key\r
- /// </summary>\r
- IME_KEY_Shift_L = 0xFFE1,\r
- /// <summary>\r
- /// The right shift key\r
- /// </summary>\r
- IME_KEY_Shift_R = 0xFFE2,\r
- /// <summary>\r
- /// The left control key\r
- /// </summary>\r
- IME_KEY_Control_L = 0xFFE3,\r
- /// <summary>\r
- /// The right control key\r
- /// </summary>\r
- IME_KEY_Control_R = 0xFFE4,\r
- /// <summary>\r
- /// The caps lock key\r
- /// </summary>\r
- IME_KEY_Caps_Lock = 0xFFE5,\r
- /// <summary>\r
- /// The shift lock key\r
- /// </summary>\r
- IME_KEY_Shift_Lock = 0xFFE6,\r
- /// <summary>\r
- /// The left meta key\r
- /// </summary>\r
- IME_KEY_Meta_L = 0xFFE7,\r
- /// <summary>\r
- /// The right meta key\r
- /// </summary>\r
- IME_KEY_Meta_R = 0xFFE8,\r
- /// <summary>\r
- /// The left alt key\r
- /// </summary>\r
- IME_KEY_Alt_L = 0xFFE9,\r
- /// <summary>\r
- /// The right alt key\r
- /// </summary>\r
- IME_KEY_Alt_R = 0xFFEA,\r
- /// <summary>\r
- /// The left super key\r
- /// </summary>\r
- IME_KEY_Super_L = 0xFFEB,\r
- /// <summary>\r
- /// The right super key\r
- /// </summary>\r
- IME_KEY_Super_R = 0xFFEC,\r
- /// <summary>\r
- /// The left hyper key\r
- /// </summary>\r
- IME_KEY_Hyper_L = 0xFFED,\r
- /// <summary>\r
- /// The right hyper key\r
- /// </summary>\r
- IME_KEY_Hyper_R = 0xFFEE,\r
-\r
- /* Latin 1 */\r
- /// <summary>\r
- /// The space key\r
- /// </summary>\r
- IME_KEY_space = 0x020,\r
- /// <summary>\r
- /// The exclamation key\r
- /// </summary>\r
- IME_KEY_exclam = 0x021,\r
- /// <summary>\r
- /// The quotedbl key\r
- /// </summary>\r
- IME_KEY_quotedbl = 0x022,\r
- /// <summary>\r
- /// The number sign key\r
- /// </summary>\r
- IME_KEY_numbersign = 0x023,\r
- /// <summary>\r
- /// The dollar key\r
- /// </summary>\r
- IME_KEY_dollar = 0x024,\r
- /// <summary>\r
- /// The percent key\r
- /// </summary>\r
- IME_KEY_percent = 0x025,\r
- /// <summary>\r
- /// The ampersand key\r
- /// </summary>\r
- IME_KEY_ampersand = 0x026,\r
- /// <summary>\r
- /// The apostrophe key\r
- /// </summary>\r
- IME_KEY_apostrophe = 0x027,\r
- /// <summary>\r
- /// The parenleft key\r
- /// </summary>\r
- IME_KEY_parenleft = 0x028,\r
- /// <summary>\r
- /// The parenright key\r
- /// </summary>\r
- IME_KEY_parenright = 0x029,\r
- /// <summary>\r
- /// The asterisk key\r
- /// </summary>\r
- IME_KEY_asterisk = 0x02a,\r
- /// <summary>\r
- /// The plus key\r
- /// </summary>\r
- IME_KEY_plus = 0x02b,\r
- /// <summary>\r
- /// The comma key\r
- /// </summary>\r
- IME_KEY_comma = 0x02c,\r
- /// <summary>\r
- /// The minus key\r
- /// </summary>\r
- IME_KEY_minus = 0x02d,\r
- /// <summary>\r
- /// The period key\r
- /// </summary>\r
- IME_KEY_period = 0x02e,\r
- /// <summary>\r
- /// The slash key\r
- /// </summary>\r
- IME_KEY_slash = 0x02f,\r
- /// <summary>\r
- /// The 0 key\r
- /// </summary>\r
- IME_KEY_0 = 0x030,\r
- /// <summary>\r
- /// The 1 key\r
- /// </summary>\r
- IME_KEY_1 = 0x031,\r
- /// <summary>\r
- /// The 2 key\r
- /// </summary>\r
- IME_KEY_2 = 0x032,\r
- /// <summary>\r
- /// The 3 key\r
- /// </summary>\r
- IME_KEY_3 = 0x033,\r
- /// <summary>\r
- /// The 4 key\r
- /// </summary>\r
- IME_KEY_4 = 0x034,\r
- /// <summary>\r
- /// The 5 key\r
- /// </summary>\r
- IME_KEY_5 = 0x035,\r
- /// <summary>\r
- /// The 6 key\r
- /// </summary>\r
- IME_KEY_6 = 0x036,\r
- /// <summary>\r
- /// The 7 key\r
- /// </summary>\r
- IME_KEY_7 = 0x037,\r
- /// <summary>\r
- /// The 8 key\r
- /// </summary>\r
- IME_KEY_8 = 0x038,\r
- /// <summary>\r
- /// The 9 key\r
- /// </summary>\r
- IME_KEY_9 = 0x039,\r
- /// <summary>\r
- /// The colon key\r
- /// </summary>\r
- IME_KEY_colon = 0x03a,\r
- /// <summary>\r
- /// The semicolon key\r
- /// </summary>\r
- IME_KEY_semicolon = 0x03b,\r
- /// <summary>\r
- /// The less key\r
- /// </summary>\r
- IME_KEY_less = 0x03c,\r
- /// <summary>\r
- /// The equal key\r
- /// </summary>\r
- IME_KEY_equal = 0x03d,\r
- /// <summary>\r
- /// The greater key\r
- /// </summary>\r
- IME_KEY_greater = 0x03e,\r
- /// <summary>\r
- /// The question key\r
- /// </summary>\r
- IME_KEY_question = 0x03f,\r
- /// <summary>\r
- /// The at key\r
- /// </summary>\r
- IME_KEY_at = 0x040,\r
- /// <summary>\r
- /// The A key\r
- /// </summary>\r
- IME_KEY_A = 0x041,\r
- /// <summary>\r
- /// The B key\r
- /// </summary>\r
- IME_KEY_B = 0x042,\r
- /// <summary>\r
- /// The C key\r
- /// </summary>\r
- IME_KEY_C = 0x043,\r
- /// <summary>\r
- /// The D key\r
- /// </summary>\r
- IME_KEY_D = 0x044,\r
- /// <summary>\r
- /// The E key\r
- /// </summary>\r
- IME_KEY_E = 0x045,\r
- /// <summary>\r
- /// The F key\r
- /// </summary>\r
- IME_KEY_F = 0x046,\r
- /// <summary>\r
- /// The G key\r
- /// </summary>\r
- IME_KEY_G = 0x047,\r
- /// <summary>\r
- /// The H key\r
- /// </summary>\r
- IME_KEY_H = 0x048,\r
- /// <summary>\r
- /// The I key\r
- /// </summary>\r
- IME_KEY_I = 0x049,\r
- /// <summary>\r
- /// The J key\r
- /// </summary>\r
- IME_KEY_J = 0x04a,\r
- /// <summary>\r
- /// The K key\r
- /// </summary>\r
- IME_KEY_K = 0x04b,\r
- /// <summary>\r
- /// The L key\r
- /// </summary>\r
- IME_KEY_L = 0x04c,\r
- /// <summary>\r
- /// The M key\r
- /// </summary>\r
- IME_KEY_M = 0x04d,\r
- /// <summary>\r
- /// The N key\r
- /// </summary>\r
- IME_KEY_N = 0x04e,\r
- /// <summary>\r
- /// The O key\r
- /// </summary>\r
- IME_KEY_O = 0x04f,\r
- /// <summary>\r
- /// The P key\r
- /// </summary>\r
- IME_KEY_P = 0x050,\r
- /// <summary>\r
- /// The Q key\r
- /// </summary>\r
- IME_KEY_Q = 0x051,\r
- /// <summary>\r
- /// The R key\r
- /// </summary>\r
- IME_KEY_R = 0x052,\r
- /// <summary>\r
- /// The S key\r
- /// </summary>\r
- IME_KEY_S = 0x053,\r
- /// <summary>\r
- /// The T key\r
- /// </summary>\r
- IME_KEY_T = 0x054,\r
- /// <summary>\r
- /// The U key\r
- /// </summary>\r
- IME_KEY_U = 0x055,\r
- /// <summary>\r
- /// The V key\r
- /// </summary>\r
- IME_KEY_V = 0x056,\r
- /// <summary>\r
- /// The W key\r
- /// </summary>\r
- IME_KEY_W = 0x057,\r
- /// <summary>\r
- /// The X key\r
- /// </summary>\r
- IME_KEY_X = 0x058,\r
- /// <summary>\r
- /// The Y key\r
- /// </summary>\r
- IME_KEY_Y = 0x059,\r
- /// <summary>\r
- /// The Z key\r
- /// </summary>\r
- IME_KEY_Z = 0x05a,\r
- /// <summary>\r
- /// The left bracket key\r
- /// </summary>\r
- IME_KEY_bracketleft = 0x05b,\r
- /// <summary>\r
- /// The backslash key\r
- /// </summary>\r
- IME_KEY_backslash = 0x05c,\r
- /// <summary>\r
- /// The right bracket key\r
- /// </summary>\r
- IME_KEY_bracketright = 0x05d,\r
- /// <summary>\r
- /// The circumflex key\r
- /// </summary>\r
- IME_KEY_asciicircum = 0x05e,\r
- /// <summary>\r
- /// The underscore key\r
- /// </summary>\r
- IME_KEY_underscore = 0x05f,\r
- /// <summary>\r
- /// The grave key\r
- /// </summary>\r
- IME_KEY_grave = 0x060,\r
- /// <summary>\r
- /// The a key\r
- /// </summary>\r
- IME_KEY_a = 0x061,\r
- /// <summary>\r
- /// The b key\r
- /// </summary>\r
- IME_KEY_b = 0x062,\r
- /// <summary>\r
- /// The c key\r
- /// </summary>\r
- IME_KEY_c = 0x063,\r
- /// <summary>\r
- /// The d key\r
- /// </summary>\r
- IME_KEY_d = 0x064,\r
- /// <summary>\r
- /// The e key\r
- /// </summary>\r
- IME_KEY_e = 0x065,\r
- /// <summary>\r
- /// The f key\r
- /// </summary>\r
- IME_KEY_f = 0x066,\r
- /// <summary>\r
- /// The g key\r
- /// </summary>\r
- IME_KEY_g = 0x067,\r
- /// <summary>\r
- /// The h key\r
- /// </summary>\r
- IME_KEY_h = 0x068,\r
- /// <summary>\r
- /// The i key\r
- /// </summary>\r
- IME_KEY_i = 0x069,\r
- /// <summary>\r
- /// The j key\r
- /// </summary>\r
- IME_KEY_j = 0x06a,\r
- /// <summary>\r
- /// The k key\r
- /// </summary>\r
- IME_KEY_k = 0x06b,\r
- /// <summary>\r
- /// The l key\r
- /// </summary>\r
- IME_KEY_l = 0x06c,\r
- /// <summary>\r
- /// The m key\r
- /// </summary>\r
- IME_KEY_m = 0x06d,\r
- /// <summary>\r
- /// The n key\r
- /// </summary>\r
- IME_KEY_n = 0x06e,\r
- /// <summary>\r
- /// The o key\r
- /// </summary>\r
- IME_KEY_o = 0x06f,\r
- /// <summary>\r
- /// The p key\r
- /// </summary>\r
- IME_KEY_p = 0x070,\r
- /// <summary>\r
- /// The q key\r
- /// </summary>\r
- IME_KEY_q = 0x071,\r
- /// <summary>\r
- /// The r key\r
- /// </summary>\r
- IME_KEY_r = 0x072,\r
- /// <summary>\r
- /// The s key\r
- /// </summary>\r
- IME_KEY_s = 0x073,\r
- /// <summary>\r
- /// The t key\r
- /// </summary>\r
- IME_KEY_t = 0x074,\r
- /// <summary>\r
- /// The u key\r
- /// </summary>\r
- IME_KEY_u = 0x075,\r
- /// <summary>\r
- /// The v key\r
- /// </summary>\r
- IME_KEY_v = 0x076,\r
- /// <summary>\r
- /// The w key\r
- /// </summary>\r
- IME_KEY_w = 0x077,\r
- /// <summary>\r
- /// The x key\r
- /// </summary>\r
- IME_KEY_x = 0x078,\r
- /// <summary>\r
- /// The y key\r
- /// </summary>\r
- IME_KEY_y = 0x079,\r
- /// <summary>\r
- /// The z key\r
- /// </summary>\r
- IME_KEY_z = 0x07a,\r
- /// <summary>\r
- /// The left brace key\r
- /// </summary>\r
- IME_KEY_braceleft = 0x07b,\r
- /// <summary>\r
- /// The bar key\r
- /// </summary>\r
- IME_KEY_bar = 0x07c,\r
- /// <summary>\r
- /// The right brace key\r
- /// </summary>\r
- IME_KEY_braceright = 0x07d,\r
- /// <summary>\r
- /// The tilde key\r
- /// </summary>\r
- IME_KEY_asciitilde = 0x07e,\r
- };\r
-\r
- /// <summary>\r
- /// Enumeration of the key masks.\r
- /// The key masks indicate which modifier keys is pressed down during the keyboard hit.The special IME_KEY_MASK_RELEASED indicates the key release event.\r
- /// </summary>\r
- public enum KeyMask\r
- {\r
- /// <summary>\r
- /// Key press event without modifier key\r
- /// </summary>\r
- IME_KEY_MASK_PRESSED = 0,\r
- /// <summary>\r
- /// The Shift key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_SHIFT = (1 << 0),\r
- /// <summary>\r
- /// The CapsLock key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_CAPSLOCK = (1 << 1),\r
- /// <summary>\r
- /// The Control key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_CONTROL = (1 << 2),\r
- /// <summary>\r
- /// The Alt key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_ALT = (1 << 3),\r
- /// <summary>\r
- /// The Meta key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_META = (1 << 4),\r
- /// <summary>\r
- /// The Win (between Control and Alt) is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_WIN = (1 << 5),\r
- /// <summary>\r
- /// The Hyper key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_HYPER = (1 << 6),\r
- /// <summary>\r
- /// The NumLock key is pressed down\r
- /// </summary>\r
- IME_KEY_MASK_NUMLOCK = (1 << 7),\r
- /// <summary>\r
- /// Key release event\r
- /// </summary>\r
- IME_KEY_MASK_RELEASED = (1 << 15),\r
- }\r
-\r
- /// <summary>\r
- /// This class contains api's related to IME(Input method editor)\r
- /// </summary>\r
- public static class InputMethodEditor\r
- {\r
- private static Object thisLock = new Object();\r
- private static ImeCallbackStructGCHandle _imeCallbackStructGCHandle = new ImeCallbackStructGCHandle();\r
- private static event EventHandler<FocusInEventArgs> _focusIn;\r
- private static ImeFocusInCb _imeFocusInDelegate;\r
- private static event EventHandler<FocusOutEventArgs> _focusOut;\r
- private static ImeFocusOutCb _imeFocusOutDelegate;\r
- private static event EventHandler<SurroundingTextUpdatedEventArgs> _surroundingTextUpdated;\r
- private static ImeSurroundingTextUpdatedCb _imeSurroundingTextUpdatedDelegate;\r
- private static event EventHandler<System.EventArgs> _inputContextReset;\r
- private static ImeInputContextResetCb _imeInputContextResetDelegate;\r
- private static event EventHandler<CursorPositionUpdatedEventArgs> _cursorPositionUpdated;\r
- private static ImeCursorPositionUpdatedCb _imeCursorPositionUpdatedDelegate;\r
- private static event EventHandler<LangaugeSetEventArgs> _langaugeSet;\r
- private static ImeLanguageSetCb _imeLangaugeSetDelegate;\r
- private static event EventHandler<ImDataSetEventArgs> _imDataSet;\r
- private static ImeImdataSetCb _imeImDataSetDelegate;\r
- private static event EventHandler<LayoutSetEventArgs> _layoutSet;\r
- private static ImeLayoutSetCb _imeLayoutSetDelegate;\r
- private static event EventHandler<ReturnKeyTypeSetEventArgs> _returnKeyTypeSet;\r
- private static ImeReturnKeyTypeSetCb _imeReturnKeyTypeSetDelegate;\r
- private static event EventHandler<ReturnKeyStateSetEventArgs> _returnKeyStateSet;\r
- private static ImeReturnKeyStateSetCb _imeReturnKeyStateSetDelegate;\r
- private static event ProcessKeyEventHandler _processKey;\r
- private static ImeProcessKeyEventCb _imeProcessKeyDelegate;\r
- private static event EventHandler<DisplayLanaguageChangedEventArgs> _displayLanaguageChanged;\r
- private static ImeDisplayLanguageChangedCb _imeDisplayLanaguageChangedDelegate;\r
- private static event EventHandler<RotationDegreeChangedEventArgs> _rotationDegreeChanged;\r
- private static ImeRotationDegreeChangedCb _imeRotationDegreeChangedDelegate;\r
- private static event EventHandler<AccessibilityStateChangedEventArgs> _accessibilityStateChanged;\r
- private static ImeAccessibilityStateChangedCb _imeAccessibilityStateChangedDelegate;\r
- private static event EventHandler<OptionWindowCreatedEventArgs> _optionWindowCreated;\r
- private static ImeOptionWindowCreatedCb _imeOptionWindowCreatedDelegate;\r
- private static event EventHandler<OptionWindowDestroyedEventArgs> _optionWindowDestroyed;\r
- private static ImeOptionWindowDestroyedCb _imeOptionWindowDestroyedDelegate;\r
- private static ImeLanguageRequestedCb _imeLanguageRequestedDelegate;\r
- private static OutAction<string> _languageRequestedDelegate;\r
- private static ImeImdataRequestedCb _imeImDataRequestedDelegate;\r
- private static OutAction<byte, uint> _imDataRequestedDelegate;\r
- private static ImeGeometryRequestedCb _imeGeometryRequestedDelegate;\r
- private static OutAction1<int> _geometryRequestedDelegate;\r
- private static Action _userCreate;\r
- private static Action _userTerminate;\r
- private static Action<int, InputMethodContext> _userShow;\r
- private static Action<int> _userHide;\r
- private static ImeCreateCb _create = (IntPtr userData) =>\r
- {\r
- Log.Info(LogTag, "In Create Delegate");\r
- _userCreate?.Invoke();\r
- };\r
- private static ImeTerminateCb _terminate = (IntPtr userData) =>\r
- {\r
- Log.Info(LogTag, "In terminate Delegate");\r
- _userTerminate?.Invoke();\r
- };\r
- private static ImeShowCb _show = (int contextId, IntPtr context, IntPtr userData) =>\r
- {\r
- Log.Info(LogTag, "In Show Delegate");\r
- _userShow?.Invoke(contextId, new InputMethodContext(context));\r
- };\r
- private static ImeHideCb _hide = (int contextId, IntPtr userData) =>\r
- {\r
- Log.Info(LogTag, "In Hide Delegate");\r
- _userHide?.Invoke(contextId);\r
- };\r
-\r
-\r
- /// <summary>\r
- /// An Action with 1 out parameter\r
- /// </summary>\r
- /// <typeparam name="T">Generic Type</typeparam>\r
- /// <param name="a">The out parameter</param>\r
- public delegate void OutAction<T>(out T a);\r
-\r
- /// <summary>\r
- /// An Action with 2 out parameter's\r
- /// </summary>\r
- /// <typeparam name="T">Generic Type</typeparam>\r
- /// <typeparam name="T1">Generic Type</typeparam>\r
- /// <param name="a">The out parameter 1</param>\r
- /// <param name="b">The out parameter 2</param>\r
- public delegate void OutAction<T,T1>(out T[] a, out T1 b);\r
-\r
- /// <summary>\r
- /// An Action with 4 out parameter's\r
- /// </summary>\r
- /// <typeparam name="T">Generic Type</typeparam>\r
- /// <param name="a">The out parameter 1</param>\r
- /// <param name="b">The out parameter 2</param>\r
- /// <param name="c">The out parameter 3</param>\r
- /// <param name="d">The out parameter 4</param>\r
- public delegate void OutAction1<T>(out T a, out T b, out T c, out T d);\r
-\r
-\r
- /// <summary>\r
- /// Called when an associated text input UI control has focus.\r
- /// </summary>\r
- public static event EventHandler<FocusInEventArgs> FocusIn\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeFocusInDelegate = (int contextId, IntPtr userData) =>\r
- {\r
- FocusInEventArgs args = new FocusInEventArgs(contextId);\r
- _focusIn?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetFocusInCb(_imeFocusInDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add FocusIn Failed with error " + error);\r
- }\r
- else\r
- {\r
- _focusIn += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _focusIn -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when an associated text input UI control loses focus.\r
- /// </summary>\r
- public static event EventHandler<FocusOutEventArgs> FocusOut\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeFocusOutDelegate = (int contextId, IntPtr userData) =>\r
- {\r
- FocusOutEventArgs args = new FocusOutEventArgs(contextId);\r
- _focusOut?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetFocusOutCb(_imeFocusOutDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add FocusOut Failed with error " + error);\r
- }\r
- else\r
- {\r
- _focusOut += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _focusOut -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when an associated text input UI control responds to a request with the surrounding text.\r
- /// </summary>\r
- public static event EventHandler<SurroundingTextUpdatedEventArgs> SurroundingTextUpdated\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeSurroundingTextUpdatedDelegate = (int contextId, IntPtr text, int cursorPos, IntPtr userData) =>\r
- {\r
- SurroundingTextUpdatedEventArgs args = new SurroundingTextUpdatedEventArgs(contextId, Marshal.PtrToStringAnsi(text), cursorPos);\r
- _surroundingTextUpdated?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetSurroundingTextUpdatedCb(_imeSurroundingTextUpdatedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add SurroundingTextUpdated Failed with error " + error);\r
- }\r
- else\r
- {\r
- _surroundingTextUpdated += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _surroundingTextUpdated -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called to reset the input context of an associated text input UI control.\r
- /// </summary>\r
- public static event EventHandler<System.EventArgs> InputContextReset\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeInputContextResetDelegate = (IntPtr userData) =>\r
- {\r
- _inputContextReset?.Invoke(null, System.EventArgs.Empty);\r
- };\r
- ErrorCode error = ImeEventSetInputContextResetCb(_imeInputContextResetDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add InputContextReset Failed with error " + error);\r
- }\r
- else\r
- {\r
- _inputContextReset += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _inputContextReset -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when the position of the cursor in an associated text input UI control changes.\r
- /// </summary>\r
- public static event EventHandler<CursorPositionUpdatedEventArgs> CursorPositionUpdated\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeCursorPositionUpdatedDelegate = (int cursorPos, IntPtr userData) =>\r
- {\r
- CursorPositionUpdatedEventArgs args = new CursorPositionUpdatedEventArgs(cursorPos);\r
- _cursorPositionUpdated?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetCursorPositionUpdatedCb(_imeCursorPositionUpdatedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add CursorPositionUpdated Failed with error " + error);\r
- }\r
- else\r
- {\r
- _cursorPositionUpdated += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _cursorPositionUpdated -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called to set the preferred language to the input panel.\r
- /// It will be only called when the client application changes the edit field's language attribute after the input panel is shown.\r
- /// </summary>\r
- public static event EventHandler<LangaugeSetEventArgs> LangaugeSet\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeLangaugeSetDelegate = (EcoreIMFInputPanelLang language, IntPtr userData) =>\r
- {\r
- LangaugeSetEventArgs args = new LangaugeSetEventArgs(language);\r
- _langaugeSet?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetLanguageSetCb(_imeLangaugeSetDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add LangaugeSet Failed with error " + error);\r
- }\r
- else\r
- {\r
- _langaugeSet += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _langaugeSet -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called to set the application specific data to deliver to the input panel.\r
- /// </summary>\r
- public static event EventHandler<ImDataSetEventArgs> ImDataSet\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeImDataSetDelegate = (IntPtr data, uint dataLength, IntPtr userData) =>\r
- {\r
- byte[] destination = new byte[dataLength];\r
- Marshal.Copy(data, destination, 0, (int)dataLength);\r
- ImDataSetEventArgs args = new ImDataSetEventArgs(destination, dataLength);\r
- _imDataSet?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetImdataSetCb(_imeImDataSetDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add ImDataSet Failed with error " + error);\r
- }\r
- else\r
- {\r
- _imDataSet += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _imDataSet -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when an associated text input UI control requests the input panel to set its layout.\r
- /// It will be only called when the client application changes the edit field's layout attribute after the input panel is shown.\r
- /// </summary>\r
- public static event EventHandler<LayoutSetEventArgs> LayoutSet\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeLayoutSetDelegate = (EcoreIMFInputPanelLayout layout, IntPtr userData) =>\r
- {\r
- LayoutSetEventArgs args = new LayoutSetEventArgs(layout);\r
- _layoutSet?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetLayoutSetCb(_imeLayoutSetDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add LayoutSet Failed with error " + error);\r
- }\r
- else\r
- {\r
- _layoutSet += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _layoutSet -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when an associated text input UI control requests the input panel to set the Return key label.\r
- /// The input panel can show text or image on the Return button according to the Return key action.\r
- /// </summary>\r
- public static event EventHandler<ReturnKeyTypeSetEventArgs> ReturnKeyTypeSet\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeReturnKeyTypeSetDelegate = (EcoreIMFInputPanelReturnKeyType type, IntPtr userData) =>\r
- {\r
- ReturnKeyTypeSetEventArgs args = new ReturnKeyTypeSetEventArgs(type);\r
- _returnKeyTypeSet?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetReturnKeyTypeSetCb(_imeReturnKeyTypeSetDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add ReturnKeyTypeSet Failed with error " + error);\r
- }\r
- else\r
- {\r
- _returnKeyTypeSet += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _returnKeyTypeSet -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when an associated text input UI control requests the input panel to enable or disable the Return key state.\r
- /// </summary>\r
- public static event EventHandler<ReturnKeyStateSetEventArgs> ReturnKeyStateSet\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeReturnKeyStateSetDelegate = (bool state, IntPtr userData) =>\r
- {\r
- ReturnKeyStateSetEventArgs args = new ReturnKeyStateSetEventArgs(state);\r
- _returnKeyStateSet?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetReturnKeyStateSetCb(_imeReturnKeyStateSetDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add ReturnKeyStateSet Failed with error " + error);\r
- }\r
- else\r
- {\r
- _returnKeyStateSet += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _returnKeyStateSet -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// This Handler is associated with ProcessKey\r
- /// </summary>\r
- /// <param name="sender">The object raising the event</param>\r
- /// <param name="e">An object of ProcessKeyEventArgs class</param>\r
- /// <returns>true if the event is processed, otherwise the event is not processed and is forwarded to the client application.</returns>\r
- public delegate bool ProcessKeyEventHandler(object sender, ProcessKeyEventArgs e);\r
-\r
- /// <summary>\r
- /// Called when the key event is received from the external devices or SendKey function.\r
- /// This Event processes the key event before an associated text input UI control does.\r
- /// </summary>\r
- /// <remarks>\r
- /// If the key event is from the external device, DeviceInfo will have its name, class and subclass information.\r
- /// </remarks>\r
- public static event ProcessKeyEventHandler ProcessKey\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeProcessKeyDelegate = (KeyCode keycode, KeyMask keymask, IntPtr devInfo, IntPtr userData) =>\r
- {\r
- ProcessKeyEventArgs args = new ProcessKeyEventArgs(keycode, keymask, devInfo);\r
- bool res = _processKey.Invoke(null, args);\r
- return res;\r
- };\r
- ErrorCode error = ImeEventSetProcessKeyEventCb(_imeProcessKeyDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add ProcessKey Failed with error " + error);\r
- }\r
- else\r
- {\r
- _processKey += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _processKey -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when the system display language is changed.\r
- /// </summary>\r
- public static event EventHandler<DisplayLanaguageChangedEventArgs> DisplayLanaguageChanged\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeDisplayLanaguageChangedDelegate = (IntPtr language, IntPtr userData) =>\r
- {\r
- DisplayLanaguageChangedEventArgs args = new DisplayLanaguageChangedEventArgs(Marshal.PtrToStringAnsi(language));\r
- _displayLanaguageChanged?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetDisplayLanguageChangedCb(_imeDisplayLanaguageChangedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add DisplayLanaguageChanged Failed with error " + error);\r
- }\r
- else\r
- {\r
- _displayLanaguageChanged += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _displayLanaguageChanged -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when the device is rotated.\r
- /// </summary>\r
- public static event EventHandler<RotationDegreeChangedEventArgs> RotationDegreeChanged\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeRotationDegreeChangedDelegate = (int degree, IntPtr userData) =>\r
- {\r
- RotationDegreeChangedEventArgs args = new RotationDegreeChangedEventArgs(degree);\r
- _rotationDegreeChanged?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetRotationDegreeChangedCb(_imeRotationDegreeChangedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add RotationDegreeChanged Failed with error " + error);\r
- }\r
- else\r
- {\r
- _rotationDegreeChanged += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _rotationDegreeChanged -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called when Accessibility in Settings application is on or off.\r
- /// </summary>\r
- public static event EventHandler<AccessibilityStateChangedEventArgs> AccessibilityStateChanged\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeAccessibilityStateChangedDelegate = (bool state, IntPtr userData) =>\r
- {\r
- AccessibilityStateChangedEventArgs args = new AccessibilityStateChangedEventArgs(state);\r
- _accessibilityStateChanged?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetAccessibilityStateChangedCb(_imeAccessibilityStateChangedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add AccessibilityStateChanged Failed with error " + error);\r
- }\r
- else\r
- {\r
- _accessibilityStateChanged += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _accessibilityStateChanged -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called to create the option window.\r
- /// </summary>\r
- /// <remarks>\r
- /// if Input panel requests to open the option window, type will be ImeOptionWindowType.Keyboard.\r
- /// And if Settings application requests to open it, type will be ImeOptionWindowType.SettingApplication.\r
- /// </remarks>\r
- public static event EventHandler<OptionWindowCreatedEventArgs> OptionWindowCreated\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeOptionWindowCreatedDelegate = (IntPtr window, ImeOptionWindowType type, IntPtr userData) =>\r
- {\r
- OptionWindowCreatedEventArgs args = new OptionWindowCreatedEventArgs(new EditorWindow(window), type);\r
- _optionWindowCreated?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetOptionWindowCreatedCb(_imeOptionWindowCreatedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add OptionWindowCreated Failed with error " + error);\r
- }\r
- else\r
- {\r
- _optionWindowCreated += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _optionWindowCreated -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Called to destroy the option window.\r
- /// </summary>\r
- public static event EventHandler<OptionWindowDestroyedEventArgs> OptionWindowDestroyed\r
- {\r
- add\r
- {\r
- lock (thisLock)\r
- {\r
- _imeOptionWindowDestroyedDelegate = (IntPtr window, IntPtr userData) =>\r
- {\r
- OptionWindowDestroyedEventArgs args = new OptionWindowDestroyedEventArgs(new EditorWindow(window));\r
- _optionWindowDestroyed?.Invoke(null, args);\r
- };\r
- ErrorCode error = ImeEventSetOptionWindowDestroyedCb(_imeOptionWindowDestroyedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add OptionWindowDestroyed Failed with error " + error);\r
- }\r
- else\r
- {\r
- _optionWindowDestroyed += value;\r
- }\r
- }\r
- }\r
- remove\r
- {\r
- lock (thisLock)\r
- {\r
- _optionWindowDestroyed -= value;\r
- }\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Sets the languageRequested Action\r
- /// </summary>\r
- /// <param name="languageRequested">\r
- /// Called when an associated text input UI control requests the language from the input panel, requesting for language code.\r
- /// </param>\r
- public static void SetLanguageRequested(OutAction<string> languageRequested)\r
- {\r
- _imeLanguageRequestedDelegate = (IntPtr userData, out IntPtr langCode) =>\r
- {\r
- string langauage;\r
- _languageRequestedDelegate(out langauage);\r
- char[] languageArray = langauage.ToCharArray();\r
- langCode = new IntPtr();\r
- Marshal.Copy(languageArray, 0, langCode, languageArray.Length);\r
- };\r
- ErrorCode error = ImeEventSetLanguageRequestedCb(_imeLanguageRequestedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add SetLanguageRequested Failed with error " + error);\r
- }\r
- _languageRequestedDelegate = languageRequested;\r
- }\r
-\r
- /// <summary>\r
- /// Sets the imDataRequested Action\r
- /// </summary>\r
- /// <param name="imDataRequested">\r
- /// Called when an associated text input UI control requests the application specific data from the input panel, requesting for data array and it's length.\r
- /// </param>\r
- public static void SetImDataRequested(OutAction<byte, uint> imDataRequested)\r
- {\r
- _imeImDataRequestedDelegate = (IntPtr userData, out IntPtr data, out uint dataLength) =>\r
- {\r
- byte[] dataArr;\r
- uint lenghtArr;\r
- _imDataRequestedDelegate(out dataArr, out lenghtArr);\r
- data = new IntPtr();\r
- Marshal.Copy(dataArr, 0, data, (int)lenghtArr);\r
- dataLength = lenghtArr;\r
- };\r
- ErrorCode error = ImeEventSetImdataRequestedCb(_imeImDataRequestedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add SetImDataRequested Failed with error " + error);\r
- }\r
- _imDataRequestedDelegate = imDataRequested;\r
- }\r
-\r
- /// <summary>\r
- /// Sets the GeometryRequested Action\r
- /// </summary>\r
- /// <param name="GeometryRequested">\r
- /// Called when an associated text input UI control requests the position and size from the input panel, requesting for x,y,w,h values.\r
- /// </param>\r
- public static void SetGeometryRequested(OutAction1<int> GeometryRequested)\r
- {\r
- _imeGeometryRequestedDelegate = (IntPtr userData, out int x, out int y, out int w, out int h) =>\r
- {\r
- int x1, y1, w1, h1;\r
- _geometryRequestedDelegate(out x1, out y1, out w1, out h1);\r
- x = x1;\r
- y = y1;\r
- w = w1;\r
- h = h1;\r
- };\r
- ErrorCode error = ImeEventSetGeometryRequestedCb(_imeGeometryRequestedDelegate, IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Add SetGeometryRequested Failed with error " + error);\r
- }\r
- _geometryRequestedDelegate = GeometryRequested;\r
- }\r
-\r
- /// <summary>\r
- /// Runs the main loop of IME application.\r
- /// This function starts to run IME application's main loop.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="create">This is called to initialize IME application before the main loop starts up</param>\r
- /// <param name="terminate">This is called when IME application is terminated</param>\r
- /// <param name="show">This is called when IME application is shown</param>\r
- /// <param name="hide">This is called when IME application is hidden</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) Operation failed\r
- /// </exception>\r
- public static void Run(Action create, Action terminate, Action<int, InputMethodContext> show, Action<int> hide)\r
- {\r
- _userCreate = create;\r
- _userTerminate = terminate;\r
- _userShow = show;\r
- _userHide = hide;\r
-\r
- ImeCallbackStruct _imeCallbackStruct = _imeCallbackStructGCHandle._imeCallbackStruct;\r
- _imeCallbackStruct.create = _create;\r
- _imeCallbackStruct.terminate = _terminate;\r
- _imeCallbackStruct.hide = _hide;\r
- _imeCallbackStruct.show = _show;\r
-\r
- ErrorCode error = ImeRun(GCHandle.ToIntPtr(_imeCallbackStructGCHandle._imeCallbackStructHandle), IntPtr.Zero);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "Run Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Sends a key event to the associated text input UI control.\r
- /// </summary>\r
- /// <remarks>\r
- /// This function sends key down or up event with key mask to the client application. If forwardKey is true, this key event goes to the edit filed directly.\r
- /// And if forwardKey is false, the ProcessKey event receives the key event before the edit field.\r
- /// </remarks>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="keyCode">The key code to be sent</param>\r
- /// <param name="keyMask">The modifier key mask</param>\r
- /// <param name="forwardKey">The flag to send the key event directly to the edit field</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// </exception>\r
- public static void SendKeyEvent(KeyCode keyCode, KeyMask keyMask, bool forwardKey)\r
- {\r
- ErrorCode error = ImeSendKeyEvent(keyCode, keyMask, forwardKey);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "SendEvent Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Sends the text to the associated text input UI control.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="str">The UTF-8 string to be committed</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// </exception>\r
- public static void CommitString(string str)\r
- {\r
- ErrorCode error = ImeCommitString(str);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "CommitString Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Requests to show preedit string.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// </exception>\r
- public static void ShowPreEditString()\r
- {\r
- ErrorCode error = ImeShowPreeditString();\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "ShowPreEditString Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Requests to hide preedit string.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// </exception>\r
- public static void HidePreEditString()\r
- {\r
- ErrorCode error = ImeHidePreeditString();\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "HidePreEditString Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Updates a new preedit string.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="str">The UTF-8 string to be updated in preedit</param>\r
- /// <param name="attrs">\r
- /// The list which has ime_preedit_attribute lists, strings can be composed of multiple string attributes: underline, highlight color and reversal color.\r
- /// The attrs can be null if no attributes to set\r
- /// </param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// 3) Invalid Parameter\r
- /// </exception>\r
- public static void UpdatePreEditString(string str, List<PreEditAttribute> attrs)\r
- {\r
- IntPtr einaList = IntPtr.Zero;\r
- GCHandle einaListHandle = GCHandle.Alloc(einaList);\r
- List<GCHandle> attributeHandleList = new List<GCHandle>();\r
- foreach (PreEditAttribute attribute in attrs)\r
- {\r
- ImePreEditAttributeStruct imePreEditAttribute = new ImePreEditAttributeStruct();\r
- imePreEditAttribute.start = attribute.Start;\r
- imePreEditAttribute.length = attribute.Length;\r
- imePreEditAttribute.type = (int)attribute.Type;\r
- imePreEditAttribute.value = attribute.Value;\r
- GCHandle attributeHandle = GCHandle.Alloc(imePreEditAttribute);\r
- attributeHandleList.Add(attributeHandle);\r
- einaList = Interop.EinaList.EinaListAppend(einaListHandle.AddrOfPinnedObject(),attributeHandle.AddrOfPinnedObject());\r
- }\r
- ErrorCode error = ImeUpdatePreeditString(str, einaListHandle.AddrOfPinnedObject());\r
- einaListHandle.Free();\r
- foreach(GCHandle handle in attributeHandleList)\r
- {\r
- handle.Free();\r
- }\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "UpdatePreEditString Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Requests the surrounding text from the position of the cursor, asynchronously.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="maxLenBefore">The maximum length of string to be retrieved before the cursor, -1 means unlimited</param>\r
- /// <param name="maxLenAfter">The maximum length of string to be retrieved after the cursor, -1 means unlimited</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// </exception>\r
- public static void RequestSurroundingText(int maxLenBefore, int maxLenAfter)\r
- {\r
- ErrorCode error = ImeRequestSurroundingText(maxLenBefore, maxLenAfter);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "RequestSurroundingText Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Requests to delete surrounding text.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="offset">The offset value from the cursor position</param>\r
- /// <param name="len">The length of the text to delete</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// 3) Invalid Parameter\r
- /// </exception>\r
- public static void DeleteSurroundingText(int offset, int len)\r
- {\r
- ErrorCode error = ImeDeleteSurroundingText(offset, len);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "DeleteSurroundingText Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Gets the surrounding text from the position of the cursor, synchronously.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="maxLenBefore">The maximum length of string to be retrieved before the cursor, -1 means unlimited</param>\r
- /// <param name="maxLenAfter">The maximum length of string to be retrieved after the cursor, -1 means unlimited</param>\r
- /// <param name="text">The surrounding text</param>\r
- /// <param name="cursorPosition">The cursor position</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// 3) Invalid Parameter\r
- /// 4) Failed to obtain text due to out of memory\r
- /// </exception>\r
- public static void GetSurroundingText(int maxLenBefore, int maxLenAfter, out string text, out int cursorPosition)\r
- {\r
- IntPtr txt;\r
- ErrorCode error = ImeGetSurroundingText(maxLenBefore, maxLenAfter, out txt, out cursorPosition);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "GetSurroundingText Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- text = Marshal.PtrToStringAnsi(txt);\r
- }\r
-\r
- /// <summary>\r
- /// Requests to set selection.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="start">The start cursor position in text (in characters not bytes)</param>\r
- /// <param name="end">The end cursor position in text (in characters not bytes)</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// 3) Invalid Parameter\r
- /// </exception>\r
- public static void SetSelection(int start, int end)\r
- {\r
- ErrorCode error = ImeSetSelection(start, end);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "SetSelection Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// This API returns the input panel main window.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <returns>The input panel main window object on success, otherwise null</returns>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// 3) Operation Failed\r
- /// </exception>\r
- public static EditorWindow GetMainWindow()\r
- {\r
- EditorWindow obj = new EditorWindow(ImeGetMainWindow());\r
- ErrorCode error = (ErrorCode)Tizen.Internals.Errors.ErrorFacts.GetLastResult();\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "GetMainWindow Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- return obj;\r
- }\r
-\r
- /// <summary>\r
- /// This API updates the input panel window's size information.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="portraitWidth">The width in portrait mode</param>\r
- /// <param name="portraitHeight">The height in portrait mode</param>\r
- /// <param name="landscapeWidth">The width in landscape mode</param>\r
- /// <param name="landscapeHeight">The height in landscape mode</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) IME main loop isn't started yet\r
- /// </exception>\r
- public static void SetSize(int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight)\r
- {\r
- ErrorCode error = ImeSetSize(portraitWidth, portraitHeight, landscapeWidth, landscapeHeight);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "SetSize Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Requests to create an option window from the input panel.\r
- /// The input panel can call this function to open the option window. This function calls OptionWindowCreated Event with ImeOptionWindowType.Keyboard.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) Operation failed\r
- /// 3) IME main loop isn't started yet\r
- /// 4) OptionWindowCreated event has not been set\r
- /// </exception>\r
- /// <precondition>\r
- /// OptionWindowCreated and OptionWindowDestroyed event should be set\r
- /// </precondition>\r
- public static void CreateOptionWindow()\r
- {\r
- ErrorCode error = ImeCreateOptionWindow();\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "CreapteOptionWindow Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
-\r
- /// <summary>\r
- /// Requests to destroy an option window.\r
- /// The input panel can call this function to close the option window which is created from either the input panel or Settings application.\r
- /// </summary>\r
- /// <priviledge>\r
- /// http://tizen.org/privilege/ime\r
- /// </priviledge>\r
- /// <param name="window">The option window to destroy</param>\r
- /// <exception cref="InvalidOperationException">\r
- /// This can occur due to the following reasons:\r
- /// 1) The application does not have the privilege to call this function\r
- /// 2) Invalid Parameter\r
- /// 3) IME main loop isn't started yet\r
- /// </exception>\r
- public static void DestroyOptionWindow(EditorWindow window)\r
- {\r
- ErrorCode error = ImeDestroyOptionWindow(window._handle);\r
- if (error != ErrorCode.None)\r
- {\r
- Log.Error(LogTag, "DestroyOptionWindow Failed with error " + error);\r
- throw InputMethodExceptionFactory.CreateException(error);\r
- }\r
- }\r
- }\r
-}\r
+/*
+* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the License);
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an AS IS BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using static Interop.InputMethod;
+
+namespace Tizen.Uix.InputMethod
+{
+ /// <summary>
+ /// Enumeration for the key codes.
+ /// If keycode & 0xff000000 == 0x01000000 then this key code is directly encoded to 24-bit UCS character. The UCS value is keycode & 0x00ffffff.
+ /// Defines the list of keys supported by the system. Note that certain keys may not be available on all the devices.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public enum KeyCode
+ {
+ /// <summary>
+ /// The Backspace key.
+ /// </summary>
+ BackSpace = 0xFF08,
+ /// <summary>
+ /// The Tab key.
+ /// </summary>
+ Tab = 0xFF09,
+ /// <summary>
+ /// The Linefeed key.
+ /// </summary>
+ Linefeed = 0xFF0A,
+ /// <summary>
+ /// The Clear key.
+ /// </summary>
+ Clear = 0xFF0B,
+ /// <summary>
+ /// The Return key.
+ /// </summary>
+ Return = 0xFF0D,
+ /// <summary>
+ /// The Pause key.
+ /// </summary>
+ Pause = 0xFF13,
+ /// <summary>
+ /// The Scroll lock key.
+ /// </summary>
+ ScrollLock = 0xFF14,
+ /// <summary>
+ /// The System Request key.
+ /// </summary>
+ SysReq = 0xFF15,
+ /// <summary>
+ /// The Escape key.
+ /// </summary>
+ Escape = 0xFF1B,
+ /// <summary>
+ /// The Delete key.
+ /// </summary>
+ Delete = 0xFFFF,
+
+ /* Cursor control & motion */
+ /// <summary>
+ /// The Home key.
+ /// </summary>
+ Home = 0xFF50,
+ /// <summary>
+ /// The Left directional key.
+ /// </summary>
+ Left = 0xFF51,
+ /// <summary>
+ /// The Up directional key.
+ /// </summary>
+ Up = 0xFF52,
+ /// <summary>
+ /// The Right directional key.
+ /// </summary>
+ Right = 0xFF53,
+ /// <summary>
+ /// The Down directional key.
+ /// </summary>
+ Down = 0xFF54,
+ /// <summary>
+ /// The Prior, Previous key.
+ /// </summary>
+ Prior = 0xFF55,
+ /// <summary>
+ /// The Page Up key.
+ /// </summary>
+ Page_Up = 0xFF55,
+ /// <summary>
+ /// The Next key.
+ /// </summary>
+ Next = 0xFF56,
+ /// <summary>
+ /// The Page Down key.
+ /// </summary>
+ Page_Down = 0xFF56,
+ /// <summary>
+ /// The End key.
+ /// </summary>
+ End = 0xFF57,
+ /// <summary>
+ /// The Begin key.
+ /// </summary>
+ Begin = 0xFF58,
+
+ /* Misc Functions */
+ /// <summary>
+ /// The Select key.
+ /// </summary>
+ Select = 0xFF60,
+ /// <summary>
+ /// The Print key.
+ /// </summary>
+ Print = 0xFF61,
+ /// <summary>
+ /// The Execute, Run, Do key.
+ /// </summary>
+ Execute = 0xFF62,
+ /// <summary>
+ /// The Insert key.
+ /// </summary>
+ Insert = 0xFF63,
+ /// <summary>
+ /// The Undo key.
+ /// </summary>
+ Undo = 0xFF65,
+ /// <summary>
+ /// The Redo key.
+ /// </summary>
+ Redo = 0xFF66,
+ /// <summary>
+ /// The Menu key.
+ /// </summary>
+ Menu = 0xFF67,
+ /// <summary>
+ /// The Find key.
+ /// </summary>
+ Find = 0xFF68,
+ /// <summary>
+ /// The Cancel, Stop, Abort, Exit key.
+ /// </summary>
+ Cancel = 0xFF69,
+ /// <summary>
+ /// The Help key.
+ /// </summary>
+ Help = 0xFF6A,
+ /// <summary>
+ /// The Break key.
+ /// </summary>
+ Break = 0xFF6B,
+ /// <summary>
+ /// The character set switch key.
+ /// </summary>
+ Mode_switch = 0xFF7E,
+ /// <summary>
+ /// The Number Lock key.
+ /// </summary>
+ Num_Lock = 0xFF7F,
+
+ /* Keypad */
+ /// <summary>
+ /// The Numpad Space key.
+ /// </summary>
+ KPSpace = 0xFF80,
+ /// <summary>
+ /// The Numpad Tab key.
+ /// </summary>
+ KPTab = 0xFF89,
+ /// <summary>
+ /// The Numpad Enter key.
+ /// </summary>
+ KPEnter = 0xFF8D,
+ /// <summary>
+ /// The Numpad Function 1 key.
+ /// </summary>
+ KPF1 = 0xFF91,
+ /// <summary>
+ /// The Numpad Function 2 key.
+ /// </summary>
+ KPF2 = 0xFF92,
+ /// <summary>
+ /// The Numpad Function 3 key.
+ /// </summary>
+ KPF3 = 0xFF93,
+ /// <summary>
+ /// The Numpad Function 4 key.
+ /// </summary>
+ KPF4 = 0xFF94,
+ /// <summary>
+ /// The Numpad Home key.
+ /// </summary>
+ KPHome = 0xFF95,
+ /// <summary>
+ /// The Numpad Left key.
+ /// </summary>
+ KPLeft = 0xFF96,
+ /// <summary>
+ /// The Numpad Up key.
+ /// </summary>
+ KPUp = 0xFF97,
+ /// <summary>
+ /// The Numpad Right key.
+ /// </summary>
+ KPRight = 0xFF98,
+ /// <summary>
+ /// The Numpad Down key.
+ /// </summary>
+ KPDown = 0xFF99,
+ /// <summary>
+ /// The Numpad Prior, Previous key.
+ /// </summary>
+ KPPrior = 0xFF9A,
+ /// <summary>
+ /// The Numpad Page Up key.
+ /// </summary>
+ KPPage_Up = 0xFF9A,
+ /// <summary>
+ /// The Numpad Next key.
+ /// </summary>
+ KPNext = 0xFF9B,
+ /// <summary>
+ /// The Numpad Page Down key.
+ /// </summary>
+ KPPage_Down = 0xFF9B,
+ /// <summary>
+ /// The Numpad End key.
+ /// </summary>
+ KPEnd = 0xFF9C,
+ /// <summary>
+ /// The Numpad Begin key.
+ /// </summary>
+ KPBegin = 0xFF9D,
+ /// <summary>
+ /// The Numpad Insert key.
+ /// </summary>
+ KPInsert = 0xFF9E,
+ /// <summary>
+ /// The Numpad Delete key.
+ /// </summary>
+ KPDelete = 0xFF9F,
+ /// <summary>
+ /// The Numpad Equal key.
+ /// </summary>
+ KPEqual = 0xFFBD,
+ /// <summary>
+ /// The Numpad Multiply key.
+ /// </summary>
+ KPMultiply = 0xFFAA,
+ /// <summary>
+ /// The Numpad Add key.
+ /// </summary>
+ KPAdd = 0xFFAB,
+ /// <summary>
+ /// The Numpad Separator key.
+ /// </summary>
+ KPSeparator = 0xFFAC,
+ /// <summary>
+ /// The Numpad Subtract key.
+ /// </summary>
+ KPSubtract = 0xFFAD,
+ /// <summary>
+ /// The Numpad Decimal key.
+ /// </summary>
+ KPDecimal = 0xFFAE,
+ /// <summary>
+ /// The Numpad Divide key.
+ /// </summary>
+ KPDivide = 0xFFAF,
+ /// <summary>
+ /// The Numpad 0 key.
+ /// </summary>
+ KP0 = 0xFFB0,
+ /// <summary>
+ /// The Numpad 1 key.
+ /// </summary>
+ KP1 = 0xFFB1,
+ /// <summary>
+ /// The Numpad 2 key.
+ /// </summary>
+ KP2 = 0xFFB2,
+ /// <summary>
+ /// The Numpad 3 key.
+ /// </summary>
+ KP3 = 0xFFB3,
+ /// <summary>
+ /// The Numpad 4 key.
+ /// </summary>
+ KP4 = 0xFFB4,
+ /// <summary>
+ /// The Numpad 5 key.
+ /// </summary>
+ KP5 = 0xFFB5,
+ /// <summary>
+ /// The Numpad 6 key.
+ /// </summary>
+ KP6 = 0xFFB6,
+ /// <summary>
+ /// The Numpad 7 key.
+ /// </summary>
+ KP7 = 0xFFB7,
+ /// <summary>
+ /// The Numpad 8 key.
+ /// </summary>
+ KP8 = 0xFFB8,
+ /// <summary>
+ /// The Numpad 9 key.
+ /// </summary>
+ KP9 = 0xFFB9,
+
+ /* Auxiliary Functions */
+ /// <summary>
+ /// The Function 1 key.
+ /// </summary>
+ F1 = 0xFFBE,
+ /// <summary>
+ /// The Function 2 key.
+ /// </summary>
+ F2 = 0xFFBF,
+ /// <summary>
+ /// The Function 3 key.
+ /// </summary>
+ F3 = 0xFFC0,
+ /// <summary>
+ /// The Function 4 key.
+ /// </summary>
+ F4 = 0xFFC1,
+ /// <summary>
+ /// The Function 5 key.
+ /// </summary>
+ F5 = 0xFFC2,
+ /// <summary>
+ /// The Function 6 key.
+ /// </summary>
+ F6 = 0xFFC3,
+ /// <summary>
+ /// The Function 7 key.
+ /// </summary>
+ F7 = 0xFFC4,
+ /// <summary>
+ /// The Function 8 key.
+ /// </summary>
+ F8 = 0xFFC5,
+ /// <summary>
+ /// The Function 9 key.
+ /// </summary>
+ F9 = 0xFFC6,
+ /// <summary>
+ /// The Function 10 key.
+ /// </summary>
+ F10 = 0xFFC7,
+ /// <summary>
+ /// The Function 11 key.
+ /// </summary>
+ F11 = 0xFFC8,
+ /// <summary>
+ /// The Function 12 key.
+ /// </summary>
+ F12 = 0xFFC9,
+ /// <summary>
+ /// The Function 13 key.
+ /// </summary>
+ F13 = 0xFFCA,
+ /// <summary>
+ /// The Function 14 key.
+ /// </summary>
+ F14 = 0xFFCB,
+ /// <summary>
+ /// The Function 15 key.
+ /// </summary>
+ F15 = 0xFFCC,
+ /// <summary>
+ /// The Function 16 key.
+ /// </summary>
+ F16 = 0xFFCD,
+ /// <summary>
+ /// The Function 17 key.
+ /// </summary>
+ F17 = 0xFFCE,
+ /// <summary>
+ /// The Function 18 key.
+ /// </summary>
+ F18 = 0xFFCF,
+ /// <summary>
+ /// The Function 19 key.
+ /// </summary>
+ F19 = 0xFFD0,
+ /// <summary>
+ /// The Function 20 key.
+ /// </summary>
+ F20 = 0xFFD1,
+ /// <summary>
+ /// The Function 21 key.
+ /// </summary>
+ F21 = 0xFFD2,
+ /// <summary>
+ /// The Function 22 key.
+ /// </summary>
+ F22 = 0xFFD3,
+ /// <summary>
+ /// The Function 23 key.
+ /// </summary>
+ F23 = 0xFFD4,
+ /// <summary>
+ /// The Function 24 key.
+ /// </summary>
+ F24 = 0xFFD5,
+ /// <summary>
+ /// The Function 25 key.
+ /// </summary>
+ F25 = 0xFFD6,
+ /// <summary>
+ /// The Function 26 key.
+ /// </summary>
+ F26 = 0xFFD7,
+ /// <summary>
+ /// The Function 27 key.
+ /// </summary>
+ F27 = 0xFFD8,
+ /// <summary>
+ /// The Function 28 key.
+ /// </summary>
+ F28 = 0xFFD9,
+ /// <summary>
+ /// The Function 29 key.
+ /// </summary>
+ F29 = 0xFFDA,
+ /// <summary>
+ /// The Function 30 key.
+ /// </summary>
+ F30 = 0xFFDB,
+ /// <summary>
+ /// The Function 31 key.
+ /// </summary>
+ F31 = 0xFFDC,
+ /// <summary>
+ /// The Function 32 key.
+ /// </summary>
+ F32 = 0xFFDD,
+ /// <summary>
+ /// The Function 33 key.
+ /// </summary>
+ F33 = 0xFFDE,
+ /// <summary>
+ /// The Function 34 key.
+ /// </summary>
+ F34 = 0xFFDF,
+ /// <summary>
+ /// The Function 35 key.
+ /// </summary>
+ F35 = 0xFFE0,
+
+ /* Modifier keys */
+ /// <summary>
+ /// The Left Shift key.
+ /// </summary>
+ ShiftL = 0xFFE1,
+ /// <summary>
+ /// The Right Shift key.
+ /// </summary>
+ ShiftR = 0xFFE2,
+ /// <summary>
+ /// The Left Control key.
+ /// </summary>
+ ControlL = 0xFFE3,
+ /// <summary>
+ /// The Right Control key.
+ /// </summary>
+ ControlR = 0xFFE4,
+ /// <summary>
+ /// The Caps Lock key.
+ /// </summary>
+ CapsLock = 0xFFE5,
+ /// <summary>
+ /// The Shift Lock key.
+ /// </summary>
+ ShiftLock = 0xFFE6,
+ /// <summary>
+ /// The Left Meta key.
+ /// </summary>
+ MetaL = 0xFFE7,
+ /// <summary>
+ /// The Right Meta key.
+ /// </summary>
+ MetaR = 0xFFE8,
+ /// <summary>
+ /// The Left Alt key.
+ /// </summary>
+ AltL = 0xFFE9,
+ /// <summary>
+ /// The Right Alt key.
+ /// </summary>
+ AltR = 0xFFEA,
+ /// <summary>
+ /// The Left Super key.
+ /// </summary>
+ SuperL = 0xFFEB,
+ /// <summary>
+ /// The Right Super key.
+ /// </summary>
+ SuperR = 0xFFEC,
+ /// <summary>
+ /// The Left Hyper key.
+ /// </summary>
+ HyperL = 0xFFED,
+ /// <summary>
+ /// The Right Hyper key.
+ /// </summary>
+ HyperR = 0xFFEE,
+
+ /* Latin 1 */
+ /// <summary>
+ /// The Space key.
+ /// </summary>
+ Space = 0x020,
+ /// <summary>
+ /// The Exclamation key.
+ /// </summary>
+ Exclam = 0x021,
+ /// <summary>
+ /// The Quotedbl key.
+ /// </summary>
+ Quotedbl = 0x022,
+ /// <summary>
+ /// The Number Sign key.
+ /// </summary>
+ NumberSign = 0x023,
+ /// <summary>
+ /// The Dollar key.
+ /// </summary>
+ Dollar = 0x024,
+ /// <summary>
+ /// The Percent key.
+ /// </summary>
+ Percent = 0x025,
+ /// <summary>
+ /// The Ampersand key.
+ /// </summary>
+ Ampersand = 0x026,
+ /// <summary>
+ /// The Apostrophe key.
+ /// </summary>
+ Apostrophe = 0x027,
+ /// <summary>
+ /// The Parenleft key.
+ /// </summary>
+ Parenleft = 0x028,
+ /// <summary>
+ /// The Parenright key.
+ /// </summary>
+ Parenright = 0x029,
+ /// <summary>
+ /// The Asterisk key.
+ /// </summary>
+ Asterisk = 0x02a,
+ /// <summary>
+ /// The Plus key.
+ /// </summary>
+ Plus = 0x02b,
+ /// <summary>
+ /// The Comma key.
+ /// </summary>
+ Comma = 0x02c,
+ /// <summary>
+ /// The Minus key.
+ /// </summary>
+ Minus = 0x02d,
+ /// <summary>
+ /// The Period key.
+ /// </summary>
+ Period = 0x02e,
+ /// <summary>
+ /// The Slash key.
+ /// </summary>
+ Slash = 0x02f,
+ /// <summary>
+ /// The 0 key.
+ /// </summary>
+ Keypad0 = 0x030,
+ /// <summary>
+ /// The 1 key.
+ /// </summary>
+ Keypad1 = 0x031,
+ /// <summary>
+ /// The 2 key.
+ /// </summary>
+ Keypad2 = 0x032,
+ /// <summary>
+ /// The 3 key.
+ /// </summary>
+ Keypad3 = 0x033,
+ /// <summary>
+ /// The 4 key.
+ /// </summary>
+ Keypad4 = 0x034,
+ /// <summary>
+ /// The 5 key.
+ /// </summary>
+ Keypad5 = 0x035,
+ /// <summary>
+ /// The 6 key.
+ /// </summary>
+ Keypad6 = 0x036,
+ /// <summary>
+ /// The 7 key.
+ /// </summary>
+ Keypad7 = 0x037,
+ /// <summary>
+ /// The 8 key.
+ /// </summary>
+ Keypad8 = 0x038,
+ /// <summary>
+ /// The 9 key.
+ /// </summary>
+ Keypad9 = 0x039,
+ /// <summary>
+ /// The Colon key.
+ /// </summary>
+ Colon = 0x03a,
+ /// <summary>
+ /// The Semicolon key.
+ /// </summary>
+ Semicolon = 0x03b,
+ /// <summary>
+ /// The Less key.
+ /// </summary>
+ Less = 0x03c,
+ /// <summary>
+ /// The Equal key.
+ /// </summary>
+ Equal = 0x03d,
+ /// <summary>
+ /// The Greater key.
+ /// </summary>
+ Greater = 0x03e,
+ /// <summary>
+ /// The Question key.
+ /// </summary>
+ Question = 0x03f,
+ /// <summary>
+ /// The At key.
+ /// </summary>
+ At = 0x040,
+ /// <summary>
+ /// The A key.
+ /// </summary>
+ KeypadA = 0x041,
+ /// <summary>
+ /// The B key.
+ /// </summary>
+ KeypadB = 0x042,
+ /// <summary>
+ /// The C key.
+ /// </summary>
+ KeypadC = 0x043,
+ /// <summary>
+ /// The D key.
+ /// </summary>
+ KeypadD = 0x044,
+ /// <summary>
+ /// The E key.
+ /// </summary>
+ KeypadE = 0x045,
+ /// <summary>
+ /// The F key.
+ /// </summary>
+ KeypadF = 0x046,
+ /// <summary>
+ /// The G key.
+ /// </summary>
+ KeypadG = 0x047,
+ /// <summary>
+ /// The H key.
+ /// </summary>
+ KeypadH = 0x048,
+ /// <summary>
+ /// The I key.
+ /// </summary>
+ KeypadI = 0x049,
+ /// <summary>
+ /// The J key.
+ /// </summary>
+ KeypadJ = 0x04a,
+ /// <summary>
+ /// The K key.
+ /// </summary>
+ KeypadK = 0x04b,
+ /// <summary>
+ /// The L key.
+ /// </summary>
+ KeypadL = 0x04c,
+ /// <summary>
+ /// The M key.
+ /// </summary>
+ KeypadM = 0x04d,
+ /// <summary>
+ /// The N key.
+ /// </summary>
+ KeypadN = 0x04e,
+ /// <summary>
+ /// The O key.
+ /// </summary>
+ KeypadO = 0x04f,
+ /// <summary>
+ /// The P key.
+ /// </summary>
+ KeypadP = 0x050,
+ /// <summary>
+ /// The Q key.
+ /// </summary>
+ KeypadQ = 0x051,
+ /// <summary>
+ /// The R key.
+ /// </summary>
+ KeypadR = 0x052,
+ /// <summary>
+ /// The S key.
+ /// </summary>
+ KeypadS = 0x053,
+ /// <summary>
+ /// The T key.
+ /// </summary>
+ KeypadT = 0x054,
+ /// <summary>
+ /// The U key.
+ /// </summary>
+ KeypadU = 0x055,
+ /// <summary>
+ /// The V key.
+ /// </summary>
+ KeypadV = 0x056,
+ /// <summary>
+ /// The W key.
+ /// </summary>
+ KeypadW = 0x057,
+ /// <summary>
+ /// The X key.
+ /// </summary>
+ KeypadX = 0x058,
+ /// <summary>
+ /// The Y key.
+ /// </summary>
+ KeypadY = 0x059,
+ /// <summary>
+ /// The Z key.
+ /// </summary>
+ KeypadZ = 0x05a,
+ /// <summary>
+ /// The Left Bracket key.
+ /// </summary>
+ BracketLeft = 0x05b,
+ /// <summary>
+ /// The Backslash key.
+ /// </summary>
+ Backslash = 0x05c,
+ /// <summary>
+ /// The Right Bracket key.
+ /// </summary>
+ BracketRight = 0x05d,
+ /// <summary>
+ /// The Circumflex key.
+ /// </summary>
+ AsciiCircum = 0x05e,
+ /// <summary>
+ /// The Underscore key.
+ /// </summary>
+ Underscore = 0x05f,
+ /// <summary>
+ /// The Grave key.
+ /// </summary>
+ Grave = 0x060,
+ /// <summary>
+ /// The a key.
+ /// </summary>
+ Keypada = 0x061,
+ /// <summary>
+ /// The b key.
+ /// </summary>
+ Keypadb = 0x062,
+ /// <summary>
+ /// The c key.
+ /// </summary>
+ Keypadc = 0x063,
+ /// <summary>
+ /// The d key.
+ /// </summary>
+ Keypadd = 0x064,
+ /// <summary>
+ /// The e key.
+ /// </summary>
+ Keypade = 0x065,
+ /// <summary>
+ /// The f key.
+ /// </summary>
+ Keypadf = 0x066,
+ /// <summary>
+ /// The g key.
+ /// </summary>
+ Keypadg = 0x067,
+ /// <summary>
+ /// The h key.
+ /// </summary>
+ Keypadh = 0x068,
+ /// <summary>
+ /// The i key.
+ /// </summary>
+ Keypadi = 0x069,
+ /// <summary>
+ /// The j key.
+ /// </summary>
+ Keypadj = 0x06a,
+ /// <summary>
+ /// The k key.
+ /// </summary>
+ Keypadk = 0x06b,
+ /// <summary>
+ /// The l key.
+ /// </summary>
+ Keypadl = 0x06c,
+ /// <summary>
+ /// The m key.
+ /// </summary>
+ Keypadm = 0x06d,
+ /// <summary>
+ /// The n key.
+ /// </summary>
+ Keypadn = 0x06e,
+ /// <summary>
+ /// The o key.
+ /// </summary>
+ Keypado = 0x06f,
+ /// <summary>
+ /// The p key.
+ /// </summary>
+ Keypadp = 0x070,
+ /// <summary>
+ /// The q key.
+ /// </summary>
+ Keypadq = 0x071,
+ /// <summary>
+ /// The r key.
+ /// </summary>
+ Keypadr = 0x072,
+ /// <summary>
+ /// The s key.
+ /// </summary>
+ Keypads = 0x073,
+ /// <summary>
+ /// The t key.
+ /// </summary>
+ Keypadt = 0x074,
+ /// <summary>
+ /// The u key.
+ /// </summary>
+ Keypadu = 0x075,
+ /// <summary>
+ /// The v key.
+ /// </summary>
+ Keypadv = 0x076,
+ /// <summary>
+ /// The w key.
+ /// </summary>
+ Keypadw = 0x077,
+ /// <summary>
+ /// The x key.
+ /// </summary>
+ Keypadx = 0x078,
+ /// <summary>
+ /// The y key.
+ /// </summary>
+ Keypady = 0x079,
+ /// <summary>
+ /// The z key.
+ /// </summary>
+ Keypadz = 0x07a,
+ /// <summary>
+ /// The Left Brace key.
+ /// </summary>
+ BraceLeft = 0x07b,
+ /// <summary>
+ /// The Bar key.
+ /// </summary>
+ Bar = 0x07c,
+ /// <summary>
+ /// The Right Brace key.
+ /// </summary>
+ BraceRight = 0x07d,
+ /// <summary>
+ /// The Tilde key.
+ /// </summary>
+ AsciiTilde = 0x07e,
+ };
+
+ /// <summary>
+ /// Enumeration for the key masks.
+ /// The key masks indicate which modifier keys are pressed down during the keyboard hit. The special MASK_RELEASED indicates the key release event.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public enum KeyMask
+ {
+ /// <summary>
+ /// Key press event without the modifier key.
+ /// </summary>
+ Pressed = 0,
+ /// <summary>
+ /// The Shift key is pressed down.
+ /// </summary>
+ Shift = (1 << 0),
+ /// <summary>
+ /// The CapsLock key is pressed down.
+ /// </summary>
+ CapsLock = (1 << 1),
+ /// <summary>
+ /// The Control key is pressed down.
+ /// </summary>
+ Control = (1 << 2),
+ /// <summary>
+ /// The Alt key is pressed down.
+ /// </summary>
+ Alt = (1 << 3),
+ /// <summary>
+ /// The Meta key is pressed down.
+ /// </summary>
+ Meta = (1 << 4),
+ /// <summary>
+ /// The Win key (between Control and Alt) is pressed down.
+ /// </summary>
+ Win = (1 << 5),
+ /// <summary>
+ /// The Hyper key is pressed down.
+ /// </summary>
+ Hyper = (1 << 6),
+ /// <summary>
+ /// The NumLock key is pressed down.
+ /// </summary>
+ NumLock = (1 << 7),
+ /// <summary>
+ /// Key release event.
+ /// </summary>
+ Released = (1 << 15),
+ }
+
+ /// <summary>
+ /// This class contains the API's related to the IME (Input method editor).
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static class InputMethodEditor
+ {
+ private static ImeCallbackStructGCHandle _imeCallbackStructGCHandle = new ImeCallbackStructGCHandle();
+ private static event EventHandler<FocusedInEventArgs> _focusIn;
+ private static ImeFocusedInCb _imeFocusedInDelegate;
+ private static event EventHandler<FocusedOutEventArgs> _focusOut;
+ private static ImeFocusedOutCb _imeFocusedOutDelegate;
+ private static event EventHandler<SurroundingTextUpdatedEventArgs> _surroundingTextUpdated;
+ private static ImeSurroundingTextUpdatedCb _imeSurroundingTextUpdatedDelegate;
+ private static event EventHandler<EventArgs> _inputContextReset;
+ private static ImeInputContextResetCb _imeInputContextResetDelegate;
+ private static event EventHandler<CursorPositionUpdatedEventArgs> _cursorPositionUpdated;
+ private static ImeCursorPositionUpdatedCb _imeCursorPositionUpdatedDelegate;
+ private static event EventHandler<LanguageSetEventArgs> _langaugeSet;
+ private static ImeLanguageSetCb _imeLanguageSetDelegate;
+ private static event EventHandler<SetDataEventArgs> _imDataSet;
+ private static ImeImdataSetCb _imeDataSetDelegate;
+ private static event EventHandler<LayoutSetEventArgs> _layoutSet;
+ private static ImeLayoutSetCb _imeLayoutSetDelegate;
+ private static event EventHandler<ReturnKeySetEventArgs> _returnKeyTypeSet;
+ private static ImeReturnKeySetCb _imeReturnKeySetDelegate;
+ private static event EventHandler<ReturnKeyStateSetEventArgs> _returnKeyStateSet;
+ private static ImeReturnKeyStateSetCb _imeReturnKeyStateSetDelegate;
+ private static ImeProcessKeyEventCb _imeProcessKeyDelegate;
+ private static event EventHandler<DisplayLanguageChangedEventArgs> _displayLanguageChanged;
+ private static ImeDisplayLanguageChangedCb _imeDisplayLanguageChangedDelegate;
+ private static event EventHandler<RotationChangedEventArgs> _rotationDegreeChanged;
+ private static ImeRotationChangedCb _imeRotationChangedDelegate;
+ private static event EventHandler<AccessibilityStateChangedEventArgs> _accessibilityStateChanged;
+ private static ImeAccessibilityStateChangedCb _imeAccessibilityStateChangedDelegate;
+ private static event EventHandler<PredictionHintUpdatedEventArgs> _predictionHintUpdated;
+ private static ImePredictionHintSetCb _imePredictionHintSetDelegate;
+ private static event EventHandler<PredictionHintDataUpdatedEventArgs> _predictionHintDataUpdated;
+ private static ImePredictionHintDataSetCb _imePredictionHintDataSetDelegate;
+ private static event EventHandler<MimeTypeUpdateRequestedEventArgs> _mimeTypeUpdateRequested;
+ private static ImeMimeTypeSetRequestCb _imeMimeTypeSetRequestDelegate;
+ private static ImeLanguageRequestedCb _imeLanguageRequestedDelegate;
+ private static OutAction<string> _languageRequestedDelegate;
+ private static BoolAction<KeyCode, KeyMask, InputMethodDeviceInformation> _processKeyDelagate;
+ private static ImeImdataRequestedCb _imeImDataRequestedDelegate;
+ private static OutArrayAction<byte> _imDataRequestedDelegate;
+ private static ImeGeometryRequestedCb _imeGeometryRequestedDelegate;
+ private static OutAction<Rect> _geometryRequestedDelegate;
+ private static ImeProcessKeyEventWithKeycodeCb _imeProcessKeyWithKeycodeDelegate;
+ private static BoolAction<uint, KeyCode, KeyMask, InputMethodDeviceInformation> _processKeyWithKeycodeDelagate;
+ private static event EventHandler<InputHintSetEventArgs> _inputHintSet;
+ private static ImeInputHintSetCb _imeInputHintSetDelegate;
+ private static Action _userCreate;
+ private static Action _userTerminate;
+ private static Action<ContextId, InputMethodContext> _userShow;
+ private static Action<ContextId> _userHide;
+ private static ImeCreateCb _create = (IntPtr userData) =>
+ {
+ Log.Info(LogTag, "In Create Delegate");
+ _userCreate?.Invoke();
+ };
+ private static ImeTerminateCb _terminate = (IntPtr userData) =>
+ {
+ Log.Info(LogTag, "In terminate Delegate");
+ _userTerminate?.Invoke();
+ _imeCallbackStructGCHandle.Dispose();
+ };
+ private static ImeShowCb _show = (int contextId, IntPtr context, IntPtr userData) =>
+ {
+ Log.Info(LogTag, "In Show Delegate");
+ _userShow?.Invoke(new ContextId(contextId), new InputMethodContext(context));
+ };
+ private static ImeHideCb _hide = (int contextId, IntPtr userData) =>
+ {
+ Log.Info(LogTag, "In Hide Delegate");
+ _userHide?.Invoke(new ContextId(contextId));
+ };
+
+ /// <summary>
+ /// Structure representing the ContextId.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public struct ContextId : IEquatable<ContextId>
+ {
+ internal ContextId(int id)
+ {
+ Id = id;
+ }
+
+ internal int Id
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Compares whether the ContextIds are equal.
+ /// </summary>
+ /// <param name="other">The ContextId to compare with this instance.</param>
+ /// <returns>true if the ContextIds is the same; otherwise, false.</returns>
+ /// <since_tizen> 4 </since_tizen>
+ public bool Equals(ContextId other)
+ {
+ return this.Id == other.Id;
+ }
+ }
+
+ /// <summary>
+ /// Rectangle representing the position and size of the UI control.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public struct Rect
+ {
+ /// <summary>
+ /// The X position in the screen.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int x;
+
+ /// <summary>
+ /// The Y position in the screen.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int y;
+
+ /// <summary>
+ /// The window width.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int w;
+
+ /// <summary>
+ /// The window height.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public int h;
+ }
+
+ /// <summary>
+ /// An action with 1 out parameter.
+ /// </summary>
+ /// <typeparam name="T">Generic Type.</typeparam>
+ /// <param name="a">The out parameter.</param>
+ /// <since_tizen> 4 </since_tizen>
+ public delegate void OutAction<T>(out T a);
+
+ /// <summary>
+ /// An action with an array out parameter.
+ /// </summary>
+ /// <typeparam name="T">Generic Type.</typeparam>
+ /// <param name="a">The out parameter 1.</param>
+ /// <since_tizen> 4 </since_tizen>
+ public delegate void OutArrayAction<T>(out T[] a);
+
+ /// <summary>
+ /// An action with 3 input parameters returning a bool.
+ /// </summary>
+ /// <typeparam name="T">Generic type for parameter 1.</typeparam>
+ /// <typeparam name="T1">Generic type for parameter 2.</typeparam>
+ /// <typeparam name="T2">Generic type for parameter 3.</typeparam>
+ /// <param name="a">The input parameter 1.</param>
+ /// <param name="b">The input parameter 2.</param>
+ /// <param name="c">The input parameter 3.</param>
+ /// <returns></returns>
+ /// <since_tizen> 4 </since_tizen>
+ public delegate bool BoolAction<T, T1, T2>(T a, T1 b, T2 c);
+
+ /// <summary>
+ /// An action with 4 input parameters returning a bool.
+ /// </summary>
+ /// <typeparam name="T">Generic type for parameter 1.</typeparam>
+ /// <typeparam name="T1">Generic type for parameter 2.</typeparam>
+ /// <typeparam name="T2">Generic type for parameter 3.</typeparam>
+ /// <typeparam name="T3">Generic type for parameter 4.</typeparam>
+ /// <param name="a">The input parameter 1.</param>
+ /// <param name="b">The input parameter 2.</param>
+ /// <param name="c">The input parameter 3.</param>
+ /// <param name="d">The input parameter 4.</param>
+ /// <returns></returns>
+ /// <since_tizen> 10 </since_tizen>
+ public delegate bool BoolAction<T, T1, T2, T3>(T a, T1 b, T2 c, T3 d);
+
+ /// <summary>
+ /// Called when an associated text input UI control has focus.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<FocusedInEventArgs> FocusedIn
+ {
+ add
+ {
+ _imeFocusedInDelegate = (int contextId, IntPtr userData) =>
+ {
+ FocusedInEventArgs args = new FocusedInEventArgs(contextId);
+ _focusIn?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetFocusedInCb(_imeFocusedInDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add FocusedIn Failed with error " + error);
+ }
+ else
+ {
+ _focusIn += value;
+ }
+ }
+ remove
+ {
+ _focusIn -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control loses focus.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<FocusedOutEventArgs> FocusedOut
+ {
+ add
+ {
+ _imeFocusedOutDelegate = (int contextId, IntPtr userData) =>
+ {
+ FocusedOutEventArgs args = new FocusedOutEventArgs(contextId);
+ _focusOut?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetFocusedOutCb(_imeFocusedOutDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add FocusedOut Failed with error " + error);
+ }
+ else
+ {
+ _focusOut += value;
+ }
+ }
+ remove
+ {
+ _focusOut -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control responds to a request with the surrounding text.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<SurroundingTextUpdatedEventArgs> SurroundingTextUpdated
+ {
+ add
+ {
+ _imeSurroundingTextUpdatedDelegate = (int contextId, IntPtr text, int cursorPos, IntPtr userData) =>
+ {
+ SurroundingTextUpdatedEventArgs args = new SurroundingTextUpdatedEventArgs(contextId, Marshal.PtrToStringAnsi(text), cursorPos);
+ _surroundingTextUpdated?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetSurroundingTextUpdatedCb(_imeSurroundingTextUpdatedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add SurroundingTextUpdated Failed with error " + error);
+ }
+ else
+ {
+ _surroundingTextUpdated += value;
+ }
+ }
+ remove
+ {
+ _surroundingTextUpdated -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called to reset the input context of an associated text input UI control.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<EventArgs> InputContextReset
+ {
+ add
+ {
+ _imeInputContextResetDelegate = (IntPtr userData) =>
+ {
+ _inputContextReset?.Invoke(null, EventArgs.Empty);
+ };
+ ErrorCode error = ImeEventSetInputContextResetCb(_imeInputContextResetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add InputContextReset Failed with error " + error);
+ }
+ else
+ {
+ _inputContextReset += value;
+ }
+ }
+ remove
+ {
+ _inputContextReset -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when the position of the cursor in an associated text input UI control changes.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<CursorPositionUpdatedEventArgs> CursorPositionUpdated
+ {
+ add
+ {
+ _imeCursorPositionUpdatedDelegate = (int cursorPos, IntPtr userData) =>
+ {
+ CursorPositionUpdatedEventArgs args = new CursorPositionUpdatedEventArgs(cursorPos);
+ _cursorPositionUpdated?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetCursorPositionUpdatedCb(_imeCursorPositionUpdatedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add CursorPositionUpdated Failed with error " + error);
+ }
+ else
+ {
+ _cursorPositionUpdated += value;
+ }
+ }
+ remove
+ {
+ _cursorPositionUpdated -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called to set the preferred language to the input panel.
+ /// It will only be called when the client application changes the edit field's language attribute after the input panel is shown.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<LanguageSetEventArgs> LanguageSet
+ {
+ add
+ {
+ _imeLanguageSetDelegate = (InputPanelLanguage language, IntPtr userData) =>
+ {
+ LanguageSetEventArgs args = new LanguageSetEventArgs(language);
+ _langaugeSet?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetLanguageSetCb(_imeLanguageSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add LanguageSet Failed with error " + error);
+ }
+ else
+ {
+ _langaugeSet += value;
+ }
+ }
+ remove
+ {
+ _langaugeSet -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called to set the application specific data to deliver to the input panel.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<SetDataEventArgs> DataSet
+ {
+ add
+ {
+ _imeDataSetDelegate = (IntPtr data, uint dataLength, IntPtr userData) =>
+ {
+ byte[] destination = new byte[dataLength];
+ Marshal.Copy(data, destination, 0, (int)dataLength);
+ SetDataEventArgs args = new SetDataEventArgs(destination, dataLength);
+ _imDataSet?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetImdataSetCb(_imeDataSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add DataSet Failed with error " + error);
+ }
+ else
+ {
+ _imDataSet += value;
+ }
+ }
+ remove
+ {
+ _imDataSet -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control requests the input panel to set its layout.
+ /// It will only be called when the client application changes the edit field's layout attribute after the input panel is shown.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<LayoutSetEventArgs> LayoutSet
+ {
+ add
+ {
+ _imeLayoutSetDelegate = (InputPanelLayout layout, IntPtr userData) =>
+ {
+ LayoutSetEventArgs args = new LayoutSetEventArgs(layout);
+ _layoutSet?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetLayoutSetCb(_imeLayoutSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add LayoutSet Failed with error " + error);
+ }
+ else
+ {
+ _layoutSet += value;
+ }
+ }
+ remove
+ {
+ _layoutSet -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control requests the input panel to set the Return key label.
+ /// The input panel can show the text or an image on the Return button, according to the Return key action.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<ReturnKeySetEventArgs> ReturnKeySet
+ {
+ add
+ {
+ _imeReturnKeySetDelegate = (InputPanelReturnKey type, IntPtr userData) =>
+ {
+ ReturnKeySetEventArgs args = new ReturnKeySetEventArgs(type);
+ _returnKeyTypeSet?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetReturnKeySetCb(_imeReturnKeySetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add ReturnKeySet Failed with error " + error);
+ }
+ else
+ {
+ _returnKeyTypeSet += value;
+ }
+ }
+ remove
+ {
+ _returnKeyTypeSet -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control requests the input panel to enable or disable the Return key state.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<ReturnKeyStateSetEventArgs> ReturnKeyStateSet
+ {
+ add
+ {
+ _imeReturnKeyStateSetDelegate = (bool state, IntPtr userData) =>
+ {
+ ReturnKeyStateSetEventArgs args = new ReturnKeyStateSetEventArgs(state);
+ _returnKeyStateSet?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetReturnKeyStateSetCb(_imeReturnKeyStateSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add ReturnKeyStateSet Failed with error " + error);
+ }
+ else
+ {
+ _returnKeyStateSet += value;
+ }
+ }
+ remove
+ {
+ _returnKeyStateSet -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when the system display language is changed.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<DisplayLanguageChangedEventArgs> DisplayLanguageChanged
+ {
+ add
+ {
+ _imeDisplayLanguageChangedDelegate = (IntPtr language, IntPtr userData) =>
+ {
+ DisplayLanguageChangedEventArgs args = new DisplayLanguageChangedEventArgs(Marshal.PtrToStringAnsi(language));
+ _displayLanguageChanged?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetDisplayLanguageChangedCb(_imeDisplayLanguageChangedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add DisplayLanguageChanged Failed with error " + error);
+ }
+ else
+ {
+ _displayLanguageChanged += value;
+ }
+ }
+ remove
+ {
+ _displayLanguageChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when the device is rotated.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<RotationChangedEventArgs> RotationChanged
+ {
+ add
+ {
+ _imeRotationChangedDelegate = (int degree, IntPtr userData) =>
+ {
+ RotationChangedEventArgs args = new RotationChangedEventArgs(degree);
+ _rotationDegreeChanged?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetRotationChangedCb(_imeRotationChangedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add RotationChanged Failed with error " + error);
+ }
+ else
+ {
+ _rotationDegreeChanged += value;
+ }
+ }
+ remove
+ {
+ _rotationDegreeChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when Accessibility in settings application is on or off.
+ /// </summary>
+ /// <since_tizen> 4 </since_tizen>
+ public static event EventHandler<AccessibilityStateChangedEventArgs> AccessibilityStateChanged
+ {
+ add
+ {
+ _imeAccessibilityStateChangedDelegate = (bool state, IntPtr userData) =>
+ {
+ AccessibilityStateChangedEventArgs args = new AccessibilityStateChangedEventArgs(state);
+ _accessibilityStateChanged?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetAccessibilityStateChangedCb(_imeAccessibilityStateChangedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add AccessibilityStateChanged Failed with error " + error);
+ }
+ else
+ {
+ _accessibilityStateChanged += value;
+ }
+ }
+ remove
+ {
+ _accessibilityStateChanged -= value;
+ }
+ }
+
+ /// <summary>
+ /// Sets the languageRequested action.
+ /// </summary>
+ /// <param name="languageRequested">
+ /// Called when an associated text input UI control requests the language from the input panel, requesting for language code.
+ /// </param>
+ /// <since_tizen> 4 </since_tizen>
+ public static void SetLanguageRequestedCallback(OutAction<string> languageRequested)
+ {
+ _imeLanguageRequestedDelegate = (IntPtr userData, out IntPtr langCode) =>
+ {
+ string language;
+ _languageRequestedDelegate(out language);
+ langCode = (IntPtr)Marshal.StringToHGlobalAnsi(language);
+ };
+ ErrorCode error = ImeEventSetLanguageRequestedCallbackCb(_imeLanguageRequestedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add SetLanguageRequestedCallback Failed with error " + error);
+ }
+ _languageRequestedDelegate = languageRequested;
+ }
+
+ /// <summary>
+ /// Sets the processKey action.
+ /// If the key event is from the external device, DeviceInfo will have its name, class, and subclass information.
+ /// </summary>
+ /// <param name="processKey">
+ /// The action is called when the key event is received from the external devices or the SendKey function.
+ /// This Event processes the key event before an associated text input UI control does.
+ /// </param>
+ /// <since_tizen> 4 </since_tizen>
+ public static void SetProcessKeyCallback(BoolAction<KeyCode, KeyMask, InputMethodDeviceInformation> processKey)
+ {
+ _imeProcessKeyDelegate = (KeyCode keyCode, KeyMask keyMask, IntPtr devInfo, IntPtr userData) =>
+ {
+ return _processKeyDelagate(keyCode, keyMask, new InputMethodDeviceInformation(devInfo));
+ };
+ ErrorCode error = ImeEventSetProcessKeyEventCb(_imeProcessKeyDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add ProcessKey Failed with error " + error);
+ }
+ _processKeyDelagate = processKey;
+ }
+
+ /// <summary>
+ /// Sets the imDataRequested action.
+ /// </summary>
+ /// <param name="imDataRequested">
+ /// Called when an associated text input UI control requests the application specific data from the input panel, requesting for data array and it's length.
+ /// </param>
+ /// <since_tizen> 4 </since_tizen>
+ public static void SetDataRequestedCallback(OutArrayAction<byte> imDataRequested)
+ {
+ _imeImDataRequestedDelegate = (IntPtr userData, out IntPtr data, out uint dataLength) =>
+ {
+ byte[] dataArr;
+ _imDataRequestedDelegate(out dataArr);
+ data = Marshal.AllocHGlobal(dataArr.Length);
+ Marshal.Copy(dataArr, 0, data, dataArr.Length);
+ dataLength = (uint)dataArr.Length;
+ };
+ ErrorCode error = ImeEventSetImdataRequestedCb(_imeImDataRequestedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add SetDataRequestedCallback Failed with error " + error);
+ }
+ _imDataRequestedDelegate = imDataRequested;
+ }
+
+ /// <summary>
+ /// Sets the GeometryRequested action.
+ /// </summary>
+ /// <param name="geometryRequested">
+ /// Called when an associated text input UI control requests the position and size from the input panel, requesting for x, y, w, h values.
+ /// </param>
+ /// <since_tizen> 4 </since_tizen>
+ public static void SetGeometryRequestedCallback(OutAction<Rect> geometryRequested)
+ {
+ _imeGeometryRequestedDelegate = (IntPtr userData, out int x, out int y, out int w, out int h) =>
+ {
+ Rect rect = new Rect();
+ _geometryRequestedDelegate(out rect);
+ x = rect.x;
+ y = rect.y;
+ w = rect.w;
+ h = rect.h;
+ };
+ ErrorCode error = ImeEventSetGeometryRequestedCallbackCb(_imeGeometryRequestedDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add SetGeometryRequestedCallback Failed with error " + error);
+ }
+ _geometryRequestedDelegate = geometryRequested;
+ }
+
+ /// <summary>
+ /// Runs the main loop of the IME application.
+ /// This function starts to run the IME application's main loop.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <remarks>
+ /// This API is a blocking call, as it starts the main loop of the application.
+ /// </remarks>
+ /// <param name="create">This is called to initialize the IME application before the main loop starts up.</param>
+ /// <param name="terminate">This is called when the IME application is terminated.</param>
+ /// <param name="show">
+ /// This is called when the IME application is shown.
+ /// It provides the context information and the context ID.
+ /// </param>
+ /// <param name="hide">
+ /// This is called when the IME application is hidden.
+ /// It provides the context ID.
+ /// </param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void Run(Action create, Action terminate, Action<ContextId, InputMethodContext> show, Action<ContextId> hide)
+ {
+ _userCreate = create;
+ _userTerminate = terminate;
+ _userShow = show;
+ _userHide = hide;
+ _imeCallbackStructGCHandle._imeCallbackStruct.create = _create;
+ _imeCallbackStructGCHandle._imeCallbackStruct.terminate = _terminate;
+ _imeCallbackStructGCHandle._imeCallbackStruct.hide = _hide;
+ _imeCallbackStructGCHandle._imeCallbackStruct.show = _show;
+
+ ImeSetDotnetFlag(true);
+ ErrorCode error = ImeRun(ref _imeCallbackStructGCHandle._imeCallbackStruct, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Run Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+
+ }
+
+ /// <summary>
+ /// Sends a key event to the associated text input UI control.
+ /// </summary>
+ /// <remarks>
+ /// This function sends a key down or up event with the key mask to the client application. If forwardKey is true, this key event goes to the edit filed directly.
+ /// And if forwardKey is false, the ProcessKey event receives the key event before the edit field.
+ /// </remarks>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="keyCode">The key code to be sent.</param>
+ /// <param name="keyMask">The modifier key mask.</param>
+ /// <param name="forwardKey">The flag to send the key event directly to the edit field.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void SendKeyEvent(KeyCode keyCode, KeyMask keyMask, bool forwardKey = false)
+ {
+ ErrorCode error = ImeSendKeyEvent(keyCode, keyMask, forwardKey);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SendEvent Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Sends the text to the associated text input UI control.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="str">The string to be committed.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void CommitString(string str)
+ {
+ ErrorCode error = ImeCommitString(str);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "CommitString Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Requests to show the pre-edit string.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void ShowPreEditString()
+ {
+ ErrorCode error = ImeShowPreeditString();
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "ShowPreEditString Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Requests to hide the pre-edit string.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void HidePreEditString()
+ {
+ ErrorCode error = ImeHidePreeditString();
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "HidePreEditString Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Updates a new pre-edit string.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="str">The string to be updated in pre-edit.</param>
+ /// <param name="attrs">
+ /// The list which has ime_preedit_attribute lists, strings can be composed of multiple string attributes: underline, highlight color, and reversal color.
+ /// The attrs list can be empty if no attributes to set.
+ /// </param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void UpdatePreEditString(string str, IEnumerable<PreEditAttribute> attrs)
+ {
+ IntPtr einaList = IntPtr.Zero;
+ foreach (PreEditAttribute attribute in attrs)
+ {
+ IntPtr attr = IntPtr.Zero;
+ ImePreEditAttributeStruct imePreEditAttribute = new ImePreEditAttributeStruct();
+ imePreEditAttribute.start = attribute.Start;
+ imePreEditAttribute.length = attribute.Length;
+ imePreEditAttribute.type = (int)attribute.Type;
+ imePreEditAttribute.value = attribute.Value;
+ attr = Marshal.AllocHGlobal(Marshal.SizeOf(imePreEditAttribute));
+ Marshal.WriteIntPtr(attr, IntPtr.Zero);
+ Marshal.StructureToPtr(imePreEditAttribute, attr, false);
+ einaList = Interop.EinaList.EinaListAppend(einaList, attr);
+ }
+ ErrorCode error = ImeUpdatePreeditString(str, einaList);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "UpdatePreEditString Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Requests the surrounding text from the position of the cursor, asynchronously.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="maxLenBefore">The maximum length of the string to be retrieved before the cursor, -1 means unlimited.</param>
+ /// <param name="maxLenAfter">The maximum length of the string to be retrieved after the cursor, -1 means unlimited.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// This can occur due to the following reasons:
+ /// 1) The IME main loop has not started yet.
+ /// 2) The necessary event is not set.
+ /// </exception>
+ /// <postcondition>
+ /// The requested surrounding text can be received using the SurroundingTextUpdated event, only if it is set.
+ /// </postcondition>
+ /// <since_tizen> 4 </since_tizen>
+ public static void RequestSurroundingText(int maxLenBefore, int maxLenAfter)
+ {
+ ErrorCode error = ImeRequestSurroundingText(maxLenBefore, maxLenAfter);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "RequestSurroundingText Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Requests to delete the surrounding text.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="offset">The offset value from the cursor position.</param>
+ /// <param name="len">The length of the text to delete.</param>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void DeleteSurroundingText(int offset, int len)
+ {
+ ErrorCode error = ImeDeleteSurroundingText(offset, len);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "DeleteSurroundingText Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Gets the surrounding text from the position of the cursor, synchronously.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="maxLenBefore">The maximum length of the string to be retrieved before the cursor, -1 means unlimited.</param>
+ /// <param name="maxLenAfter">The maximum length of the string to be retrieved after the cursor, -1 means unlimited.</param>
+ /// <param name="text">The surrounding text.</param>
+ /// <param name="cursorPosition">The cursor position.</param>
+ /// <exception cref="OutOfMemoryException">This exception can be due to out of memory.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void GetSurroundingText(int maxLenBefore, int maxLenAfter, out string text, out int cursorPosition)
+ {
+ IntPtr txt;
+ ErrorCode error = ImeGetSurroundingText(maxLenBefore, maxLenAfter, out txt, out cursorPosition);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "GetSurroundingText Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ text = Marshal.PtrToStringAnsi(txt);
+ }
+
+ /// <summary>
+ /// Requests to set the selection.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="start">The start cursor position in text (in characters not bytes).</param>
+ /// <param name="end">The end cursor position in text (in characters not bytes).</param>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ public static void SetSelection(int start, int end)
+ {
+ ErrorCode error = ImeSetSelection(start, end);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SetSelection Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// This API returns the input panel main window.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <returns>The input panel main window object on success, otherwise null.</returns>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">
+ /// This can occur due to the following reasons:
+ /// 1) The IME main loop has not started yet.
+ /// 2) Operation failed.
+ /// </exception>
+ /// <since_tizen> 4 </since_tizen>
+ [Obsolete("Deprecated since API10. Will be removed in API12.")]
+ public static EditorWindow GetMainWindow()
+ {
+ EditorWindow._handle = ImeGetMainWindow();
+ EditorWindow obj = new EditorWindow();
+ ErrorCode error = (ErrorCode)Tizen.Internals.Errors.ErrorFacts.GetLastResult();
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "GetMainWindow Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ return obj;
+ }
+
+ /// <summary>
+ /// Sends the request to hide the IME.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 5 </since_tizen>
+ public static void RequestHide()
+ {
+ ErrorCode error = ImeRequestHide();
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "RequestHide Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// This API requests the InputMethodEditor to initialize.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">This exception can be due to operation failed.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void Create()
+ {
+ ErrorCode error = ImeInitialize();
+ Log.Info(LogTag, "ImeInitialize result : " + error);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "ImeInitialize Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+
+ error = ImePrepare();
+ Log.Info(LogTag, "ImePrepare result : " + error);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "ImePrepare Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// This API requests the InputMethodEditor to finalize.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <since_tizen> 4 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static void Destroy()
+ {
+ ErrorCode error = ImeFinalize();
+ Log.Info(LogTag, "ImeFinalize result : " + error);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "ImeFinalize Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Sets the floating mode to on or off.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="floatingMode"><c>true</c> to set the floating mode to on and <c>false</c> to set it to off.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 5 </since_tizen>
+ public static void SetFloatingMode(bool floatingMode)
+ {
+ ErrorCode error = ImeSetFloatingMode(floatingMode);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SetFloatingMode Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Allows the floating input panel window to move along with the mouse pointer when the mouse is pressed.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <remarks>
+ /// This function can be used in floating mode. If the floating mode is deactivated, calling this function has no effect.
+ /// </remarks>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 5 </since_tizen>
+ public static void SetFloatingDragStart()
+ {
+ ErrorCode error = ImeSetFloatingDragStart();
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SetFloatingDragStart Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Does not allow the movement of the floating input panel window with the mouse pointer when the mouse is pressed.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <remarks>
+ /// This function can be used in floating mode. If the floating mode is deactivated, calling this function has no effect.
+ /// </remarks>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 5 </since_tizen>
+ public static void SetFloatingDragEnd()
+ {
+ ErrorCode error = ImeSetFloatingDragEnd();
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SetFloatingDragEnd Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Notifies the changed language of the input panel to the the associated text input UI control.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <remarks>
+ /// LanguageRequestedCallback is raised after this API is called when the App requests changed language information.
+ /// </remarks>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void SendLanguageUpdated()
+ {
+ ErrorCode error = ImeUpdateInputPanelEvent(ImeEventType.Language, 0);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SendLanguageUpdated Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Sends the changed shift mode of the input panel to the the associated text input UI control.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="enable"><c>true</c> if shift button is clicked, otherwise <c>false</c>.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void SendShiftModeUpdated(bool enable)
+ {
+ ErrorCode error = ImeUpdateInputPanelEvent(ImeEventType.ShiftMode, enable ? (uint)ImeShiftMode.On : (uint)ImeShiftMode.Off);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SendInputPanelEvent Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Notifies the changed geometry of input panel window to the associated text input UI control.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void SendCustomGeometryUpdated()
+ {
+ ErrorCode error = ImeUpdateInputPanelEvent(ImeEventType.Geometry, 0);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SendCustomGeometryUpdated Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Gets the selected text synchronously.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <returns>The selected text.</returns>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static string GetSelectedText()
+ {
+ IntPtr txt;
+ ErrorCode error = ImeGetSelectedText(out txt);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "GetSelectedText Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ return Marshal.PtrToStringAnsi(txt);
+ }
+
+ /// <summary>
+ /// Called to set the prediction hint string to deliver to the input panel.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<PredictionHintUpdatedEventArgs> PredictionHintUpdated
+ {
+ add
+ {
+ if (_imePredictionHintSetDelegate == null)
+ {
+ _imePredictionHintSetDelegate = (IntPtr predictionHint, IntPtr userData) =>
+ {
+ PredictionHintUpdatedEventArgs args = new PredictionHintUpdatedEventArgs(Marshal.PtrToStringAnsi(predictionHint));
+ _predictionHintUpdated?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetPredictionHintSetCb(_imePredictionHintSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add PredictionHintUpdated Failed with error " + error);
+ }
+ }
+ _predictionHintUpdated += value;
+ }
+ remove
+ {
+ _predictionHintUpdated -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called to set the prediction hint key and value to deliver to the input panel.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<PredictionHintDataUpdatedEventArgs> PredictionHintDataUpdated
+ {
+ add
+ {
+ if (_imePredictionHintDataSetDelegate == null)
+ {
+ _imePredictionHintDataSetDelegate = (IntPtr key, IntPtr keyValue, IntPtr userData) =>
+ {
+ PredictionHintDataUpdatedEventArgs args = new PredictionHintDataUpdatedEventArgs(Marshal.PtrToStringAnsi(key), Marshal.PtrToStringAnsi(keyValue));
+ _predictionHintDataUpdated?.Invoke(null, args);
+ };
+
+ ErrorCode error = ImeEventSetPredictionHintDataSetCb(_imePredictionHintDataSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add PredictionHintDataUpdated Failed with error " + error);
+ }
+ }
+ _predictionHintDataUpdated += value;
+ }
+ remove
+ {
+ _predictionHintDataUpdated -= value;
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control requests the text entry to set the MIME type.
+ /// </summary>
+ /// <since_tizen> 6 </since_tizen>
+ public static event EventHandler<MimeTypeUpdateRequestedEventArgs> MimeTypeUpdateRequested
+ {
+ add
+ {
+ if (_imeMimeTypeSetRequestDelegate == null)
+ {
+ _imeMimeTypeSetRequestDelegate = (IntPtr mimeType, IntPtr userData) =>
+ {
+ MimeTypeUpdateRequestedEventArgs args = new MimeTypeUpdateRequestedEventArgs(Marshal.PtrToStringAnsi(mimeType));
+ _mimeTypeUpdateRequested?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetMimeTypeSetRequestCb(_imeMimeTypeSetRequestDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add MimeTypeUpdateRequested Failed with error " + error);
+ }
+ }
+ _mimeTypeUpdateRequested += value;
+ }
+ remove
+ {
+ _mimeTypeUpdateRequested -= value;
+ }
+ }
+
+ /// <summary>
+ /// Sends a private command to the associated text input UI control.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="command">The UTF-8 string to be sent.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void SendPrivateCommand(string command)
+ {
+ ErrorCode error = ImeSendPrivateCommand(command);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SendPrivateCommand Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Commits contents such as image to the associated text input UI control.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="content">The content URI to be sent.</param>
+ /// <param name="description">The content description.</param>
+ /// <param name="mimeType">The MIME type received from the MimeTypeSetRequest</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 6 </since_tizen>
+ public static void CommitContent(string content, string description, string mimeType)
+ {
+ ErrorCode error = ImeCommitContent(content, description, mimeType);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "CommitContent Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// This API updates the given native input panel window's size information.
+ /// The native window handle of NUI Window can be got by below code.
+ /// var handle = new Window.SafeNativeWindowHandle();
+ /// IntPtr nativeHandle = handle.DangerousGetHandle();
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="window">The native window handle.</param>
+ /// <param name="portraitWidth">The width in the portrait mode.</param>
+ /// <param name="portraitHeight">The height in the portrait mode.</param>
+ /// <param name="landscapeWidth">The width in the landscape mode.</param>
+ /// <param name="landscapeHeight">The height in the landscape mode.</param>
+ /// <exception cref="ArgumentException">This exception can be due to an invalid parameter.</exception>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 9 </since_tizen>
+ public static void SetSize(IntPtr window, int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight)
+ {
+ ErrorCode error = ImeSetNativeWindowSize(window, portraitWidth, portraitHeight, landscapeWidth, landscapeHeight);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SetSize Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Sets the processKey action.
+ /// If the key event is from the external device, DeviceInfo will have its name, class, and subclass information.
+ /// </summary>
+ /// <param name="processKey">
+ /// <c>true</c> if the event was processed, otherwise the event was not processed and was forwarded to the client application.
+ /// The first parameter is X11 key code and the second parameter is key symbol.
+ /// The action is called when the key event is received from the external devices or the SendKey function.
+ /// This Event processes the key event before an associated text input UI control does.
+ /// </param>
+ /// <since_tizen> 10 </since_tizen>
+ public static void SetProcessKeyCallback(BoolAction<uint, KeyCode, KeyMask, InputMethodDeviceInformation> processKey)
+ {
+ _imeProcessKeyWithKeycodeDelegate = (uint keyCode, KeyCode keySymbol, KeyMask keyMask, IntPtr devInfo, IntPtr userData) =>
+ {
+ return _processKeyWithKeycodeDelagate(keyCode, keySymbol, keyMask, new InputMethodDeviceInformation(devInfo));
+ };
+ ErrorCode error = ImeEventSetProcessKeyEventWithKeycodeCb(_imeProcessKeyWithKeycodeDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add ProcessKeyWithKeycode Failed with error " + error);
+ }
+ _processKeyWithKeycodeDelagate = processKey;
+ }
+
+ /// <summary>
+ /// Updates the cursor position in the preedit string.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="position">The cursor position in the preedit string.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 10 </since_tizen>
+ public static void UpdatePreeditCursor(uint position)
+ {
+ ErrorCode error = ImeUpdatePreeditCursor(position);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "UpdatePreeditCursor Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Sets whether candidate strings will be shown or not.
+ /// </summary>
+ /// <privilege>
+ /// http://tizen.org/privilege/ime
+ /// </privilege>
+ /// <param name="visible"><c>true</c> to show candidate strings, <c>false</c> otherwise.</param>
+ /// <exception cref="UnauthorizedAccessException">This exception can be due to permission denied.</exception>
+ /// <exception cref="InvalidOperationException">The IME main loop has not started yet.</exception>
+ /// <since_tizen> 10 </since_tizen>
+ public static void SetCandidateVisibilityState(bool visible)
+ {
+ ErrorCode error = ImeSetCandidateVisibilityState(visible);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "SetCandidateVisibilityState Failed with error " + error);
+ throw InputMethodExceptionFactory.CreateException(error);
+ }
+ }
+
+ /// <summary>
+ /// Called when an associated text input UI control requests the input panel to set its input hint.
+ /// It will only be called when the client application changes the edit field's input hint attribute after the input panel is shown.
+ /// </summary>
+ /// <seealso cref="InputHints"/>
+ /// <since_tizen> 10 </since_tizen>
+ public static event EventHandler<InputHintSetEventArgs> InputHintSet
+ {
+ add
+ {
+ _imeInputHintSetDelegate = (InputHints hint, IntPtr userData) =>
+ {
+ InputHintSetEventArgs args = new InputHintSetEventArgs(hint);
+ _inputHintSet?.Invoke(null, args);
+ };
+ ErrorCode error = ImeEventSetInputHintSetCb(_imeInputHintSetDelegate, IntPtr.Zero);
+ if (error != ErrorCode.None)
+ {
+ Log.Error(LogTag, "Add InputHintSet Failed with error " + error);
+ }
+ else
+ {
+ _inputHintSet += value;
+ }
+ }
+ remove
+ {
+ _inputHintSet -= value;
+ }
+ }
+ }
+}