5 typedef struct _Elm_Params_Genlist
7 const char *horizontal_mode;
9 Eina_Bool multi_exists:1;
10 Eina_Bool always_select:1;
11 Eina_Bool always_select_exists:1;
12 Eina_Bool no_select:1;
13 Eina_Bool no_select_exists:1;
15 Eina_Bool compress_exists:1;
16 Eina_Bool homogeneous:1;
17 Eina_Bool homogeneous_exists:1;
19 Eina_Bool h_bounce_exists:1;
21 Eina_Bool v_bounce_exists:1;
24 static const char* list_horizontal_mode_choices[] = {"compress", "scroll", "limit", NULL};
27 _list_horizontal_mode_setting_get(const char *horizontal_mode_str)
31 assert(sizeof(list_horizontal_mode_choices)/sizeof(list_horizontal_mode_choices[0]) == ELM_LIST_LAST + 1);
33 for (i = 0; i < sizeof(list_horizontal_mode_choices); i++)
35 if (!strcmp(horizontal_mode_str, list_horizontal_mode_choices[i]))
42 external_genlist_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
44 const Elm_Params_Genlist *p;
46 if (to_params) p = to_params;
47 else if (from_params) p = from_params;
50 if (p->horizontal_mode)
52 Elm_List_Mode set = _list_horizontal_mode_setting_get(p->horizontal_mode);
54 if (set != ELM_LIST_LAST)
55 elm_genlist_horizontal_mode_set(obj, set);
58 elm_genlist_multi_select_set(obj, p->multi);
59 if (p->always_select_exists)
60 elm_genlist_always_select_mode_set(obj, p->always_select);
61 if (p->no_select_exists)
62 elm_genlist_no_select_mode_set(obj, p->no_select);
63 if (p->compress_exists)
64 elm_genlist_compress_mode_set(obj, p->compress);
65 if (p->homogeneous_exists)
66 elm_genlist_homogeneous_set(obj, p->homogeneous);
67 if ((p->h_bounce_exists) && (p->v_bounce_exists))
68 elm_genlist_bounce_set(obj, p->h_bounce, p->v_bounce);
69 else if ((p->h_bounce_exists) || (p->v_bounce_exists))
71 Eina_Bool h_bounce, v_bounce;
73 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
74 if (p->h_bounce_exists)
75 elm_genlist_bounce_set(obj, p->h_bounce, v_bounce);
77 elm_genlist_bounce_set(obj, h_bounce, p->v_bounce);
82 external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
84 if (!strcmp(param->name, "horizontal mode"))
86 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
88 Elm_List_Mode set = _list_horizontal_mode_setting_get(param->s);
90 if (set == ELM_LIST_LAST) return EINA_FALSE;
91 elm_genlist_horizontal_mode_set(obj, set);
95 else if (!strcmp(param->name, "multi select"))
97 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
99 elm_genlist_multi_select_set(obj, param->i);
103 else if (!strcmp(param->name, "always select"))
105 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
107 elm_genlist_always_select_mode_set(obj, param->i);
111 else if (!strcmp(param->name, "no select"))
113 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
115 elm_genlist_no_select_mode_set(obj, param->i);
119 else if (!strcmp(param->name, "compress"))
121 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
123 elm_genlist_compress_mode_set(obj, param->i);
127 else if (!strcmp(param->name, "homogeneous"))
129 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
131 elm_genlist_homogeneous_set(obj, param->i);
135 else if (!strcmp(param->name, "height bounce"))
137 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
139 Eina_Bool h_bounce, v_bounce;
140 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
141 elm_genlist_bounce_set(obj, param->i, v_bounce);
145 else if (!strcmp(param->name, "width bounce"))
147 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
149 Eina_Bool h_bounce, v_bounce;
150 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
151 elm_genlist_bounce_set(obj, h_bounce, param->i);
156 ERR("unknown parameter '%s' of type '%s'",
157 param->name, edje_external_param_type_str(param->type));
163 external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
165 if (!strcmp(param->name, "horizontal mode"))
167 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
169 Elm_List_Mode list_horizontal_mode_set = elm_genlist_horizontal_mode_get(obj);
171 if (list_horizontal_mode_set == ELM_LIST_LAST)
174 param->s = list_horizontal_mode_choices[list_horizontal_mode_set];
178 else if (!strcmp(param->name, "multi select"))
180 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
182 param->i = elm_genlist_multi_select_get(obj);
186 else if (!strcmp(param->name, "always select"))
188 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
190 param->i = elm_genlist_always_select_mode_get(obj);
194 else if (!strcmp(param->name, "no select"))
196 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
198 param->i = elm_genlist_no_select_mode_get(obj);
202 else if (!strcmp(param->name, "compress"))
204 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
206 param->i = elm_genlist_compress_mode_get(obj);
210 else if (!strcmp(param->name, "homogeneous"))
212 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
214 param->i = elm_genlist_homogeneous_get(obj);
218 else if (!strcmp(param->name, "height bounce"))
220 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
222 Eina_Bool h_bounce, v_bounce;
223 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
228 else if (!strcmp(param->name, "width bounce"))
230 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
232 Eina_Bool h_bounce, v_bounce;
233 elm_genlist_bounce_get(obj, &h_bounce, &v_bounce);
239 ERR("unknown parameter '%s' of type '%s'",
240 param->name, edje_external_param_type_str(param->type));
246 external_genlist_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
248 Elm_Params_Genlist *mem;
249 Edje_External_Param *param;
252 mem = calloc(1, sizeof(Elm_Params_Genlist));
256 EINA_LIST_FOREACH(params, l, param)
258 if (!strcmp(param->name, "horizontal mode"))
259 mem->horizontal_mode = eina_stringshare_add(param->s);
260 else if (!strcmp(param->name, "multi select"))
262 mem->multi = !!param->i;
263 mem->multi_exists = EINA_TRUE;
265 else if (!strcmp(param->name, "always select"))
267 mem->always_select = !!param->i;
268 mem->always_select_exists = EINA_TRUE;
270 else if (!strcmp(param->name, "no select"))
272 mem->no_select = !!param->i;
273 mem->no_select_exists = EINA_TRUE;
275 else if (!strcmp(param->name, "compress"))
277 mem->compress = !!param->i;
278 mem->compress_exists = EINA_TRUE;
280 else if (!strcmp(param->name, "homogeneous"))
282 mem->homogeneous = !!param->i;
283 mem->homogeneous_exists = EINA_TRUE;
285 else if (!strcmp(param->name, "height bounce"))
287 mem->h_bounce = !!param->i;
288 mem->h_bounce_exists = EINA_TRUE;
290 else if (!strcmp(param->name, "width bounce"))
292 mem->v_bounce = !!param->i;
293 mem->v_bounce_exists = EINA_TRUE;
300 static Evas_Object *external_genlist_content_get(void *data __UNUSED__,
301 const Evas_Object *obj, const char *content)
308 external_genlist_params_free(void *params)
310 Elm_Params_Genlist *mem = params;
312 if (mem->horizontal_mode)
313 eina_stringshare_del(mem->horizontal_mode);
318 static Edje_External_Param_Info external_genlist_params[] = {
319 EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal mode", "scroll", list_horizontal_mode_choices),
320 EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
321 EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
322 EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
323 EDJE_EXTERNAL_PARAM_INFO_BOOL("compress"),
324 EDJE_EXTERNAL_PARAM_INFO_BOOL("homogeneous"),
325 EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
326 EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
327 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
330 DEFINE_EXTERNAL_ICON_ADD(genlist, "genlist");
331 DEFINE_EXTERNAL_TYPE_SIMPLE(genlist, "Generic List");