edje external elm_gengrid added
authorjh0506.yun <jh0506.yun@samsung.com>
Thu, 11 Nov 2010 07:10:36 +0000 (16:10 +0900)
committerjh0506.yun <jh0506.yun@samsung.com>
Thu, 11 Nov 2010 07:10:36 +0000 (16:10 +0900)
data/edje_externals/Makefile.am
data/edje_externals/ico_gengrid.png [new file with mode: 0755]
data/edje_externals/icons.edc
src/edje_externals/Makefile.am
src/edje_externals/elm_gengrid.c [new file with mode: 0644]
src/edje_externals/modules.inc

index 3adc941..fba76e6 100644 (file)
@@ -17,6 +17,7 @@ ico_check.png \
 ico_clock.png \
 ico_fileselector.png \
 ico_fileselector_button.png \
 ico_clock.png \
 ico_fileselector.png \
 ico_fileselector_button.png \
+ico_gengrid.png \
 ico_genlist.png \
 ico_hoversel.png \
 ico_icon.png \
 ico_genlist.png \
 ico_hoversel.png \
 ico_icon.png \
diff --git a/data/edje_externals/ico_gengrid.png b/data/edje_externals/ico_gengrid.png
new file mode 100755 (executable)
index 0000000..c6c42ba
Binary files /dev/null and b/data/edje_externals/ico_gengrid.png differ
index 0e0e468..fe2125d 100644 (file)
@@ -18,6 +18,7 @@ ICON("check")
 ICON("clock")
 ICON("fileselector")
 ICON("fileselector_button")
 ICON("clock")
 ICON("fileselector")
 ICON("fileselector_button")
+ICON("gengrid")
 ICON("genlist")
 ICON("hoversel")
 ICON("icon")
 ICON("genlist")
 ICON("hoversel")
 ICON("icon")
index 1baa249..c9e2abd 100644 (file)
@@ -35,6 +35,7 @@ elm_check.c \
 elm_clock.c \
 elm_fileselector.c \
 elm_fileselector_button.c \
 elm_clock.c \
 elm_fileselector.c \
 elm_fileselector_button.c \
+elm_gengrid.c \
 elm_genlist.c \
 elm_hoversel.c \
 elm_icon.c \
 elm_genlist.c \
 elm_hoversel.c \
 elm_icon.c \
