Revert "get add/hide buttons out of the toolbar"

This reverts commit 9fa112a98c.
This commit is contained in:
Carsten Haitzler 2014-12-03 08:42:41 +09:00
parent d43513e71b
commit 913b6d7417
2 changed files with 33 additions and 75 deletions

View File

@ -2304,37 +2304,6 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
group { name: "terminology/tabs";
parts {
part { name: "terminology.bg";
type: SWALLOW;
description { state: "default" 0.0;
visible: 1;
align: 0 0;
rel1 {
to: "terminology.tabbar";
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
to: "terminology.tabbar";
relative: 1.0 1.0;
offset: 0 0;
}
}
description { state: "hidden" 0.0;
visible: 0;
min: 0 0;
rel1 {
to: "terminology.tabbar";
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
to: "terminology.tabbar";
relative: 1.0 1.0;
offset: 0 0;
}
}
}
part { name: "terminology.tabbar";
type: SWALLOW;
description { state: "default" 0.0;
@ -2368,14 +2337,12 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
action: STATE_SET "hidden" 0.0;
transition: DECELERATE 0.6;
target: "terminology.tabbar";
target: "terminology.bg";
}
program {
signal: "tabbar,on"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.4;
target: "terminology.tabbar";
target: "terminology.bg";
}
part { name: "content";
type: SWALLOW;

View File

@ -76,13 +76,11 @@ struct _Tabs {
Evas_Object *base;
Evas_Object *selector;
Evas_Object *selector_bg;
Evas_Object *box;
Evas_Object *bg;
Evas_Object *btn_add;
Evas_Object *btn_hide;
Evas_Object *tabbar;
Evas_Object *tabbar_spacer;
Evas_Object *selector_spacer;
Elm_Object_Item *tb_item_add;
Elm_Object_Item *tb_item_hide;
Eina_List *tabs;
Tab_Item *current;
};
@ -2266,11 +2264,7 @@ _tabs_close(Term_Container *tc, Term_Container *child,
tc->parent->close(tc->parent, tc, refocus);
evas_object_del(tabs->base);
evas_object_del(tabs->box);
evas_object_del(tabs->btn_add);
evas_object_del(tabs->btn_hide);
evas_object_del(tabs->tabbar);
evas_object_del(tabs->bg);
evas_object_del(tabs->tabbar_spacer);
evas_object_del(tabs->selector_spacer);
eina_stringshare_del(tc->title);
@ -2469,16 +2463,22 @@ _tab_selected(void *data,
static Tab_Item*
tab_item_new(Tabs *tabs, Term_Container *child)
{
Elm_Object_Item *toolbar_item;
Elm_Object_Item *toolbar_item, *sep;
Tab_Item *tab_item;
tab_item = calloc(1, sizeof(Tab_Item));
tab_item->tc = child;
assert(child != NULL);
toolbar_item = elm_toolbar_item_append(tabs->tabbar,
NULL, "Terminology",
_tab_selected, tab_item);
sep = elm_toolbar_item_insert_before(tabs->tabbar,
tabs->tb_item_add,
NULL, NULL, NULL, NULL);
elm_toolbar_item_priority_set(sep, 1);
elm_toolbar_item_separator_set(sep, EINA_TRUE);
tab_item->separator = sep;
toolbar_item = elm_toolbar_item_insert_before(tabs->tabbar, sep,
NULL, "Terminology",
_tab_selected, tab_item);
elm_toolbar_item_priority_set(toolbar_item, 1);
tab_item->elm_item = toolbar_item;
@ -2504,12 +2504,17 @@ _tab_new_cb(void *data,
Win *wn = tc_parent->wn;
DBG("new");
elm_toolbar_item_selected_set(tabs->tb_item_add, EINA_FALSE);
elm_object_item_focus_set(tabs->tb_item_add, EINA_FALSE);
tm_new = term_new(wn, wn->config,
NULL, wn->config->login_shell, NULL,
80, 24, EINA_FALSE);
tc_new = _solo_new(tm_new, wn);
evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
elm_toolbar_item_selected_set(tabs->tb_item_add, EINA_FALSE);
tc_new->parent = tc_parent;
tab_item_new(tabs, tc_new);
@ -2525,8 +2530,8 @@ _cb_tabbar_show(void *data, Evas_Object *obj EINA_UNUSED,
edje_object_signal_emit(tabs->base, "tabbar,on", "terminology");
edje_object_signal_emit(tabs->base, "tabcontrols,off", "terminology");
edje_object_part_swallow(tabs->base, "terminology.tabbar", tabs->box);
evas_object_show(tabs->box);
edje_object_part_swallow(tabs->base, "terminology.tabbar", tabs->tabbar);
evas_object_show(tabs->tabbar);
}
static void
@ -2538,6 +2543,8 @@ _tab_hide_cb(void *data,
Tabs *tabs = data;
DBG("hide");
elm_toolbar_item_selected_set(tabs->tb_item_hide, EINA_FALSE);
elm_object_item_focus_set(tabs->tb_item_hide, EINA_FALSE);
elm_coords_finger_size_adjust(1, &w, 1, &h);
@ -2569,8 +2576,8 @@ _tab_hide_cb(void *data,
edje_object_signal_emit(tabs->base, "tabbar,off", "terminology");
edje_object_signal_emit(tabs->base, "tabcontrols,on", "terminology");
edje_object_part_unswallow(tabs->base, tabs->box);
evas_object_hide(tabs->box);
edje_object_part_unswallow(tabs->base, tabs->tabbar);
evas_object_hide(tabs->tabbar);
}
static void
@ -2642,7 +2649,8 @@ _tabs_new(Term_Container *child, Term_Container *parent)
Win *wn;
Term_Container *tc;
Tabs *tabs;
Evas_Object *o, *ic;
Evas_Object *o;
Elm_Object_Item *sep;
tabs = calloc(1, sizeof(Tabs));
if (!tabs)
@ -2677,44 +2685,27 @@ _tabs_new(Term_Container *child, Term_Container *parent)
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(o);
tabs->box = o = elm_box_add(wn->win);
elm_box_horizontal_set(o, EINA_TRUE);
tabs->tabbar = o = elm_toolbar_add(wn->win);
DBG("style:%s", elm_object_style_get(o));
elm_object_style_set(o, "transparent");
DBG("style:%s", elm_object_style_get(o));
elm_toolbar_homogeneous_set(o, EINA_FALSE);
elm_toolbar_shrink_mode_set(o, ELM_TOOLBAR_SHRINK_EXPAND);
elm_toolbar_transverse_expanded_set(o, EINA_TRUE);
elm_toolbar_standard_priority_set(o, 0);
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_box_pack_end(tabs->box, o);
evas_object_show(o);
tabs->btn_add = o = elm_button_add(wn->win);
elm_object_text_set(o, "+");
elm_box_pack_end(tabs->box, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "clicked", _tab_new_cb, tabs);
ic = elm_icon_add(wn->win);
elm_icon_standard_set(ic, "menu/arrow_down");
tabs->btn_hide = o = elm_button_add(wn->win);
elm_object_part_content_set(o, "icon", ic);
elm_box_pack_end(tabs->box, o);
evas_object_show(o);
evas_object_smart_callback_add(o, "clicked", _tab_hide_cb, tabs);
tabs->tb_item_add = elm_toolbar_item_append(o, NULL, "+", _tab_new_cb, tabs);
elm_toolbar_item_priority_set(tabs->tb_item_add, 100);
sep = elm_toolbar_item_append(tabs->tabbar, NULL, NULL, NULL, NULL);
elm_toolbar_item_priority_set(sep, 1);
elm_toolbar_item_separator_set(sep, EINA_TRUE);
tabs->tb_item_hide = elm_toolbar_item_append(o, NULL, "v", _tab_hide_cb, tabs);
elm_toolbar_item_priority_set(tabs->tb_item_hide, 100);
child->parent = tc;
tab_item_new(tabs, child);
tabs->bg = o = elm_bg_add(wn->win);
edje_object_part_swallow(tabs->base, "terminology.bg", tabs->bg);
evas_object_show(o);
edje_object_part_swallow(tabs->base, "terminology.tabbar", tabs->box);
edje_object_part_swallow(tabs->base, "terminology.tabbar", tabs->tabbar);
o = child->get_evas_object(child);
DBG("swallow:%p", o);
edje_object_part_swallow(tabs->base, "content", o);