forked from enlightenment/efl
introduce efl_ui_tab_bar_default_item
Summary: Tab bar used a direct layout to implement all this functionality by its own. However, it seems that we can reuse a lot of object functionality that is already part of efl.ui.item. With this commit the features that are not part of Efl.Ui.Item are moved to Efl.Ui.Tab_Bar_Default_Item. The tab bar is changed in a way that you do not need to pass the icon and label by hand anymore, you can rather just pass the tab_bar default item. Additionally, the item for a tab_page can now directly be generated from a page. This is the first commit in order to cleanup efl_ui_tab_bar, tab_page & tab_pager. The goal is also to implement our interfaces for inserting elements on those objects. So our common test suites can also be used. Reviewers: zmike, segfaultxavi, cedric, woohyun, bowonryu Reviewed By: woohyun Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9726
This commit is contained in:
parent
9c018613ee
commit
ef3d88dfc9
|
@ -70,7 +70,7 @@ group { "efl/tab_bar/tab";
|
||||||
#define LABEL 2
|
#define LABEL 2
|
||||||
#define MASK 3
|
#define MASK 3
|
||||||
#define DISABLE 4
|
#define DISABLE 4
|
||||||
script {
|
script {
|
||||||
public btmode;
|
public btmode;
|
||||||
public eval_mode(m) {
|
public eval_mode(m) {
|
||||||
new m1 = m & MASK;
|
new m1 = m & MASK;
|
||||||
|
@ -216,10 +216,10 @@ group { "efl/tab_bar/tab";
|
||||||
desc { "default";
|
desc { "default";
|
||||||
align: 0.5 0.5;
|
align: 0.5 0.5;
|
||||||
rel1.relative: 0.0 0.0;
|
rel1.relative: 0.0 0.0;
|
||||||
rel1.offset: 2 2;
|
rel1.offset: 5 5;
|
||||||
rel2.to_y: "efl.text";
|
rel2.to_y: "efl.text";
|
||||||
rel2.relative: 1.0 0.0;
|
rel2.relative: 1.0 0.0;
|
||||||
rel2.offset: -3 -1;
|
rel2.offset: -6 -4;
|
||||||
}
|
}
|
||||||
desc { "noicon";
|
desc { "noicon";
|
||||||
inherit: "default" 0.0;
|
inherit: "default" 0.0;
|
||||||
|
@ -417,12 +417,22 @@ group { "efl/tab_bar/tab";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rect { "event";
|
rect { "event";
|
||||||
ignore_flags: ON_HOLD;
|
|
||||||
desc { "default";
|
desc { "default";
|
||||||
color: 0 0 0 0;
|
color: 0 0 0 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
swallow { "efl.extra";
|
||||||
|
desc { "default";
|
||||||
|
fixed: 1 1;
|
||||||
|
align: 1.0 0.0;
|
||||||
|
rel1.relative: 1.0 0.0;
|
||||||
|
rel1.offset: -3 2;
|
||||||
|
rel2.relative: 1.0 0.0;
|
||||||
|
rel2.offset: -3 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
programs {
|
programs {
|
||||||
|
EFL_UI_CLICKABLE_PART_BIND(event)
|
||||||
program {
|
program {
|
||||||
signal: "efl,orient,horizontal"; source: "efl";
|
signal: "efl,orient,horizontal"; source: "efl";
|
||||||
action: STATE_SET "default" 0.0;
|
action: STATE_SET "default" 0.0;
|
||||||
|
@ -461,10 +471,6 @@ group { "efl/tab_bar/tab";
|
||||||
target: "bar";
|
target: "bar";
|
||||||
target: "bend";
|
target: "bend";
|
||||||
}
|
}
|
||||||
program {
|
|
||||||
signal: "mouse,up,1"; source: "event";
|
|
||||||
action: SIGNAL_EMIT "efl,action,click" "efl";
|
|
||||||
}
|
|
||||||
program {
|
program {
|
||||||
signal: "efl,highlight,on"; source: "efl";
|
signal: "efl,highlight,on"; source: "efl";
|
||||||
action: STATE_SET "selected" 0.0;
|
action: STATE_SET "selected" 0.0;
|
||||||
|
@ -475,14 +481,6 @@ group { "efl/tab_bar/tab";
|
||||||
action: STATE_SET "default" 0.0;
|
action: STATE_SET "default" 0.0;
|
||||||
target: "highlight";
|
target: "highlight";
|
||||||
}
|
}
|
||||||
program {
|
|
||||||
signal: "mouse,in"; source: "event";
|
|
||||||
action: SIGNAL_EMIT "efl,mouse,in" "efl";
|
|
||||||
}
|
|
||||||
program { name: "mouse,out";
|
|
||||||
signal: "mouse,out"; source: "event";
|
|
||||||
action: SIGNAL_EMIT "efl,mouse,out" "efl";
|
|
||||||
}
|
|
||||||
program { name: "st1";
|
program { name: "st1";
|
||||||
signal: "efl,state,text,unset"; source: "efl";
|
signal: "efl,state,text,unset"; source: "efl";
|
||||||
script {
|
script {
|
||||||
|
|
|
@ -92,5 +92,17 @@ void test_efl_ui_item(void *data EINA_UNUSED,
|
||||||
o = _item_add(box, EFL_UI_GROUP_ITEM_CLASS, 6);
|
o = _item_add(box, EFL_UI_GROUP_ITEM_CLASS, 6);
|
||||||
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
||||||
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||||
|
|
||||||
|
o = _item_add(box, EFL_UI_TAB_BAR_DEFAULT_ITEM_CLASS, 5);
|
||||||
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40+40));
|
||||||
|
efl_pack_end(box, o);
|
||||||
|
|
||||||
|
o = _item_add(box, EFL_UI_TAB_BAR_DEFAULT_ITEM_CLASS, 6);
|
||||||
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40));
|
||||||
|
efl_ui_widget_disabled_set(o, EINA_TRUE);
|
||||||
|
efl_pack_end(box, o);
|
||||||
|
o = _item_add(box, EFL_UI_TAB_BAR_DEFAULT_ITEM_CLASS, 5);
|
||||||
|
efl_ui_tab_bar_default_item_icon_set(o, "folder");
|
||||||
|
efl_gfx_hint_size_min_set(o, EINA_SIZE2D(40, 40+40));
|
||||||
efl_pack_end(box, o);
|
efl_pack_end(box, o);
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,6 +272,11 @@ typedef Eo Efl_Ui_Spotlight_Indicator;
|
||||||
# include <efl_ui_popup_part_backwall.eo.h>
|
# include <efl_ui_popup_part_backwall.eo.h>
|
||||||
# include <efl_ui_grid.eo.h>
|
# include <efl_ui_grid.eo.h>
|
||||||
# include <efl_ui_list.eo.h>
|
# include <efl_ui_list.eo.h>
|
||||||
|
# include <efl_ui_tab_bar_default_item.eo.h>
|
||||||
|
# include <efl_ui_tab_bar.eo.h>
|
||||||
|
# include <efl_ui_tab_page.eo.h>
|
||||||
|
# include <efl_ui_tab_page_part_tab.eo.h>
|
||||||
|
# include <efl_ui_tab_pager.eo.h>
|
||||||
/**
|
/**
|
||||||
* Initialize Elementary
|
* Initialize Elementary
|
||||||
*
|
*
|
||||||
|
|
|
@ -349,10 +349,6 @@ typedef Eo Efl_Ui_Focus_Manager;
|
||||||
# include <efl_ui_dnd_container.eo.h>
|
# include <efl_ui_dnd_container.eo.h>
|
||||||
# include <efl_ui_relative_layout.eo.h>
|
# include <efl_ui_relative_layout.eo.h>
|
||||||
# include <efl_ui_animation_view.eo.h>
|
# include <efl_ui_animation_view.eo.h>
|
||||||
# include <efl_ui_tab_bar.eo.h>
|
|
||||||
# include <efl_ui_tab_page.eo.h>
|
|
||||||
# include <efl_ui_tab_page_part_tab.eo.h>
|
|
||||||
# include <efl_ui_tab_pager.eo.h>
|
|
||||||
|
|
||||||
/* include deprecated calls last of all */
|
/* include deprecated calls last of all */
|
||||||
#include <elm_deprecated.h>
|
#include <elm_deprecated.h>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Efl_Ui.h>
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
#include "efl_ui_tab_bar_private.h"
|
#include "efl_ui_tab_bar_private.h"
|
||||||
#include "els_box.h"
|
#include "els_box.h"
|
||||||
|
@ -11,51 +11,19 @@
|
||||||
#define MY_CLASS EFL_UI_TAB_BAR_CLASS
|
#define MY_CLASS EFL_UI_TAB_BAR_CLASS
|
||||||
#define MY_CLASS_NAME "Efl.Ui.Tab_Bar"
|
#define MY_CLASS_NAME "Efl.Ui.Tab_Bar"
|
||||||
|
|
||||||
static const char PART_NAME_TAB[] = "tab";
|
|
||||||
|
|
||||||
static void _tab_select(Efl_Ui_Tab_Bar_Data *sd, Tab_Info *ti);
|
|
||||||
|
|
||||||
static Eina_Bool _key_action_select(Evas_Object *obj, const char *params);
|
|
||||||
|
|
||||||
static const Elm_Action key_actions[] = {
|
|
||||||
{"select", _key_action_select},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_key_action_select(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
||||||
{
|
|
||||||
EFL_UI_TAB_BAR_DATA_GET(obj, sd);
|
|
||||||
|
|
||||||
if (!sd->tab_infos) return EINA_FALSE;
|
|
||||||
|
|
||||||
Tab_Info *ti;
|
|
||||||
Eina_List *l, *l_next;
|
|
||||||
EINA_LIST_FOREACH_SAFE(sd->tab_infos, l, l_next, ti)
|
|
||||||
{
|
|
||||||
if (efl_ui_focus_object_focus_get(ti->tab))
|
|
||||||
{
|
|
||||||
_tab_select(sd, ti);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_tab_bar_current_tab_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd, int index)
|
_efl_ui_tab_bar_current_tab_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd, int index)
|
||||||
{
|
{
|
||||||
Tab_Info *ti;
|
Efl_Ui_Item *item;
|
||||||
ti = eina_list_nth(sd->tab_infos, index);
|
item = eina_list_nth(sd->tab_infos, index);
|
||||||
|
|
||||||
_tab_select(sd, ti);
|
efl_ui_selectable_selected_set(item, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static int
|
EOLIAN static int
|
||||||
_efl_ui_tab_bar_current_tab_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd)
|
_efl_ui_tab_bar_current_tab_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd)
|
||||||
{
|
{
|
||||||
return sd->cur;
|
return eina_list_data_idx(sd->tab_infos, sd->selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static unsigned int
|
EOLIAN static unsigned int
|
||||||
|
@ -64,228 +32,75 @@ _efl_ui_tab_bar_tab_count(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd)
|
||||||
return sd->cnt;
|
return sd->cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void _remove_item(Eo *obj, Efl_Ui_Tab_Bar_Data *pd, Efl_Ui_Item *item);
|
||||||
_tab_icon_update(Tab_Info *ti)
|
|
||||||
{
|
|
||||||
Eo *old_icon =
|
|
||||||
efl_content_get(efl_part(ti->tab, "efl.icon"));
|
|
||||||
|
|
||||||
_elm_widget_sub_object_redirect_to_top(ti->tab, old_icon);
|
|
||||||
efl_content_unset(efl_part(ti->tab, "efl.icon"));
|
|
||||||
efl_content_set(efl_part(ti->tab, "efl.icon"), ti->icon);
|
|
||||||
|
|
||||||
efl_del(old_icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_tab_icon_set_cb(void *data,
|
_selelction_change_cb(void *data, const Efl_Event *ev)
|
||||||
Eo *obj,
|
|
||||||
const char *emission,
|
|
||||||
const char *source)
|
|
||||||
{
|
{
|
||||||
Tab_Info *ti = data;
|
Efl_Ui_Tab_Bar_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
|
||||||
_tab_icon_update(ti);
|
|
||||||
|
|
||||||
efl_layout_signal_callback_del(obj, emission, source, ti, _tab_icon_set_cb, NULL);
|
if (!efl_ui_selectable_selected_get(ev->object))
|
||||||
efl_layout_signal_emit(ti->tab, "efl,state,icon,reset", "efl");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_tab_icon_obj_set(Eo *obj,
|
|
||||||
Tab_Info *ti,
|
|
||||||
Eo *icon_obj,
|
|
||||||
const char *icon_str)
|
|
||||||
{
|
|
||||||
Eo *old_icon;
|
|
||||||
const char *s;
|
|
||||||
|
|
||||||
if (icon_str)
|
|
||||||
eina_stringshare_replace(&ti->icon_str, icon_str);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
eina_stringshare_del(ti->icon_str);
|
if (pd->selected == ev->object)
|
||||||
ti->icon_str = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ti->icon = icon_obj;
|
|
||||||
if (icon_obj)
|
|
||||||
{
|
|
||||||
efl_gfx_entity_visible_set(ti->icon, EINA_TRUE);
|
|
||||||
elm_widget_sub_object_add(obj, ti->icon);
|
|
||||||
}
|
|
||||||
|
|
||||||
s = elm_layout_data_get(ti->tab, "transition_animation_on");
|
|
||||||
if ((s) && (atoi(s)))
|
|
||||||
{
|
|
||||||
old_icon = efl_content_get
|
|
||||||
(efl_part(ti->tab, "efl.icon_new"));
|
|
||||||
if (old_icon)
|
|
||||||
{
|
{
|
||||||
_elm_widget_sub_object_redirect_to_top(ti->tab, old_icon);
|
pd->selected = NULL;
|
||||||
efl_gfx_entity_visible_set(old_icon, EINA_FALSE);
|
|
||||||
}
|
}
|
||||||
efl_content_set
|
|
||||||
(efl_part(ti->tab, "efl.icon_new"), ti->icon);
|
|
||||||
efl_layout_signal_emit(ti->tab, "efl,state,icon_new,set", "efl");
|
|
||||||
efl_layout_signal_callback_add
|
|
||||||
(ti->tab, "efl,state,icon_set,done", "efl", ti, _tab_icon_set_cb, NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
_tab_icon_update(ti);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_tab_icon_set(Eo *icon_obj,
|
|
||||||
const char *type,
|
|
||||||
const char *icon)
|
|
||||||
{
|
|
||||||
char icon_str[512];
|
|
||||||
|
|
||||||
if ((!type) || (!*type)) goto end;
|
|
||||||
if ((!icon) || (!*icon)) return EINA_FALSE;
|
|
||||||
if ((snprintf(icon_str, sizeof(icon_str), "%s%s", type, icon) > 0)
|
|
||||||
&& (elm_icon_standard_set(icon_obj, icon_str)))
|
|
||||||
return EINA_TRUE;
|
|
||||||
end:
|
|
||||||
if (elm_icon_standard_set(icon_obj, icon))
|
|
||||||
return EINA_TRUE;
|
|
||||||
|
|
||||||
WRN("couldn't find icon definition for '%s'", icon);
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_tab_unselect(Efl_Ui_Tab_Bar_Data *sd, Tab_Info *ti)
|
|
||||||
{
|
|
||||||
if ((!ti->tab) || (!ti->selected)) return;
|
|
||||||
|
|
||||||
ti->selected = EINA_FALSE;
|
|
||||||
|
|
||||||
efl_layout_signal_emit(ti->tab, "efl,state,unselected", "efl");
|
|
||||||
if (ti->icon)
|
|
||||||
elm_widget_signal_emit(ti->icon, "efl,state,unselected", "efl");
|
|
||||||
|
|
||||||
sd->cur = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_tab_select(Efl_Ui_Tab_Bar_Data *sd, Tab_Info *ti)
|
|
||||||
{
|
|
||||||
if (!ti->selected)
|
|
||||||
{
|
|
||||||
Eo *tp;
|
|
||||||
tp = efl_parent_get(ti->tab);
|
|
||||||
int index;
|
|
||||||
|
|
||||||
_tab_unselect(sd, sd->selected_tab);
|
|
||||||
ti->selected = EINA_TRUE;
|
|
||||||
sd->selected_tab = ti;
|
|
||||||
|
|
||||||
efl_layout_signal_emit(ti->tab, "efl,state,selected", "efl");
|
|
||||||
if (ti->icon)
|
|
||||||
elm_widget_signal_emit(ti->icon, "efl,state,selected", "efl");
|
|
||||||
|
|
||||||
index = eina_list_data_idx(sd->tab_infos, ti);
|
|
||||||
|
|
||||||
sd->cur = index;
|
|
||||||
|
|
||||||
efl_event_callback_call(tp, EFL_UI_EVENT_ITEM_SELECTED, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_action_click_cb(void *data,
|
|
||||||
Eo *obj EINA_UNUSED,
|
|
||||||
const char *emission EINA_UNUSED,
|
|
||||||
const char *source EINA_UNUSED)
|
|
||||||
{
|
|
||||||
Eo *tb;
|
|
||||||
Tab_Info *ti;
|
|
||||||
ti = data;
|
|
||||||
tb = efl_parent_get(ti->tab);
|
|
||||||
EFL_UI_TAB_BAR_DATA_GET(tb, sd);
|
|
||||||
|
|
||||||
_tab_select(sd, ti);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Tab_Info *
|
|
||||||
_tab_add(Eo *obj, const char *label, const char *icon)
|
|
||||||
{
|
|
||||||
Eo *tab, *icon_obj;
|
|
||||||
Tab_Info *ti;
|
|
||||||
Eina_Error theme_apply;
|
|
||||||
|
|
||||||
ti = calloc(1, sizeof(*ti));
|
|
||||||
|
|
||||||
ti->tab = NULL;
|
|
||||||
ti->label = eina_stringshare_add(label);
|
|
||||||
|
|
||||||
tab = efl_add(EFL_UI_LAYOUT_CLASS, obj,
|
|
||||||
efl_gfx_hint_align_set(efl_added, EVAS_HINT_FILL, EVAS_HINT_FILL));
|
|
||||||
/* FIXME: This is for tab sizing issue.
|
|
||||||
* Recently, the size_hint_fill API has been added,
|
|
||||||
* but currently tab_bar is not available because it uses evas_object_box.
|
|
||||||
* This should be removed after the box in tab_bar has been replaced by efl.ui.box */
|
|
||||||
|
|
||||||
icon_obj = elm_icon_add(tab);
|
|
||||||
|
|
||||||
if (_tab_icon_set(icon_obj, "toolbar/", icon))
|
|
||||||
{
|
|
||||||
ti->icon = icon_obj;
|
|
||||||
ti->icon_str = eina_stringshare_add(icon);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ti->icon = NULL;
|
if (pd->selected)
|
||||||
ti->icon_str = NULL;
|
efl_ui_selectable_selected_set(pd->selected, EINA_FALSE);
|
||||||
efl_del(icon_obj);
|
EINA_SAFETY_ON_FALSE_RETURN(!pd->selected);
|
||||||
|
pd->selected = ev->object;
|
||||||
|
efl_event_callback_call(data, EFL_UI_EVENT_ITEM_SELECTED, NULL);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
theme_apply = elm_widget_element_update(obj, tab, PART_NAME_TAB);
|
static void
|
||||||
|
_invalidate_cb(void *data, const Efl_Event *ev)
|
||||||
|
{
|
||||||
|
Efl_Ui_Tab_Bar_Data *pd = efl_data_scope_safe_get(data, MY_CLASS);
|
||||||
|
|
||||||
if (theme_apply == EFL_UI_THEME_APPLY_ERROR_GENERIC)
|
EINA_SAFETY_ON_NULL_RETURN(pd);
|
||||||
CRI("Failed to set layout!");
|
_remove_item(data, pd, ev->object);
|
||||||
|
}
|
||||||
|
|
||||||
efl_layout_signal_callback_add
|
EFL_CALLBACKS_ARRAY_DEFINE(item_listeners,
|
||||||
(tab, "efl,action,click", "efl", ti,_action_click_cb, NULL);
|
{EFL_UI_EVENT_SELECTED_CHANGED, _selelction_change_cb},
|
||||||
|
{EFL_EVENT_INVALIDATE, _invalidate_cb},
|
||||||
|
)
|
||||||
|
|
||||||
if (ti->icon)
|
static void
|
||||||
efl_content_set(efl_part(tab, "efl.icon"), ti->icon);
|
_remove_item(Eo *obj, Efl_Ui_Tab_Bar_Data *pd, Efl_Ui_Item *item)
|
||||||
|
{
|
||||||
|
pd->tab_infos = eina_list_remove(pd->tab_infos, item);
|
||||||
|
|
||||||
if (ti->label)
|
if (pd->selected == item)
|
||||||
efl_text_set(efl_part(tab, "efl.text"), ti->label);
|
pd->selected = NULL;
|
||||||
|
|
||||||
efl_ui_widget_focus_allow_set(tab, EINA_TRUE);
|
efl_event_callback_array_del(item, item_listeners(), obj);
|
||||||
|
|
||||||
ti->tab = tab;
|
|
||||||
|
|
||||||
return ti;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_tab_bar_tab_add(Eo *obj, Efl_Ui_Tab_Bar_Data *sd,
|
_efl_ui_tab_bar_tab_add(Eo *obj, Efl_Ui_Tab_Bar_Data *sd,
|
||||||
int index, const char *label, const char *icon)
|
int index, Efl_Ui_Tab_Bar_Default_Item *tab)
|
||||||
{
|
{
|
||||||
Tab_Info *ti;
|
efl_ui_item_container_set(tab, obj);
|
||||||
ti = _tab_add(obj, label, icon);
|
efl_ui_widget_sub_object_add(obj, tab);
|
||||||
|
efl_event_callback_array_add(tab, item_listeners(), obj);
|
||||||
efl_parent_set(ti->tab, obj);
|
efl_gfx_hint_align_set(tab, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
efl_ui_widget_sub_object_add(obj, ti->tab);
|
|
||||||
|
|
||||||
if (sd->cnt > index)
|
if (sd->cnt > index)
|
||||||
{
|
{
|
||||||
Tab_Info *existing_ti;
|
Efl_Ui_Item *existing_ti;
|
||||||
existing_ti = eina_list_nth(sd->tab_infos, index);
|
existing_ti = eina_list_nth(sd->tab_infos, index);
|
||||||
|
|
||||||
sd->tab_infos = eina_list_prepend_relative(sd->tab_infos, ti, existing_ti);
|
sd->tab_infos = eina_list_prepend_relative(sd->tab_infos, tab, existing_ti);
|
||||||
evas_object_box_insert_before(sd->bx, ti->tab, existing_ti->tab);
|
evas_object_box_insert_before(sd->bx, tab, existing_ti);
|
||||||
|
|
||||||
if (sd->cur >= index) sd->cur ++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sd->tab_infos = eina_list_append(sd->tab_infos, ti);
|
sd->tab_infos = eina_list_append(sd->tab_infos, tab);
|
||||||
evas_object_box_append(sd->bx, ti->tab);
|
evas_object_box_append(sd->bx, tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
sd->cnt ++;
|
sd->cnt ++;
|
||||||
|
@ -296,45 +111,10 @@ _efl_ui_tab_bar_tab_remove(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd, int ind
|
||||||
{
|
{
|
||||||
if ((sd->cnt > 0) && (sd->cnt > index) && (index >= 0))
|
if ((sd->cnt > 0) && (sd->cnt > index) && (index >= 0))
|
||||||
{
|
{
|
||||||
Tab_Info *ti;
|
Efl_Ui_Item *ti;
|
||||||
ti = eina_list_nth(sd->tab_infos, index);
|
ti = eina_list_nth(sd->tab_infos, index);
|
||||||
|
|
||||||
_tab_unselect(sd, ti);
|
efl_del(ti);
|
||||||
evas_object_box_remove(sd->bx, ti->tab);
|
|
||||||
efl_del(ti->tab);
|
|
||||||
|
|
||||||
sd->tab_infos = eina_list_remove(sd->tab_infos, ti);
|
|
||||||
sd->cnt --;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_tab_bar_tab_label_set(Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Data *sd, int index, const char *label)
|
|
||||||
{
|
|
||||||
Tab_Info *ti;
|
|
||||||
ti = eina_list_nth(sd->tab_infos, index);
|
|
||||||
eina_stringshare_replace(&ti->label, label);
|
|
||||||
|
|
||||||
efl_text_set(efl_part(ti->tab, "efl.text"), ti->label);
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
|
||||||
_efl_ui_tab_bar_tab_icon_set(Eo *obj, Efl_Ui_Tab_Bar_Data *sd, int index, const char *icon)
|
|
||||||
{
|
|
||||||
Eo *icon_obj;
|
|
||||||
Tab_Info *ti;
|
|
||||||
ti = eina_list_nth(sd->tab_infos, index);
|
|
||||||
|
|
||||||
if ((icon) && (ti->icon_str) && (!strcmp(icon, ti->icon_str))) return;
|
|
||||||
|
|
||||||
icon_obj = elm_icon_add(obj);
|
|
||||||
if (!icon_obj) return;
|
|
||||||
if (_tab_icon_set(icon_obj, "toolbar/", icon))
|
|
||||||
_tab_icon_obj_set(obj, ti, icon_obj, icon);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_tab_icon_obj_set(obj, ti, NULL, NULL);
|
|
||||||
efl_del(icon_obj);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,16 +166,8 @@ _efl_ui_tab_bar_efl_object_constructor(Eo *obj, Efl_Ui_Tab_Bar_Data *sd)
|
||||||
efl_content_set(efl_part(obj, "efl.content"), sd->bx);
|
efl_content_set(efl_part(obj, "efl.content"), sd->bx);
|
||||||
|
|
||||||
sd->cnt = 0;
|
sd->cnt = 0;
|
||||||
sd->cur = -1;
|
|
||||||
|
|
||||||
Tab_Info *ti = calloc(1, sizeof(*ti));
|
|
||||||
sd->selected_tab = ti;
|
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Standard widget overrides */
|
|
||||||
|
|
||||||
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_tab_bar, Efl_Ui_Tab_Bar_Data)
|
|
||||||
|
|
||||||
#include "efl_ui_tab_bar.eo.c"
|
#include "efl_ui_tab_bar.eo.c"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base
|
class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base implements Efl.Ui.Single_Selectable
|
||||||
{
|
{
|
||||||
[[Tab Bar class]]
|
[[Tab Bar class]]
|
||||||
methods {
|
methods {
|
||||||
|
@ -13,8 +13,7 @@ class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base
|
||||||
tab_add @beta {
|
tab_add @beta {
|
||||||
params {
|
params {
|
||||||
@in index: int;
|
@in index: int;
|
||||||
@in label: string;
|
@in icon : Efl.Ui.Tab_Bar_Default_Item;
|
||||||
@in icon: string;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tab_remove @beta {
|
tab_remove @beta {
|
||||||
|
@ -22,22 +21,9 @@ class @beta Efl.Ui.Tab_Bar extends Efl.Ui.Layout_Base
|
||||||
@in index: int;
|
@in index: int;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tab_label_set @beta {
|
|
||||||
params {
|
|
||||||
@in index: int;
|
|
||||||
@in label: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tab_icon_set @beta {
|
|
||||||
params {
|
|
||||||
@in index: int;
|
|
||||||
@in icon: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Object.destructor;
|
Efl.Object.destructor;
|
||||||
Efl.Ui.Widget.widget_input_event_handler;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "elementary_config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Elementary.h>
|
||||||
|
|
||||||
|
#include "elm_priv.h"
|
||||||
|
#include "elm_part_helper.h"
|
||||||
|
|
||||||
|
#define MY_CLASS EFL_UI_TAB_BAR_DEFAULT_ITEM_CLASS
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
Efl_Gfx_Image *icon;
|
||||||
|
const char *icon_name;
|
||||||
|
} Efl_Ui_Tab_Bar_Default_Item_Data;
|
||||||
|
|
||||||
|
static void
|
||||||
|
_tab_icon_set_cb(void *data,
|
||||||
|
Eo *obj,
|
||||||
|
const char *emission,
|
||||||
|
const char *source)
|
||||||
|
{
|
||||||
|
Efl_Ui_Item *ti = data;
|
||||||
|
|
||||||
|
Efl_Ui_Image *new_img = efl_content_get(efl_part(obj, "efl.icon_new"));
|
||||||
|
efl_content_set(efl_part(obj, "efl.icon"), new_img); //this must be efl.icon here as obj is the edje object
|
||||||
|
|
||||||
|
efl_layout_signal_callback_del(obj, emission, source, ti, _tab_icon_set_cb, NULL);
|
||||||
|
efl_layout_signal_emit(obj, "efl,state,icon,reset", "efl");
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_tab_bar_default_item_icon_set(Eo *obj, Efl_Ui_Tab_Bar_Default_Item_Data *pd, const char *standard_name)
|
||||||
|
{
|
||||||
|
eina_stringshare_replace(&pd->icon_name, standard_name);
|
||||||
|
|
||||||
|
//if there is a already a icon, create a animation
|
||||||
|
if (pd->icon)
|
||||||
|
{
|
||||||
|
Efl_Ui_Image *new_icon = efl_add(EFL_UI_IMAGE_CLASS, obj);
|
||||||
|
efl_content_set(efl_part(obj, "efl.icon_new"), new_icon);
|
||||||
|
efl_ui_image_icon_set(new_icon, standard_name);
|
||||||
|
efl_layout_signal_emit(obj, "efl,state,icon_new,set", "efl");
|
||||||
|
efl_layout_signal_callback_add
|
||||||
|
(obj, "efl,state,icon_set,done", "efl", obj, _tab_icon_set_cb, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pd->icon = efl_add(EFL_UI_IMAGE_CLASS, obj);
|
||||||
|
efl_content_set(efl_part(obj,"icon"), pd->icon);
|
||||||
|
efl_ui_image_icon_set(pd->icon, standard_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static const char*
|
||||||
|
_efl_ui_tab_bar_default_item_icon_get(const Eo *obj EINA_UNUSED, Efl_Ui_Tab_Bar_Default_Item_Data *pd)
|
||||||
|
{
|
||||||
|
return pd->icon_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static Efl_Object *
|
||||||
|
_efl_ui_tab_bar_default_item_efl_object_constructor(Eo *obj, Efl_Ui_Tab_Bar_Default_Item_Data *pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Eo *eo;
|
||||||
|
|
||||||
|
eo = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
|
|
||||||
|
if (!elm_widget_theme_klass_get(obj))
|
||||||
|
elm_widget_theme_klass_set(obj, "tab_bar/tab");
|
||||||
|
|
||||||
|
return eo;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "efl_ui_tab_bar_default_item.eo.c"
|
|
@ -0,0 +1,18 @@
|
||||||
|
class @beta Efl.Ui.Tab_Bar_Default_Item extends Efl.Ui.Default_Item
|
||||||
|
{
|
||||||
|
[[ A icon that represents the default parts in the appearance of the tab bar. ]]
|
||||||
|
methods {
|
||||||
|
@property icon {
|
||||||
|
[[Set the content of the default item as a image.
|
||||||
|
|
||||||
|
The content will be re-set (means, the old content is deleted).
|
||||||
|
]]
|
||||||
|
values {
|
||||||
|
standard_name : string; [[The icon name, names are defined as standard free desktop icon names.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
implements {
|
||||||
|
Efl.Object.constructor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,31 +2,17 @@
|
||||||
#define EFL_UI_TAB_BAR_PRIVATE_H
|
#define EFL_UI_TAB_BAR_PRIVATE_H
|
||||||
|
|
||||||
typedef struct _Efl_Ui_Tab_Bar_Data Efl_Ui_Tab_Bar_Data;
|
typedef struct _Efl_Ui_Tab_Bar_Data Efl_Ui_Tab_Bar_Data;
|
||||||
typedef struct _Tab_Info Tab_Info;
|
|
||||||
|
|
||||||
struct _Efl_Ui_Tab_Bar_Data
|
struct _Efl_Ui_Tab_Bar_Data
|
||||||
{
|
{
|
||||||
Efl_Canvas_Object *bx;
|
Efl_Canvas_Object *bx;
|
||||||
int cnt;
|
int cnt;
|
||||||
int cur;
|
|
||||||
Efl_Ui_Layout_Orientation dir;
|
Efl_Ui_Layout_Orientation dir;
|
||||||
|
|
||||||
Eina_List *tab_infos;
|
Eina_List *tab_infos;
|
||||||
Tab_Info *selected_tab;
|
Efl_Ui_Item *selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Tab_Info
|
|
||||||
{
|
|
||||||
Eo *tab;
|
|
||||||
|
|
||||||
const char *label;
|
|
||||||
const char *icon_str;
|
|
||||||
Eo *icon;
|
|
||||||
|
|
||||||
Eina_Bool selected : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define EFL_UI_TAB_BAR_DATA_GET(o, sd) \
|
#define EFL_UI_TAB_BAR_DATA_GET(o, sd) \
|
||||||
Efl_Ui_Tab_Bar_Data *sd = efl_data_scope_get(o, EFL_UI_TAB_BAR_CLASS)
|
Efl_Ui_Tab_Bar_Data *sd = efl_data_scope_get(o, EFL_UI_TAB_BAR_CLASS)
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#define EFL_PART_PROTECTED
|
#define EFL_PART_PROTECTED
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Efl_Ui.h>
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
#include "efl_ui_tab_page_private.h"
|
#include "efl_ui_tab_page_private.h"
|
||||||
#include "elm_part_helper.h"
|
#include "elm_part_helper.h"
|
||||||
|
@ -110,6 +110,7 @@ _efl_ui_tab_page_part_tab_icon_set(Eo *obj, void *_pd EINA_UNUSED, const char *p
|
||||||
Efl_Ui_Tab_Page_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_TAB_PAGE_CLASS);
|
Efl_Ui_Tab_Page_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_TAB_PAGE_CLASS);
|
||||||
|
|
||||||
eina_stringshare_replace(&sd->tab_icon, path);
|
eina_stringshare_replace(&sd->tab_icon, path);
|
||||||
|
efl_ui_tab_bar_default_item_icon_set(sd->tab_bar_icon, sd->tab_icon);
|
||||||
|
|
||||||
Efl_Ui_Tab_Page_Tab_Changed_Event event;
|
Efl_Ui_Tab_Page_Tab_Changed_Event event;
|
||||||
event.changed_info = EFL_UI_TAB_PAGE_TAB_CHANGED_ICON;
|
event.changed_info = EFL_UI_TAB_PAGE_TAB_CHANGED_ICON;
|
||||||
|
@ -133,6 +134,7 @@ _efl_ui_tab_page_part_tab_efl_text_text_set(Eo *obj, void *_pd EINA_UNUSED, cons
|
||||||
Efl_Ui_Tab_Page_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_TAB_PAGE_CLASS);
|
Efl_Ui_Tab_Page_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_TAB_PAGE_CLASS);
|
||||||
|
|
||||||
eina_stringshare_replace(&sd->tab_label, text);
|
eina_stringshare_replace(&sd->tab_label, text);
|
||||||
|
efl_text_set(sd->tab_bar_icon, sd->tab_label);
|
||||||
|
|
||||||
Efl_Ui_Tab_Page_Tab_Changed_Event event;
|
Efl_Ui_Tab_Page_Tab_Changed_Event event;
|
||||||
event.changed_info = EFL_UI_TAB_PAGE_TAB_CHANGED_LABEL;
|
event.changed_info = EFL_UI_TAB_PAGE_TAB_CHANGED_LABEL;
|
||||||
|
@ -149,6 +151,20 @@ _efl_ui_tab_page_part_tab_efl_text_text_get(const Eo *obj, void *_pd EINA_UNUSED
|
||||||
return sd->tab_label;
|
return sd->tab_label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static Efl_Ui_Tab_Bar_Default_Item*
|
||||||
|
_efl_ui_tab_page_tab_bar_item_get(const Eo *obj, Efl_Ui_Tab_Page_Data *pd)
|
||||||
|
{
|
||||||
|
if (!pd->tab_bar_icon)
|
||||||
|
{
|
||||||
|
pd->tab_bar_icon = efl_add(EFL_UI_TAB_BAR_DEFAULT_ITEM_CLASS, (Eo*)obj);
|
||||||
|
efl_text_set(pd->tab_bar_icon, pd->tab_label);
|
||||||
|
efl_ui_tab_bar_default_item_icon_set(pd->tab_bar_icon, pd->tab_icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pd->tab_bar_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "efl_ui_tab_page_part_tab.eo.c"
|
#include "efl_ui_tab_page_part_tab.eo.c"
|
||||||
|
|
||||||
/* Efl.Part end */
|
/* Efl.Part end */
|
||||||
|
|
|
@ -13,6 +13,19 @@ class @beta Efl.Ui.Tab_Page extends Efl.Ui.Layout_Base implements Efl.Content
|
||||||
{
|
{
|
||||||
[[Tab Page class]]
|
[[Tab Page class]]
|
||||||
methods {
|
methods {
|
||||||
|
@property tab_bar_item {
|
||||||
|
[[Get this page represented as a @Efl.Ui.Tab_Bar_Default_Item
|
||||||
|
|
||||||
|
The object returned here will reflect all the properties from the part here. Properties will be automatically updated.
|
||||||
|
This property is unique per @Efl.Ui.Tab_Page
|
||||||
|
]]
|
||||||
|
get {
|
||||||
|
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
item : Efl.Ui.Tab_Bar_Default_Item; [[The @Efl.Ui.Tab_Bar_Default_Item for the tab bar]]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
parts {
|
parts {
|
||||||
tab: Efl.Ui.Tab_Page_Part_Tab;
|
tab: Efl.Ui.Tab_Page_Part_Tab;
|
||||||
|
|
|
@ -8,6 +8,7 @@ struct _Efl_Ui_Tab_Page_Data
|
||||||
Eo *content;
|
Eo *content;
|
||||||
const char *tab_label;
|
const char *tab_label;
|
||||||
const char *tab_icon;
|
const char *tab_icon;
|
||||||
|
Eo *tab_bar_icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,4 +26,4 @@ struct _Efl_Ui_Tab_Page_Data
|
||||||
|
|
||||||
#include "efl_ui_tab_page_part_tab.eo.h"
|
#include "efl_ui_tab_page_part_tab.eo.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <Elementary.h>
|
#include <Efl_Ui.h>
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
|
|
||||||
#include "efl_ui_tab_pager_private.h"
|
#include "efl_ui_tab_pager_private.h"
|
||||||
|
@ -29,31 +29,6 @@ _tab_select_cb(void *data, const Efl_Event *event)
|
||||||
efl_ui_spotlight_active_index_set(data, index);
|
efl_ui_spotlight_active_index_set(data, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_tab_changed_cb(void *data, const Efl_Event *event)
|
|
||||||
{
|
|
||||||
Efl_Ui_Tab_Page_Tab_Changed_Event *ev = event->info;
|
|
||||||
int index;
|
|
||||||
|
|
||||||
EFL_UI_TAB_PAGER_DATA_GET(data, sd);
|
|
||||||
EFL_UI_TAB_PAGE_DATA_GET(event->object, pd);
|
|
||||||
index = eina_list_data_idx(sd->tab_pages, event->object);
|
|
||||||
|
|
||||||
switch (ev->changed_info)
|
|
||||||
{
|
|
||||||
case EFL_UI_TAB_PAGE_TAB_CHANGED_LABEL:
|
|
||||||
efl_ui_tab_bar_tab_label_set(sd->tab_bar, index, pd->tab_label);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case EFL_UI_TAB_PAGE_TAB_CHANGED_ICON:
|
|
||||||
efl_ui_tab_bar_tab_icon_set(sd->tab_bar, index, pd->tab_icon);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_tab_pager_tab_bar_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd, Efl_Canvas_Object *tab_bar)
|
_efl_ui_tab_pager_tab_bar_set(Eo *obj, Efl_Ui_Tab_Pager_Data *sd, Efl_Canvas_Object *tab_bar)
|
||||||
{
|
{
|
||||||
|
@ -125,8 +100,6 @@ _efl_ui_tab_pager_efl_pack_pack_clear(Eo *obj, Efl_Ui_Tab_Pager_Data *sd)
|
||||||
int begin_index = 0;
|
int begin_index = 0;
|
||||||
EINA_LIST_FOREACH_SAFE(sd->tab_pages, l, l_next, subobj)
|
EINA_LIST_FOREACH_SAFE(sd->tab_pages, l, l_next, subobj)
|
||||||
{
|
{
|
||||||
efl_event_callback_del(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
sd->tab_pages = eina_list_remove(sd->tab_pages, subobj);
|
sd->tab_pages = eina_list_remove(sd->tab_pages, subobj);
|
||||||
sd->cnt--;
|
sd->cnt--;
|
||||||
|
|
||||||
|
@ -149,8 +122,6 @@ _efl_ui_tab_pager_efl_pack_unpack_all(Eo *obj, Efl_Ui_Tab_Pager_Data *sd)
|
||||||
int begin_index = 0;
|
int begin_index = 0;
|
||||||
EINA_LIST_FOREACH_SAFE(sd->tab_pages, l, l_next, subobj)
|
EINA_LIST_FOREACH_SAFE(sd->tab_pages, l, l_next, subobj)
|
||||||
{
|
{
|
||||||
efl_event_callback_del(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
sd->tab_pages = eina_list_remove(sd->tab_pages, subobj);
|
sd->tab_pages = eina_list_remove(sd->tab_pages, subobj);
|
||||||
sd->cnt--;
|
sd->cnt--;
|
||||||
|
|
||||||
|
@ -168,8 +139,6 @@ _efl_ui_tab_pager_efl_pack_unpack(Eo *obj, Efl_Ui_Tab_Pager_Data *sd, Efl_Gfx_En
|
||||||
{
|
{
|
||||||
if (sd->tab_bar)
|
if (sd->tab_bar)
|
||||||
{
|
{
|
||||||
efl_event_callback_del(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
int index = eina_list_data_idx(sd->tab_pages, (void *)subobj);
|
int index = eina_list_data_idx(sd->tab_pages, (void *)subobj);
|
||||||
|
|
||||||
sd->tab_pages = eina_list_remove(sd->tab_pages, subobj);
|
sd->tab_pages = eina_list_remove(sd->tab_pages, subobj);
|
||||||
|
@ -191,19 +160,16 @@ _efl_ui_tab_pager_efl_pack_linear_pack_begin(Eo *obj,
|
||||||
{
|
{
|
||||||
if (sd->tab_bar)
|
if (sd->tab_bar)
|
||||||
{
|
{
|
||||||
EFL_UI_TAB_PAGE_DATA_GET(subobj, pd);
|
|
||||||
int begin_index = 0;
|
int begin_index = 0;
|
||||||
|
|
||||||
sd->tab_pages = eina_list_prepend(sd->tab_pages, subobj);
|
sd->tab_pages = eina_list_prepend(sd->tab_pages, subobj);
|
||||||
sd->cnt ++;
|
sd->cnt ++;
|
||||||
|
|
||||||
efl_ui_tab_bar_tab_add(sd->tab_bar, begin_index, pd->tab_label, pd->tab_icon);
|
efl_ui_tab_bar_tab_add(sd->tab_bar, begin_index, efl_ui_tab_page_tab_bar_item_get(subobj));
|
||||||
efl_pack_begin(efl_super(obj, MY_CLASS), subobj);
|
efl_pack_begin(efl_super(obj, MY_CLASS), subobj);
|
||||||
|
|
||||||
sd->cur ++;
|
sd->cur ++;
|
||||||
|
|
||||||
efl_event_callback_add(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
else return EINA_FALSE;
|
else return EINA_FALSE;
|
||||||
|
@ -216,17 +182,14 @@ _efl_ui_tab_pager_efl_pack_linear_pack_end(Eo *obj,
|
||||||
{
|
{
|
||||||
if (sd->tab_bar)
|
if (sd->tab_bar)
|
||||||
{
|
{
|
||||||
EFL_UI_TAB_PAGE_DATA_GET(subobj, pd);
|
|
||||||
int end_index = efl_ui_tab_bar_tab_count(sd->tab_bar);
|
int end_index = efl_ui_tab_bar_tab_count(sd->tab_bar);
|
||||||
|
|
||||||
sd->tab_pages = eina_list_append(sd->tab_pages, subobj);
|
sd->tab_pages = eina_list_append(sd->tab_pages, subobj);
|
||||||
sd->cnt ++;
|
sd->cnt ++;
|
||||||
|
|
||||||
efl_ui_tab_bar_tab_add(sd->tab_bar, end_index, pd->tab_label, pd->tab_icon);
|
efl_ui_tab_bar_tab_add(sd->tab_bar, end_index, efl_ui_tab_page_tab_bar_item_get(subobj));
|
||||||
efl_pack_end(efl_super(obj, MY_CLASS), subobj);
|
efl_pack_end(efl_super(obj, MY_CLASS), subobj);
|
||||||
|
|
||||||
efl_event_callback_add(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
else return EINA_FALSE;
|
else return EINA_FALSE;
|
||||||
|
@ -240,19 +203,16 @@ _efl_ui_tab_pager_efl_pack_linear_pack_before(Eo *obj,
|
||||||
{
|
{
|
||||||
if (sd->tab_bar)
|
if (sd->tab_bar)
|
||||||
{
|
{
|
||||||
EFL_UI_TAB_PAGE_DATA_GET(subobj, pd);
|
|
||||||
int before_index = eina_list_data_idx(sd->tab_pages, (void *)existing);
|
int before_index = eina_list_data_idx(sd->tab_pages, (void *)existing);
|
||||||
|
|
||||||
sd->tab_pages = eina_list_prepend_relative(sd->tab_pages, subobj, existing);
|
sd->tab_pages = eina_list_prepend_relative(sd->tab_pages, subobj, existing);
|
||||||
sd->cnt ++;
|
sd->cnt ++;
|
||||||
|
|
||||||
efl_ui_tab_bar_tab_add(sd->tab_bar, before_index, pd->tab_label, pd->tab_icon);
|
efl_ui_tab_bar_tab_add(sd->tab_bar, before_index, efl_ui_tab_page_tab_bar_item_get(subobj));
|
||||||
efl_pack_before(efl_super(obj, MY_CLASS), subobj, existing);
|
efl_pack_before(efl_super(obj, MY_CLASS), subobj, existing);
|
||||||
|
|
||||||
if (sd->cur >= before_index) sd->cur ++;
|
if (sd->cur >= before_index) sd->cur ++;
|
||||||
|
|
||||||
efl_event_callback_add(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
else return EINA_FALSE;
|
else return EINA_FALSE;
|
||||||
|
@ -266,19 +226,16 @@ _efl_ui_tab_pager_efl_pack_linear_pack_after(Eo *obj,
|
||||||
{
|
{
|
||||||
if (sd->tab_bar)
|
if (sd->tab_bar)
|
||||||
{
|
{
|
||||||
EFL_UI_TAB_PAGE_DATA_GET(subobj, pd);
|
|
||||||
int after_index = eina_list_data_idx(sd->tab_pages, (void *)existing) + 1;
|
int after_index = eina_list_data_idx(sd->tab_pages, (void *)existing) + 1;
|
||||||
|
|
||||||
sd->tab_pages = eina_list_append_relative(sd->tab_pages, subobj, existing);
|
sd->tab_pages = eina_list_append_relative(sd->tab_pages, subobj, existing);
|
||||||
sd->cnt ++;
|
sd->cnt ++;
|
||||||
|
|
||||||
efl_ui_tab_bar_tab_add(sd->tab_bar, after_index, pd->tab_label, pd->tab_icon);
|
efl_ui_tab_bar_tab_add(sd->tab_bar, after_index, efl_ui_tab_page_tab_bar_item_get(subobj));
|
||||||
efl_pack_after(efl_super(obj, MY_CLASS), subobj, existing);
|
efl_pack_after(efl_super(obj, MY_CLASS), subobj, existing);
|
||||||
|
|
||||||
if (sd->cur > after_index) sd->cur ++;
|
if (sd->cur > after_index) sd->cur ++;
|
||||||
|
|
||||||
efl_event_callback_add(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
else return EINA_FALSE;
|
else return EINA_FALSE;
|
||||||
|
@ -293,19 +250,16 @@ _efl_ui_tab_pager_efl_pack_linear_pack_at(Eo *obj,
|
||||||
if (sd->tab_bar)
|
if (sd->tab_bar)
|
||||||
{
|
{
|
||||||
Efl_Gfx_Entity *existing = NULL;
|
Efl_Gfx_Entity *existing = NULL;
|
||||||
EFL_UI_TAB_PAGE_DATA_GET(subobj, pd);
|
|
||||||
|
|
||||||
existing = eina_list_nth(sd->tab_pages, index);
|
existing = eina_list_nth(sd->tab_pages, index);
|
||||||
sd->tab_pages = eina_list_prepend_relative(sd->tab_pages, subobj, existing);
|
sd->tab_pages = eina_list_prepend_relative(sd->tab_pages, subobj, existing);
|
||||||
sd->cnt ++;
|
sd->cnt ++;
|
||||||
|
|
||||||
efl_ui_tab_bar_tab_add(sd->tab_bar, index, pd->tab_label, pd->tab_icon);
|
efl_ui_tab_bar_tab_add(sd->tab_bar, index, efl_ui_tab_page_tab_bar_item_get(subobj));
|
||||||
efl_pack_at(efl_super(obj, MY_CLASS), subobj, index);
|
efl_pack_at(efl_super(obj, MY_CLASS), subobj, index);
|
||||||
|
|
||||||
if (sd->cur >= index) sd->cur ++;
|
if (sd->cur >= index) sd->cur ++;
|
||||||
|
|
||||||
efl_event_callback_add(subobj, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
else return EINA_FALSE;
|
else return EINA_FALSE;
|
||||||
|
@ -320,8 +274,6 @@ _efl_ui_tab_pager_efl_pack_linear_pack_unpack_at(Eo *obj, Efl_Ui_Tab_Pager_Data
|
||||||
existing = eina_list_nth(sd->tab_pages, index);
|
existing = eina_list_nth(sd->tab_pages, index);
|
||||||
if (!existing) return NULL;
|
if (!existing) return NULL;
|
||||||
|
|
||||||
efl_event_callback_del(existing, EFL_UI_TAB_PAGE_EVENT_TAB_CHANGED, _tab_changed_cb, obj);
|
|
||||||
|
|
||||||
sd->tab_pages = eina_list_remove(sd->tab_pages, existing);
|
sd->tab_pages = eina_list_remove(sd->tab_pages, existing);
|
||||||
sd->cnt--;
|
sd->cnt--;
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,7 @@ pub_eo_files = [
|
||||||
'efl_ui_multi_selectable.eo',
|
'efl_ui_multi_selectable.eo',
|
||||||
'efl_ui_single_selectable.eo',
|
'efl_ui_single_selectable.eo',
|
||||||
'efl_ui_position_manager_data_access_v1.eo',
|
'efl_ui_position_manager_data_access_v1.eo',
|
||||||
|
'efl_ui_tab_bar_default_item.eo',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach eo_file : pub_eo_files
|
foreach eo_file : pub_eo_files
|
||||||
|
@ -939,6 +940,7 @@ elementary_src = [
|
||||||
'efl_ui_position_manager_entity.c',
|
'efl_ui_position_manager_entity.c',
|
||||||
'efl_ui_position_manager_list.c',
|
'efl_ui_position_manager_list.c',
|
||||||
'efl_ui_position_manager_grid.c',
|
'efl_ui_position_manager_grid.c',
|
||||||
|
'efl_ui_tab_bar_default_item.c'
|
||||||
]
|
]
|
||||||
|
|
||||||
elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]
|
elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]
|
||||||
|
|
Loading…
Reference in New Issue