diff --git a/src/edje_externals/elm_gengrid.c b/src/edje_externals/elm_gengrid.c
new file mode 100644 (file)
index 0000000..eddcc80
--- /dev/null
@@ -0,0 +1,335 @@
+#include <assert.h>
+
+#include "private.h"
+
+typedef struct _Elm_Params_Gengrid
+{
+   Eina_Bool item_size_x_exists;
+   int item_size_x;
+   Eina_Bool item_size_y_exists;
+   int item_size_y;
+   Eina_Bool align_x_exists;
+   double align_x;
+   Eina_Bool align_y_exists;
+   double align_y;
+   Eina_Bool always_select_exists;
+   Eina_Bool always_select : 1;
+   Eina_Bool no_select_exists;
+   Eina_Bool no_select;
+   Eina_Bool multi_select_exists;
+   Eina_Bool multi_select : 1;
+   Eina_Bool h_bounce_exists;
+   Eina_Bool h_bounce : 1;
+   Eina_Bool v_bounce_exists;
+   Eina_Bool v_bounce : 1;
+   Eina_Bool horizontal_exists;
+   Eina_Bool horizontal;
+} Elm_Params_Gengrid;
+
+static Eina_Bool horizontal_bk;
+
+static void
+external_gengrid_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
+{
+   const Elm_Params_Gengrid *p;
+
+   if (to_params) p = to_params;
+   else if (from_params) p = from_params;
+   else return;
+
+   if (p->item_size_x_exists && p->item_size_y_exists)
+     elm_gengrid_item_size_set(obj, p->item_size_x, p->item_size_y);
+   else if (p->item_size_x_exists || p->item_size_y_exists)
+     {
+       Evas_Coord w, h;
+       elm_gengrid_item_size_get(obj, &w, &h);
+       if (p->item_size_x_exists)
+         elm_gengrid_item_size_set(obj, p->item_size_x, h);
+       else
+         elm_gengrid_item_size_set(obj, w, p->item_size_y);
+     }
+   if (p->align_x_exists && p->align_y_exists)
+     elm_gengrid_align_set(obj, p->align_x, p->align_y);
+   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->always_select_exists)
+     elm_gengrid_always_select_mode_set(obj, p->always_select);
+   if (p->no_select_exists)
+     elm_gengrid_no_select_mode_set(obj, p->no_select);
+   if (p->multi_select_exists)
+     elm_gengrid_multi_select_set(obj, p->multi_select);
+   if (p->h_bounce_exists && p->v_bounce_exists)
+     elm_gengrid_bounce_set(obj, p->h_bounce, p->v_bounce);
+   else if (p->h_bounce_exists || p->v_bounce_exists)
+     {
+        Eina_Bool h, v;
+       elm_gengrid_bounce_get(obj, &h, &v);
+       if (p->h_bounce_exists)
+         elm_gengrid_bounce_set(obj, p->h_bounce, v);
+       else
+         elm_gengrid_bounce_set(obj, h, p->v_bounce);
+     }
+   if (p->horizontal_exists)
+     {
+        elm_gengrid_horizontal_set(obj, p->horizontal);
+       horizontal_bk = p->horizontal;
+     }
+}
+
+static Eina_Bool
+external_gengrid_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
+{
+   if (!strcmp(param->name, "item size x") 
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
+     {
+       Evas_Coord w, h;
+       elm_gengrid_item_size_get(obj, &w, &h);
+       elm_gengrid_item_size_set(obj, param->i, h);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "item size y")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
+     {
+        Evas_Coord w, h;
+       elm_gengrid_item_size_get(obj, &w, &h);
+       elm_gengrid_item_size_set(obj, w, param->i);
+       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;
+     }
+   else if (!strcmp(param->name, "always select")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       elm_gengrid_always_select_mode_set(obj, param->i);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "no select")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       elm_gengrid_no_select_mode_set(obj, param->i);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "multi select")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       elm_gengrid_multi_select_set(obj, param->i);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "h bounce")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       Eina_Bool h, v;
+       elm_gengrid_bounce_get(obj, &h, &v);
+       elm_gengrid_item_size_set(obj, param->i, v);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "v bounce")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       Eina_Bool h, v;
+       elm_gengrid_bounce_get(obj, &h, &v);
+       elm_gengrid_item_size_set(obj, h, param->i);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "horizontal")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       elm_gengrid_horizontal_set(obj, param->i);
+       horizontal_bk = param->i;
+       return EINA_TRUE;
+     }
+
+   ERR("unknown parameter '%s' of type '%s'",
+       param->name, edje_external_param_type_str(param->type));
+
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+external_gengrid_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
+{
+   if (!strcmp(param->name, "item size x")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
+     {
+       Evas_Coord x, y;
+       elm_gengrid_item_size_get(obj, &x, &y);
+        param->i = x;
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "item size y")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
+     {
+       Evas_Coord x, y;
+       elm_gengrid_item_size_get(obj, &x, &y);
+       param->i = y;
+       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;
+     }
+   else if (!strcmp(param->name, "always select")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       param->i = elm_gengrid_always_select_mode_get(obj);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "no select")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       param->i = elm_gengrid_no_select_mode_get(obj);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "multi select")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       param->i = elm_gengrid_multi_select_get(obj);
+       return EINA_TRUE;
+     }
+   else if (!strcmp(param->name, "horizontal")
+                  && param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+     {
+       param->i = horizontal_bk;
+       return EINA_TRUE;
+     }
+
+   ERR("unknown parameter '%s' of type '%s'",
+                  param->name, edje_external_param_type_str(param->type));
+
+   return EINA_FALSE;
+}
+
+static void *
+external_gengrid_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
+{
+   Elm_Params_Gengrid *mem;
+   Edje_External_Param *param;
+   const Eina_List *l;
+   
+   mem = calloc(1, sizeof(Elm_Params_Gengrid));
+   if (!mem)
+     return NULL;
+
+   EINA_LIST_FOREACH(params, l, param)
+     {
+        if (!strcmp(param->name, "item size x"))
+         {
+            mem->item_size_x = param->i;
+            mem->item_size_x_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "item size y"))
+         {
+            mem->item_size_y = param->i;
+            mem->item_size_y_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;
+         }
+       else if (!strcmp(param->name, "always select"))
+         {
+            mem->always_select = param->i;
+            mem->always_select_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "no_select"))
+         {
+            mem->no_select = param->i;
+            mem->no_select_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "multi select"))
+         {
+            mem->multi_select = param->i;
+            mem->multi_select_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "h bounce"))
+         {
+            mem->h_bounce = param->i;
+            mem->h_bounce_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "v bounce"))
+         {
+            mem->v_bounce = param->i;
+            mem->v_bounce_exists = EINA_TRUE;
+         }
+       else if (!strcmp(param->name, "horizontal"))
+       {
+            mem->horizontal = param->i;
+            horizontal_bk = param->i;
+            mem->horizontal_exists = EINA_TRUE;
+       }
+     }
+   
+   return mem;
+}
+
+static Evas_Object *external_gengrid_content_get(void *data __UNUSED__,
+               const Evas_Object *obj, const char *content)
+{
+   ERR("so content");
+   return NULL;
+}
+
+static void
+external_gengrid_params_free(void *params)
+{
+   Elm_Params_Gengrid *mem = params;
+
+   free(mem);
+}
+
+static Edje_External_Param_Info external_gengrid_params[] = {
+    EDJE_EXTERNAL_PARAM_INFO_INT("item size x"),
+    EDJE_EXTERNAL_PARAM_INFO_INT("item size y"),
+    EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align x"),
+    EDJE_EXTERNAL_PARAM_INFO_DOUBLE("align y"),
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("always select"),
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("no select"),
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("multi select"),
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("h bounce"),
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("v bounce"),
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("hirizontal"),
+    EDJE_EXTERNAL_PARAM_INFO_SENTINEL
+};
+
+DEFINE_EXTERNAL_ICON_ADD(gengrid, "gengrid");
+DEFINE_EXTERNAL_TYPE_SIMPLE(gengrid, "Gengrid");
+
index 4542132..c8f3e74 100644 (file)
@@ -6,6 +6,7 @@ DEFINE_TYPE(check)
 DEFINE_TYPE(clock)
 DEFINE_TYPE(fileselector)
 DEFINE_TYPE(fileselector_button)
 DEFINE_TYPE(clock)
 DEFINE_TYPE(fileselector)
 DEFINE_TYPE(fileselector_button)
+DEFINE_TYPE(gengrid)
 DEFINE_TYPE(genlist)
 DEFINE_TYPE(hoversel)
 DEFINE_TYPE(icon)
 DEFINE_TYPE(genlist)
 DEFINE_TYPE(hoversel)
 DEFINE_TYPE(icon)