aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/elementary/src/bin/test_slider.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/elementary/src/bin/test_slider.c')
-rw-r--r--libraries/elementary/src/bin/test_slider.c193
1 files changed, 193 insertions, 0 deletions
diff --git a/libraries/elementary/src/bin/test_slider.c b/libraries/elementary/src/bin/test_slider.c
new file mode 100644
index 0000000..c10e93c
--- /dev/null
+++ b/libraries/elementary/src/bin/test_slider.c
@@ -0,0 +1,193 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5#ifndef ELM_LIB_QUICKLAUNCH
6
7void
8_change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
9{
10 double val = elm_slider_value_get(obj);
11 elm_slider_value_set(data, val);
12}
13
14void
15test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
16{
17 Evas_Object *win, *bx, *sl, *ic, *sl1, *bx2;
18 char buf[PATH_MAX];
19
20 win = elm_win_util_standard_add("slider", "Slider");
21 elm_win_autodel_set(win, EINA_TRUE);
22
23 bx = elm_box_add(win);
24 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
25 elm_win_resize_object_add(win, bx);
26 evas_object_show(bx);
27
28 ic = elm_icon_add(win);
29 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
30 elm_icon_file_set(ic, buf, NULL);
31 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
32
33 sl = elm_slider_add(win);
34 sl1 = sl;
35 elm_object_text_set(sl, "Horizontal");
36 elm_object_part_content_set(sl, "icon", ic);
37 elm_slider_unit_format_set(sl, "%1.1f units");
38 elm_slider_span_size_set(sl, 120);
39 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
40 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
41 elm_box_pack_end(bx, sl);
42 evas_object_show(ic);
43 evas_object_show(sl);
44
45 /* horizontal disable state */
46 ic = elm_icon_add(win);
47 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
48 elm_icon_file_set(ic, buf, NULL);
49 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
50
51 sl = elm_slider_add(win);
52 elm_object_text_set(sl, "Disabled");
53 elm_object_part_content_set(sl, "icon", ic);
54 elm_slider_unit_format_set(sl, "%1.1f units");
55 elm_slider_span_size_set(sl, 120);
56 elm_slider_min_max_set(sl, 50, 150);
57 elm_slider_value_set(sl, 80);
58 elm_object_disabled_set(sl, EINA_TRUE);
59 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
60 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 elm_box_pack_end(bx, sl);
62 evas_object_show(ic);
63 evas_object_show(sl);
64
65 ic = elm_icon_add(win);
66 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
67 elm_icon_file_set(ic, buf, NULL);
68 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
69
70 sl = elm_slider_add(win);
71 elm_object_text_set(sl, "Horizontal inverted");
72 elm_object_part_content_set(sl, "end", ic);
73 elm_slider_span_size_set(sl, 80);
74 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
75 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
76 elm_slider_indicator_format_set(sl, "%3.0f");
77 elm_slider_min_max_set(sl, 50, 150);
78 elm_slider_value_set(sl, 80);
79 elm_slider_inverted_set(sl, EINA_TRUE);
80 evas_object_size_hint_align_set(sl, 0.5, 0.5);
81 evas_object_size_hint_weight_set(sl, 0.0, 0.0);
82 elm_box_pack_end(bx, sl);
83 evas_object_show(ic);
84 evas_object_show(sl);
85
86 /* label2 disable */
87 ic = elm_icon_add(win);
88 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
89 elm_icon_file_set(ic, buf, NULL);
90 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
91
92 sl = elm_slider_add(win);
93 elm_object_text_set(sl, "Disabled inverted");
94 elm_object_part_content_set(sl, "end", ic);
95 elm_slider_span_size_set(sl, 80);
96 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
97 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
98 elm_slider_indicator_format_set(sl, "%3.0f");
99 elm_slider_min_max_set(sl, 50, 150);
100 elm_slider_value_set(sl, 80);
101 elm_slider_inverted_set(sl, EINA_TRUE);
102 elm_object_disabled_set(sl, EINA_TRUE);
103 evas_object_size_hint_align_set(sl, 0.5, 0.5);
104 evas_object_size_hint_weight_set(sl, 0.0, 0.0);
105 elm_box_pack_end(bx, sl);
106 evas_object_show(ic);
107 evas_object_show(sl);
108
109 sl = elm_slider_add(win);
110 elm_slider_indicator_show_set(sl, EINA_FALSE);
111 elm_object_text_set(sl, "Scale doubled");
112 elm_slider_unit_format_set(sl, "%3.0f units");
113 elm_slider_span_size_set(sl, 40);
114 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
115 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
116 elm_slider_indicator_format_set(sl, "%3.0f");
117 elm_slider_min_max_set(sl, 50, 150);
118 elm_slider_value_set(sl, 80);
119 elm_slider_inverted_set(sl, EINA_TRUE);
120 elm_object_scale_set(sl, 2.0);
121 elm_box_pack_end(bx, sl);
122 evas_object_show(ic);
123 evas_object_show(sl);
124
125 bx2 = elm_box_add(win);
126 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
127 elm_box_horizontal_set(bx2, EINA_TRUE);
128 elm_box_pack_end(bx, bx2);
129 evas_object_show(bx2);
130
131 ic = elm_icon_add(win);
132 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
133 elm_icon_file_set(ic, buf, NULL);
134 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
135
136 sl = elm_slider_add(win);
137 elm_object_part_content_set(sl, "icon", ic);
138 elm_object_text_set(sl, "Vertical inverted");
139 elm_slider_inverted_set(sl, EINA_TRUE);
140 elm_slider_unit_format_set(sl, "%1.1f units");
141 elm_slider_span_size_set(sl, 60);
142 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
143 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
144 elm_slider_indicator_format_set(sl, "%1.1f");
145 elm_slider_value_set(sl, 0.2);
146 elm_object_scale_set(sl, 1.0);
147 elm_slider_horizontal_set(sl, 0);
148 elm_box_pack_end(bx2, sl);
149 evas_object_show(ic);
150 evas_object_show(sl);
151
152 evas_object_smart_callback_add(sl1, "changed", _change_cb, sl);
153
154 sl = elm_slider_add(win);
155 elm_object_text_set(sl, "Vertical");
156 elm_slider_unit_format_set(sl, "%1.1f units");
157 elm_slider_span_size_set(sl, 60);
158 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
159 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
160 elm_slider_indicator_format_set(sl, "%1.1f");
161 elm_slider_value_set(sl, 0.2);
162 elm_object_scale_set(sl, 1.0);
163 elm_slider_horizontal_set(sl, EINA_FALSE);
164 elm_box_pack_end(bx2, sl);
165 evas_object_show(ic);
166 evas_object_show(sl);
167
168 /* vertical disable state */
169 ic = elm_icon_add(win);
170 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
171 elm_icon_file_set(ic, buf, NULL);
172 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
173
174 sl = elm_slider_add(win);
175 elm_object_part_content_set(sl, "icon", ic);
176 elm_object_text_set(sl, "Disabled vertical");
177 elm_slider_inverted_set(sl, EINA_TRUE);
178 elm_slider_unit_format_set(sl, "%1.1f units");
179 elm_slider_span_size_set(sl, 100);
180 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
181 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
182 elm_slider_indicator_format_set(sl, "%1.1f");
183 elm_slider_value_set(sl, 0.2);
184 elm_object_scale_set(sl, 1.0);
185 elm_slider_horizontal_set(sl, 0);
186 elm_object_disabled_set(sl, EINA_TRUE);
187 elm_box_pack_end(bx2, sl);
188 evas_object_show(ic);
189 evas_object_show(sl);
190
191 evas_object_show(win);
192}
193#endif