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;
15 Elm_Animator *animator;
18 win = elm_win_add(NULL, "color selector", ELM_WIN_BASIC);
19 elm_win_title_set(win, "Color selector");
20 elm_win_autodel_set(win, EINA_TRUE);
21 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
24 elm_win_resize_object_add(win, bg);
27 rect = evas_object_rectangle_add(evas_object_evas_get(win));
28 evas_object_resize(rect, 50, 50);
29 evas_object_move(rect, 125, 325);
30 evas_object_color_set(rect, 0, 0, 255, 255);
31 evas_object_show(rect);
33 cs = elm_colorselector_add(win);
34 elm_colorselector_color_set(cs, 0, 0, 255, 255);
35 evas_object_resize(cs, 300, 300);
37 evas_object_smart_callback_add(cs, "changed", _change_color, rect);
39 evas_object_resize(win, 300, 400);
40 evas_object_show(win);
43 evas_object_del(rect);
50 _change_color(void *data, Evas_Object *obj, void *event_info)
53 elm_colorselector_color_get(obj, &r, &g, &b, &a);
54 evas_object_color_set(data, r, g, b, a);