summaryrefslogtreecommitdiff
path: root/src/bin/e_widget_toolbar.c
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2009-07-27 00:30:06 +0000
committerChristopher Michael <cpmichael1@comcast.net>2009-07-27 00:30:06 +0000
commit33fe50ae6eda26908891c0eef1c4ed6d8a3966bb (patch)
tree1f1769df96369a248b73f804629b80c18defbbcb /src/bin/e_widget_toolbar.c
parentdd6ec8ed028c2cdb1171d6393bf40f24cace3ca0 (diff)
Remove whitespace.
Use E_FREE for things created with E_NEW. Add new function to clear the toolbar. Add new function to return the number of the selected item. SVN revision: 41501
Diffstat (limited to 'src/bin/e_widget_toolbar.c')
-rw-r--r--src/bin/e_widget_toolbar.c50
1 files changed, 44 insertions, 6 deletions
diff --git a/src/bin/e_widget_toolbar.c b/src/bin/e_widget_toolbar.c
index acbc94b..d205a6f 100644
--- a/src/bin/e_widget_toolbar.c
+++ b/src/bin/e_widget_toolbar.c
@@ -59,7 +59,8 @@ e_widget_toolbar_add(Evas *evas, int icon_w, int icon_h)
59 o = wd->o_base; 59 o = wd->o_base;
60 e_scrollframe_custom_theme_set(o, "base/theme/widgets", "e/widgets/toolbar"); 60 e_scrollframe_custom_theme_set(o, "base/theme/widgets", "e/widgets/toolbar");
61 e_scrollframe_single_dir_set(o, 1); 61 e_scrollframe_single_dir_set(o, 1);
62 e_scrollframe_policy_set(o, E_SCROLLFRAME_POLICY_AUTO, E_SCROLLFRAME_POLICY_OFF); 62 e_scrollframe_policy_set(o, E_SCROLLFRAME_POLICY_AUTO,
63 E_SCROLLFRAME_POLICY_OFF);
63 e_scrollframe_thumbscroll_force(o, 1); 64 e_scrollframe_thumbscroll_force(o, 1);
64 evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, 65 evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE,
65 _e_wid_cb_scrollframe_resize, obj); 66 _e_wid_cb_scrollframe_resize, obj);
@@ -106,7 +107,7 @@ e_widget_toolbar_item_append(Evas_Object *obj, Evas_Object *icon, const char *la
106 it->data1 = data1; 107 it->data1 = data1;
107 it->data2 = data2; 108 it->data2 = data2;
108 wd->items = eina_list_append(wd->items, it); 109 wd->items = eina_list_append(wd->items, it);
109 110
110 edje_object_signal_callback_add(o, "e,action,click", "e", 111 edje_object_signal_callback_add(o, "e,action,click", "e",
111 _e_wid_signal_cb1, it); 112 _e_wid_signal_cb1, it);
112 edje_extern_object_min_size_set(icon, wd->icon_w, wd->icon_h); 113 edje_extern_object_min_size_set(icon, wd->icon_w, wd->icon_h);
@@ -147,7 +148,7 @@ e_widget_toolbar_item_remove(Evas_Object *obj, int num)
147 evas_object_del(it->o_base); 148 evas_object_del(it->o_base);
148 evas_object_del(it->o_icon); 149 evas_object_del(it->o_icon);
149 wd->items = eina_list_remove(wd->items, it); 150 wd->items = eina_list_remove(wd->items, it);
150 free(it); 151 E_FREE(it);
151 } 152 }
152} 153}
153 154
@@ -158,7 +159,7 @@ e_widget_toolbar_item_select(Evas_Object *obj, int num)
158 Eina_List *l; 159 Eina_List *l;
159 Item *it; 160 Item *it;
160 int i; 161 int i;
161 162
162 wd = e_widget_data_get(obj); 163 wd = e_widget_data_get(obj);
163 for (i = 0, l = wd->items; l; l = l->next, i++) 164 for (i = 0, l = wd->items; l; l = l->next, i++)
164 { 165 {
@@ -251,6 +252,43 @@ e_widget_toolbar_focus_steal_set(Evas_Object *obj, Eina_Bool steal)
251 } 252 }
252} 253}
253 254
255EAPI void
256e_widget_toolbar_clear(Evas_Object *obj)
257{
258 E_Widget_Data *wd;
259
260 wd = e_widget_data_get(obj);
261 while (wd->items)
262 {
263 Item *it = NULL;
264
265 if (!(it = wd->items->data)) continue;
266 evas_object_del(it->o_base);
267 evas_object_del(it->o_icon);
268 wd->items = eina_list_remove(wd->items, it);
269 E_FREE(it);
270 }
271}
272
273EAPI int
274e_widget_toolbar_item_selected_get(Evas_Object *obj)
275{
276 E_Widget_Data *wd = NULL;
277 Eina_List *l = NULL;
278 int i = 0;
279
280 wd = e_widget_data_get(obj);
281 for (i = 0, l = wd->items; l; l = l->next, i++)
282 {
283 Item *it = NULL;
284
285 if (!(it = l->data)) continue;;
286 if (it->selected) return i;
287 }
288 return 0;
289}
290
291/* local functions */
254static void 292static void
255_e_wid_del_hook(Evas_Object *obj) 293_e_wid_del_hook(Evas_Object *obj)
256{ 294{
@@ -264,10 +302,10 @@ _e_wid_del_hook(Evas_Object *obj)
264 it = wd->items->data; 302 it = wd->items->data;
265 evas_object_del(it->o_base); 303 evas_object_del(it->o_base);
266 evas_object_del(it->o_icon); 304 evas_object_del(it->o_icon);
267 free(it);
268 wd->items = eina_list_remove_list(wd->items, wd->items); 305 wd->items = eina_list_remove_list(wd->items, wd->items);
306 E_FREE(it);
269 } 307 }
270 free(wd); 308 E_FREE(wd);
271} 309}
272 310
273static void 311static void