PuzzleSDK
UICheckBoxDefaultBehaviorTest类 参考

#include <UICheckBoxTest.h>

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

Public 成员函数

 CREATE_FUNC (UICheckBoxDefaultBehaviorTest)
 
 UICheckBoxDefaultBehaviorTest ()
 
 ~UICheckBoxDefaultBehaviorTest ()
 
virtual 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
 

Protected 属性

cocos2d::ui::Text * _displayValueLabel
 
- 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
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

详细描述

在文件 UICheckBoxTest.h50 行定义.

构造及析构函数说明

◆ UICheckBoxDefaultBehaviorTest()

UICheckBoxDefaultBehaviorTest::UICheckBoxDefaultBehaviorTest ( )

在文件 UICheckBoxTest.cpp124 行定义.

125: _displayValueLabel(nullptr)
126{
127
128}
cocos2d::ui::Text * _displayValueLabel

◆ ~UICheckBoxDefaultBehaviorTest()

UICheckBoxDefaultBehaviorTest::~UICheckBoxDefaultBehaviorTest ( )

在文件 UICheckBoxTest.cpp130 行定义.

131{
132}

成员函数说明

◆ CREATE_FUNC()

UICheckBoxDefaultBehaviorTest::CREATE_FUNC ( UICheckBoxDefaultBehaviorTest  )

◆ init()

bool UICheckBoxDefaultBehaviorTest::init ( )
overridevirtual

重载 UIScene .

在文件 UICheckBoxTest.cpp134 行定义.

135{
136 if (UIScene::init())
137 {
138 Size widgetSize = _widget->getContentSize();
139
140 // Add a label in which the checkbox events will be displayed
141 _displayValueLabel = Text::create("No Event", "fonts/Marker Felt.ttf", 32);
142 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
143 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
144 _uiLayer->addChild(_displayValueLabel);
145
146 // Add the alert
147 Text* alert = Text::create("Only left two and the last checkbox can be clicked!","fonts/Marker Felt.ttf",20 );
148 alert->setColor(Color3B(159, 168, 176));
149 alert->setPosition(Vec2(widgetSize.width / 2.0f,
150 widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
151 _uiLayer->addChild(alert);
152
153 // Create the checkbox
154 CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
155 "cocosui/check_box_active.png");
156 checkBox->setPosition(Vec2(widgetSize.width / 2.0f - 50, widgetSize.height / 2.0f));
157
158 _uiLayer->addChild(checkBox);
159
160
161 // Create the checkbox
162 CheckBox* checkBox2 = CheckBox::create("cocosui/check_box_normal.png",
163 "cocosui/check_box_active.png");
164 checkBox2->setPosition(Vec2(widgetSize.width / 2.0f - 150, widgetSize.height / 2.0f));
165 checkBox2->ignoreContentAdaptWithSize(false);
166 checkBox2->setZoomScale(0.5f);
167 checkBox2->setContentSize(Size(80.0f,80.0f));
168 checkBox2->setName("bigCheckBox");
169 _uiLayer->addChild(checkBox2);
170
171
172 // Create the checkbox
173 CheckBox* checkBoxDisabled = CheckBox::create("cocosui/check_box_normal.png",
174 "cocosui/check_box_active.png");
175 checkBoxDisabled->setPosition(Vec2(widgetSize.width / 2.0f + 20, widgetSize.height / 2.0f));
176 checkBoxDisabled->setEnabled(false);
177 checkBoxDisabled->setBright(false);
178 _uiLayer->addChild(checkBoxDisabled);
179
180 CheckBox* checkBoxDisabled2 = CheckBox::create("cocosui/check_box_normal.png",
181 "cocosui/check_box_active.png");
182 checkBoxDisabled2->setPosition(Vec2(widgetSize.width / 2.0f + 70, widgetSize.height / 2.0f));
183 checkBoxDisabled2->setBright(false);
184 checkBoxDisabled2->setSelected(true);
185 _uiLayer->addChild(checkBoxDisabled2);
186 return true;
187 }
188 return false;
189}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

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

+ 函数调用图:

类成员变量说明

◆ _displayValueLabel

cocos2d::ui::Text* UICheckBoxDefaultBehaviorTest::_displayValueLabel
protected

在文件 UICheckBoxTest.h61 行定义.

被这些函数引用 init().


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