3 typedef struct _Elm_Params_fileselector_entry
12 Eina_Bool is_save_set:1;
13 Eina_Bool folder_only:1;
14 Eina_Bool folder_only_set:1;
15 Eina_Bool expandable:1;
16 Eina_Bool expandable_set:1;
17 Eina_Bool inwin_mode:1;
18 Eina_Bool inwin_mode_set:1;
20 } Elm_Params_fileselector_entry;
23 external_fileselector_entry_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
25 const Elm_Params_fileselector_entry *p;
27 if (to_params) p = to_params;
28 else if (from_params) p = from_params;
32 elm_object_text_set(obj, p->label);
33 if (p->icon) elm_object_part_content_set(obj, "button icon", p->icon);
34 if (p->fs.path) elm_fileselector_entry_selected_set(obj, p->fs.path);
35 if (p->fs.is_save_set)
36 elm_fileselector_entry_is_save_set(obj, p->fs.is_save);
37 if (p->fs.folder_only_set)
38 elm_fileselector_entry_folder_only_set(obj, p->fs.folder_only);
39 if (p->fs.expandable_set)
40 elm_fileselector_entry_expandable_set(obj, p->fs.expandable);
41 if (p->fs.inwin_mode_set)
42 elm_fileselector_entry_inwin_mode_set(obj, p->fs.inwin_mode);
46 external_fileselector_entry_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
48 if (!strcmp(param->name, "label"))
50 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
52 elm_object_text_set(obj, param->s);
56 else if (!strcmp(param->name, "icon"))
58 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
60 Evas_Object *icon = external_common_param_icon_get(obj, param);
61 if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
62 elm_object_part_content_set(obj, "button icon", icon);
66 else if (!strcmp(param->name, "path"))
68 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
70 elm_fileselector_entry_selected_set(obj, param->s);
74 else if (!strcmp(param->name, "save"))
76 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
78 elm_fileselector_entry_is_save_set(obj, param->i);
82 else if (!strcmp(param->name, "folder only"))
84 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
86 elm_fileselector_entry_folder_only_set(obj, param->i);
90 else if (!strcmp(param->name, "expandable"))
92 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
94 elm_fileselector_entry_expandable_set(obj, param->i);
98 else if (!strcmp(param->name, "inwin mode"))
100 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
102 elm_fileselector_entry_inwin_mode_set(obj, param->i);
107 ERR("unknown parameter '%s' of type '%s'",
108 param->name, edje_external_param_type_str(param->type));
114 external_fileselector_entry_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
116 if (!strcmp(param->name, "label"))
118 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
120 param->s = elm_object_text_get(obj);
124 else if (!strcmp(param->name, "icon"))
126 /* not easy to get icon name back from live object */
129 else if (!strcmp(param->name, "path"))
131 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
133 param->s = elm_fileselector_entry_selected_get(obj);
137 else if (!strcmp(param->name, "save"))
139 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
141 param->i = elm_fileselector_entry_is_save_get(obj);
145 else if (!strcmp(param->name, "folder only"))
147 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
149 param->i = elm_fileselector_entry_folder_only_get(obj);
153 else if (!strcmp(param->name, "expandable"))
155 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
157 param->i = elm_fileselector_entry_expandable_get(obj);
161 else if (!strcmp(param->name, "inwin mode"))
163 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
165 param->i = elm_fileselector_entry_inwin_mode_get(obj);
170 ERR("unknown parameter '%s' of type '%s'",
171 param->name, edje_external_param_type_str(param->type));
177 external_fileselector_entry_params_parse(void *data __UNUSED__, Evas_Object *obj, const Eina_List *params)
179 Elm_Params_fileselector_entry *mem;
180 Edje_External_Param *param;
183 mem = calloc(1, sizeof(Elm_Params_fileselector_entry));
187 external_common_icon_param_parse(&mem->icon, obj, params);
189 EINA_LIST_FOREACH(params, l, param)
191 if (!strcmp(param->name, "path"))
192 mem->fs.path = eina_stringshare_add(param->s);
193 else if (!strcmp(param->name, "save"))
195 mem->fs.is_save = !!param->i;
196 mem->fs.is_save_set = EINA_TRUE;
198 else if (!strcmp(param->name, "folder only"))
200 mem->fs.folder_only = !!param->i;
201 mem->fs.folder_only_set = EINA_TRUE;
203 else if (!strcmp(param->name, "expandable"))
205 mem->fs.expandable = !!param->i;
206 mem->fs.expandable_set = EINA_TRUE;
208 else if (!strcmp(param->name, "inwin mode"))
210 mem->fs.inwin_mode = !!param->i;
211 mem->fs.inwin_mode_set = EINA_TRUE;
213 else if (!strcmp(param->name, "label"))
214 mem->label = eina_stringshare_add(param->s);
220 static Evas_Object *external_fileselector_entry_content_get(void *data __UNUSED__,
221 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
228 external_fileselector_entry_params_free(void *params)
230 Elm_Params_fileselector_entry *mem = params;
233 eina_stringshare_del(mem->fs.path);
235 eina_stringshare_del(mem->label);
239 static Edje_External_Param_Info external_fileselector_entry_params[] = {
240 DEFINE_EXTERNAL_COMMON_PARAMS,
241 EDJE_EXTERNAL_PARAM_INFO_STRING("label"),
242 EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
243 EDJE_EXTERNAL_PARAM_INFO_STRING("path"),
244 EDJE_EXTERNAL_PARAM_INFO_BOOL("save"),
245 EDJE_EXTERNAL_PARAM_INFO_BOOL("folder only"),
246 EDJE_EXTERNAL_PARAM_INFO_BOOL("expandable"),
247 EDJE_EXTERNAL_PARAM_INFO_BOOL("inwin mode"),
248 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
251 DEFINE_EXTERNAL_ICON_ADD(fileselector_entry, "fileselector_entry");
252 DEFINE_EXTERNAL_TYPE_SIMPLE(fileselector_entry, "File Selector Entry");