5 typedef struct _Elm_Params_Gengrid
9 Eina_Bool multi_exists : 1;
10 Eina_Bool no_select : 1;
11 Eina_Bool no_select_exists : 1;
12 Eina_Bool always_select : 1;
13 Eina_Bool always_select_exists : 1;
15 Eina_Bool h_bounce_exists:1;
17 Eina_Bool v_bounce_exists:1;
19 Eina_Bool h_pagerel_exists : 1;
21 Eina_Bool v_pagerel_exists : 1;
23 Eina_Bool h_itemsize_exists : 1;
25 Eina_Bool v_itemsize_exists : 1;
26 Eina_Bool horizontal : 1;
27 Eina_Bool horizontal_exists : 1;
28 Eina_Bool align_x_exists;
30 Eina_Bool align_y_exists;
35 external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
37 const Elm_Params_Gengrid *p;
39 if (to_params) p = to_params;
40 else if (from_params) p = from_params;
44 elm_gengrid_multi_select_set(obj, p->multi);
45 if (p->no_select_exists)
48 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE);
50 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
52 if (p->always_select_exists)
55 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS);
57 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
59 if (p->h_bounce_exists)
61 Eina_Bool h_bounce, v_bounce;
62 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
63 elm_gengrid_bounce_set(obj, p->h_bounce, v_bounce);
65 if (p->v_bounce_exists)
67 Eina_Bool h_bounce, v_bounce;
68 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
69 elm_gengrid_bounce_set(obj, h_bounce, p->v_bounce);
71 if (p->h_pagerel_exists)
73 double h_pagerel, v_pagerel;
74 elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel);
75 elm_gengrid_page_relative_set(obj, h_pagerel, p->v_pagerel);
77 if (p->v_pagerel_exists)
79 double h_pagerel, v_pagerel;
80 elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel);
81 elm_gengrid_page_relative_set(obj, p->h_pagerel, v_pagerel);
83 if (p->h_itemsize_exists)
85 int h_itemsize, v_itemsize;
86 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
87 elm_gengrid_item_size_set(obj, h_itemsize, p->v_itemsize);
89 if (p->v_itemsize_exists)
91 int h_itemsize, v_itemsize;
92 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
93 elm_gengrid_item_size_set(obj, p->h_itemsize, v_itemsize);
95 else if (p->align_x_exists || p->align_y_exists)
98 elm_gengrid_align_get(obj, &x, &y);
99 if (p->align_x_exists)
100 elm_gengrid_align_set(obj, p->align_x, y);
102 elm_gengrid_align_set(obj, x, p->align_y);
104 if (p->horizontal_exists)
106 elm_gengrid_horizontal_set(obj, p->horizontal);
111 external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
113 if (!strcmp(param->name, "multi select"))
115 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
117 elm_gengrid_multi_select_set(obj, param->i);
121 else if (!strcmp(param->name, "no selected"))
123 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
126 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_NONE);
128 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
132 else if (!strcmp(param->name, "always select"))
134 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
137 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_ALWAYS);
139 elm_gengrid_select_mode_set (obj, ELM_OBJECT_SELECT_MODE_DEFAULT);
143 else if (!strcmp(param->name, "height bounce"))
145 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
147 Eina_Bool h_bounce, v_bounce;
148 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
149 elm_gengrid_bounce_set(obj, param->i, v_bounce);
153 else if (!strcmp(param->name, "width bounce"))
155 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
157 Eina_Bool h_bounce, v_bounce;
158 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
159 elm_gengrid_bounce_set(obj, h_bounce, param->i);
163 else if (!strcmp(param->name, "horizontal page relative"))
165 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
167 double h_pagerel, v_pagerel;
168 elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel);
169 elm_gengrid_page_relative_set(obj, param->d, v_pagerel);
173 else if (!strcmp(param->name, "vertical page relative"))
175 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
177 double h_pagerel, v_pagerel;
178 elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel);
179 elm_gengrid_page_relative_set(obj, h_pagerel, param->d);
183 else if (!strcmp(param->name, "horizontal item size"))
185 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
187 int h_itemsize, v_itemsize;
188 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
189 elm_gengrid_item_size_set(obj, param->i, v_itemsize);
193 else if (!strcmp(param->name, "vertical item size"))
195 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
197 int h_itemsize, v_itemsize;
198 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
199 elm_gengrid_item_size_set(obj, h_itemsize, param->i);
203 else if (!strcmp(param->name, "horizontal"))
205 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
207 elm_gengrid_horizontal_set(obj, param->i);
211 else if (!strcmp(param->name, "align x")
212 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
215 elm_gengrid_align_get(obj, &x, &y);
216 elm_gengrid_align_set(obj, param->d, y);
219 else if (!strcmp(param->name, "align y")
220 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
223 elm_gengrid_align_get(obj, &x, &y);
224 elm_gengrid_align_set(obj, x, param->d);
227 ERR("unknown parameter '%s' of type '%s'",
228 param->name, edje_external_param_type_str(param->type));
234 external_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
236 if (!strcmp(param->name, "multi select"))
238 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
240 param->i = elm_gengrid_multi_select_get(obj);
244 else if (!strcmp(param->name, "no selected"))
246 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
248 if (elm_gengrid_select_mode_get (obj) ==
249 ELM_OBJECT_SELECT_MODE_NONE)
250 param->i = EINA_TRUE;
252 param->i = EINA_FALSE;
256 else if (!strcmp(param->name, "always select"))
258 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
260 if (elm_gengrid_select_mode_get (obj) ==
261 ELM_OBJECT_SELECT_MODE_ALWAYS)
262 param->i = EINA_TRUE;
264 param->i = EINA_FALSE;
268 else if (!strcmp(param->name, "height bounce"))
270 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
272 Eina_Bool h_bounce, v_bounce;
273 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
278 else if (!strcmp(param->name, "width bounce"))
280 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
282 Eina_Bool h_bounce, v_bounce;
283 elm_gengrid_bounce_get(obj, &h_bounce, &v_bounce);
288 else if (!strcmp(param->name, "horizontal page relative"))
290 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
292 double h_pagerel, v_pagerel;
293 elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel);
294 param->d = h_pagerel;
298 else if (!strcmp(param->name, "vertical page relative"))
300 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
302 double h_pagerel, v_pagerel;
303 elm_gengrid_page_relative_get(obj, &h_pagerel, &v_pagerel);
304 param->d = v_pagerel;
308 else if (!strcmp(param->name, "horizontal item size"))
310 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
312 int h_itemsize, v_itemsize;
313 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
314 param->i = h_itemsize;
318 else if (!strcmp(param->name, "vertical item size"))
320 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
322 int h_itemsize, v_itemsize;
323 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
324 param->i = v_itemsize;
328 else if (!strcmp(param->name, "horizontal"))
330 if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
332 param->i = elm_gengrid_horizontal_get(obj);
336 else if (!strcmp(param->name, "align x")
337 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
340 elm_gengrid_align_get(obj, &x, &y);
344 else if (!strcmp(param->name, "align y")
345 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
348 elm_gengrid_align_get(obj, &x, &y);
352 ERR("unknown parameter '%s' of type '%s'",
353 param->name, edje_external_param_type_str(param->type));
359 external_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
361 Elm_Params_Gengrid *mem;
362 Edje_External_Param *param;
365 mem = ELM_NEW(Elm_Params_Gengrid);
369 EINA_LIST_FOREACH(params, l, param)
371 if (!strcmp(param->name, "multi select"))
373 mem->multi = !!param->i;
374 mem->multi_exists = EINA_TRUE;
376 else if (!strcmp(param->name, "no selected"))
378 mem->no_select = !!param->i;
379 mem->no_select_exists = EINA_TRUE;
381 else if (!strcmp(param->name, "always select"))
383 mem->always_select = !!param->i;
384 mem->always_select_exists = EINA_TRUE;
386 else if (!strcmp(param->name, "height bounce"))
388 mem->h_bounce = !!param->i;
389 mem->h_bounce_exists = EINA_TRUE;
391 else if (!strcmp(param->name, "width bounce"))
393 mem->v_bounce = !!param->i;
394 mem->v_bounce_exists = EINA_TRUE;
396 else if (!strcmp(param->name, "horizontal page relative"))
398 mem->h_pagerel = param->d;
399 mem->h_pagerel_exists = EINA_TRUE;
401 else if (!strcmp(param->name, "vertical page relative"))
403 mem->v_pagerel = param->d;
404 mem->v_pagerel_exists = EINA_TRUE;
406 else if (!strcmp(param->name, "horizontal item size"))
408 mem->h_itemsize = param->i;
409 mem->h_itemsize_exists = EINA_TRUE;
411 else if (!strcmp(param->name, "vertical item size"))
413 mem->v_itemsize = param->i;
414 mem->v_itemsize_exists = EINA_TRUE;
416 else if (!strcmp(param->name, "horizontal"))
418 mem->horizontal = !!param->i;
419 mem->horizontal_exists = EINA_TRUE;
421 else if (!strcmp(param->name, "align x"))
423 mem->align_x = param->d;
424 mem->align_x_exists = EINA_TRUE;
426 else if (!strcmp(param->name, "align y"))
428 mem->align_y = param->d;
429 mem->align_y_exists = EINA_TRUE;
437 external_gengrid_content_get(void *data __UNUSED__, const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
444 external_gengrid_params_free(void *params)
446 Elm_Params_Gengrid *mem = params;
450 static Edje_External_Param_Info external_gengrid_params[] = {
451 DEFINE_EXTERNAL_COMMON_PARAMS,
452 EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
453 EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
454 EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
455 EDJE_EXTERNAL_PARAM_INFO_BOOL("height bounce"),
456 EDJE_EXTERNAL_PARAM_INFO_BOOL("width bounce"),
457 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("horizontal page relative"),
458 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("vertical page relative"),
459 EDJE_EXTERNAL_PARAM_INFO_INT("horizontal item size"),
460 EDJE_EXTERNAL_PARAM_INFO_INT("vertical item size"),
461 EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
462 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align x"),
463 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align y"),
464 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
467 DEFINE_EXTERNAL_ICON_ADD(gengrid, "gengrid");
468 DEFINE_EXTERNAL_TYPE_SIMPLE(gengrid, "Generic Grid");