elementary/map - map supports language,changed
[framework/uifw/elementary.git] / 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 } Elm_Color_RGBA;
43
44 typedef struct _Elm_Custom_Palette
45 {
46    const char *palette_name;
47    Eina_List  *color_list;
48 } Elm_Custom_Palette;
49
50 /**
51  * @enum Elm_Colorselector_Mode
52  * @typedef Elm_Colorselector_Mode
53  *
54  * Different modes supported by Colorselector
55  *
56  * @see elm_colorselector_mode_set()
57  * @see elm_colorselector_mode_get()
58  */
59 typedef enum
60 {
61    ELM_COLORSELECTOR_PALETTE = 0, /**< only color palette is displayed */
62    ELM_COLORSELECTOR_COMPONENTS, /**< only color selector is displayed */
63    ELM_COLORSELECTOR_BOTH, /**< Both Palette and selector is displayed, default */
64    ELM_COLORSELECTOR_PICKER, /**< only color picker is displayed */
65    ELM_COLORSELECTOR_ALL /**< all possible color selector is displayed */
66 } Elm_Colorselector_Mode;
67
68 /**
69  * @brief Add a new colorselector to the parent
70  *
71  * @param parent The parent object
72  * @return The new object or NULL if it cannot be created
73  *
74  * @ingroup Colorselector
75  */
76 EAPI Evas_Object *elm_colorselector_add(Evas_Object *parent);
77
78 /**
79  * Set color to colorselector
80  *
81  * @param obj Colorselector object
82  * @param r r-value of color
83  * @param g g-value of color
84  * @param b b-value of color
85  * @param a a-value of color
86  *
87  * @ingroup Colorselector
88  */
89 EAPI void elm_colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a);
90
91 /**
92  * Get current color from colorselector
93  *
94  * @param obj Colorselector object
95  * @param r integer pointer for r-value of color
96  * @param g integer pointer for g-value of color
97  * @param b integer pointer for b-value of color
98  * @param a integer pointer for a-value of color
99  *
100  * @ingroup Colorselector
101  */
102 EAPI void elm_colorselector_color_get(const Evas_Object *obj, int *r, int *g, int *b, int *a);
103
104 /**
105  * Set Colorselector's mode.
106  *
107  * @param obj Colorselector object
108  * @param mode Elm_Colorselector_Mode
109  *
110  * Colorselector supports three modes palette only, selector only and both.
111  *
112  * @ingroup Colorselector
113  */
114 EAPI void elm_colorselector_mode_set(Evas_Object *obj, Elm_Colorselector_Mode mode);
115
116 /**
117  * Get Colorselector's mode.
118  *
119  * @param obj Colorselector object
120  * @return mode The current mode of colorselector
121  *
122  * @ingroup Colorselector
123  */
124 EAPI Elm_Colorselector_Mode elm_colorselector_mode_get(const Evas_Object *obj);
125
126 /**
127  * Get Palette item's color.
128  *
129  * @param it The color palette item.
130  * @param r integer pointer for r-value of color
131  * @param g integer pointer for g-value of color
132  * @param b integer pointer for b-value of color
133  * @param a integer pointer for a-value of color
134  *
135  * @ingroup Colorselector
136  */
137 EAPI void elm_colorselector_palette_item_color_get(const Elm_Object_Item *it, int *r, int *g, int *b, int *a);
138
139 /**
140  * Set palette item's color.
141  *
142  * @param it The color palette item.
143  * @param r r-value of color
144  * @param g g-value of color
145  * @param b b-value of color
146  * @param a a-value of color
147  *
148  * @ingroup Colorselector
149  */
150 EAPI void elm_colorselector_palette_item_color_set(Elm_Object_Item *it, int r, int g, int b, int a);
151
152 /**
153  * Add a new color item to palette.
154  *
155  * @param obj The Colorselector object
156  * @param r r-value of color
157  * @param g g-value of color
158  * @param b b-value of color
159  * @param a a-value of color
160  * @return A new color palette Item.
161  *
162  * @ingroup Colorselector
163  */
164 EAPI Elm_Object_Item *elm_colorselector_palette_color_add(Evas_Object *obj, int r, int g, int b, int a);
165
166 /**
167  * Clear the palette items.
168  *
169  * @param obj The Colorselector object
170  *
171  * @ingroup Colorselector
172  */
173 EAPI void elm_colorselector_palette_clear(Evas_Object *obj);
174
175 /**
176  * Set current palette's name
177  *
178  * @param obj The Colorselector object
179  * @param palette_name Name of palette
180  *
181  * When colorpalette name is set, colors will be loaded from and saved to config
182  * using the set name. If no name is set then colors will be loaded from or
183  * saved to "default" config.
184  *
185  * @ingroup Colorselector
186  */
187 EAPI void elm_colorselector_palette_name_set(Evas_Object *obj, const char *palette_name);
188
189 /**
190  * Get current palette's name
191  *
192  * @param obj The Colorselector object
193  * @return Name of palette
194  *
195  * Returns the currently set palette name using which colors will be
196  * saved/loaded in to config.
197  *
198  * @ingroup Colorselector
199  */
200 EAPI const char *elm_colorselector_palette_name_get(const Evas_Object *obj);
201
202 /**
203  * @}
204  */