forked from enlightenment/efl
elementary/colorselector - updated for elm_colorselector_mode_set test
SVN revision: 69832
This commit is contained in:
parent
6dc1215380
commit
9d4398fff6
|
@ -5,7 +5,8 @@
|
||||||
#ifndef ELM_LIB_QUICKLAUNCH
|
#ifndef ELM_LIB_QUICKLAUNCH
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_colorselector_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
_colorselector_clicked_cb(void *data, Evas_Object *obj,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
Evas_Object *re = data;
|
Evas_Object *re = data;
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
@ -22,7 +23,8 @@ _colorselector_clicked_cb(void *data, Evas_Object *obj, void *event_info __UNUSE
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info)
|
_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
|
||||||
|
void *event_info)
|
||||||
{
|
{
|
||||||
int r = 0, g = 0, b = 0 ,a = 0;
|
int r = 0, g = 0, b = 0 ,a = 0;
|
||||||
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
|
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
|
||||||
|
@ -31,7 +33,8 @@ _colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__, void *event_in
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
_colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
|
||||||
|
void *event_info)
|
||||||
{
|
{
|
||||||
int r = 0,g = 0,b = 0 ,a = 0;
|
int r = 0,g = 0,b = 0 ,a = 0;
|
||||||
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
|
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
|
||||||
|
@ -39,10 +42,40 @@ _colorpalette_longpressed_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
|
||||||
printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a);
|
printf("\ncolor = %d-%d-%d-%d\n", r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
_palette_cb(void *data, Evas_Object *obj __UNUSED__,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *bg, *bx, *cs, *fr, *re;
|
Evas_Object *cs = data;
|
||||||
|
Evas_Object *win = evas_object_data_get(cs, "win");
|
||||||
|
elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_PALETTE);
|
||||||
|
evas_object_resize(win, 320, 300);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_components_cb(void *data, Evas_Object *obj __UNUSED__,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *cs = data;
|
||||||
|
Evas_Object *win = evas_object_data_get(cs, "win");
|
||||||
|
elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_COMPONENTS);
|
||||||
|
evas_object_resize(win, 320, 350);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_both_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *cs = data;
|
||||||
|
Evas_Object *win = evas_object_data_get(cs, "win");
|
||||||
|
elm_colorselector_mode_set(cs, ELM_COLORSELECTOR_BOTH);
|
||||||
|
evas_object_resize(win, 320, 480);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
|
||||||
|
void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
Evas_Object *win, *bg, *bx, *bx2, *cs, *fr, *re, *bt;
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
|
||||||
win = elm_win_add(NULL, "colorselector", ELM_WIN_BASIC);
|
win = elm_win_add(NULL, "colorselector", ELM_WIN_BASIC);
|
||||||
|
@ -52,7 +85,6 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
|
||||||
bg = elm_bg_add(win);
|
bg = elm_bg_add(win);
|
||||||
elm_win_resize_object_add(win, bg);
|
elm_win_resize_object_add(win, bg);
|
||||||
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_color_set(bg, 255, 255, 255, 255);
|
|
||||||
evas_object_show(bg);
|
evas_object_show(bg);
|
||||||
|
|
||||||
bx = elm_box_add(win);
|
bx = elm_box_add(win);
|
||||||
|
@ -61,19 +93,20 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
|
||||||
evas_object_show(bx);
|
evas_object_show(bx);
|
||||||
|
|
||||||
fr = elm_frame_add(bx);
|
fr = elm_frame_add(bx);
|
||||||
evas_object_size_hint_weight_set(fr, 1.0, 0.5);
|
evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0);
|
||||||
evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(fr, "Color View");
|
elm_object_text_set(fr, "Color View");
|
||||||
elm_box_pack_end(bx, fr);
|
elm_box_pack_end(bx, fr);
|
||||||
evas_object_show(fr);
|
evas_object_show(fr);
|
||||||
|
|
||||||
re = evas_object_rectangle_add(evas_object_evas_get(win));
|
re = evas_object_rectangle_add(evas_object_evas_get(win));
|
||||||
|
evas_object_size_hint_min_set(re, 1, 100);
|
||||||
evas_object_show(re);
|
evas_object_show(re);
|
||||||
elm_object_content_set(fr, re);
|
elm_object_content_set(fr, re);
|
||||||
|
|
||||||
fr = elm_frame_add(bx);
|
fr = elm_frame_add(bx);
|
||||||
evas_object_size_hint_weight_set(fr, 1.0, 0);
|
evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0);
|
evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
elm_object_text_set(fr, "Color Selector");
|
elm_object_text_set(fr, "Color Selector");
|
||||||
elm_box_pack_end(bx, fr);
|
elm_box_pack_end(bx, fr);
|
||||||
evas_object_show(fr);
|
evas_object_show(fr);
|
||||||
|
@ -107,6 +140,7 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
|
||||||
_colorpalette_clicked_cb, re);
|
_colorpalette_clicked_cb, re);
|
||||||
evas_object_smart_callback_add(cs, "color,item,longpressed",
|
evas_object_smart_callback_add(cs, "color,item,longpressed",
|
||||||
_colorpalette_longpressed_cb, re);
|
_colorpalette_longpressed_cb, re);
|
||||||
|
evas_object_data_set(cs, "win", win);
|
||||||
|
|
||||||
elm_colorselector_color_get(cs, &r, &g, &b, &a);
|
elm_colorselector_color_get(cs, &r, &g, &b, &a);
|
||||||
/* Fix Alpha pre multiplication by edje */
|
/* Fix Alpha pre multiplication by edje */
|
||||||
|
@ -115,6 +149,37 @@ test_colorselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
|
||||||
b = (b * a) / 255;
|
b = (b * a) / 255;
|
||||||
evas_object_color_set(re, r, g, b, a);
|
evas_object_color_set(re, r, g, b, a);
|
||||||
|
|
||||||
|
bx2 = elm_box_add(bx);
|
||||||
|
elm_box_horizontal_set(bx2, EINA_TRUE);
|
||||||
|
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0);
|
||||||
|
evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(bx2);
|
||||||
|
elm_box_pack_end(bx, bx2);
|
||||||
|
|
||||||
|
bt = elm_button_add(bx2);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _palette_cb, cs);
|
||||||
|
elm_object_text_set(bt, "Palette");
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(bx2);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _components_cb, cs);
|
||||||
|
elm_object_text_set(bt, "Components");
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(bx2);
|
||||||
|
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _both_cb, cs);
|
||||||
|
elm_object_text_set(bt, "Both");
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
evas_object_resize(win, 320, 480);
|
evas_object_resize(win, 320, 480);
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue