PuzzleSDK
UIPageViewChildSizeTest类 参考

#include <UIPageViewTest.h>

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

Public 成员函数

 CREATE_FUNC (UIPageViewChildSizeTest)
 
 UIPageViewChildSizeTest ()
 
 ~UIPageViewChildSizeTest ()
 
virtual bool init () override
 
void pageViewEvent (cocos2d::Ref *sender, cocos2d::ui::PageView::EventType type)
 
- 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
 

详细描述

在文件 UIPageViewTest.h143 行定义.

构造及析构函数说明

◆ UIPageViewChildSizeTest()

UIPageViewChildSizeTest::UIPageViewChildSizeTest ( )

在文件 UIPageViewTest.cpp912 行定义.

913 : _displayValueLabel(nullptr)
914{
915
916}
cocos2d::ui::Text * _displayValueLabel

◆ ~UIPageViewChildSizeTest()

UIPageViewChildSizeTest::~UIPageViewChildSizeTest ( )

在文件 UIPageViewTest.cpp918 行定义.

919{
920}

成员函数说明

◆ CREATE_FUNC()

UIPageViewChildSizeTest::CREATE_FUNC ( UIPageViewChildSizeTest  )

◆ init()

bool UIPageViewChildSizeTest::init ( )
overridevirtual

重载 UIScene .

在文件 UIPageViewTest.cpp922 行定义.

923{
924 if (UIScene::init())
925 {
926 Size widgetSize = _widget->getContentSize();
927
928 // Add a label in which the dragpanel events will be displayed
929 _displayValueLabel = Text::create("Move by horizontal direction", "fonts/Marker Felt.ttf", 32);
930 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
931 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
932 widgetSize.height / 2.0f +
933 _displayValueLabel->getContentSize().height * 1.5));
934 _uiLayer->addChild(_displayValueLabel);
935
936 // Add the black background
937 Text* alert = Text::create("PageView", "fonts/Marker Felt.ttf", 30);
938 alert->setColor(Color3B(159, 168, 176));
939 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
940 _uiLayer->addChild(alert);
941
942 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
943
944 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
945
946 // Create the page view
947 Size size(240, 130);
948 PageView* pageView = PageView::create();
949 pageView->setDirection(PageView::Direction::HORIZONTAL);
950 pageView->setContentSize(size);
951 Size backgroundSize = background->getContentSize();
952 pageView->setPosition((widgetSize - pageView->getContentSize()) / 2.0f);
953 pageView->removeAllItems();
954 pageView->setIndicatorEnabled(true);
955
956 int pageCount = 4;
957 for (int i = 0; i < pageCount; ++i)
958 {
959 ImageView* imageView = ImageView::create("cocosui/scrollviewbg.png");
960 imageView->setScale9Enabled(true);
961
962 Text* label = Text::create(StringUtils::format("page %d", (i + 1)), "fonts/Marker Felt.ttf", 30);
963 label->setColor(Color3B(192, 192, 192));
964 label->setAnchorPoint(Vec2::ZERO);
965 imageView->addChild(label);
966
967 pageView->insertCustomItem(imageView, i);
968 }
969
970 pageView->addEventListener((PageView::ccPageViewCallback)CC_CALLBACK_2(UIPageViewChildSizeTest::pageViewEvent, this));
971
972 _uiLayer->addChild(pageView);
973
974 return true;
975 }
976 return false;
977}
void pageViewEvent(cocos2d::Ref *sender, cocos2d::ui::PageView::EventType type)
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() , 以及 pageViewEvent().

+ 函数调用图:

◆ pageViewEvent()

void UIPageViewChildSizeTest::pageViewEvent ( cocos2d::Ref *  sender,
cocos2d::ui::PageView::EventType  type 
)

在文件 UIPageViewTest.cpp979 行定义.

980{
981 switch (type)
982 {
983 case PageView::EventType::TURNING:
984 {
985 PageView* pageView = dynamic_cast<PageView*>(pSender);
986
987 _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast<long>(pageView->getCurrentPageIndex() + 1)));
988 }
989 break;
990
991 default:
992 break;
993 }
994}

引用了 _displayValueLabel.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

类成员变量说明

◆ _displayValueLabel

cocos2d::ui::Text* UIPageViewChildSizeTest::_displayValueLabel
protected

在文件 UIPageViewTest.h156 行定义.

被这些函数引用 init() , 以及 pageViewEvent().


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