PuzzleSDK
UITabControlTest类 参考

#include <UITabControlTest.h>

+ 类 UITabControlTest 继承关系图:
+ UITabControlTest 的协作图:

Public 成员函数

 CREATE_FUNC (UITabControlTest)
 
 UITabControlTest ()
 
 ~UITabControlTest ()
 
bool init () override
 
- Public 成员函数 继承自 UIScene
 UIScene ()
 
 ~UIScene ()
 
virtual void onEnter () override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string title () const
 
virtual std::string subtitle () const
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 UIScene
cocos2d::Layer * _uiLayer
 
cocos2d::ui::Layout * _widget
 
cocos2d::ui::Text * _sceneTitle
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 UITabControlTest.h33 行定义.

构造及析构函数说明

◆ UITabControlTest()

UITabControlTest::UITabControlTest ( )

在文件 UITabControlTest.cpp38 行定义.

39{
40}

◆ ~UITabControlTest()

UITabControlTest::~UITabControlTest ( )

在文件 UITabControlTest.cpp42 行定义.

43{
44
45}

成员函数说明

◆ CREATE_FUNC()

UITabControlTest::CREATE_FUNC ( UITabControlTest  )

◆ init()

bool UITabControlTest::init ( )
overridevirtual

重载 UIScene .

在文件 UITabControlTest.cpp47 行定义.

48{
49
50 if (UIScene::init())
51 {
52 Size widgetSize = _widget->getContentSize();
53
54 auto displayText = Text::create();
55 displayText->setPosition(VisibleRect::bottom() + Vec2(0, 50));
56 _uiLayer->addChild(displayText);
57
58 auto tab = TabControl::create();
59 tab->setContentSize(Size(200.f, 200.f));
60 tab->setHeaderHeight(20.f);
61 tab->setHeaderWidth(70.f);
62 tab->setHeaderSelectedZoom(.1f);
63 tab->setHeaderDockPlace(TabControl::Dock::TOP);
64
65 auto header1 = TabHeader::create();
66 header1->setTitleText("background");
67 header1->loadTextureBackGround("cocosui/check_box_normal_disable.png");
68 auto header2 = TabHeader::create("cross", "cocosui/check_box_normal_disable.png", "cocosui/check_box_active.png");
69 auto header3 = TabHeader::create("press&cross", "cocosui/check_box_normal.png",
70 "cocosui/check_box_normal_press.png",
71 "cocosui/check_box_active.png",
72 "cocosui/check_box_normal_disable.png",
73 "cocosui/check_box_active_disable.png");
74
75 auto container1 = Layout::create();
76 container1->setOpacity(255);
77 container1->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
78 container1->setBackGroundColor(Color3B::GRAY);
79 container1->setBackGroundColorOpacity(255);
80 auto container2 = Layout::create();
81 container2->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
82 container2->setOpacity(255);
83 container2->setBackGroundColor(Color3B::BLUE);
84 container2->setBackGroundColorOpacity(255);
85 auto container3 = Layout::create();
86 container3->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
87 container3->setOpacity(255);
88 container3->setBackGroundColor(Color3B::RED);
89 container3->setBackGroundColorOpacity(255);
90
91 tab->insertTab(0, header1, container1);
92 tab->insertTab(1, header2, container2);
93 tab->insertTab(2, header3, container3);
94
95 tab->setSelectTab(2);
96
97 _uiLayer->addChild(tab);
98 tab->setPosition(Vec2(widgetSize.width * .5f, widgetSize.height * .5f));
99
100 tab->setTabChangedEventListener(
101 [displayText](int index, TabControl::EventType evtType)
102 {
103 displayText->retain();
104 char display[20];
105 sprintf(display, "tab %d selected", index);
106 displayText->setString(display);
107 displayText->release();
108 }
109 );
110
111 return true;
112 }
113 return false;
114}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45
static cocos2d::Vec2 bottom()
Definition: VisibleRect.cpp:63

引用了 UIScene::_uiLayer, UIScene::_widget, VisibleRect::bottom() , 以及 UIScene::init().

+ 函数调用图:

该类的文档由以下文件生成: