2 # include "elementary_config.h"
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
7 _bt_repeated(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
12 snprintf(buf, sizeof(buf), "count=%d", count++);
15 elm_object_text_set(obj, buf);
19 _bt_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
21 int param = (int)(long)(data);
23 printf("clicked event on Button:%d\n", param);
27 _bt_unpressed(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
29 int param = (int)(long)(data);
31 printf("unpressed event on Button:%d\n", param);
35 test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
37 Evas_Object *win, *scr, *bx, *ic, *bt;
40 win = elm_win_util_standard_add("buttons", "Buttons");
41 elm_win_autodel_set(win, EINA_TRUE);
43 scr = elm_scroller_add(win);
44 elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE);
45 elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
46 elm_win_resize_object_add(win, scr);
47 evas_object_show(scr);
48 evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
50 bx = elm_box_add(win);
51 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
52 elm_object_content_set(scr, bx);
55 ic = elm_icon_add(win);
56 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
57 elm_icon_file_set(ic, buf, NULL);
58 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
59 bt = elm_button_add(win);
60 elm_object_text_set(bt, "Icon sized to button");
61 elm_object_part_content_set(bt, "icon", ic);
62 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)1);
63 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)1);
64 elm_box_pack_end(bx, bt);
68 ic = elm_icon_add(bx);
69 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
70 elm_icon_file_set(ic, buf, NULL);
71 elm_icon_resizable_set(ic, 0, 0);
72 bt = elm_button_add(win);
73 elm_object_text_set(bt, "Icon no scale");
74 elm_object_part_content_set(bt, "icon", ic);
75 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)2);
76 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)2);
77 elm_box_pack_end(bx, bt);
81 ic = elm_icon_add(win);
82 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
83 elm_icon_file_set(ic, buf, NULL);
84 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
85 bt = elm_button_add(win);
86 elm_object_text_set(bt, "Disabled Button");
87 elm_object_part_content_set(bt, "icon", ic);
88 elm_object_disabled_set(bt, EINA_TRUE);
89 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)3);
90 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)3);
91 elm_box_pack_end(bx, bt);
95 ic = elm_icon_add(win);
96 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
97 elm_icon_file_set(ic, buf, NULL);
98 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
99 bt = elm_button_add(win);
100 elm_object_part_content_set(bt, "icon", ic);
101 elm_object_disabled_set(bt, EINA_TRUE);
102 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)4);
103 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)4);
104 elm_box_pack_end(bx, bt);
105 evas_object_show(bt);
106 evas_object_show(ic);
108 bt = elm_button_add(win);
109 elm_object_text_set(bt, "Label Only");
110 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)5);
111 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)5);
112 elm_box_pack_end(bx, bt);
113 evas_object_smart_callback_add(bt, "repeated", _bt_repeated, NULL);
114 elm_button_autorepeat_set(bt, EINA_TRUE);
115 elm_button_autorepeat_initial_timeout_set(bt, 2.0);
116 elm_button_autorepeat_gap_timeout_set(bt, 0.5);
117 evas_object_show(bt);
119 ic = elm_icon_add(win);
120 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
121 elm_icon_file_set(ic, buf, NULL);
122 elm_icon_resizable_set(ic, 0, 0);
123 bt = elm_button_add(win);
124 elm_object_part_content_set(bt, "icon", ic);
125 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)6);
126 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)6);
127 elm_box_pack_end(bx, bt);
128 evas_object_show(bt);
129 evas_object_show(ic);
131 bt = elm_button_add(win);
132 elm_object_style_set(bt, "anchor");
133 elm_object_text_set(bt, "Anchor style");
134 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)7);
135 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)7);
136 elm_box_pack_end(bx, bt);
137 evas_object_show(bt);
139 ic = elm_icon_add(win);
140 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
141 elm_icon_file_set(ic, buf, NULL);
142 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
143 bt = elm_button_add(win);
144 elm_object_style_set(bt, "anchor");
145 elm_object_part_content_set(bt, "icon", ic);
146 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)8);
147 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)8);
148 elm_box_pack_end(bx, bt);
149 evas_object_show(bt);
150 evas_object_show(ic);
152 ic = elm_icon_add(win);
153 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
154 elm_icon_file_set(ic, buf, NULL);
155 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
156 bt = elm_button_add(win);
157 elm_object_access_info_set(bt, "This is some custom text describing this widget");
158 elm_object_style_set(bt, "anchor");
159 elm_object_part_content_set(bt, "icon", ic);
160 elm_object_disabled_set(bt, EINA_TRUE);
161 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)9);
162 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)9);
163 elm_box_pack_end(bx, bt);
164 evas_object_show(bt);
165 evas_object_show(ic);
166 evas_object_resize(win, 320, 480);
167 evas_object_show(win);