elementary: Support alignment in gengrid
authormike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 10 Oct 2011 08:32:56 +0000 (08:32 +0000)
committermike_m <mike_m@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 10 Oct 2011 08:32:56 +0000 (08:32 +0000)
Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@63949 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/edje_externals/elm_gengrid.c

index 45faca5..6c3bf07 100644 (file)
@@ -25,6 +25,10 @@ typedef struct _Elm_Params_Gengrid
    Eina_Bool v_itemsize_exists : 1;
    Eina_Bool horizontal : 1;
    Eina_Bool horizontal_exists : 1;
+   Eina_Bool align_x_exists;
+   double align_x;
+   Eina_Bool align_y_exists;
+   double align_y;
 } Elm_Params_Gengrid;
 
 static void
@@ -78,6 +82,15 @@ external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *
         elm_gengrid_item_size_get(obj, &h_itemsize, &v_itemsize);
         elm_gengrid_item_size_set(obj, p->h_itemsize, v_itemsize);
      }
+   else if (p->align_x_exists || p->align_y_exists)
+     {
+        double x, y;
+       elm_gengrid_align_get(obj, &x, &y);
+       if (p->align_x_exists)
+         elm_gengrid_align_set(obj, p->align_x, y);
+       else
+         elm_gengrid_align_set(obj, x, p->align_y);
+     }
    if (p->horizontal_exists)
      {
         elm_gengrid_horizontal_set(obj, p->horizontal);
@@ -179,7 +192,22 @@ external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_E
              return EINA_TRUE;
           }
      }
-
+   else if (!strcmp(param->name, "align x")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
+     {
+       double x, y;
+       elm_gengrid_align_get(obj, &x, &y);
+       elm_gengrid_align_set(obj, param->d, y);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "align y")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
+     {
+       double x, y;
+       elm_gengrid_align_get(obj, &x, &y);
+       elm_gengrid_align_set(obj, x, param->d);
+       return EINA_TRUE;
+     }
    ERR("unknown parameter '%s' of type '%s'",
        param->name, edje_external_param_type_str(param->type));
 
@@ -281,7 +309,22 @@ external_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_E
              return EINA_TRUE;
           }
      }
-
+   else if (!strcmp(param->name, "align x")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
+     {
+       double x, y;
+       elm_gengrid_align_get(obj, &x, &y);
+       param->d = x;
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "align y")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
+     {
+       double x, y;
+       elm_gengrid_align_get(obj, &x, &y);
+       param->d = y;
+       return EINA_TRUE;
+     }
    ERR("unknown parameter '%s' of type '%s'",
        param->name, edje_external_param_type_str(param->type));
 
@@ -351,6 +394,16 @@ external_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__
              mem->horizontal = !!param->i;
              mem->horizontal_exists = EINA_TRUE;
           }
+       else if (!strcmp(param->name, "align x"))
+         {
+            mem->align_x = param->d;
+            mem->align_x_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "align y"))
+         {
+            mem->align_y = param->d;
+            mem->align_y_exists = EINA_TRUE;
+         }
      }
 
    return mem;
@@ -382,6 +435,8 @@ static Edje_External_Param_Info external_gengrid_params[] = {
    EDJE_EXTERNAL_PARAM_INFO_INT("horizontal item size"),
    EDJE_EXTERNAL_PARAM_INFO_INT("vertical item size"),
    EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
+   EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align x"),
+   EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align y"),
    EDJE_EXTERNAL_PARAM_INFO_SENTINEL
 };