summaryrefslogtreecommitdiff
path: root/legacy/elementary/src/edje_externals/elm_gengrid.c
diff options
context:
space:
mode:
authorMike McCormack <mj.mccormack@samsung.com>2011-10-10 08:32:56 +0000
committerMike McCormack <mikem@ring3k.org>2011-10-10 08:32:56 +0000
commitbcf44a7450ab34338691568abb0e1cd70cf836b7 (patch)
tree37df9549587ac3b78be98972a2932ca646974f5a /legacy/elementary/src/edje_externals/elm_gengrid.c
parent0368cf0de633d5ee9f572fc45e8c836e3770b8aa (diff)
elementary: Support alignment in gengrid
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 63949
Diffstat (limited to 'legacy/elementary/src/edje_externals/elm_gengrid.c')
-rw-r--r--legacy/elementary/src/edje_externals/elm_gengrid.c59
1 files changed, 57 insertions, 2 deletions
diff --git a/legacy/elementary/src/edje_externals/elm_gengrid.c b/legacy/elementary/src/edje_externals/elm_gengrid.c
index 45faca5..6c3bf07 100644
--- a/legacy/elementary/src/edje_externals/elm_gengrid.c
+++ b/legacy/elementary/src/edje_externals/elm_gengrid.c
@@ -25,6 +25,10 @@ typedef struct _Elm_Params_Gengrid
25 Eina_Bool v_itemsize_exists : 1; 25 Eina_Bool v_itemsize_exists : 1;
26 Eina_Bool horizontal : 1; 26 Eina_Bool horizontal : 1;
27 Eina_Bool horizontal_exists : 1; 27 Eina_Bool horizontal_exists : 1;
28 Eina_Bool align_x_exists;
29 double align_x;
30 Eina_Bool align_y_exists;
31 double align_y;
28} Elm_Params_Gengrid; 32} Elm_Params_Gengrid;
29 33
30static void 34static void
@@ -78,6 +82,15 @@ external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *
78 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize); 82 elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
79 elm_gengrid_item_size_set(obj, p->h_itemsize, v_itemsize); 83 elm_gengrid_item_size_set(obj, p->h_itemsize, v_itemsize);
80 } 84 }
85 else if (p->align_x_exists || p->align_y_exists)
86 {
87 double x, y;
88 elm_gengrid_align_get(obj, &x, &y);
89 if (p->align_x_exists)
90 elm_gengrid_align_set(obj, p->align_x, y);
91 else
92 elm_gengrid_align_set(obj, x, p->align_y);
93 }
81 if (p->horizontal_exists) 94 if (p->horizontal_exists)
82 { 95 {
83 elm_gengrid_horizontal_set(obj, p->horizontal); 96 elm_gengrid_horizontal_set(obj, p->horizontal);
@@ -179,7 +192,22 @@ external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_E
179 return EINA_TRUE; 192 return EINA_TRUE;
180 } 193 }
181 } 194 }
182 195 else if (!strcmp(param->name, "align x")
196 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
197 {
198 double x, y;
199 elm_gengrid_align_get(obj, &x, &y);
200 elm_gengrid_align_set(obj, param->d, y);
201 return EINA_TRUE;
202 }
203 else if (!strcmp(param->name, "align y")
204 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
205 {
206 double x, y;
207 elm_gengrid_align_get(obj, &x, &y);
208 elm_gengrid_align_set(obj, x, param->d);
209 return EINA_TRUE;
210 }
183 ERR("unknown parameter '%s' of type '%s'", 211 ERR("unknown parameter '%s' of type '%s'",
184 param->name, edje_external_param_type_str(param->type)); 212 param->name, edje_external_param_type_str(param->type));
185 213
@@ -281,7 +309,22 @@ external_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_E
281 return EINA_TRUE; 309 return EINA_TRUE;
282 } 310 }
283 } 311 }
284 312 else if (!strcmp(param->name, "align x")
313 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
314 {
315 double x, y;
316 elm_gengrid_align_get(obj, &x, &y);
317 param->d = x;
318 return EINA_TRUE;
319 }
320 else if (!strcmp(param->name, "align y")
321 && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
322 {
323 double x, y;
324 elm_gengrid_align_get(obj, &x, &y);
325 param->d = y;
326 return EINA_TRUE;
327 }
285 ERR("unknown parameter '%s' of type '%s'", 328 ERR("unknown parameter '%s' of type '%s'",
286 param->name, edje_external_param_type_str(param->type)); 329 param->name, edje_external_param_type_str(param->type));
287 330
@@ -351,6 +394,16 @@ external_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__
351 mem->horizontal = !!param->i; 394 mem->horizontal = !!param->i;
352 mem->horizontal_exists = EINA_TRUE; 395 mem->horizontal_exists = EINA_TRUE;
353 } 396 }
397 else if (!strcmp(param->name, "align x"))
398 {
399 mem->align_x = param->d;
400 mem->align_x_exists = EINA_TRUE;
401 }
402 else if (!strcmp(param->name, "align y"))
403 {
404 mem->align_y = param->d;
405 mem->align_y_exists = EINA_TRUE;
406 }
354 } 407 }
355 408
356 return mem; 409 return mem;
@@ -382,6 +435,8 @@ static Edje_External_Param_Info external_gengrid_params[] = {
382 EDJE_EXTERNAL_PARAM_INFO_INT("horizontal item size"), 435 EDJE_EXTERNAL_PARAM_INFO_INT("horizontal item size"),
383 EDJE_EXTERNAL_PARAM_INFO_INT("vertical item size"), 436 EDJE_EXTERNAL_PARAM_INFO_INT("vertical item size"),
384 EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"), 437 EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
438 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align x"),
439 EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align y"),
385 EDJE_EXTERNAL_PARAM_INFO_SENTINEL 440 EDJE_EXTERNAL_PARAM_INFO_SENTINEL
386}; 441};
387 442