1 /**
2  * @file lv_ime_pinyin.h
3  *
4  */
5 #ifndef LV_IME_PINYIN_H
6 #define LV_IME_PINYIN_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 /*********************
13  *      INCLUDES
14  *********************/
15 #include "../../lv_conf_internal.h"
16 #include "../../core/lv_obj.h"
17 
18 #if LV_USE_IME_PINYIN != 0
19 
20 /*********************
21  *      DEFINES
22  *********************/
23 #define LV_IME_PINYIN_K9_MAX_INPUT  7
24 
25 /**********************
26  *      TYPEDEFS
27  **********************/
28 
29 typedef enum {
30     LV_IME_PINYIN_MODE_K26,
31     LV_IME_PINYIN_MODE_K9,
32     LV_IME_PINYIN_MODE_K9_NUMBER,
33 } lv_ime_pinyin_mode_t;
34 
35 /*Data of pinyin_dict*/
36 typedef struct {
37     const char * const py;
38     const char * const py_mb;
39 } lv_pinyin_dict_t;
40 
41 /*Data of 9-key input(k9) mode*/
42 typedef struct {
43     char py_str[7];
44 } ime_pinyin_k9_py_str_t;
45 
46 /***********************
47  * GLOBAL VARIABLES
48  ***********************/
49 
50 extern const lv_obj_class_t lv_ime_pinyin_class;
51 
52 /**********************
53  * GLOBAL PROTOTYPES
54  **********************/
55 lv_obj_t * lv_ime_pinyin_create(lv_obj_t * parent);
56 
57 /*=====================
58  * Setter functions
59  *====================*/
60 
61 /**
62  * Set the keyboard of Pinyin input method.
63  * @param obj  pointer to a Pinyin input method object
64  * @param kb pointer to a Pinyin input method keyboard
65  */
66 void lv_ime_pinyin_set_keyboard(lv_obj_t * obj, lv_obj_t * kb);
67 
68 /**
69  * Set the dictionary of Pinyin input method.
70  * @param obj  pointer to a Pinyin input method object
71  * @param dict pointer to a Pinyin input method dictionary
72  */
73 void lv_ime_pinyin_set_dict(lv_obj_t * obj, lv_pinyin_dict_t * dict);
74 
75 /**
76  * Set mode, 26-key input(k26) or 9-key input(k9).
77  * @param obj  pointer to a Pinyin input method object
78  * @param mode   the mode from 'lv_ime_pinyin_mode_t'
79  */
80 void lv_ime_pinyin_set_mode(lv_obj_t * obj, lv_ime_pinyin_mode_t mode);
81 
82 /*=====================
83  * Getter functions
84  *====================*/
85 
86 /**
87  * Set the dictionary of Pinyin input method.
88  * @param obj  pointer to a Pinyin IME object
89  * @return     pointer to the Pinyin IME keyboard
90  */
91 lv_obj_t * lv_ime_pinyin_get_kb(lv_obj_t * obj);
92 
93 /**
94  * Set the dictionary of Pinyin input method.
95  * @param obj  pointer to a Pinyin input method object
96  * @return     pointer to the Pinyin input method candidate panel
97  */
98 lv_obj_t * lv_ime_pinyin_get_cand_panel(lv_obj_t * obj);
99 
100 /**
101  * Set the dictionary of Pinyin input method.
102  * @param obj  pointer to a Pinyin input method object
103  * @return     pointer to the Pinyin input method dictionary
104  */
105 const lv_pinyin_dict_t * lv_ime_pinyin_get_dict(lv_obj_t * obj);
106 
107 /*=====================
108  * Other functions
109  *====================*/
110 
111 /**********************
112  *      MACROS
113  **********************/
114 
115 #endif  /*LV_IME_PINYIN*/
116 
117 #ifdef __cplusplus
118 } /*extern "C"*/
119 #endif
120 
121 #endif /*LV_USE_IME_PINYIN*/
122