1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
7 static void _pos_selected_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info)
9 printf("Selection: %s\n", (char *)event_info);
10 printf("Label selected: %s\n", elm_actionslider_selected_label_get(obj));
14 _position_change_magnetic_cb(void *data __UNUSED__, Evas_Object * obj, void *event_info)
16 if (!strcmp((char *)event_info, "left"))
17 elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_LEFT);
18 else if (!strcmp((char *)event_info, "right"))
19 elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_RIGHT);
23 _magnet_enable_disable_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info)
25 if (!strcmp((char *)event_info, "left"))
26 elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_CENTER);
27 else if (!strcmp((char *)event_info, "right"))
28 elm_actionslider_magnet_pos_set(obj, ELM_ACTIONSLIDER_NONE);
32 test_actionslider(void *data __UNUSED__, Evas_Object * obj __UNUSED__, void *event_info __UNUSED__)
34 Evas_Object *win, *bg, *bx, *as;
36 win = elm_win_add(NULL, "actionslider", ELM_WIN_BASIC);
37 elm_win_title_set(win, "Actionslider");
38 elm_win_autodel_set(win, 1);
41 elm_win_resize_object_add(win, bg);
42 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, 0);
45 bx = elm_box_add(win);
46 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0);
47 elm_win_resize_object_add(win, bx);
50 as = elm_actionslider_add(win);
51 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
52 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
53 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
54 elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
55 elm_actionslider_labels_set(as, "Snooze", NULL, "Stop");
56 elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT |
57 ELM_ACTIONSLIDER_RIGHT);
58 evas_object_smart_callback_add(as, "pos_changed",
59 _position_change_magnetic_cb, NULL);
60 evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
62 elm_box_pack_end(bx, as);
64 as = elm_actionslider_add(win);
65 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
66 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
67 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER);
68 elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER);
69 elm_actionslider_labels_set(as, "Snooze", NULL, "Stop");
70 elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_LEFT |
71 ELM_ACTIONSLIDER_RIGHT);
72 evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
74 elm_box_pack_end(bx, as);
76 as = elm_actionslider_add(win);
77 elm_object_style_set(as, "bar");
78 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
79 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
80 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
81 elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER|
82 ELM_ACTIONSLIDER_RIGHT);
83 elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_CENTER |
84 ELM_ACTIONSLIDER_RIGHT);
85 elm_actionslider_labels_set(as, NULL, "Accept", "Reject");
86 evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
88 elm_box_pack_end(bx, as);
90 as = elm_actionslider_add(win);
91 elm_object_style_set(as, "bar");
92 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
93 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
94 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
95 elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_LEFT);
96 elm_actionslider_labels_set(as, NULL, "Accept", "Reject");
97 elm_actionslider_indicator_label_set(as, "Go");
98 evas_object_smart_callback_add(as, "pos_changed",
99 _position_change_magnetic_cb, NULL);
100 evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
101 evas_object_show(as);
102 elm_box_pack_end(bx, as);
105 as = elm_actionslider_add(win);
106 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
107 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
108 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
109 elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_ALL);
110 elm_actionslider_labels_set(as, "Left", "Center", "Right");
111 elm_actionslider_indicator_label_set(as, "Go");
112 evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
113 evas_object_show(as);
114 elm_box_pack_end(bx, as);
116 as = elm_actionslider_add(win);
117 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
118 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
119 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_CENTER);
120 elm_actionslider_magnet_pos_set(as, ELM_ACTIONSLIDER_CENTER);
121 elm_actionslider_labels_set(as, "Enable", "Magnet", "Disable");
122 evas_object_smart_callback_add(as, "pos_changed",
123 _magnet_enable_disable_cb, NULL);
124 evas_object_smart_callback_add(as, "selected", _pos_selected_cb, NULL);
125 evas_object_show(as);
126 elm_box_pack_end(bx, as);
128 evas_object_resize(win, 320, 400);
129 evas_object_show(win);