aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/edje_externals/Makefile.am1
-rwxr-xr-xdata/edje_externals/ico_list.pngbin0 -> 2167 bytes
-rw-r--r--data/edje_externals/icons.edc3
-rw-r--r--src/edje_externals/Makefile.am1
-rw-r--r--src/edje_externals/elm_list.c272
-rw-r--r--src/edje_externals/modules.inc1
-rw-r--r--src/lib/Elementary.h.in2
-rw-r--r--src/lib/elm_list.c19
8 files changed, 299 insertions, 0 deletions
diff --git a/data/edje_externals/Makefile.am b/data/edje_externals/Makefile.am
index 6de0e2880..d278cbf6e 100644
--- a/data/edje_externals/Makefile.am
+++ b/data/edje_externals/Makefile.am
@@ -19,6 +19,7 @@ ico_fileselector.png \
ico_fileselector_button.png \
ico_genlist.png \
ico_hoversel.png \
+ico_list.png \
ico_map.png \
ico_notepad.png \
ico_photocam.png \
diff --git a/data/edje_externals/ico_list.png b/data/edje_externals/ico_list.png
new file mode 100755
index 000000000..9a1dc647d
--- /dev/null
+++ b/data/edje_externals/ico_list.png
Binary files differ
diff --git a/data/edje_externals/icons.edc b/data/edje_externals/icons.edc
index 4bccee283..e36ccead7 100644
--- a/data/edje_externals/icons.edc
+++ b/data/edje_externals/icons.edc
@@ -20,6 +20,7 @@ ICON("fileselector")
ICON("fileselector_button")
ICON("genlist")
ICON("hoversel")
+ICON("list")
ICON("map")
ICON("notepad")
ICON("photocam")
@@ -32,3 +33,5 @@ ICON("spinner")
ICON("thumb")
ICON("toggle")
ICON("toolbar")
+ICON("slideshow")
+
diff --git a/src/edje_externals/Makefile.am b/src/edje_externals/Makefile.am
index 2b85a02a0..5d56695de 100644
--- a/src/edje_externals/Makefile.am
+++ b/src/edje_externals/Makefile.am
@@ -36,6 +36,7 @@ elm_fileselector.c \
elm_fileselector_button.c \
elm_genlist.c \
elm_hoversel.c \
+elm_list.c \
elm_map.c \
elm_notepad.c \
elm_photocam.c \
diff --git a/src/edje_externals/elm_list.c b/src/edje_externals/elm_list.c
new file mode 100644
index 000000000..bd245da71
--- /dev/null
+++ b/src/edje_externals/elm_list.c
@@ -0,0 +1,272 @@
+#include <assert.h>
+
+#include "private.h"
+
+typedef struct _Elm_Params_List
+{
+ const char *policy_h;
+ const char *policy_v;
+ const char *horizontal_mode;
+ Eina_Bool multi : 1;
+ Eina_Bool multi_exists : 1;
+ Eina_Bool always_select : 1;
+ Eina_Bool always_select_exists : 1;
+} Elm_Params_List;
+
+#define CHOICE_GET(CHOICES, STR) \
+ unsigned int i; \
+ for (i = 0; i < sizeof(CHOICES); i++) \
+ if (strcmp(STR, CHOICES[i]) == 0) \
+ return i
+
+static const char *scroller_policy_choices[] = {"auto", "on", "off", NULL};
+static const char *list_horizontal_mode_choices[] = {"compress", "scroll",
+ "limit", NULL};
+
+static Elm_Scroller_Policy
+_scroller_policy_choices_setting_get(const char *policy_str)
+{
+ assert(sizeof(scroller_policy_choices)/
+ sizeof(scroller_policy_choices[0]) == ELM_SCROLLER_POLICY_LAST + 1);
+ CHOICE_GET(scroller_policy_choices, policy_str);
+ return ELM_SCROLLER_POLICY_LAST;
+}
+
+static Elm_List_Mode
+_list_horizontal_mode_setting_get(const char *horizontal_mode_str)
+{
+ assert(sizeof(list_horizontal_mode_choices)/
+ sizeof(list_horizontal_mode_choices[0]) == ELM_LIST_LAST + 1);
+ CHOICE_GET(list_horizontal_mode_choices, horizontal_mode_str);
+ return ELM_LIST_LAST;
+}
+
+
+static void
+external_list_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
+{
+ const Elm_Params_List *p;
+ Elm_Scroller_Policy policy_h, policy_v;
+
+ if (to_params) p = to_params;
+ else if (from_params) p = from_params;
+ else return;
+
+ if (p->horizontal_mode)
+ {
+ Elm_List_Mode set = _list_horizontal_mode_setting_get(p->horizontal_mode
+ );
+ if (set == ELM_LIST_LAST) return;
+ elm_list_horizontal_mode_set(obj, set);
+ }
+
+ if ((p->policy_h) && (p->policy_v))
+ {
+ policy_h = _scroller_policy_choices_setting_get(p->policy_h);
+ policy_v = _scroller_policy_choices_setting_get(p->policy_v);
+ elm_list_scroller_policy_set(obj, policy_h, policy_v);
+ }
+ else if ((p->policy_h) || (p->policy_v))
+ {
+ elm_list_scroller_policy_get(obj, &policy_h, &policy_v);
+ if (p->policy_h)
+ {
+ policy_h = _scroller_policy_choices_setting_get(p->policy_h);
+ elm_list_scroller_policy_set(obj, policy_h, policy_v);
+ }
+ else
+ {
+ policy_v = _scroller_policy_choices_setting_get(p->policy_v);
+ elm_list_scroller_policy_set(obj, policy_h, policy_v);
+ }
+ }
+
+ if (p->multi_exists)
+ elm_list_multi_select_set(obj, p->multi);
+ if (p->always_select_exists)
+ elm_list_always_select_mode_set(obj, p->always_select);
+}
+
+static Eina_Bool
+external_list_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
+{
+ if (!strcmp(param->name, "horizontal mode"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Elm_List_Mode set = _list_horizontal_mode_setting_get(param->s);
+ if (set == ELM_LIST_LAST) return EINA_FALSE;
+ elm_list_horizontal_mode_set(obj, set);
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "scroll horizontal"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Elm_Scroller_Policy h, v;
+ elm_list_scroller_policy_get(obj, &h, &v);
+ h = _scroller_policy_choices_setting_get(param->s);
+ if (h == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE;
+ elm_list_scroller_policy_set(obj, h, v);
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "scroll vertical"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Elm_Scroller_Policy h, v;
+ elm_list_scroller_policy_get(obj, &h, &v);
+ v = _scroller_policy_choices_setting_get(param->s);
+ if (v == ELM_SCROLLER_POLICY_LAST) return EINA_FALSE;
+ elm_list_scroller_policy_set(obj, h, v);
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "multi"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+ {
+ elm_list_multi_select_set(obj, param->i);
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "always_select"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+ {
+ elm_list_always_select_mode_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_list_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
+{
+ if (!strcmp(param->name, "multi"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+ {
+ param->i = elm_list_multi_select_get(obj);
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "always_select"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
+ {
+ param->i = elm_list_always_select_mode_get(obj);
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "scroll horizontal"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Elm_Scroller_Policy h, v;
+ elm_list_scroller_policy_get(obj, &h, &v);
+
+ param->s = scroller_policy_choices[h];
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "scroll vertical"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Elm_Scroller_Policy h, v;
+ elm_list_scroller_policy_get(obj, &h, &v);
+
+ param->s = scroller_policy_choices[v];
+ return EINA_TRUE;
+ }
+ }
+ else if (!strcmp(param->name, "horizontal mode"))
+ {
+ if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
+ {
+ Elm_List_Mode m = elm_list_horizontal_mode_get(obj);
+
+ if (m == ELM_LIST_LAST)
+ return EINA_FALSE;
+
+ param->s = list_horizontal_mode_choices[m];
+ 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_list_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
+{
+ Elm_Params_List *mem;
+ Edje_External_Param *param;
+ const Eina_List *l;
+
+ mem = calloc(1, sizeof(Elm_Params_List));
+ if (!mem)
+ return NULL;
+
+ EINA_LIST_FOREACH(params, l, param)
+ {
+ if (!strcmp(param->name, "multi"))
+ {
+ mem->multi = param->i;
+ mem->multi_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, "scroll horizontal"))
+ mem->policy_h = eina_stringshare_add(param->s);
+ else if (!strcmp(param->name, "scroll vertical"))
+ mem->policy_v = eina_stringshare_add(param->s);
+ else if (!strcmp(param->name, "horizontal mode"))
+ mem->horizontal_mode = eina_stringshare_add(param->s);
+ }
+ return mem;
+}
+
+static void
+external_list_params_free(void *params)
+{
+ Elm_Params_List *mem = params;
+
+ if (mem->horizontal_mode)
+ eina_stringshare_del(mem->horizontal_mode);
+ if (mem->policy_h)
+ eina_stringshare_del(mem->policy_h);
+ if (mem->policy_v)
+ eina_stringshare_del(mem->policy_v);
+
+ free(mem);
+}
+
+static Edje_External_Param_Info external_list_params[] = {
+ EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("horizontal mode", "scroll",
+ list_horizontal_mode_choices),
+ EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("scroll horizontal", "auto",
+ scroller_policy_choices),
+ EDJE_EXTERNAL_PARAM_INFO_CHOICE_FULL("scroll vertical", "auto",
+ scroller_policy_choices),
+ EDJE_EXTERNAL_PARAM_INFO_BOOL("multi"),
+ EDJE_EXTERNAL_PARAM_INFO_BOOL("always_select"),
+ EDJE_EXTERNAL_PARAM_INFO_SENTINEL
+};
+
+DEFINE_EXTERNAL_ICON_ADD(list, "list")
+DEFINE_EXTERNAL_TYPE_SIMPLE(list, "List");
diff --git a/src/edje_externals/modules.inc b/src/edje_externals/modules.inc
index 8a54899a2..ec2950839 100644
--- a/src/edje_externals/modules.inc
+++ b/src/edje_externals/modules.inc
@@ -8,6 +8,7 @@ DEFINE_TYPE(fileselector)
DEFINE_TYPE(fileselector_button)
DEFINE_TYPE(genlist)
DEFINE_TYPE(hoversel)
+DEFINE_TYPE(list)
DEFINE_TYPE(map)
DEFINE_TYPE(notepad)
DEFINE_TYPE(photocam)
diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in
index e238ac609..a57e44430 100644
--- a/src/lib/Elementary.h.in
+++ b/src/lib/Elementary.h.in
@@ -861,6 +861,7 @@ extern "C" {
EAPI void elm_list_horizontal_mode_set(Evas_Object *obj, Elm_List_Mode mode);
EAPI Elm_List_Mode elm_list_horizontal_mode_get(const Evas_Object *obj);
EAPI void elm_list_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select);
+ EAPI Eina_Bool elm_list_always_select_mode_get(const Evas_Object *obj);
EAPI const Eina_List *elm_list_items_get(const Evas_Object *obj);
EAPI Elm_List_Item *elm_list_selected_item_get(const Evas_Object *obj);
EAPI const Eina_List *elm_list_selected_items_get(const Evas_Object *obj);
@@ -881,6 +882,7 @@ extern "C" {
EAPI Elm_List_Item *elm_list_item_next(const Elm_List_Item *it);
EAPI void elm_list_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
EAPI void elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
+ EAPI void elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
/* smart callbacks called:
* "clicked" - when the user double-clicked an item
* "selected" - when the user selected an item
diff --git a/src/lib/elm_list.c b/src/lib/elm_list.c
index 1e168c1a0..1cfa895e2 100644
--- a/src/lib/elm_list.c
+++ b/src/lib/elm_list.c
@@ -900,6 +900,15 @@ elm_list_always_select_mode_set(Evas_Object *obj, Eina_Bool always_select)
wd->always_select = always_select;
}
+EAPI Eina_Bool
+elm_list_always_select_mode_get(const Evas_Object *obj)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return EINA_FALSE;
+ return wd->always_select;
+}
+
EAPI const Eina_List *
elm_list_items_get(const Evas_Object *obj)
{
@@ -1164,3 +1173,13 @@ elm_list_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm
if (wd->scr)
elm_scroller_policy_set(wd->scr, policy_h, policy_v);
}
+
+EAPI void
+elm_list_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
+{
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ if (wd->scr)
+ elm_scroller_policy_get(wd->scr, policy_h, policy_v);
+}