aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJean Guyomarc'h <jean@guyomarch.bzh>2016-07-03 11:29:35 +0200
committerJean Guyomarc'h <jean@guyomarch.bzh>2016-07-03 21:35:07 +0200
commitfd5f07300feafa347ec29a9ea9c164b88a245294 (patch)
treea8c0c2cd519e0dc17228bd2fab1a7eadfce5592c /src
parentelementary: document elm_table parameters (diff)
downloadefl-fd5f07300feafa347ec29a9ea9c164b88a245294.tar.gz
edje_external: add combobox external
The combobox widget can now be used from edje externals. It accepts the "guide" parameter, which is of type string.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/edje_external/elementary/elm_combobox.c113
-rw-r--r--src/edje_external/elementary/modules.inc1
3 files changed, 115 insertions, 0 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 3e81fbc420..12d5961815 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -1207,6 +1207,7 @@ edje_external_elementary_module_la_SOURCES = \
edje_external/elementary/elm_calendar.c \
edje_external/elementary/elm_check.c \
edje_external/elementary/elm_clock.c \
+ edje_external/elementary/elm_combobox.c \
edje_external/elementary/elm_entry.c \
edje_external/elementary/elm_fileselector.c \
edje_external/elementary/elm_fileselector_button.c \
diff --git a/src/edje_external/elementary/elm_combobox.c b/src/edje_external/elementary/elm_combobox.c
new file mode 100644
index 0000000000..518fcad38b
--- /dev/null
+++ b/src/edje_external/elementary/elm_combobox.c
@@ -0,0 +1,113 @@
+#include "private.h"
+
+typedef struct
+{
+ Elm_Params base;
+ Eina_Stringshare *guide;
+} Elm_Params_Combobox;
+
+
+static void
+external_combobox_state_set(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ const void *from_params,
+ const void *to_params,
+ float pos EINA_UNUSED)
+{
+ const Elm_Params_Combobox *p;
+
+ if (to_params) p = to_params;
+ else if (from_params) p = from_params;
+ else return;
+
+ if (p->guide) elm_object_part_text_set(obj, "guide", p->guide);
+}
+
+static Eina_Bool
+external_combobox_param_set(void *data EINA_UNUSED,
+ Evas_Object *obj,
+ const Edje_External_Param *param)
+{
+ if (!strcmp(param->name, "guide"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ elm_object_part_text_set(obj, "guide", param->s);
+ 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_combobox_param_get(void *data EINA_UNUSED,
+ const Evas_Object *obj,
+ Edje_External_Param *param)
+{
+ if (!strcmp(param->name, "guide"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ param->s = elm_object_part_text_get(obj, "guide");
+ return EINA_TRUE;
+ }
+ }
+
+ ERR("Unknown parameter '%s' f type %s", param->name,
+ edje_external_param_type_str(param->type));
+ return EINA_FALSE;
+}
+
+static void *
+external_combobox_params_parse(void *data EINA_UNUSED,
+ Evas_Object *obj EINA_UNUSED,
+ const Eina_List *params)
+{
+ Elm_Params_Combobox *mem;
+ Edje_External_Param *param;
+ const Eina_List *l;
+
+ mem = calloc(1, sizeof(*mem));
+ if (EINA_UNLIKELY(!mem))
+ return NULL;
+
+ EINA_LIST_FOREACH(params, l, param)
+ {
+ if (!strcmp(param->name, "guide"))
+ {
+ mem->guide = eina_stringshare_add(param->s);
+ }
+ }
+
+ return mem;
+}
+
+static Evas_Object *
+external_combobox_content_get(void *data EINA_UNUSED,
+ const Evas_Object *obj EINA_UNUSED,
+ const char *content EINA_UNUSED)
+{
+ ERR("No content for combobox");
+ return NULL;
+}
+
+static void
+external_combobox_params_free(void *params)
+{
+ Elm_Params_Combobox *const mem = params;
+
+ if (mem->guide) eina_stringshare_del(mem->guide);
+ free(mem);
+}
+
+static Edje_External_Param_Info external_combobox_params[] = {
+ DEFINE_EXTERNAL_COMMON_PARAMS,
+ EDJE_EXTERNAL_PARAM_INFO_STRING("guide"),
+ EDJE_EXTERNAL_PARAM_INFO_SENTINEL
+};
+
+DEFINE_EXTERNAL_ICON_ADD(combobox, "combobox");
+DEFINE_EXTERNAL_TYPE_SIMPLE(combobox, "Combobox");
diff --git a/src/edje_external/elementary/modules.inc b/src/edje_external/elementary/modules.inc
index 221817bcfd..dbfead5183 100644
--- a/src/edje_external/elementary/modules.inc
+++ b/src/edje_external/elementary/modules.inc
@@ -5,6 +5,7 @@ DEFINE_TYPE(button)
DEFINE_TYPE(calendar)
DEFINE_TYPE(check)
DEFINE_TYPE(clock)
+DEFINE_TYPE(combobox)
DEFINE_TYPE(entry)
DEFINE_TYPE(fileselector)
DEFINE_TYPE(fileselector_button)