rename deactiveTabItem

This commit is contained in:
geron-cn 2016-03-03 18:09:07 +08:00
parent 008089a506
commit 46f2e8c8b6
2 changed files with 9 additions and 10 deletions

View File

@ -89,8 +89,7 @@ namespace ui
} }
else else
{ {
headerCell->setSelected(false); deactiveTabItem(tabItem);
container->setVisible(false);
} }
headerCell->setContentSize(Size(_headerWidth, _headerHeight)); headerCell->setContentSize(Size(_headerWidth, _headerHeight));
@ -309,14 +308,14 @@ namespace ui
{ {
if (tabIndex <= -1 || tabIndex >= (int)_tabItems.size()) if (tabIndex <= -1 || tabIndex >= (int)_tabItems.size())
{ {
deactiveHeader(_selectedItem); deactiveTabItem(_selectedItem);
_selectedItem = nullptr; _selectedItem = nullptr;
} }
else else
{ {
deactiveHeader(_selectedItem); deactiveTabItem(_selectedItem);
auto tabItem = _tabItems.at(tabIndex); auto tabItem = _tabItems.at(tabIndex);
activeHeader(tabItem); activeTabItem(tabItem);
_selectedItem = tabItem; _selectedItem = tabItem;
} }
} }
@ -327,7 +326,7 @@ namespace ui
auto tabItem = _tabItems.at(tabIndex); auto tabItem = _tabItems.at(tabIndex);
if (tabItem == _selectedItem) if (tabItem == _selectedItem)
{ {
deactiveHeader(_selectedItem); deactiveTabItem(_selectedItem);
_selectedItem = nullptr; _selectedItem = nullptr;
} }
} }
@ -396,7 +395,7 @@ namespace ui
} }
} }
void TabControl::activeHeader(TabItem* item) void TabControl::activeTabItem(TabItem* item)
{ {
if (item != nullptr) if (item != nullptr)
{ {
@ -408,7 +407,7 @@ namespace ui
} }
} }
void TabControl::deactiveHeader(TabItem* item) void TabControl::deactiveTabItem(TabItem* item)
{ {
if (item != nullptr) if (item != nullptr)
{ {

View File

@ -364,8 +364,8 @@ namespace ui {
// format tab header and container after insert // format tab header and container after insert
void initAfterInsert(int index); void initAfterInsert(int index);
void activeHeader(TabItem* item); void activeTabItem(TabItem* item);
void deactiveHeader(TabItem* item); void deactiveTabItem(TabItem* item);
Vec2 getHeaderAnchorWithDock() const; Vec2 getHeaderAnchorWithDock() const;
TabItem* _selectedItem; TabItem* _selectedItem;