PuzzleSDK
UIButtonIgnoreContentSizeTest类 参考

#include <UIButtonTest.h>

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

Public 成员函数

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

详细描述

在文件 UIButtonTest.h169 行定义.

构造及析构函数说明

◆ UIButtonIgnoreContentSizeTest()

UIButtonIgnoreContentSizeTest::UIButtonIgnoreContentSizeTest ( )

在文件 UIButtonTest.cpp801 行定义.

802: _displayValueLabel(nullptr)
803{
804
805}
cocos2d::ui::Text * _displayValueLabel
Definition: UIButtonTest.h:180

◆ ~UIButtonIgnoreContentSizeTest()

UIButtonIgnoreContentSizeTest::~UIButtonIgnoreContentSizeTest ( )

在文件 UIButtonTest.cpp807 行定义.

808{
809}

成员函数说明

◆ CREATE_FUNC()

UIButtonIgnoreContentSizeTest::CREATE_FUNC ( UIButtonIgnoreContentSizeTest  )

◆ init()

bool UIButtonIgnoreContentSizeTest::init ( )
overridevirtual

重载 UIScene .

在文件 UIButtonTest.cpp811 行定义.

812{
813 if (UIScene::init())
814 {
815 Size widgetSize = _widget->getContentSize();
816
817 // Add a label in which the button events will be displayed
818 _displayValueLabel = Text::create("Button IgnoreContent Size Test", "fonts/Marker Felt.ttf",32);
819 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
820 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20));
821 _uiLayer->addChild(_displayValueLabel);
822
823
824 // Create the button
825 auto button = Button::create("cocosui/animationbuttonnormal.png",
826 "cocosui/animationbuttonpressed.png");
827 button->ignoreContentAdaptWithSize(false);
828 button->setContentSize(Size(200.0f,100.0f));
829 button->setPositionNormalized(Vec2(0.3f, 0.5f));
830 button->setTitleText("PLAY GAME");
831 button->setZoomScale(0.3f);
832 button->setPressedActionEnabled(true);
833 button->addClickEventListener([=](Ref* sender) {
834 CCLOG("clicked!");
835 button->setScale(1.2f);
836 });
837 _uiLayer->addChild(button);
838
839 // Create the button
840 auto button2 = Button::create("cocosui/animationbuttonnormal.png",
841 "cocosui/animationbuttonpressed.png");
842 button2->ignoreContentAdaptWithSize(false);
843 button2->setContentSize(Size(200.0f,100.0f));
844 button2->setPositionNormalized(Vec2(0.8f, 0.5f));
845 button2->setTitleText("PLAY GAME");
846 button2->setZoomScale(0.3f);
847 button2->setPressedActionEnabled(true);
848 button2->addClickEventListener([=](Ref* sender) {
849 button2->runAction(ScaleTo::create(1.0f, 1.2f));
850 CCLOG("clicked!");
851 });
852 _uiLayer->addChild(button2);
853
854 return true;
855 }
856 return false;
857}
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* UIButtonIgnoreContentSizeTest::_displayValueLabel
protected

在文件 UIButtonTest.h180 行定义.

被这些函数引用 init().


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