From 008089a50685610d6c2700624ba6dacfccf668bb Mon Sep 17 00:00:00 2001 From: geron-cn Date: Thu, 3 Mar 2016 16:22:42 +0800 Subject: [PATCH 1/2] add TabControl TabHeader to tolua --- tools/tolua/cocos2dx_ui.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/tolua/cocos2dx_ui.ini b/tools/tolua/cocos2dx_ui.ini index fd73fd9230..ca38b08e71 100644 --- a/tools/tolua/cocos2dx_ui.ini +++ b/tools/tolua/cocos2dx_ui.ini @@ -30,7 +30,7 @@ headers = %(cocosdir)s/cocos/ui/CocosGUI.h # what classes to produce code for. You can use regular expressions here. When testing the regular # expression, it will be enclosed in "^$", like this: "^Menu*$". -classes = Helper Widget Layout Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter Rich.* HBox VBox RelativeBox Scale9Sprite EditBox LayoutComponent AbstractCheckButton RadioButton RadioButtonGroup +classes = Helper Widget Layout Button CheckBox ImageView Text TextAtlas TextBMFont LoadingBar Slider TextField ScrollView ListView PageView LayoutParameter LinearLayoutParameter RelativeLayoutParameter Rich.* HBox VBox RelativeBox Scale9Sprite EditBox LayoutComponent AbstractCheckButton RadioButton RadioButtonGroup TabControl TabHeader # what should we skip? in the format ClassName::[function function] # ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also From 46f2e8c8b69c1e3e492e04fc8c02815b3bc452d0 Mon Sep 17 00:00:00 2001 From: geron-cn Date: Thu, 3 Mar 2016 18:09:07 +0800 Subject: [PATCH 2/2] rename deactiveTabItem --- cocos/ui/UITabControl.cpp | 15 +++++++-------- cocos/ui/UITabControl.h | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cocos/ui/UITabControl.cpp b/cocos/ui/UITabControl.cpp index 6d81d8c789..b2207631b3 100644 --- a/cocos/ui/UITabControl.cpp +++ b/cocos/ui/UITabControl.cpp @@ -89,8 +89,7 @@ namespace ui } else { - headerCell->setSelected(false); - container->setVisible(false); + deactiveTabItem(tabItem); } headerCell->setContentSize(Size(_headerWidth, _headerHeight)); @@ -309,14 +308,14 @@ namespace ui { if (tabIndex <= -1 || tabIndex >= (int)_tabItems.size()) { - deactiveHeader(_selectedItem); + deactiveTabItem(_selectedItem); _selectedItem = nullptr; } else { - deactiveHeader(_selectedItem); + deactiveTabItem(_selectedItem); auto tabItem = _tabItems.at(tabIndex); - activeHeader(tabItem); + activeTabItem(tabItem); _selectedItem = tabItem; } } @@ -327,7 +326,7 @@ namespace ui auto tabItem = _tabItems.at(tabIndex); if (tabItem == _selectedItem) { - deactiveHeader(_selectedItem); + deactiveTabItem(_selectedItem); _selectedItem = nullptr; } } @@ -396,7 +395,7 @@ namespace ui } } - void TabControl::activeHeader(TabItem* item) + void TabControl::activeTabItem(TabItem* item) { if (item != nullptr) { @@ -408,7 +407,7 @@ namespace ui } } - void TabControl::deactiveHeader(TabItem* item) + void TabControl::deactiveTabItem(TabItem* item) { if (item != nullptr) { diff --git a/cocos/ui/UITabControl.h b/cocos/ui/UITabControl.h index 434d816008..e78fbfdec2 100644 --- a/cocos/ui/UITabControl.h +++ b/cocos/ui/UITabControl.h @@ -364,8 +364,8 @@ namespace ui { // format tab header and container after insert void initAfterInsert(int index); - void activeHeader(TabItem* item); - void deactiveHeader(TabItem* item); + void activeTabItem(TabItem* item); + void deactiveTabItem(TabItem* item); Vec2 getHeaderAnchorWithDock() const; TabItem* _selectedItem;