Initialize Tizen 2.3
[framework/uifw/elementary.git] / wearable / src / lib / elm_colorselector.h
1 /**
2  * @defgroup Colorselector Colorselector
3  * @ingroup Elementary
4  *
5  * @image html colorselector_inheritance_tree.png
6  * @image latex colorselector_inheritance_tree.eps
7  *
8  * @image html img/widget/colorselector/preview-00.png
9  * @image latex img/widget/colorselector/preview-00.eps
10  *
11  * A ColorSelector is a color selection widget. It allows application
12  * to set a series of colors.It also allows to load/save colors
13  * from/to config with a unique identifier, by default, the colors are
14  * loaded/saved from/to config using "default" identifier. The colors
15  * can be picked by user from the color set by clicking on individual
16  * color item on the palette or by selecting it from selector.
17  *
18  * This widget inherits from the @ref Layout one, so that all the
19  * functions acting on it also work for check objects.
20  *
21  * This widget emits the following signals, besides the ones sent from
22  * @ref Layout:
23  * - @c "changed" - When the color value changes on selector
24  *   event_info is NULL.
25  * - @c "color,item,selected" - When user clicks on color item. The
26  *   event_info parameter of the callback will be the selected color
27  *   item.
28  * - @c "color,item,longpressed" - When user long presses on color
29  *   item. The event info parameter of the callback contains selected
30  *   color item.
31  *
32  * See @ref tutorial_colorselector.
33  * @{
34  */
35
36 typedef struct _Elm_Color_RGBA
37 {
38    unsigned int r;
39    unsigned int g;
40    unsigned int b;
41    unsigned int a;
42    const char *color_name;
43 } Elm_Color_RGBA;
44
45 typedef struct _Elm_Custom_Palette
46 {
47    const char *palette_name;
48    Eina_List  *color_list;
49 } Elm_Custom_Palette;
50
51 /**
52  * @enum Elm_Colorselector_Mode
53  * @typedef Elm_Colorselector_Mode
54  *
55  * Different modes supported by Colorselector
56  *
57  * @see elm_colorselector_mode_set()
58  * @see elm_colorselector_mode_get()
59  */
60 typedef enum
61 {
62    ELM_COLORSELECTOR_PALETTE = 0, /**< only color palette is displayed */
63    ELM_COLORSELECTOR_COMPONENTS, /**< only color selector is displayed */
64    ELM_COLORSELECTOR_BOTH, /**< Both Palette and selector is displayed, default */
65    ELM_COLORSELECTOR_PICKER, /**< only color picker is displayed */
66    ELM_COLORSELECTOR_PLANE, /**< only color plane is displayed */
67    ELM_COLORSELECTOR_PALETTE_PLANE, /**< both palette and plane is displayed */
68    ELM_COLORSELECTOR_ALL /**< all possible color selector is displayed */
69 } Elm_Colorselector_Mode;
70
71 /**
72  * @brief Add a new colorselector to the parent
73  *
74  * @param parent The parent object
75  * @return The new object or NULL if it cannot be created
76  *
77  * @ingroup Colorselector
78  */
79 EAPI Evas_Object *elm_colorselector_add(Evas_Object *parent);
80
81 /**
82  * Set color to colorselector
83  *
84  * @param obj Colorselector object
85  * @param r r-value of color
86  * @param g g-value of color
87  * @param b b-value of color
88  * @param a a-value of color
89  *
90  * @ingroup Colorselector
91  */
92 EAPI void elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a);
93
94 /**
95  * Get current color from colorselector
96  *
97  * @param obj Colorselector object
98  * @param r integer pointer for r-value of color
99  * @param g integer pointer for g-value of color
100  * @param b integer pointer for b-value of color
101  * @param a integer pointer for a-value of color
102  *
103  * @ingroup Colorselector
104  */
105 EAPI void elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a);
106
107 /**
108  * Set Colorselector's mode.
109  *
110  * @param obj Colorselector object
111  * @param mode Elm_Colorselector_Mode
112  *
113  * Colorselector supports three modes palette only, selector only and both.
114  *
115  * @ingroup Colorselector
116  */
117 EAPI void elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode);
118
119 /**
120  * Get Colorselector's mode.
121  *
122  * @param obj Colorselector object
123  * @return mode The current mode of colorselector
124  *
125  * @ingroup Colorselector
126  */
127 EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj);
128
129 /**
130  * Get Palette item's color.
131  *
132  * @param it The color palette item.
133  * @param r integer pointer for r-value of color
134  * @param g integer pointer for g-value of color
135  * @param b integer pointer for b-value of color
136  * @param a integer pointer for a-value of color
137  *
138  * @ingroup Colorselector
139  */
140 EAPI void elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r, int *g, int *b, int *a);
141
142 /**
143  * Set palette item's color.
144  *
145  * @param it The color palette item.
146  * @param r r-value of color
147  * @param g g-value of color
148  * @param b b-value of color
149  * @param a a-value of color
150  *
151  * @ingroup Colorselector
152  */
153 EAPI void elm_colorselector_palette_item_color_set(Elm_Object_Item *it, int r, int g, int b, int a);
154
155 /**
156  * Add a new color item to palette.
157  *
158  * @param obj The Colorselector object
159  * @param r r-value of color
160  * @param g g-value of color
161  * @param b b-value of color
162  * @param a a-value of color
163  * @return A new color palette Item.
164  *
165  * @ingroup Colorselector
166  */
167 EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a);
168
169 /**
170  * Clear the palette items.
171  *
172  * @param obj The Colorselector object
173  *
174  * @ingroup Colorselector
175  */
176 EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
177
178 /**
179  * Get list of palette item's.
180  *
181  * @param obj The Colorselector object
182  * @return The list of color items.
183  *
184  * @ingroup Colorselector
185  */
186 EAPI Eina_List *elm_colorselector_palette_items_get(const Evas_Object *obj);
187
188 /**
189  * Set current palette's name
190  *
191  * @param obj The Colorselector object
192  * @param palette_name Name of palette
193  *
194  * When colorpalette name is set, colors will be loaded from and saved to config
195  * using the set name. If no name is set then colors will be loaded from or
196  * saved to "default" config.
197  *
198  * @ingroup Colorselector
199  */
200 EAPI void elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name);
201
202 /**
203  * Get current palette's name
204  *
205  * @param obj The Colorselector object
206  * @return Name of palette
207  *
208  * Returns the currently set palette name using which colors will be
209  * saved/loaded in to config.
210  *
211  * @ingroup Colorselector
212  */
213 EAPI const char *elm_colorselector_palette_name_get(const Evas_Object *obj);
214
215 /**
216  * @}
217  */