1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Efl_Ui.h>
#include <Elementary.h>
static double
_step_size_calculate(double min, double max)
{
double step = 0.0;
int steps = 0;
steps = max - min;
if (steps) step = (1.0 / steps);
return step;
}
static void
_intv_slider_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
double from, to;
efl_ui_slider_interval_value_get(ev->object, &from, &to);
if (from < 100)
efl_ui_slider_interval_value_set(ev->object, 100, to);
if (to > 500)
efl_ui_slider_interval_value_set(ev->object, from, 500);
}
void
test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *win, *bx, *hbx;
double step;
win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Efl.Ui.Slider_Interval"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
bx = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,
efl_text_set(efl_added, "Horizontal"),
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(160, 0)),
efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
efl_pack(bx, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,
efl_text_set(efl_added, "Manual step"),
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
step = _step_size_calculate(0, 9);
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(120, 0)),
efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
efl_ui_range_step_set(efl_added, step),
efl_pack(bx, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,
efl_text_set(efl_added, "Disabled"),
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(120, 0)),
efl_ui_range_limits_set(efl_added, 10, 145),
efl_ui_slider_interval_value_set(efl_added, 50, 100),
efl_ui_range_step_set(efl_added, step),
elm_object_disabled_set(efl_added, EINA_TRUE),
efl_pack(bx, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,
efl_text_set(efl_added, "Vertical"),
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
hbx = efl_add(EFL_UI_BOX_CLASS, bx,
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
efl_pack(bx, efl_added));
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, hbx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 160)),
efl_ui_range_limits_set(efl_added, 10, 145),
efl_ui_slider_interval_value_set(efl_added, 50, 100),
efl_ui_range_step_set(efl_added, step),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
efl_pack(hbx, efl_added));
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, hbx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 160)),
efl_ui_range_limits_set(efl_added, 10, 145),
efl_ui_slider_interval_value_set(efl_added, 50, 100),
efl_ui_range_step_set(efl_added, step),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
elm_object_disabled_set(efl_added, EINA_TRUE),
efl_pack(hbx, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,
efl_text_set(efl_added, "Limited (100-500)"),
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(260, 0)),
efl_ui_range_limits_set(efl_added, 0, 600),
efl_ui_slider_interval_value_set(efl_added, 100, 500),
efl_ui_range_step_set(efl_added, step),
efl_event_callback_add(efl_added, EFL_UI_RANGE_EVENT_CHANGED, _intv_slider_changed_cb, NULL),
efl_pack(bx, efl_added));
}
|