forked from enlightenment/efl
parent
02c013627e
commit
72d7a5341b
|
@ -11,10 +11,41 @@ _change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
|
||||||
elm_slider_value_set(data, val);
|
elm_slider_value_set(data, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_change_print_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
double val = elm_slider_value_get(obj);
|
||||||
|
printf("change to %3.3f\n", val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_bt_0(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
elm_slider_value_set(data, 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_bt_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
elm_slider_value_set(data, 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_bt_p1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
elm_slider_value_set(data, elm_slider_value_get(data) + 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_bt_m1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
|
{
|
||||||
|
elm_slider_value_set(data, elm_slider_value_get(data) - 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||||
{
|
{
|
||||||
Evas_Object *win, *bx, *sl, *ic, *sl1, *bx2;
|
Evas_Object *win, *bx, *sl, *ic, *sl1, *bx2, *bt;
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
|
|
||||||
win = elm_win_util_standard_add("slider", "Slider");
|
win = elm_win_util_standard_add("slider", "Slider");
|
||||||
|
@ -37,7 +68,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
elm_slider_unit_format_set(sl, "%1.1f units");
|
elm_slider_unit_format_set(sl, "%1.1f units");
|
||||||
elm_slider_span_size_set(sl, 120);
|
elm_slider_span_size_set(sl, 120);
|
||||||
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
|
||||||
elm_box_pack_end(bx, sl);
|
elm_box_pack_end(bx, sl);
|
||||||
evas_object_show(ic);
|
evas_object_show(ic);
|
||||||
evas_object_show(sl);
|
evas_object_show(sl);
|
||||||
|
@ -57,7 +88,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
elm_slider_value_set(sl, 80);
|
elm_slider_value_set(sl, 80);
|
||||||
elm_object_disabled_set(sl, EINA_TRUE);
|
elm_object_disabled_set(sl, EINA_TRUE);
|
||||||
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
|
||||||
elm_box_pack_end(bx, sl);
|
elm_box_pack_end(bx, sl);
|
||||||
evas_object_show(ic);
|
evas_object_show(ic);
|
||||||
evas_object_show(sl);
|
evas_object_show(sl);
|
||||||
|
@ -72,7 +103,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
elm_object_part_content_set(sl, "end", ic);
|
elm_object_part_content_set(sl, "end", ic);
|
||||||
elm_slider_span_size_set(sl, 80);
|
elm_slider_span_size_set(sl, 80);
|
||||||
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
|
||||||
elm_slider_indicator_format_set(sl, "%3.0f");
|
elm_slider_indicator_format_set(sl, "%3.0f");
|
||||||
elm_slider_min_max_set(sl, 50, 150);
|
elm_slider_min_max_set(sl, 50, 150);
|
||||||
elm_slider_value_set(sl, 80);
|
elm_slider_value_set(sl, 80);
|
||||||
|
@ -94,7 +125,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
elm_object_part_content_set(sl, "end", ic);
|
elm_object_part_content_set(sl, "end", ic);
|
||||||
elm_slider_span_size_set(sl, 80);
|
elm_slider_span_size_set(sl, 80);
|
||||||
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
|
||||||
elm_slider_indicator_format_set(sl, "%3.0f");
|
elm_slider_indicator_format_set(sl, "%3.0f");
|
||||||
elm_slider_min_max_set(sl, 50, 150);
|
elm_slider_min_max_set(sl, 50, 150);
|
||||||
elm_slider_value_set(sl, 80);
|
elm_slider_value_set(sl, 80);
|
||||||
|
@ -112,7 +143,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
elm_slider_unit_format_set(sl, "%3.0f units");
|
elm_slider_unit_format_set(sl, "%3.0f units");
|
||||||
elm_slider_span_size_set(sl, 40);
|
elm_slider_span_size_set(sl, 40);
|
||||||
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
|
||||||
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 00);
|
||||||
elm_slider_indicator_format_set(sl, "%3.0f");
|
elm_slider_indicator_format_set(sl, "%3.0f");
|
||||||
elm_slider_min_max_set(sl, 50, 150);
|
elm_slider_min_max_set(sl, 50, 150);
|
||||||
elm_slider_value_set(sl, 80);
|
elm_slider_value_set(sl, 80);
|
||||||
|
@ -124,6 +155,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
|
|
||||||
bx2 = elm_box_add(win);
|
bx2 = elm_box_add(win);
|
||||||
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(bx2, 0.5, EVAS_HINT_FILL);
|
||||||
elm_box_horizontal_set(bx2, EINA_TRUE);
|
elm_box_horizontal_set(bx2, EINA_TRUE);
|
||||||
elm_box_pack_end(bx, bx2);
|
elm_box_pack_end(bx, bx2);
|
||||||
evas_object_show(bx2);
|
evas_object_show(bx2);
|
||||||
|
@ -151,26 +183,6 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
|
|
||||||
evas_object_smart_callback_add(sl1, "changed", _change_cb, sl);
|
evas_object_smart_callback_add(sl1, "changed", _change_cb, sl);
|
||||||
|
|
||||||
sl = elm_slider_add(win);
|
|
||||||
elm_object_text_set(sl, "Vertical");
|
|
||||||
elm_slider_unit_format_set(sl, "%1.1f units");
|
|
||||||
elm_slider_span_size_set(sl, 60);
|
|
||||||
evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
|
|
||||||
evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
|
|
||||||
elm_slider_indicator_format_set(sl, "%1.1f");
|
|
||||||
elm_slider_value_set(sl, 0.2);
|
|
||||||
elm_object_scale_set(sl, 1.0);
|
|
||||||
elm_slider_horizontal_set(sl, EINA_FALSE);
|
|
||||||
elm_box_pack_end(bx2, sl);
|
|
||||||
evas_object_show(ic);
|
|
||||||
evas_object_show(sl);
|
|
||||||
|
|
||||||
/* vertical disable state */
|
|
||||||
ic = elm_icon_add(win);
|
|
||||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
|
|
||||||
elm_image_file_set(ic, buf, NULL);
|
|
||||||
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
|
|
||||||
|
|
||||||
sl = elm_slider_add(win);
|
sl = elm_slider_add(win);
|
||||||
elm_object_part_content_set(sl, "icon", ic);
|
elm_object_part_content_set(sl, "icon", ic);
|
||||||
elm_object_text_set(sl, "Disabled vertical");
|
elm_object_text_set(sl, "Disabled vertical");
|
||||||
|
@ -188,6 +200,57 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
||||||
evas_object_show(ic);
|
evas_object_show(ic);
|
||||||
evas_object_show(sl);
|
evas_object_show(sl);
|
||||||
|
|
||||||
|
/* vertical disable state */
|
||||||
|
ic = elm_icon_add(win);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
|
||||||
|
elm_image_file_set(ic, buf, NULL);
|
||||||
|
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
|
||||||
|
|
||||||
|
sl = elm_slider_add(win);
|
||||||
|
elm_object_text_set(sl, "Vertical");
|
||||||
|
elm_slider_unit_format_set(sl, "%1.1f units");
|
||||||
|
elm_slider_span_size_set(sl, 60);
|
||||||
|
evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
|
||||||
|
evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
|
||||||
|
elm_slider_indicator_format_set(sl, "%1.1f");
|
||||||
|
elm_slider_value_set(sl, 0.2);
|
||||||
|
elm_object_scale_set(sl, 1.0);
|
||||||
|
elm_slider_horizontal_set(sl, EINA_FALSE);
|
||||||
|
evas_object_smart_callback_add(sl, "changed", _change_print_cb, sl);
|
||||||
|
elm_box_pack_end(bx2, sl);
|
||||||
|
evas_object_show(ic);
|
||||||
|
evas_object_show(sl);
|
||||||
|
|
||||||
|
bx2 = elm_box_add(win);
|
||||||
|
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
|
||||||
|
elm_box_horizontal_set(bx2, EINA_TRUE);
|
||||||
|
elm_box_pack_end(bx, bx2);
|
||||||
|
evas_object_show(bx2);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "0");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _bt_0, sl);
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "1");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _bt_1, sl);
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "+.1");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _bt_p1, sl);
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
|
bt = elm_button_add(win);
|
||||||
|
elm_object_text_set(bt, "-.1");
|
||||||
|
evas_object_smart_callback_add(bt, "clicked", _bt_m1, sl);
|
||||||
|
evas_object_show(bt);
|
||||||
|
elm_box_pack_end(bx2, bt);
|
||||||
|
|
||||||
evas_object_show(win);
|
evas_object_show(win);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue