MTK 虚拟键盘与输入法

一、    虚拟键盘

Typedef struct

{

               BOOLenable_dead_key;

               S16n_matrix_layout;

               S16n_custom_keys;                                                                                      //用户自定义按键个数

               UI_character_typematrix_string[MMI_VKBD_MAX_ROM][MMI_VKBD_MAX_COLUMN + 1];//键盘矩阵

               UI_character_typecustom_string[MMI_VKBD_MAX_CUSTOM_KEYS];                        //用户自定义按键

               MMI_ID_TYPEcustom_key_image[MMI_VKBD_MAX_CUSTOM_KEYS];     //自定义按键图片

               Gui_virtual_keyboard_pen_enumcustom_key_type[MMI_VKBD_MAX_CUSTOM_KEYS];//用户自定义按键类型(按键功能:输入字符型、删除字符等)

}gui_keyboard_language_struct;

Typedef struct

{

               S16width;                                                                                                         //虚拟键盘的宽

               S16height;                                                                                                        //虚拟键盘的高

               S16n_matrix_key_layout;

               S16n_custom_keys;                                                                                      //用户自定义按键个数

               Constgui_matrix_key_layout_struct *matrix_layout;                                    //矩阵按键的排布(大小相同的按键)

               Constgui_custom_key_layout_struct[s1]  *custom_keys;                                       //用户自定义按键在虚拟键盘上的排布坐标

               U16ImageId;                                                                                                    //虚拟键盘布局图片ID

}gui_keyboard_layout_struct;

Typedef struct

{

               S16x,y;                                        //客户自定义按键的x,y坐标(相对虚拟键盘坐标而言)

               S16key_width,key_height;   //客户自定义按键的宽度,高度。

}gui_custom_key_layout_struct;

Typedef struct

{

               S16x,y;                                                                    //原有矩阵按键的x,y坐标(相对虚拟键盘坐标而言)

               S16n_columns,n_rows;                                                   //矩阵列数,行数

               S16width,height;                                                  //矩阵区域的宽度和高度

               S16key_width,key_height;                               //矩阵按键的宽度,高度

               S16horizontal_key_gap,vertical_key_gap;  //矩阵按键之间水平间隙,垂直间隙(此间隙只对矩阵按键有效)

}gui_matrix_key_layout_struct;

Typedef struct

{

               Gui_virtual_keyboard_language_enumlang;                                                      //虚拟键盘支持的语言类型

               Const_gui_keyboard_layout_struct*virtual_keyboard_layout;                  //虚拟键盘布局排布

               Const_gui_keyboard_language_struct*virtual_keyboard_language;          //虚拟键盘上要显示的字符

}gui_keyboard_lang_map_struct,*gui_keyboard_lang_map_struct_p;

gui_keyboard_lang_map_structMMI_virtual_keyboard_language_map[];              //此数组将虚拟键盘的排布和字符结合在一起

typedef struct virtual_keyboard_struct

{

               S16x,y;

               S16width,height;

               U32flags;

               Gui_virtual_keyboard_language_enumlang_type;

               UI_virtual_keyboard_theme*keyboard_theme;

               UI_character_typedisp_area_text[MMI_VKBD_MAX_DISPLAY_AREA_TEXT_LEN+1];;

               ConstUI_character_type*allowed_characters;

               UI_character_typedisable_chars[MMI_VKBD_MAX_DISABLED_KEYS + 1];

               Gui_virtual_keyboard_pen_enumdisabled_symbols[MMI_VKBD_MAX_DISABLED_KEYS + 1];

               MMI_BOOLkey_down_accepted;

               UI_character_typedead_key_input[MMI_VKBD_MAX_DEADKEY_INPUT];

               MMI_BOOLselected_key_cached;

               Virtual_keyboard_selection_structselected_key;

               Gdi_image_cache_bmp_structselected_key_bitmap;

               Void(*hide_callback)(S32 x1,S32 y1,S32 x2,S32 y2);

               Void(*display_callback)(gui_vkbd_display_callback_type_enum *flag,PU8 *content);

#ifdef__MMI_VK_POPUP_HINT__

               MMI_BOOLactive;

               Void(*hide_cursor_callback)(S32 x1,S32 y1,S32 x2,S32 y2);

               Void(*blink_cursor_callback)(void);

               Gdi_image_cache_bmp_structselected_key_enlarged_bitmap;

#endif

}virtual_keyboard;

 

gui_create_virtual_keyboard();                                                     //创建虚拟键盘

gui_show_virtual_keyboard();                                                      //显示虚拟键盘

gui_virtual_keyboard_translate_pen_event();                         //

gui_virtual_keyboard_get_current_character();                       //

gui_virtual_keyboard_translate_pen_position();                   //判断触摸位置是否在虚拟键盘范围中

gui_virtual_keyboard_get_selected_key();                 //用于获得事件发生位置的字符

gui_virtual_keyboard_is_key_disable()                                    //此函数中判断虚拟键盘上哪些按键可以禁用

gui_set_virtual_keyboard_allowed_characters()                     //用来设置虚拟键盘上允许显示的按键

gui_virtual_keyboard_cache_and_show_selected_key_for_large_icon()//此函数用来放大选择的字符

gui_virtual_keyboard_is_key_disable()                                    //函数用来禁用掉某些按键

gui_virtual_keyboard_show_selected_key()                            //

 

虚拟键盘的显示与隐藏主要体现在输入法的切换方面,因此需要修改代码的地方在文件EditorPen.c里面。主要修改的函数是mmi_pen_editor_vk_show和mmi_pen_editor_set_virtual_keyboard_by_input_mode.

输入法提示符的显示:

每当我们切换一个输入法的时候,左上角就会显示当前输入法的名称。改功能在wgui_categories_input.c文件中的wgui_get_inputbox_information_icon和wgui_redraw_input_information_bar函数中实现。

 

{GUI_VIRTUAL_KEYBOARD_ENGLISH_UPPERCASE,&gui_virtual_keyboard_standard_layout,&gui_keyboard_english_uppercase_string};

Static const gui_keyboard_layout_structgui_virtual_keyboard_standard_layout =

{

               MMI_VKBD_STANDARD_WIDTH,

               MMI_VKBD_STANDARD_HEIGHT,

               1,

               21,

               &gui_standard_matrix_layout,

               Gui_standard_custom_key_layout,

               IMG_VKBD_STANDARD

};

Static const gui_matrix_key_layout_structgui_standard_matrix_layout =

{

               2,11,

               10,1,

               320,40,

               28,40,

               4,14

}

Static const gui_custom_key_layout_strucgui_standard_custom_key_layout[]=

{

               {18,65,28,40},

               {50,65,28,40},

               {82,65,28,40},

               {114,65,28,40},

               {146,65,28,40},

               {178,65,28,40},

               {210,65,28,40},

               {242,65,28,40},

               {274,65,28,40},

 

               {2,119,38,40},

               {50,119,28,40},

               {82,119,28,40},

               {114,119,28,40},

               {146,119,28,40},

               {178,119,28,40},

               {210,119,28,40},

               {242,119,28,40},

               {280,119,28,40},

 

               {2,  173,76,40},

               {82,173,156,40},

               {242,173,76,40}

}

Static const gui_keyboard_language_structgui_keyboard_english_uppercase_string =

{

               MMI_FALSE,

               1,

               21,

               {

                             {‘Q’,’W’,’E’,’R’,’T’,’Y’,’U’,’I’,’O’,’P’}

               }

               {

                             ‘A’,’S’,’D’, ’F’, ’G’, ’H’, ’J’, ’K’, ’L’,

                             ’\0’, ’Z’, ’X’, ’C’, ’V’, ’B’, ’N’, ’M’, ’\0’,

                             ’\0’, ’\0’, ’\0’,

}

{

              0,0,0,0,0,0,0,0,0,

              IMG_VKBD_CUSTOM_CAPSLOCK,0,0,0,0,0,0,0,IMG_VKBD_CUSTOM_BRACKET,

              IMG_VKBD_CUSTOM_IM_ICON_CAP_ABC,IMG_VKBD_CUSTOM_SPACE,IMG_VKBD_CUSTOM_SYMBPICKER,

}

{

              GUI_VKBD_PEN_CHAR_I,GUI_VKBD_PEN_CHAR_I, GUI_VKBD_PEN_CHAR_I,

              GUI_VKBD_PEN_CHAR_I,GUI_VKBD_PEN_CHAR_I, GUI_VKBD_PEN_CHAR_I,

              GUI_VKBD_PEN_CHAR_I,GUI_VKBD_PEN_CHAR_I, GUI_VKBD_PEN_CHAR_I,

 

              GUI_VKBD_PEN_CAPSLOCK,GUI_VKBD_PEN_CHAR_I, GUI_VKBD_PEN_CHAR_I,

              GUI_VKBD_PEN_CHAR_I,GUI_VKBD_PEN_CHAR_I, GUI_VKBD_PEN_CHAR_I,

              GUI_VKBD_PEN_CHAR_I,GUI_VKBD_PEN_CHAR_I, GUI_VKBD_PEN_BAKSPACE,

              GUI_VKBD_PEN_DISPLAY_CALLBACK,GUI_VKBD_PEN_SPACE,GUI_VKBD_PEN_SYMBPICKER,

}

};

绘制后,虚拟键盘显示如下:

 

虚拟键盘文件gui_virtual_keyboard.c            wgui_virtual_keyboard.c


输入法待续。。。

你可能感兴趣的:(MTK,输入法,mtk,keyboard,layout,character,struct)