8cd9db0bda81b0e60164d0629d5260035bac8a13
[platform/core/uifw/ise-default.git] / src / include / ise.h
1 /*
2  * Copyright (c) 2012 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #ifndef _ISE_H_
19 #define _ISE_H_
20
21 #include <sclcore.h>
22 #include <string>
23 #include <Elementary.h>
24 #include <dlog.h>
25
26 #include "languages.h"
27
28 #define ISE_VERSION "1.1.0-1"
29 #define LOCALEDIR RESDIR"/locale"
30
31 #define PRIMARY_LATIN_LANGUAGE "English"
32 #undef MAIN_ENTRY_XML_PATH
33 #ifdef _TV
34 #define MAIN_ENTRY_XML_PATH LAYOUTDIR"/tv/main_entry.xml"
35 #elif _WEARABLE
36 #define MAIN_ENTRY_XML_PATH LAYOUTDIR"/wearable/main_entry.xml"
37 #else
38 #define MAIN_ENTRY_XML_PATH LAYOUTDIR"/mobile/main_entry.xml"
39 #endif
40
41 #define DEFAULT_KEYBOARD_ISE_UUID "org.tizen.ise-engine-default"
42
43 //#define INPUT_MODE_NATIVE MAX_INPUT_MODE /* Native mode. It will distinguish to the current user language */
44
45 //#define ISE_RELEASE_AUTOCOMMIT_BLOCK_INTERVAL 1300
46 #undef LOG_TAG
47 #define LOG_TAG "ISE_DEFAULT"
48
49 enum ISE_LAYOUT{
50     ISE_LAYOUT_STYLE_NORMAL = 0,
51     ISE_LAYOUT_STYLE_NUMBER,
52     ISE_LAYOUT_STYLE_EMAIL,
53     ISE_LAYOUT_STYLE_URL,
54     ISE_LAYOUT_STYLE_PHONENUMBER,
55     ISE_LAYOUT_STYLE_IP,
56     ISE_LAYOUT_STYLE_MONTH,
57     ISE_LAYOUT_STYLE_NUMBERONLY,
58     ISE_LAYOUT_STYLE_INVALID,
59     ISE_LAYOUT_STYLE_HEX,
60     ISE_LAYOUT_STYLE_TERMINAL,
61     ISE_LAYOUT_STYLE_PASSWORD,
62     ISE_LAYOUT_STYLE_DATETIME,
63     ISE_LAYOUT_STYLE_EMOTICON,
64     ISE_LAYOUT_STYLE_VOICE,
65
66     ISE_LAYOUT_STYLE_NUMBERONLY_SIG,
67     ISE_LAYOUT_STYLE_NUMBERONLY_DEC,
68     ISE_LAYOUT_STYLE_NUMBERONLY_SIGDEC,
69
70     ISE_LAYOUT_STYLE_PASSWD_3X4,
71
72     ISE_LAYOUT_STYLE_MAX
73 };
74
75 enum ISE_CANDIDATE_REQUEST {
76     ISE_CANDIDATE_REQ_NONE,
77     ISE_CANDIDATE_REQ_SHOW,
78     ISE_CANDIDATE_REQ_HIDE,
79 };
80
81 typedef struct {
82     const sclchar *input_mode;
83     const sclchar *sublayout_name;
84     const sclboolean force_latin;
85 } ISE_DEFAULT_VALUES;
86
87 #ifdef _TV
88 const ISE_DEFAULT_VALUES g_ise_default_values[ISE_LAYOUT_STYLE_MAX] = {
89     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NORMAL */
90     {"SYM_QTY_1",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NUMBER */
91     {"",                "EMAIL",        TRUE },     /* ISE_LAYOUT_STYLE_EMAIL */
92     {"",                "URL",          TRUE },     /* ISE_LAYOUT_STYLE_URL */
93     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_PHONENUMBER */
94     {"NUMONLY_QTY",     "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_IP */
95     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_MONTH */
96     {"NUMONLY_QTY",     "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY */
97     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_INVALID */
98     {"SYM_QTY_1",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_HEX */
99     {"",                "DEFAULT",      TRUE },     /* ISE_LAYOUT_STYLE_TERMINAL */
100     {"",                "DEFAULT",      TRUE },     /* ISE_LAYOUT_STYLE_PASSWORD */
101     {"NUMONLY_QTY",     "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_DATETIME */
102     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_EMOTICON */
103     {"STT_3X4",         "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_VOICE */
104
105     {"NUMONLY_QTY",     "DEFAULT",   FALSE },       /* ISE_LAYOUT_STYLE_NUMBERONLY_SIG */
106     {"NUMONLY_QTY",     "DEFAULT",   FALSE },       /* ISE_LAYOUT_STYLE_NUMBERONLY_DEC */
107     {"NUMONLY_QTY",     "DEFAULT",   FALSE },       /* ISE_LAYOUT_STYLE_NUMBERONLY_SIGDEC */
108
109     {"NUMONLY_QTY",     "DEFAULT",   FALSE },       /* ISE_LAYOUT_STYLE_PASSWD_3X4 */
110 };
111 #elif _WEARABLE
112 const ISE_DEFAULT_VALUES g_ise_default_values[ISE_LAYOUT_STYLE_MAX] = {
113     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NORMAL */
114     {"NUM_3X4",         "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NUMBER */
115     {"",                "EMAIL",        TRUE },     /* ISE_LAYOUT_STYLE_EMAIL */
116     {"",                "URL",          TRUE },     /* ISE_LAYOUT_STYLE_URL */
117     {"PHONE_3X4",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_PHONENUMBER */
118     {"NUMONLY_3X4_DEC", "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_IP */
119     {"MONTH_3X4",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_MONTH */
120     {"NUMONLY_3X4",     "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY */
121     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_INVALID */
122     {"SYM_4X4_1",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_HEX */
123     {"",                "DEFAULT",      TRUE },     /* ISE_LAYOUT_STYLE_TERMINAL */
124     {"",                "DEFAULT",      TRUE },     /* ISE_LAYOUT_STYLE_PASSWORD */
125     {"DATETIME_3X4",    "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_DATETIME */
126     {"EMOTICON_LAYOUT", "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_EMOTICON */
127     {"STT_3X4",         "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_VOICE */
128
129     {"NUMONLY_3X4_SIG",    "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY_SIG */
130     {"NUMONLY_3X4_DEC",    "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY_DEC */
131     {"NUMONLY_3X4_SIGDEC", "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY_SIGDEC */
132
133     {"PASSWD_3X4",         "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_PASSWD_3X4 */
134 };
135 #else
136 const ISE_DEFAULT_VALUES g_ise_default_values[ISE_LAYOUT_STYLE_MAX] = {
137     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NORMAL */
138     {"SYM_QTY_1",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NUMBER */
139     {"",                "EMAIL",        TRUE },     /* ISE_LAYOUT_STYLE_EMAIL */
140     {"",                "URL",          TRUE },     /* ISE_LAYOUT_STYLE_URL */
141     {"PHONE_3X4",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_PHONENUMBER */
142     {"NUMONLY_3X4_DEC", "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_IP */
143     {"MONTH_3X4",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_MONTH */
144     {"NUMONLY_3X4",     "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY */
145     {"",                "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_INVALID */
146     {"SYM_QTY_1",       "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_HEX */
147     {"",                "DEFAULT",      TRUE },     /* ISE_LAYOUT_STYLE_TERMINAL */
148     {"",                "DEFAULT",      TRUE },     /* ISE_LAYOUT_STYLE_PASSWORD */
149     {"DATETIME_3X4",    "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_DATETIME */
150     {"EMOTICON_LAYOUT", "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_EMOTICON */
151     {"STT_3X4",         "DEFAULT",      FALSE },    /* ISE_LAYOUT_STYLE_VOICE */
152
153     {"NUMONLY_3X4_SIG",    "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY_SIG */
154     {"NUMONLY_3X4_DEC",    "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY_DEC */
155     {"NUMONLY_3X4_SIGDEC", "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_NUMBERONLY_SIGDEC */
156
157     {"PASSWD_3X4",         "DEFAULT",   FALSE },    /* ISE_LAYOUT_STYLE_PASSWD_3X4 */
158 };
159 #endif
160
161 #define ISE_RETURN_KEY_LABEL_DONE   gettext("IDS_IME_SK_DONE_ABB")
162 #define ISE_RETURN_KEY_LABEL_GO     gettext("IDS_IME_BUTTON_GO_M_KEYBOARD")
163 #define ISE_RETURN_KEY_LABEL_JOIN   gettext("IDS_IME_BUTTON_JOIN_M_KEYBOARD")
164 #define ISE_RETURN_KEY_LABEL_LOGIN  gettext("IDS_IME_BUTTON_LOG_IN_M_KEYBOARD")
165 #define ISE_RETURN_KEY_LABEL_NEXT   gettext("IDS_IME_OPT_NEXT_ABB")
166 #define ISE_RETURN_KEY_LABEL_SEARCH gettext("IDS_IME_BUTTON_SEARCH_M_KEYBOARD")
167 #define ISE_RETURN_KEY_LABEL_SEND   gettext("IDS_IME_BUTTON_SEND_M_KEYBOARD")
168 #define ISE_RETURN_KEY_LABEL_SIGNIN gettext("IDS_IME_BUTTON_SIGN_IN_M_KEYBOARD")
169
170 #define ISE_CANCEL_STRING           gettext("IDS_ST_SK_CANCEL");
171
172 #define IMDATA_ACTION_DISABLE_EMOTICONS 0x0040
173
174 typedef struct {
175     int ic;
176     int focused_ic;
177     sclu32 layout;
178     sclu32 layout_variation;
179     sclboolean caps_mode;
180     sclboolean need_reset;
181     sclboolean visible_state;
182     std::string multitap_value;
183     SCLKeyModifier prev_modifier;
184     sclboolean disable_force_latin;
185 } KEYBOARD_STATE;
186
187 void ise_send_string(const sclchar *key_value);
188 void ise_update_preedit_string(const sclchar *str, const sclboolean underline = TRUE);
189 void ise_send_event(sclulong key_event, sclulong key_mask);
190 void ise_forward_key_event(sclulong key_event);
191
192 void ise_focus_in(int ic);
193 void ise_focus_out(int ic);
194 void ise_attach_input_context(int ic);
195 void ise_detach_input_context(int ic);
196 void ise_show(int ic);
197 void ise_hide();
198 void ise_create();
199 void ise_destroy();
200 void ise_app_candidate_show();
201 void ise_app_candidate_hide();
202 #ifdef _WEARABLE
203 void ise_check_wearable_candidate();
204 void ise_set_emoticon_label(int group_id);
205 #endif
206 void ise_reset_context();
207 void ise_reset_input_context();
208 void ise_set_layout(sclu32 layout, sclu32 layout_variation);
209 void ise_set_screen_rotation(int degree);
210 void ise_set_accessibility_state(bool state);
211 void ise_set_caps_mode(unsigned int mode);
212 void ise_update_cursor_position(int position);
213 void ise_set_return_key_type(unsigned int type);
214 void ise_set_return_key_disable(unsigned int disabled);
215 void ise_get_language_locale(char **locale);
216 void ise_update_table(const std::vector<std::string> &vec_str);
217 void ise_process_key_event(scim::KeyEvent &key, sclu32 &ret);
218
219 #endif