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;
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_choices[] = {"compress", "scroll", "limit", "expand", NULL};
27 _list_horizontal_setting_get(const char *horizontal_str)
31 assert(sizeof(list_horizontal_choices)/sizeof(list_horizontal_choices[0]) == ELM_LIST_LAST + 1);
33 for (i = 0; i < ELM_LIST_LAST; i++)
35 if (!strcmp(horizontal_str, list_horizontal_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;
52 Elm_List_Mode set = _list_horizontal_setting_get(p->horizontal);
54 if (set != ELM_LIST_LAST)
55 elm_genlist_mode_set(obj, set);
58 elm_genlist_multi_select_set(obj, p->multi);
59 if (p->no_select_exists)
62 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE);
64 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
66 if (p->always_select_exists)
69 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS);
71 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
73 if (p->homogeneous_exists)
74 elm_genlist_homogeneous_set(obj, p->homogeneous);
75 if ((p->h_bounce_exists) && (p->v_bounce_exists))
76 elm_scroller_bounce_set(obj, p->h_bounce, p->v_bounce);
77 else if ((p->h_bounce_exists) || (p->v_bounce_exists))
79 Eina_Bool h_bounce, v_bounce;
81 elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
82 if (p->h_bounce_exists)
83 elm_scroller_bounce_set(obj, p->h_bounce, v_bounce);
85 elm_scroller_bounce_set(obj, h_bounce, p->v_bounce);
90 external_genlist_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
92 if (!strcmp(param->name, "horizontal mode"))
94 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
96 Elm_List_Mode set = _list_horizontal_setting_get(param->s);
98 if (set == ELM_LIST_LAST) return EINA_FALSE;
99 elm_genlist_mode_set(obj, set);
103 else if (!strcmp(param->name, "multi select"))
105 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
107 elm_genlist_multi_select_set(obj, param->i);
111 else if (!strcmp(param->name, "always select"))
113 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
116 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS);
118 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
122 else if (!strcmp(param->name, "no select"))
124 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
127 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE);
129 elm_genlist_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
133 else if (!strcmp(param->name, "homogeneous"))
135 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
137 elm_genlist_homogeneous_set(obj, param->i);
141 else if (!strcmp(param->name, "height bounce"))
143 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
145 Eina_Bool h_bounce, v_bounce;
146 elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
147 elm_scroller_bounce_set(obj, param->i, v_bounce);
151 else if (!strcmp(param->name, "width bounce"))
153 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
155 Eina_Bool h_bounce, v_bounce;
156 elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
157 elm_scroller_bounce_set(obj, h_bounce, param->i);
162 ERR("unknown parameter '%s' of type '%s'",
163 param->name, edje_external_param_type_str(param->type));
169 external_genlist_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
171 if (!strcmp(param->name, "horizontal mode"))
173 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_CHOICE)
175 Elm_List_Mode list_horizontal_set = elm_genlist_mode_get(obj);
177 if (list_horizontal_set == ELM_LIST_LAST)
180 param->s = list_horizontal_choices[list_horizontal_set];
184 else if (!strcmp(param->name, "multi select"))
186 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
188 param->i = elm_genlist_multi_select_get(obj);
192 else if (!strcmp(param->name, "always select"))
194 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
196 if (elm_genlist_select_mode_get (obj) ==
197 ELM_OBJECT_SELECT_MODE_ALWAYS)
198 param->i = EINA_TRUE;
200 param->i = EINA_FALSE;
204 else if (!strcmp(param->name, "no select"))
206 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
208 if (elm_genlist_select_mode_get (obj) ==
209 ELM_OBJECT_SELECT_MODE_NONE)
210 param->i = EINA_TRUE;
212 param->i = EINA_FALSE;
216 else if (!strcmp(param->name, "homogeneous"))
218 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
220 param->i = elm_genlist_homogeneous_get(obj);
224 else if (!strcmp(param->name, "height bounce"))
226 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
228 Eina_Bool h_bounce, v_bounce;
229 elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
234 else if (!strcmp(param->name, "width bounce"))
236 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
238 Eina_Bool h_bounce, v_bounce;
239 elm_scroller_bounce_get(obj, &h_bounce, &v_bounce);
245 ERR("unknown parameter '%s' of type '%s'",
246 param->name, edje_external_param_type_str(param->type));
252 external_genlist_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
254 Elm_Params_Genlist *mem;
255 Edje_External_Param *param;
258 mem = ELM_NEW(Elm_Params_Genlist);
262 EINA_LIST_FOREACH(params, l, param)
264 if (!strcmp(param->name, "horizontal mode"))
265 mem->horizontal = eina_stringshare_add(param->s);
266 else if (!strcmp(param->name, "multi select"))
268 mem->multi = !!param->i;
269 mem->multi_exists = EINA_TRUE;
271 else if (!strcmp(param->name, "always select"))
273 mem->always_select = !!param->i;
274 mem->always_select_exists = EINA_TRUE;
276 else if (!strcmp(param->name, "no select"))
278 mem->no_select = !!param->i;
279 mem->no_select_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("homogeneous"),
326 EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
327 EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
328 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
331 DEFINE_EXTERNAL_ICON_ADD(genlist, "genlist");
332 DEFINE_EXTERNAL_TYPE_SIMPLE(genlist, "Generic List");