summaryrefslogtreecommitdiff
path: root/src/bin/elementary/test_ui_slider_interval.c
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2017-09-29 13:35:21 +0900
committerAmitesh Singh <amitesh.sh@samsung.com>2017-09-29 13:37:56 +0900
commit92eb5d1962a42b78d95551017301953589d2fcb7 (patch)
tree6a36ef387f667c921682fd9adf442619228fb9dc /src/bin/elementary/test_ui_slider_interval.c
parent522488eed976d48916e20c45c336a21ff1c82605 (diff)
elm test: rename test_slider_interval.c to test_ui_slider_interval.c
Diffstat (limited to 'src/bin/elementary/test_ui_slider_interval.c')
-rw-r--r--src/bin/elementary/test_ui_slider_interval.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/src/bin/elementary/test_ui_slider_interval.c b/src/bin/elementary/test_ui_slider_interval.c
new file mode 100644
index 0000000..cee02ff
--- /dev/null
+++ b/src/bin/elementary/test_ui_slider_interval.c
@@ -0,0 +1,110 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6static double
7_step_size_calculate(double min, double max)
8{
9 double step = 0.0;
10 int steps = 0;
11
12 steps = max - min;
13 if (steps) step = (1.0 / steps);
14 return step;
15}
16
17static void
18_intv_slider_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
19{
20 double from, to;
21
22 efl_ui_slider_interval_value_get(ev->object, &from, &to);
23 if (from < 100)
24 efl_ui_slider_interval_value_set(ev->object, 100, to);
25 if (to > 500)
26 efl_ui_slider_interval_value_set(ev->object, from, 500);
27}
28
29void
30test_slider_interval(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
31{
32 Eo *win, *bx, *hbx;
33 double step;
34
35 win = efl_add(EFL_UI_WIN_CLASS, NULL,
36 efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC),
37 efl_text_set(efl_added, "Efl.Ui.Slider_Interval"),
38 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
39
40 bx = efl_add(EFL_UI_BOX_CLASS, win,
41 efl_content_set(win, efl_added));
42
43 efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
44 efl_text_set(efl_added, "Horizontal"),
45 efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_NONE),
46 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(160, 0)),
47 efl_ui_slider_indicator_format_set(efl_added, "%1.5f"),
48 efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
49 efl_pack(bx, efl_added));
50
51 step = _step_size_calculate(0, 9);
52 efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
53 efl_text_set(efl_added, "Manual step"),
54 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)),
55 efl_ui_range_unit_format_set(efl_added, "%1.1f units"),
56 efl_ui_slider_indicator_format_set(efl_added, "%1.1f"),
57 efl_ui_slider_interval_value_set(efl_added, 0.4, 0.9),
58 efl_ui_slider_step_set(efl_added, step),
59 efl_pack(bx, efl_added));
60
61 efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
62 efl_text_set(efl_added, "Disabled"),
63 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(120, 0)),
64 efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
65 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
66 efl_ui_range_min_max_set(efl_added, 10, 145),
67 efl_ui_slider_interval_value_set(efl_added, 50, 100),
68 efl_ui_slider_step_set(efl_added, step),
69 elm_object_disabled_set(efl_added, EINA_TRUE),
70 efl_pack(bx, efl_added));
71
72 hbx = efl_add(EFL_UI_BOX_CLASS, bx,
73 efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL),
74 efl_pack(bx, efl_added));
75
76 efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, hbx,
77 efl_text_set(efl_added, "Vertical"),
78 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)),
79 efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
80 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
81 efl_ui_range_min_max_set(efl_added, 10, 145),
82 efl_ui_slider_interval_value_set(efl_added, 50, 100),
83 efl_ui_slider_step_set(efl_added, step),
84 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
85 efl_pack(hbx, efl_added));
86
87 efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, hbx,
88 efl_text_set(efl_added, "Disabled"),
89 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(0, 160)),
90 efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
91 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
92 efl_ui_range_min_max_set(efl_added, 10, 145),
93 efl_ui_slider_interval_value_set(efl_added, 50, 100),
94 efl_ui_slider_step_set(efl_added, step),
95 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL),
96 elm_object_disabled_set(efl_added, EINA_TRUE),
97 efl_pack(hbx, efl_added));
98
99 efl_add(EFL_UI_SLIDER_INTERVAL_CLASS, bx,
100 efl_text_set(efl_added, "Limited (100-500)"),
101 efl_ui_slider_indicator_visible_mode_set(efl_added, EFL_UI_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS),
102 efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(260, 0)),
103 efl_ui_range_unit_format_set(efl_added, "%1.0f units"),
104 efl_ui_slider_indicator_format_set(efl_added, "%1.0f"),
105 efl_ui_range_min_max_set(efl_added, 0, 600),
106 efl_ui_slider_interval_value_set(efl_added, 100, 500),
107 efl_ui_slider_step_set(efl_added, step),
108 efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_CHANGED, _intv_slider_changed_cb, NULL),
109 efl_pack(bx, efl_added));
110}