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