elementary: add external elm_index
authoryoz <yoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 27 May 2011 17:34:02 +0000 (17:34 +0000)
committeryoz <yoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 27 May 2011 17:34:02 +0000 (17:34 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@59758 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/edje_externals/Makefile.am
src/edje_externals/elm_index.c [new file with mode: 0644]
src/edje_externals/modules.inc

index f4b3881..0ea7de1 100644 (file)
@@ -57,7 +57,8 @@ elm_spinner.c \
 elm_thumb.c \
 elm_toggle.c \
 elm_toolbar.c \
-elm_segment_control.c
+elm_segment_control.c \
+elm_index.c
 
 module_la_LIBADD = $(top_builddir)/src/lib/libelementary.la
 module_la_LDFLAGS = -no-undefined -module -avoid-version -shared -fPIC
diff --git a/src/edje_externals/elm_index.c b/src/edje_externals/elm_index.c
new file mode 100644 (file)
index 0000000..74052f0
--- /dev/null
@@ -0,0 +1,104 @@
+#include "private.h"
+
+typedef struct _Elm_Params_Index
+{
+   Elm_Params base;
+   Eina_Bool active:1;
+   Eina_Bool active_exists:1;
+
+} Elm_Params_Index;
+
+static void
+external_index_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
+{
+   const Elm_Params_Index *p;
+
+   if (to_params) p = to_params;
+   else if (from_params) p = from_params;
+   else return;
+
+   if (p->active_exists)
+     elm_index_active_set(obj, p->active_exists);
+}
+
+static Eina_Bool
+external_index_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
+{
+   if (!strcmp(param->name, "active"))
+     {
+        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+          {
+             elm_index_active_set(obj, 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_index_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
+{
+   if (!strcmp(param->name, "active"))
+     {
+        if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+          {
+             param->i = elm_index_active_get(obj);
+             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_index_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
+{
+   Elm_Params_Index *mem;
+   Edje_External_Param *param;
+   const Eina_List *l;
+
+   mem = calloc(1, sizeof(Elm_Params_Index));
+   if (!mem)
+     return NULL;
+
+   EINA_LIST_FOREACH(params, l, param)
+     {
+        if (!strcmp(param->name, "active"))
+          {
+             mem->active = !!param->i;
+             mem->active_exists = EINA_TRUE;
+          }
+
+     }
+
+   return mem;
+}
+
+static Evas_Object *external_index_content_get(void *data __UNUSED__,
+               const Evas_Object *obj __UNUSED__, const char *content __UNUSED__)
+{
+       ERR("No content.");
+       return NULL;
+}
+
+static void
+external_index_params_free(void *params)
+{
+   Elm_Params_Index *mem = params;
+   free(mem);
+}
+
+static Edje_External_Param_Info external_index_params[] = {
+   DEFINE_EXTERNAL_COMMON_PARAMS,
+    EDJE_EXTERNAL_PARAM_INFO_BOOL("active"),
+   EDJE_EXTERNAL_PARAM_INFO_SENTINEL
+};
+
+DEFINE_EXTERNAL_ICON_ADD(index, "index");
+DEFINE_EXTERNAL_TYPE_SIMPLE(index, "index");
index 6187e76..fda4576 100644 (file)
@@ -28,3 +28,4 @@ DEFINE_TYPE(label)
 DEFINE_TYPE(icon)
 DEFINE_TYPE(scroller)
 DEFINE_TYPE(segment_control)
+DEFINE_TYPE(index)