2 * ISF(Input Service Framework)
4 * ISF is based on SCIM 1.4.7 and extended for supporting more mobile fitable.
5 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
7 * Contact: Shuo Liu <shuo0805.liu@samsung.com>, Jihoon Kim <jihoon48.kim@samsung.com>
9 * This library is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU Lesser General Public License as published by the
11 * Free Software Foundation; either version 2.1 of the License, or (at your option)
14 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
15 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software Foundation, Inc., 51
21 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "isf_demo_efl.h"
26 #include "isf_layout_efl.h"
28 static void _rotate_cb (void *data, Evas_Object *obj, void *event_info)
30 struct appdata *ad = (struct appdata *)data;
32 int angle = elm_win_rotation_get (ad->win_main);
34 elm_win_rotation_with_resize_set (ad->win_main, 270);
35 } else if (angle == 270) {
36 elm_win_rotation_with_resize_set (ad->win_main, 0);
40 static void _input_panel_state_cb (void *data, Ecore_IMF_Context *ctx, int value)
44 if (value == ECORE_IMF_INPUT_PANEL_STATE_SHOW) {
45 ecore_imf_context_input_panel_geometry_get (ctx, &x, &y, &w, &h);
46 printf ("Input panel is shown\n");
47 printf ("x : %d, y : %d, w : %d, h : %d\n", x, y, w, h);
48 } else if (value == ECORE_IMF_INPUT_PANEL_STATE_HIDE) {
49 printf ("Input panel is hidden\n");
50 } else if (value == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW) {
51 printf ("Input panel will be shown\n");
55 static void _input_panel_resize_cb (void *data, Ecore_IMF_Context *ctx, int value)
59 ecore_imf_context_input_panel_geometry_get (ctx, &x, &y, &w, &h);
60 printf ("[%s] x : %d, y : %d, w : %d, h : %d\n", __func__, x, y, w, h);
63 static void _shift_mode_cb (void *data, Ecore_IMF_Context *ctx, int value)
65 if (value == ECORE_IMF_INPUT_PANEL_SHIFT_MODE_OFF) {
66 printf ("[%s] Shift Mode : OFF\n", __func__);
67 } else if (value == ECORE_IMF_INPUT_PANEL_SHIFT_MODE_ON) {
68 printf ("[%s] Shift Mode : ON\n", __func__);
72 static void _language_changed_cb (void *data, Ecore_IMF_Context *ctx, int value)
76 ecore_imf_context_input_panel_language_locale_get(ctx, &locale);
78 printf ("[%s] language : %s\n", __func__, locale);
84 static void _candidate_panel_state_cb (void *data, Ecore_IMF_Context *ctx, int value)
88 if (value == ECORE_IMF_CANDIDATE_PANEL_SHOW) {
89 ecore_imf_context_candidate_panel_geometry_get (ctx, &x, &y, &w, &h);
90 printf ("Candidate window is shown\n");
91 printf ("[%s] x : %d, y : %d, w : %d, h : %d\n", __func__, x, y, w, h);
92 } else if (value == ECORE_IMF_CANDIDATE_PANEL_HIDE) {
93 printf ("Candidate window is hidden\n");
97 static void _candidate_panel_geometry_changed_cb (void *data, Ecore_IMF_Context *ctx, int value)
101 ecore_imf_context_candidate_panel_geometry_get (ctx, &x, &y, &w, &h);
102 printf ("[%s] x : %d, y : %d, w : %d, h : %d\n", __func__, x, y, w, h);
106 _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
108 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
109 printf("[key down] keyname : '%s', key : '%s', string : '%s', compose : '%s'\n", ev->keyname, ev->key, ev->string, ev->compose);
113 _key_up_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
115 Evas_Event_Key_Up *ev = (Evas_Event_Key_Up *)event_info;
116 printf("[key up] keyname : '%s', key : '%s', string : '%s', compose : '%s'\n", ev->keyname, ev->key, ev->string, ev->compose);
119 static Evas_Object *_create_ef_layout(Evas_Object *parent, const char *label, const char *guide_text,Elm_Input_Panel_Layout layout)
121 Evas_Object *ef = _create_ef(parent,label,guide_text);
122 Ecore_IMF_Context *ic = NULL;
123 Evas_Object *en = elm_object_part_content_get(ef,"elm.swallow.content");
124 elm_entry_input_panel_layout_set (en, layout);
125 evas_object_event_callback_add(en, EVAS_CALLBACK_KEY_DOWN, _key_down_cb, NULL);
126 evas_object_event_callback_add(en, EVAS_CALLBACK_KEY_UP, _key_up_cb, NULL);
128 ic = (Ecore_IMF_Context *)elm_entry_imf_context_get (en);
131 ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_state_cb, NULL);
132 ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_INPUT_PANEL_GEOMETRY_EVENT, _input_panel_resize_cb, NULL);
133 ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_INPUT_PANEL_SHIFT_MODE_EVENT, _shift_mode_cb, NULL);
134 ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_INPUT_PANEL_LANGUAGE_EVENT, _language_changed_cb, NULL);
136 ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_CANDIDATE_PANEL_STATE_EVENT, _candidate_panel_state_cb, NULL);
137 ecore_imf_context_input_panel_event_callback_add (ic, ECORE_IMF_CANDIDATE_PANEL_GEOMETRY_EVENT, _candidate_panel_geometry_changed_cb, NULL);
143 static void add_layout_to_conformant (void *data, Evas_Object *lay_in, const char *title)
145 Evas_Object *scroller = NULL;
146 Evas_Object *win = NULL;
147 Evas_Object *conform = NULL;
148 struct appdata *ad = NULL;
150 ad = (struct appdata *) data;
153 // Enabling illume notification property for window
154 elm_win_conformant_set (win, EINA_TRUE);
156 // Creating conformant widget
157 conform = elm_conformant_add (win);
158 evas_object_size_hint_weight_set (conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
159 evas_object_show (conform);
161 scroller = elm_scroller_add (ad->naviframe);
163 elm_scroller_bounce_set (scroller, EINA_FALSE, EINA_TRUE);
164 evas_object_show (scroller);
166 elm_object_content_set (scroller, lay_in);
167 elm_object_content_set (conform, scroller);
168 elm_naviframe_item_push (ad->naviframe, title, NULL, NULL, conform, NULL);
171 static Evas_Object * create_inner_layout (void *data)
173 struct appdata *ad = (struct appdata *)data;
174 Evas_Object *bx = NULL ;
175 Evas_Object *ef = NULL ;
176 Evas_Object *parent = ad->naviframe;
178 bx = elm_box_add (parent);
179 evas_object_size_hint_weight_set (bx, EVAS_HINT_EXPAND, 0.0);
180 evas_object_size_hint_align_set (bx, EVAS_HINT_FILL, 0.0);
181 evas_object_show (bx);
184 ef = _create_ef_layout (parent, _("NORMAL LAYOUT"), _("click to enter TEXT"), ELM_INPUT_PANEL_LAYOUT_NORMAL);
185 elm_box_pack_end (bx, ef);
188 ef = _create_ef_layout (parent, _("NUMBER LAYOUT"), _("click to enter NUMBER"), ELM_INPUT_PANEL_LAYOUT_NUMBER);
189 elm_box_pack_end (bx, ef);
192 ef = _create_ef_layout (parent, _("EMAIL LAYOUT"), _("click to enter EMAIL"), ELM_INPUT_PANEL_LAYOUT_EMAIL);
193 elm_box_pack_end (bx, ef);
196 ef = _create_ef_layout (parent, _("URL LAYOUT"), _("click to enter URL"), ELM_INPUT_PANEL_LAYOUT_URL);
197 elm_box_pack_end (bx, ef);
199 /* Phonenumber Layout */
200 ef = _create_ef_layout (parent, _("PHONENUMBER LAYOUT"), _("click to enter PHONENUMBER"), ELM_INPUT_PANEL_LAYOUT_PHONENUMBER);
201 elm_box_pack_end (bx, ef);
204 ef = _create_ef_layout (parent, _("IP LAYOUT"), _("click to enter IP"), ELM_INPUT_PANEL_LAYOUT_IP);
205 elm_box_pack_end (bx, ef);
208 ef = _create_ef_layout (parent, _("MONTH LAYOUT"), _("click to enter MONTH"), ELM_INPUT_PANEL_LAYOUT_MONTH);
209 elm_box_pack_end (bx, ef);
211 /* Number Only Layout */
212 ef = _create_ef_layout (parent, _("NUMBERONLY LAYOUT"), _("click to enter NUMBERONLY"), ELM_INPUT_PANEL_LAYOUT_NUMBERONLY);
213 elm_box_pack_end (bx, ef);
215 /* Click to rotate button */
216 Evas_Object *rotate_btn = elm_button_add(parent);
217 elm_object_text_set(rotate_btn, "rotate");
218 evas_object_smart_callback_add(rotate_btn, "clicked", _rotate_cb, (void *)ad);
219 evas_object_size_hint_weight_set (rotate_btn, EVAS_HINT_EXPAND, 0.0);
220 evas_object_size_hint_align_set (rotate_btn, EVAS_HINT_FILL, 0);
221 evas_object_show (rotate_btn);
222 elm_box_pack_end (bx, rotate_btn);
227 void ise_layout_bt (void *data, Evas_Object *obj, void *event_info)
229 Evas_Object *lay_inner = create_inner_layout (data);
230 add_layout_to_conformant (data, lay_inner, _("Layout"));
234 vi:ts=4:ai:nowrap:expandtab