2 //gcc -g `pkg-config --cflags --libs elementary` colorselector_example_01.c -o colorselector_example_01
4 #include <Elementary.h>
6 # include "elementary_config.h"
9 static void _change_color(void *data, Evas_Object *obj, void *event_info);
12 elm_main(int argc, char **argv)
14 Evas_Object *win, *bg, *cs, *frame, *rect;
17 win = elm_win_add(NULL, "color selector", ELM_WIN_BASIC);
18 elm_win_title_set(win, "Color selector");
19 elm_win_autodel_set(win, EINA_TRUE);
20 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
23 elm_win_resize_object_add(win, bg);
26 rect = evas_object_rectangle_add(evas_object_evas_get(win));
27 evas_object_resize(rect, 50, 50);
28 evas_object_move(rect, 125, 325);
29 evas_object_color_set(rect, 0, 0, 255, 255);
30 evas_object_show(rect);
32 cs = elm_colorselector_add(win);
33 elm_colorselector_color_set(cs, 0, 0, 255, 255);
34 evas_object_resize(cs, 300, 300);
36 evas_object_smart_callback_add(cs, "changed", _change_color, rect);
38 evas_object_resize(win, 300, 400);
39 evas_object_show(win);
42 evas_object_del(rect);
49 _change_color(void *data, Evas_Object *obj, void *event_info)
52 elm_colorselector_color_get(obj, &r, &g, &b, &a);
53 evas_object_color_set(data, r, g, b, a);