summaryrefslogtreecommitdiff
path: root/src/bin/e_widget_toolbar.c
diff options
context:
space:
mode:
authorViktor Kojouharov <vkojouharov@gmail.com>2009-04-23 02:12:55 +0000
committerCarsten Haitzler <raster@rasterman.com>2009-04-23 02:12:55 +0000
commit6ca152fef80320c8876e6a7a0bcb87254541e18b (patch)
treef63fb6e763f8d95a4fcb0811605c1fb3a800057b /src/bin/e_widget_toolbar.c
parent0d71d18f121c5fa8d8230b19ec1d2c4ef920ba9f (diff)
From: Viktor Kojouharov <vkojouharov@gmail.com>
This little patch adds 'tabs' to the fileman module window. The tabs are implemented using the toolbar widget. Currently you can add tabs and switch between them. The only problem right now is that when adding more than two tabs, the toolbar/scrollbar area is moved off the canvas for some reason, until the user resizes the window - raster though it might be a problem with the toolbar widget itself, but he didn't see the patch, so it might as well be something on my side. SVN revision: 40306
Diffstat (limited to 'src/bin/e_widget_toolbar.c')
-rw-r--r--src/bin/e_widget_toolbar.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/bin/e_widget_toolbar.c b/src/bin/e_widget_toolbar.c
index e416bab..f46896a 100644
--- a/src/bin/e_widget_toolbar.c
+++ b/src/bin/e_widget_toolbar.c
@@ -11,6 +11,7 @@ struct _E_Widget_Data
11 int icon_w, icon_h; 11 int icon_w, icon_h;
12 Eina_List *items; 12 Eina_List *items;
13 Evas_Bool scrollable : 1; 13 Evas_Bool scrollable : 1;
14 Evas_Bool focus_steal : 1;
14}; 15};
15 16
16struct _Item 17struct _Item
@@ -49,6 +50,7 @@ e_widget_toolbar_add(Evas *evas, int icon_w, int icon_h)
49 e_widget_data_set(obj, wd); 50 e_widget_data_set(obj, wd);
50 wd->icon_w = icon_w; 51 wd->icon_w = icon_w;
51 wd->icon_h = icon_h; 52 wd->icon_h = icon_h;
53 wd->focus_steal = 1;
52 54
53 o = e_scrollframe_add(evas); 55 o = e_scrollframe_add(evas);
54 wd->o_base = o; 56 wd->o_base = o;
@@ -168,6 +170,30 @@ e_widget_toolbar_item_select(Evas_Object *obj, int num)
168} 170}
169 171
170EAPI void 172EAPI void
173e_widget_toolbar_item_label_set(Evas_Object *obj, int num, const char *label)
174{
175 E_Widget_Data *wd;
176 Item *it;
177
178 wd = e_widget_data_get(obj);
179 it = eina_list_nth(wd->items, num);
180 if (it)
181 {
182 int mw, mh;
183
184 edje_object_part_text_set(it->o_base, "e.text.label", label);
185 edje_object_size_min_calc(it->o_base, &mw, &mh);
186 e_box_pack_options_set(it->o_base,
187 1, 1, /* fill */
188 0, 0, /* expand */
189 0.5, 0.5, /* align */
190 mw, mh, /* min */
191 9999, 9999 /* max */
192 );
193 }
194}
195
196EAPI void
171e_widget_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable) 197e_widget_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable)
172{ 198{
173 E_Widget_Data *wd; 199 E_Widget_Data *wd;
@@ -185,6 +211,29 @@ e_widget_toolbar_scrollable_set(Evas_Object *obj, Evas_Bool scrollable)
185 e_widget_min_size_set(obj, mw + (500 - vw), mh + (500 - vh)); 211 e_widget_min_size_set(obj, mw + (500 - vw), mh + (500 - vh));
186} 212}
187 213
214EAPI void
215e_widget_toolbar_focus_steal_set(Evas_Object *obj, Evas_Bool steal)
216{
217 E_Widget_Data *wd;
218
219 wd = e_widget_data_get(obj);
220 if (wd->focus_steal == steal) return;
221 if (steal)
222 {
223 evas_object_event_callback_add(e_scrollframe_edje_object_get(wd->o_base),
224 EVAS_CALLBACK_MOUSE_DOWN,
225 _e_wid_focus_steal, obj);
226 wd->focus_steal = 1;
227 }
228 else
229 {
230 evas_object_event_callback_del(e_scrollframe_edje_object_get(wd->o_base),
231 EVAS_CALLBACK_MOUSE_DOWN,
232 _e_wid_focus_steal);
233 wd->focus_steal = 0;
234 }
235}
236
188static void 237static void
189_e_wid_del_hook(Evas_Object *obj) 238_e_wid_del_hook(Evas_Object *obj)
190{ 239{