summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShilpa Singh <shilpa.singh@samsung.com>2014-02-07 23:30:01 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-02-07 23:35:13 +0900
commitcd9507ed6004044c57f164b151ea6bf43d25da2f (patch)
tree9f5c829252952e021067c07fea27cb63ac74e124
parent3902d1697e7111b5bbc327c789b8828a59653623 (diff)
Colorselector: Palette_items_get API added.
Summary: Summary: Issue:Colorselector adds default palette items by reading colors from config, application do not have any way to get that color list. Solution: API added to get the palette's item list. Signed-off by: Shilpa Singh(shilpa.singh@samsung.com) Test Plan: Test Plan: Create a list pointer and call palette_items_get API to get the list of color items. Change the color of any item to confirm whether the list has been returned correctly. Eina_List *list = elm_colorselector_palette_items_get(cs); Eina_List *list2 = eina_list_last(list); Elm_Object_Item *color_item = eina_list_data_get(list2); elm_colorselector_palette_item_color_set(color_item, 0, 0, 0, 255); Reviewers: seoz, Hermet, raster CC: govi, myoungwoon Differential Revision: https://phab.enlightenment.org/D503
-rw-r--r--src/bin/test_colorselector.c7
-rw-r--r--src/lib/elm_colorselector.c19
-rw-r--r--src/lib/elm_colorselector_eo.h13
-rw-r--r--src/lib/elm_colorselector_legacy.h15
4 files changed, 54 insertions, 0 deletions
diff --git a/src/bin/test_colorselector.c b/src/bin/test_colorselector.c
index fe1157f88..411d7a037 100644
--- a/src/bin/test_colorselector.c
+++ b/src/bin/test_colorselector.c
@@ -81,6 +81,8 @@ test_colorselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
81 void *event_info EINA_UNUSED) 81 void *event_info EINA_UNUSED)
82{ 82{
83 Evas_Object *win, *bx, *bx2, *cs, *fr, *re, *bt; 83 Evas_Object *win, *bx, *bx2, *cs, *fr, *re, *bt;
84 const Eina_List *item_list, *last_item_list;
85 Elm_Object_Item *color_item;
84 int r, g, b, a; 86 int r, g, b, a;
85 87
86 win = elm_win_util_standard_add("colorselector", "ColorSelector"); 88 win = elm_win_util_standard_add("colorselector", "ColorSelector");
@@ -124,6 +126,11 @@ test_colorselector(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
124 elm_colorselector_palette_color_add(cs, 255, 255, 119, 255); 126 elm_colorselector_palette_color_add(cs, 255, 255, 119, 255);
125 elm_colorselector_palette_color_add(cs, 133, 100, 255, 255); 127 elm_colorselector_palette_color_add(cs, 133, 100, 255, 255);
126 128
129 item_list = elm_colorselector_palette_items_get(cs);
130 last_item_list = eina_list_last(item_list);
131 color_item = eina_list_data_get(last_item_list);
132 elm_colorselector_palette_item_color_set(color_item, 255, 0, 0, 255);
133
127 a = 180; 134 a = 180;
128 r = 255; 135 r = 255;
129 g = 160; 136 g = 160;
diff --git a/src/lib/elm_colorselector.c b/src/lib/elm_colorselector.c
index 080968932..714cd7941 100644
--- a/src/lib/elm_colorselector.c
+++ b/src/lib/elm_colorselector.c
@@ -2149,6 +2149,23 @@ _palette_clear(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
2149 sd->focused = ELM_COLORSELECTOR_COMPONENTS; 2149 sd->focused = ELM_COLORSELECTOR_COMPONENTS;
2150} 2150}
2151 2151
2152EAPI const Eina_List *
2153elm_colorselector_palette_items_get(const Evas_Object *obj)
2154{
2155 ELM_COLORSELECTOR_CHECK(obj) NULL;
2156 const Eina_List *color_list = NULL;
2157 eo_do((Eo *) obj, elm_obj_colorselector_palette_items_get(&color_list));
2158 return color_list;
2159}
2160
2161static void
2162_palette_items_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
2163{
2164 const Eina_List **ret = va_arg(*list, const Eina_List **);
2165 Elm_Colorselector_Smart_Data *sd = _pd;
2166 *ret = sd->items;
2167}
2168
2152EAPI void 2169EAPI void
2153elm_colorselector_palette_name_set(Evas_Object *obj, 2170elm_colorselector_palette_name_set(Evas_Object *obj,
2154 const char *palette_name) 2171 const char *palette_name)
@@ -2213,6 +2230,7 @@ _class_constructor(Eo_Class *klass)
2213 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET), _mode_get), 2230 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET), _mode_get),
2214 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD), _palette_color_add), 2231 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD), _palette_color_add),
2215 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR), _palette_clear), 2232 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR), _palette_clear),
2233 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET), _palette_items_get),
2216 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET), _palette_name_set), 2234 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET), _palette_name_set),
2217 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET), _palette_name_get), 2235 EO_OP_FUNC(ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET), _palette_name_get),
2218 EO_OP_FUNC_SENTINEL 2236 EO_OP_FUNC_SENTINEL
@@ -2231,6 +2249,7 @@ static const Eo_Op_Description op_desc[] = {
2231 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET, "Get Colorselector's mode."), 2249 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET, "Get Colorselector's mode."),
2232 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD, "Add a new color item to palette."), 2250 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD, "Add a new color item to palette."),
2233 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR, "Clear the palette items."), 2251 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR, "Clear the palette items."),
2252 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET, "Get palette's item list"),
2234 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET, "Set current palette's name."), 2253 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET, "Set current palette's name."),
2235 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET, "Get current palette's name."), 2254 EO_OP_DESCRIPTION(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET, "Get current palette's name."),
2236 EO_OP_DESCRIPTION_SENTINEL 2255 EO_OP_DESCRIPTION_SENTINEL
diff --git a/src/lib/elm_colorselector_eo.h b/src/lib/elm_colorselector_eo.h
index 93ddc4ce3..b7ac81a25 100644
--- a/src/lib/elm_colorselector_eo.h
+++ b/src/lib/elm_colorselector_eo.h
@@ -12,6 +12,7 @@ enum
12 ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET, 12 ELM_OBJ_COLORSELECTOR_SUB_ID_MODE_GET,
13 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD, 13 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_COLOR_ADD,
14 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR, 14 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR,
15 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET,
15 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET, 16 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_SET,
16 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET, 17 ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_NAME_GET,
17 ELM_OBJ_COLORSELECTOR_SUB_ID_LAST 18 ELM_OBJ_COLORSELECTOR_SUB_ID_LAST
@@ -114,6 +115,18 @@ enum
114#define elm_obj_colorselector_palette_clear() ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR) 115#define elm_obj_colorselector_palette_clear() ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_CLEAR)
115 116
116/** 117/**
118 * @def elm_obj_colorselector_palette_items_get
119 * @since 1.9
120 *
121 * Get list of palette items.
122 *
123 * @param[out] ret
124 *
125 * @ingroup Colorselector
126 */
127#define elm_obj_colorselector_palette_items_get(ret) ELM_OBJ_COLORSELECTOR_ID(ELM_OBJ_COLORSELECTOR_SUB_ID_PALETTE_ITEMS_GET), EO_TYPECHECK(const Eina_List **, ret)
128
129/**
117 * @def elm_obj_colorselector_palette_name_set 130 * @def elm_obj_colorselector_palette_name_set
118 * @since 1.8 131 * @since 1.8
119 * 132 *
diff --git a/src/lib/elm_colorselector_legacy.h b/src/lib/elm_colorselector_legacy.h
index 5165fa4a1..b366056ef 100644
--- a/src/lib/elm_colorselector_legacy.h
+++ b/src/lib/elm_colorselector_legacy.h
@@ -80,6 +80,21 @@ EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int
80EAPI void elm_colorselector_palette_clear(Evas_Object *obj); 80EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
81 81
82/** 82/**
83 * Get list of palette items.
84 *
85 * @param obj The Colorselector object
86 * @return The list of color palette items.
87 *
88 * Note That palette item list is internally managed by colorselector widget and
89 * it should not be freed/modified by application.
90 *
91 * @since 1.9
92 *
93 * @ingroup Colorselector
94 */
95EAPI const Eina_List *elm_colorselector_palette_items_get(const Evas_Object *obj);
96
97/**
83 * Set current palette's name 98 * Set current palette's name
84 * 99 *
85 * @param obj The Colorselector object 100 * @param obj The Colorselector object