5 typedef struct _Elm_Params_Genlist
8 const char *horizontal;
10 Eina_Bool multi_exists:1;
11 Eina_Bool always_select:1;
12 Eina_Bool always_select_exists:1;
13 Eina_Bool no_select:1;
14 Eina_Bool no_select_exists:1;
16 Eina_Bool compress_exists:1;
17 Eina_Bool homogeneous:1;
18 Eina_Bool homogeneous_exists:1;
20 Eina_Bool h_bounce_exists:1;
22 Eina_Bool v_bounce_exists:1;
25 static const char* list_horizontal_choices[] = {"compress", "scroll", "limit", "expand", NULL};
28 _list_horizontal_setting_get(const char *horizontal_str)
32 assert(sizeof(list_horizontal_choices)/sizeof(list_horizontal_choices[0]) == ELM_LIST_LAST + 1);
34 for (i = 0; i < ELM_LIST_LAST; i++)
36 if (!strcmp(horizontal_str, list_horizontal_choices[i]))
43 external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
45 const Elm_Params_Genlist *p;
47 if (to_params) p = to_params;
48 else if (from_params) p = from_params;
53 Elm_List_Mode set = _list_horizontal_setting_get(p->horizontal);
55 if (set != ELM_LIST_LAST)
56 elm_genlist_horizontal_mode_set(obj, set);
59 elm_genlist_multi_select_set(obj, p->multi);
60 if (p->always_select_exists)
61 elm_genlist_always_select_mode_set(obj, p->always_select);
62 if (p->no_select_exists)
63 elm_genlist_no_select_mode_set(obj, p->no_select);
64 if (p->compress_exists)
65 elm_genlist_compress_mode_set(obj, p->compress);
66 if (p->homogeneous_exists)
67 elm_genlist_homogeneous_set(obj, p->homogeneous);
68 if ((p->h_bounce_exists) && (p->v_bounce_exists))
69 elm_genlist_bounce_set(obj, p->h_bounce, p->v_bounce);
70 else if ((p->h_bounce_exists) || (p->v_bounce_exists))
72 Eina_Bool h_bounce, v_bounce;
74 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
75 if (p->h_bounce_exists)
76 elm_genlist_bounce_set(obj, p->h_bounce, v_bounce);
78 elm_genlist_bounce_set(obj, h_bounce, p->v_bounce);
83 external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
85 if (!strcmp(param->name, "horizontal mode"))
87 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
89 Elm_List_Mode set = _list_horizontal_setting_get(param->s);
91 if (set == ELM_LIST_LAST) return EINA_FALSE;
92 elm_genlist_horizontal_mode_set(obj, set);
96 else if (!strcmp(param->name, "multi select"))
98 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
100 elm_genlist_multi_select_set(obj, param->i);
104 else if (!strcmp(param->name, "always select"))
106 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
108 elm_genlist_always_select_mode_set(obj, param->i);
112 else if (!strcmp(param->name, "no select"))
114 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
116 elm_genlist_no_select_mode_set(obj, param->i);
120 else if (!strcmp(param->name, "compress"))
122 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
124 elm_genlist_compress_mode_set(obj, param->i);
128 else if (!strcmp(param->name, "homogeneous"))
130 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
132 elm_genlist_homogeneous_set(obj, param->i);
136 else if (!strcmp(param->name, "height bounce"))
138 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
140 Eina_Bool h_bounce, v_bounce;
141 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
142 elm_genlist_bounce_set(obj, param->i, v_bounce);
146 else if (!strcmp(param->name, "width bounce"))
148 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
150 Eina_Bool h_bounce, v_bounce;
151 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
152 elm_genlist_bounce_set(obj, h_bounce, param->i);
157 ERR("unknown parameter '%s' of type '%s'",
158 param->name, edje_external_param_type_str(param->type));
164 external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
166 if (!strcmp(param->name, "horizontal mode"))
168 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
170 Elm_List_Mode list_horizontal_mode_set = elm_genlist_horizontal_mode_get(obj);
172 if (list_horizontal_mode_set == ELM_LIST_LAST)
175 param->s = list_horizontal_choices[list_horizontal_mode_set];
179 else if (!strcmp(param->name, "multi select"))
181 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
183 param->i = elm_genlist_multi_select_get(obj);
187 else if (!strcmp(param->name, "always select"))
189 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
191 param->i = elm_genlist_always_select_mode_get(obj);
195 else if (!strcmp(param->name, "no select"))
197 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
199 param->i = elm_genlist_no_select_mode_get(obj);
203 else if (!strcmp(param->name, "compress"))
205 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
207 param->i = elm_genlist_compress_mode_get(obj);
211 else if (!strcmp(param->name, "homogeneous"))
213 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
215 param->i = elm_genlist_homogeneous_get(obj);
219 else if (!strcmp(param->name, "height bounce"))
221 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
223 Eina_Bool h_bounce, v_bounce;
224 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
229 else if (!strcmp(param->name, "width bounce"))
231 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
233 Eina_Bool h_bounce, v_bounce;
234 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
240 ERR("unknown parameter '%s' of type '%s'",
241 param->name, edje_external_param_type_str(param->type));
247 external_genlist_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
249 Elm_Params_Genlist *mem;
250 Edje_External_Param *param;
253 mem = ELM_NEW(Elm_Params_Genlist);
257 EINA_LIST_FOREACH(params, l, param)
259 if (!strcmp(param->name, "horizontal mode"))
260 mem->horizontal = eina_stringshare_add(param->s);
261 else if (!strcmp(param->name, "multi select"))
263 mem->multi = !!param->i;
264 mem->multi_exists = EINA_TRUE;
266 else if (!strcmp(param->name, "always select"))
268 mem->always_select = !!param->i;
269 mem->always_select_exists = EINA_TRUE;
271 else if (!strcmp(param->name, "no select"))
273 mem->no_select = !!param->i;
274 mem->no_select_exists = EINA_TRUE;
276 else if (!strcmp(param->name, "compress"))
278 mem->compress = !!param->i;
279 mem->compress_exists = EINA_TRUE;
281 else if (!strcmp(param->name, "homogeneous"))
283 mem->homogeneous = !!param->i;
284 mem->homogeneous_exists = EINA_TRUE;
286 else if (!strcmp(param->name, "height bounce"))
288 mem->h_bounce = !!param->i;
289 mem->h_bounce_exists = EINA_TRUE;
291 else if (!strcmp(param->name, "width bounce"))
293 mem->v_bounce = !!param->i;
294 mem->v_bounce_exists = EINA_TRUE;
301 static Evas_Object *external_genlist_content_get(void *data __UNUSED__,
302 const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
309 external_genlist_params_free(void *params)
311 Elm_Params_Genlist *mem = params;
314 eina_stringshare_del(mem->horizontal);
319 static Edje_External_Param_Info external_genlist_params[] = {
320 DEFINE_EXTERNAL_COMMON_PARAMS,
321 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal mode", "scroll", list_horizontal_choices),
322 EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
323 EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
324 EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
325 EDJE_EXTERNAL_PARAM_INFO_BOOL("compress"),
326 EDJE_EXTERNAL_PARAM_INFO_BOOL("homogeneous"),
327 EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
328 EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
329 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
332 DEFINE_EXTERNAL_ICON_ADD(genlist, "genlist");
333 DEFINE_EXTERNAL_TYPE_SIMPLE(genlist, "Generic List");