summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-12-21 09:32:50 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-12-21 09:32:50 +0000
commit45962539bde402b7ab1dcaa6c58271202c1da3c7 (patch)
treeb396490c8aa277bbcfc4a7c1f5cb85f4953e0925 /src/bin
parent7000f805ec243c390876070c4811e5c9ff1cb6d0 (diff)
Rajeev Ranjan(in India) made a patch for elm_button.
Reasons for this patch are as follows. 1. Clicked signal is emitted from button when mouse release region coincides with button region and there has not been any drag outside the region during pressed state. (theme change) 2. Unpressed signal is emitted from button every time we press on button and unpress it irrespective of whether we unpress in button's region or outside. (theme change) 3. The unsetting of maximum size hint has been removed from _sizing_eval function as there is a possibility that some application may set this hint and if we unset it then this information set by application will be lost. 4. Modification in test code for button to show the difference between clicked and unpressed signal emission from this widget. Added a scroller in the heirarchy to show the effect of hold on clicked signal emission. SVN revision: 55687
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_button.c49
1 files changed, 45 insertions, 4 deletions
diff --git a/src/bin/test_button.c b/src/bin/test_button.c
index c90ab1c23..de9c64f47 100644
--- a/src/bin/test_button.c
+++ b/src/bin/test_button.c
@@ -15,10 +15,26 @@ _bt_repeated(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED_
15 elm_button_label_set(obj, buf); 15 elm_button_label_set(obj, buf);
16} 16}
17 17
18static void
19_bt_clicked(void *data, Evas_Object * obj, void *event_info)
20{
21 int param = (int)(data);
22
23 printf("clicked event on Button:%d\n", param);
24}
25
26static void
27_bt_unpressed(void *data, Evas_Object * obj, void *event_info)
28{
29 int param = (int)(data);
30
31 printf("unpressed event on Button:%d\n", param);
32}
33
18void 34void
19test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 35test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
20{ 36{
21 Evas_Object *win, *bg, *bx, *ic, *bt; 37 Evas_Object *win, *bg, *scr, *bx, *ic, *bt;
22 char buf[PATH_MAX]; 38 char buf[PATH_MAX];
23 39
24 win = elm_win_add(NULL, "buttons", ELM_WIN_BASIC); 40 win = elm_win_add(NULL, "buttons", ELM_WIN_BASIC);
@@ -30,9 +46,16 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
30 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 46 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31 evas_object_show(bg); 47 evas_object_show(bg);
32 48
49 scr = elm_scroller_add(win);
50 elm_scroller_bounce_set(scr, EINA_FALSE, EINA_TRUE);
51 elm_scroller_policy_set(scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
52 elm_win_resize_object_add(win, scr);
53 evas_object_show(scr);
54 evas_object_size_hint_weight_set(scr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
55
33 bx = elm_box_add(win); 56 bx = elm_box_add(win);
34 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 57 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
35 elm_win_resize_object_add(win, bx); 58 elm_scroller_content_set(scr, bx);
36 evas_object_show(bx); 59 evas_object_show(bx);
37 60
38 ic = elm_icon_add(win); 61 ic = elm_icon_add(win);
@@ -42,17 +65,21 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
42 bt = elm_button_add(win); 65 bt = elm_button_add(win);
43 elm_button_label_set(bt, "Icon sized to button"); 66 elm_button_label_set(bt, "Icon sized to button");
44 elm_button_icon_set(bt, ic); 67 elm_button_icon_set(bt, ic);
68 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)1);
69 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)1);
45 elm_box_pack_end(bx, bt); 70 elm_box_pack_end(bx, bt);
46 evas_object_show(bt); 71 evas_object_show(bt);
47 evas_object_show(ic); 72 evas_object_show(ic);
48 73
49 ic = elm_icon_add(win); 74 ic = elm_icon_add(bx);
50 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); 75 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
51 elm_icon_file_set(ic, buf, NULL); 76 elm_icon_file_set(ic, buf, NULL);
52 elm_icon_scale_set(ic, 0, 0); 77 elm_icon_scale_set(ic, 0, 0);
53 bt = elm_button_add(win); 78 bt = elm_button_add(win);
54 elm_button_label_set(bt, "Icon no scale"); 79 elm_button_label_set(bt, "Icon no scale");
55 elm_button_icon_set(bt, ic); 80 elm_button_icon_set(bt, ic);
81 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)2);
82 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)2);
56 elm_box_pack_end(bx, bt); 83 elm_box_pack_end(bx, bt);
57 evas_object_show(bt); 84 evas_object_show(bt);
58 evas_object_show(ic); 85 evas_object_show(ic);
@@ -65,6 +92,8 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
65 elm_button_label_set(bt, "Disabled Button"); 92 elm_button_label_set(bt, "Disabled Button");
66 elm_button_icon_set(bt, ic); 93 elm_button_icon_set(bt, ic);
67 elm_object_disabled_set(bt, 1); 94 elm_object_disabled_set(bt, 1);
95 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)3);
96 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)3);
68 elm_box_pack_end(bx, bt); 97 elm_box_pack_end(bx, bt);
69 evas_object_show(bt); 98 evas_object_show(bt);
70 evas_object_show(ic); 99 evas_object_show(ic);
@@ -76,12 +105,16 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
76 bt = elm_button_add(win); 105 bt = elm_button_add(win);
77 elm_button_icon_set(bt, ic); 106 elm_button_icon_set(bt, ic);
78 elm_object_disabled_set(bt, 1); 107 elm_object_disabled_set(bt, 1);
108 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)4);
109 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)4);
79 elm_box_pack_end(bx, bt); 110 elm_box_pack_end(bx, bt);
80 evas_object_show(bt); 111 evas_object_show(bt);
81 evas_object_show(ic); 112 evas_object_show(ic);
82 113
83 bt = elm_button_add(win); 114 bt = elm_button_add(win);
84 elm_button_label_set(bt, "Label Only"); 115 elm_button_label_set(bt, "Label Only");
116 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)5);
117 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)5);
85 elm_box_pack_end(bx, bt); 118 elm_box_pack_end(bx, bt);
86 evas_object_smart_callback_add(bt, "repeated", _bt_repeated, NULL); 119 evas_object_smart_callback_add(bt, "repeated", _bt_repeated, NULL);
87 elm_button_autorepeat_set(bt, 1); 120 elm_button_autorepeat_set(bt, 1);
@@ -95,6 +128,8 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
95 elm_icon_scale_set(ic, 0, 0); 128 elm_icon_scale_set(ic, 0, 0);
96 bt = elm_button_add(win); 129 bt = elm_button_add(win);
97 elm_button_icon_set(bt, ic); 130 elm_button_icon_set(bt, ic);
131 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)6);
132 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)6);
98 elm_box_pack_end(bx, bt); 133 elm_box_pack_end(bx, bt);
99 evas_object_show(bt); 134 evas_object_show(bt);
100 evas_object_show(ic); 135 evas_object_show(ic);
@@ -103,6 +138,8 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
103 bt = elm_button_add(win); 138 bt = elm_button_add(win);
104 elm_object_style_set(bt, "anchor"); 139 elm_object_style_set(bt, "anchor");
105 elm_button_label_set(bt, "Anchor style"); 140 elm_button_label_set(bt, "Anchor style");
141 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)7);
142 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)7);
106 elm_box_pack_end(bx, bt); 143 elm_box_pack_end(bx, bt);
107 evas_object_show(bt); 144 evas_object_show(bt);
108 145
@@ -113,6 +150,8 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
113 bt = elm_button_add(win); 150 bt = elm_button_add(win);
114 elm_object_style_set(bt, "anchor"); 151 elm_object_style_set(bt, "anchor");
115 elm_button_icon_set(bt, ic); 152 elm_button_icon_set(bt, ic);
153 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)8);
154 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)8);
116 elm_box_pack_end(bx, bt); 155 elm_box_pack_end(bx, bt);
117 evas_object_show(bt); 156 evas_object_show(bt);
118 evas_object_show(ic); 157 evas_object_show(ic);
@@ -126,10 +165,12 @@ test_button(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
126 elm_object_style_set(bt, "anchor"); 165 elm_object_style_set(bt, "anchor");
127 elm_button_icon_set(bt, ic); 166 elm_button_icon_set(bt, ic);
128 elm_object_disabled_set(bt, 1); 167 elm_object_disabled_set(bt, 1);
168 evas_object_smart_callback_add(bt, "clicked", _bt_clicked, (void *)9);
169 evas_object_smart_callback_add(bt, "unpressed", _bt_unpressed, (void *)9);
129 elm_box_pack_end(bx, bt); 170 elm_box_pack_end(bx, bt);
130 evas_object_show(bt); 171 evas_object_show(bt);
131 evas_object_show(ic); 172 evas_object_show(ic);
132 173 evas_object_resize(win, 320, 480);
133 evas_object_show(win); 174 evas_object_show(win);
134} 175}
135#endif 176#endif