5 typedef struct _Elm_Params_Entry
11 Eina_Bool scrollable:1;
12 Eina_Bool scrollable_exists:1;
13 Eina_Bool single_line:1;
14 Eina_Bool single_line_exists:1;
16 Eina_Bool password_exists:1;
17 Eina_Bool horizontal_bounce:1;
18 Eina_Bool horizontal_bounce_exists:1;
19 Eina_Bool vertical_bounce:1;
20 Eina_Bool vertical_bounce_exists:1;
22 Eina_Bool editable_exists:1;
23 const char *line_wrap;
26 #define CHOICE_GET(CHOICES, STR) \
28 for (i = 0; i < sizeof(CHOICES)/sizeof (CHOICES)[0]; i++) \
29 if (strcmp((STR), (CHOICES)[i]) == 0) \
33 static const char *entry_line_wrap_choices[] = {"none", "char", "word",
37 _entry_line_wrap_choices_setting_get(const char *line_wrap_str)
39 assert(sizeof(entry_line_wrap_choices)/
40 sizeof(entry_line_wrap_choices[0]) == ELM_WRAP_LAST + 1);
41 CHOICE_GET(entry_line_wrap_choices, line_wrap_str);
46 external_entry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
48 const Elm_Params_Entry *p;
49 Eina_Bool hbounce, vbounce;
50 Elm_Wrap_Type line_wrap;
52 if (to_params) p = to_params;
53 else if (from_params) p = from_params;
57 elm_object_text_set(obj, p->label);
59 elm_entry_icon_set(obj, p->icon);
61 elm_entry_entry_set(obj, p->entry);
62 if (p->scrollable_exists)
63 elm_entry_scrollable_set(obj, p->scrollable);
64 if (p->single_line_exists)
65 elm_entry_single_line_set(obj, p->single_line);
66 if (p->password_exists)
67 elm_entry_password_set(obj, p->password);
68 if (p->horizontal_bounce_exists && p->vertical_bounce_exists)
69 elm_entry_bounce_set(obj, p->horizontal_bounce, p->vertical_bounce);
70 else if (p->horizontal_bounce_exists || p->vertical_bounce_exists)
72 elm_entry_bounce_get(obj, &hbounce, &vbounce);
73 if (p->horizontal_bounce_exists)
74 elm_entry_bounce_set(obj, p->horizontal_bounce, vbounce);
76 elm_entry_bounce_set(obj, hbounce, p->vertical_bounce);
78 if (p->editable_exists)
79 elm_entry_editable_set(obj, p->editable);
82 line_wrap = _entry_line_wrap_choices_setting_get(p->line_wrap);
83 elm_entry_line_wrap_set(obj, line_wrap);
88 external_entry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
90 if (!strcmp(param->name, "label"))
92 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
94 elm_object_text_set(obj, param->s);
98 else if (!strcmp(param->name, "icon"))
100 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
102 Evas_Object *icon = external_common_param_icon_get(obj, param);
103 elm_entry_icon_set(obj, icon);
107 else if (!strcmp(param->name, "entry"))
109 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
111 elm_entry_entry_set(obj, param->s);
115 else if (!strcmp(param->name, "scrollable"))
117 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
119 elm_entry_scrollable_set(obj, param->i);
123 else if (!strcmp(param->name, "single line"))
125 if(param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
127 elm_entry_single_line_set(obj, param->i);
131 else if (!strcmp(param->name, "password"))
133 if(param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
135 elm_entry_password_set(obj, param->i);
139 else if (!strcmp(param->name, "horizontal bounce"))
141 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
143 Eina_Bool hbounce, vbounce;
144 elm_entry_bounce_get(obj, NULL, &vbounce);
145 hbounce = !!param->i;
146 elm_entry_bounce_set(obj, hbounce, vbounce);
150 else if (!strcmp(param->name, "vertical bounce"))
152 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
154 Eina_Bool hbounce, vbounce;
155 elm_entry_bounce_get(obj, &hbounce, NULL);
156 vbounce = !!param->i;
157 elm_entry_bounce_set(obj, hbounce, vbounce);
161 else if (!strcmp(param->name, "editable"))
163 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
165 elm_entry_editable_set(obj, param->i);
169 else if (!strcmp(param->name, "line wrap"))
171 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
173 Elm_Wrap_Type line_wrap;
174 line_wrap = _entry_line_wrap_choices_setting_get(param->s);
175 if (line_wrap == ELM_WRAP_LAST) return EINA_FALSE;
176 elm_entry_line_wrap_set(obj, line_wrap);
181 ERR("unknown parameter '%s' of type '%s'",
182 param->name, edje_external_param_type_str(param->type));
188 external_entry_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
190 if (!strcmp(param->name, "label"))
192 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
194 param->s = elm_object_text_get(obj);
198 else if (!strcmp(param->name, "icon"))
200 /* not easy to get icon name back from live object */
203 else if (!strcmp(param->name, "entry"))
205 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
207 param->s = elm_entry_entry_get(obj);
211 else if (!strcmp(param->name, "scrollable"))
213 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
215 param->i = elm_entry_scrollable_get(obj);
219 else if (!strcmp(param->name, "single line"))
221 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
223 param->i = elm_entry_single_line_get(obj);
227 else if (!strcmp(param->name, "password"))
229 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
231 param->i = elm_entry_password_get(obj);
235 else if (!strcmp(param->name, "horizontal bounce"))
237 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
240 elm_entry_bounce_get(obj, &hbounce, NULL);
245 else if (!strcmp(param->name, "vertical bounce"))
247 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
250 elm_entry_bounce_get(obj, NULL, &vbounce);
255 else if (!strcmp(param->name, "editable"))
257 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
259 param->i = elm_entry_editable_get(obj);
263 else if (!strcmp(param->name, "line wrap"))
265 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
267 Elm_Wrap_Type line_wrap;
268 line_wrap = elm_entry_line_wrap_get(obj);
269 param->s = entry_line_wrap_choices[line_wrap];
274 ERR("unknown parameter '%s' of type '%s'",
275 param->name, edje_external_param_type_str(param->type));
281 external_entry_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params)
283 Elm_Params_Entry *mem;
284 Edje_External_Param *param;
287 mem = ELM_NEW(Elm_Params_Entry);
291 external_common_icon_param_parse(&mem->icon, obj, params);
293 EINA_LIST_FOREACH(params, l, param)
295 if (!strcmp(param->name, "label"))
297 mem->label = eina_stringshare_add(param->s);
299 else if (!strcmp(param->name, "entry"))
301 mem->entry = eina_stringshare_add(param->s);
303 else if (!strcmp(param->name, "scrollable"))
305 mem->scrollable = !!param->i;
306 mem->scrollable_exists = EINA_TRUE;
308 else if (!strcmp(param->name, "single line"))
310 mem->single_line = !!param->i;
311 mem->single_line_exists = EINA_TRUE;
313 else if (!strcmp(param->name, "password"))
315 mem->password = !!param->i;
316 mem->password_exists = EINA_TRUE;
318 else if (!strcmp(param->name, "horizontal bounce"))
320 mem->horizontal_bounce = !!param->i;
321 mem->horizontal_bounce_exists = EINA_TRUE;
323 else if (!strcmp(param->name, "vertical bounce"))
325 mem->vertical_bounce = !!param->i;
326 mem->vertical_bounce_exists = EINA_TRUE;
328 else if (!strcmp(param->name, "editable"))
330 mem->editable = !!param->i;
331 mem->editable_exists = EINA_TRUE;
333 else if (!strcmp(param->name, "line wrap"))
334 mem->line_wrap = eina_stringshare_add(param->s);
340 static Evas_Object *external_entry_content_get(void *data __UNUSED__,
341 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
348 external_entry_params_free(void *params)
350 Elm_Params_Entry *mem = params;
352 eina_stringshare_del(mem->label);
354 eina_stringshare_del(mem->entry);
356 eina_stringshare_del(mem->line_wrap);
360 static Edje_External_Param_Info external_entry_params[] = {
361 DEFINE_EXTERNAL_COMMON_PARAMS,
362 EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
363 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
364 EDJE_EXTERNAL_PARAM_INFO_STRING("entry"),
365 EDJE_EXTERNAL_PARAM_INFO_BOOL("scrollable"),
366 EDJE_EXTERNAL_PARAM_INFO_BOOL("single line"),
367 EDJE_EXTERNAL_PARAM_INFO_BOOL("password"),
368 EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal bounce"),
369 EDJE_EXTERNAL_PARAM_INFO_BOOL("vertical bounce"),
370 EDJE_EXTERNAL_PARAM_INFO_BOOL("editable"),
371 EDJE_EXTERNAL_PARAM_INFO_STRING("line_wrap"),
372 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
375 DEFINE_EXTERNAL_ICON_ADD(entry, "entry");
376 DEFINE_EXTERNAL_TYPE_SIMPLE(entry, "Entry");