1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _colorselector_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
10 Evas_Object *re = data;
13 elm_colorselector_color_get(obj, &r, &g, &b, &a);
14 printf("Current Color [r=%d g=%d b=%d a=%d]\n",r, g, b, a);
16 /* Fix Alpha pre multiplication by edje */
21 evas_object_color_set(re, r, g, b, a);
25 test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
27 Evas_Object *win, *bg, *bx, *cp, *fr, *ly, *re;
31 win = elm_win_add(NULL, "colorselector", ELM_WIN_BASIC);
32 elm_win_title_set(win, "Color Selector");
33 elm_win_autodel_set(win, EINA_TRUE);
36 elm_win_resize_object_add(win, bg);
37 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
38 evas_object_color_set(bg, 255, 255, 255, 255);
41 bx = elm_box_add(win);
42 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
43 elm_win_resize_object_add(win, bx);
46 fr = elm_frame_add(win);
47 evas_object_size_hint_weight_set(fr, 1.0, 0.5);
48 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
49 elm_object_text_set(fr, "Color View");
50 elm_box_pack_end(bx, fr);
53 ly = elm_layout_add(win);
54 snprintf(buf, sizeof(buf), "%s/objects/colorpreview.edj", elm_app_data_dir_get());
55 elm_layout_file_set(ly, buf, "main");
56 evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
57 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58 elm_frame_content_set(fr, ly);
61 re = evas_object_rectangle_add(evas_object_evas_get(win));
63 elm_object_content_part_set(ly, "ColorPreview", re);
65 fr = elm_frame_add(win);
66 evas_object_size_hint_weight_set(fr, 1.0, 0);
67 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0);
68 elm_object_text_set(fr, "Color Selector");
69 elm_box_pack_end(bx, fr);
72 cp = elm_colorselector_add(win);
79 elm_colorselector_color_set(cp, r, g, b, a);
80 evas_object_size_hint_weight_set(cp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
81 evas_object_size_hint_align_set(cp, EVAS_HINT_FILL, EVAS_HINT_FILL);
82 elm_frame_content_set(fr, cp);
84 evas_object_smart_callback_add(cp, "changed", _colorselector_clicked_cb, re);
86 elm_colorselector_color_get(cp, &r, &g, &b, &a);
87 /* Fix Alpha pre multiplication by edje */
91 evas_object_color_set(re, r, g, b, a);
93 evas_object_resize(win, 320, 480);
94 evas_object_show(win);