PuzzleSDK
UIScrollViewDisableTest类 参考

#include <UIScrollViewTest.h>

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

Public 成员函数

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

详细描述

在文件 UIScrollViewTest.h131 行定义.

构造及析构函数说明

◆ UIScrollViewDisableTest()

UIScrollViewDisableTest::UIScrollViewDisableTest ( )

在文件 UIScrollViewTest.cpp572 行定义.

573: _displayValueLabel(nullptr)
574{
575}
cocos2d::ui::Text * _displayValueLabel

◆ ~UIScrollViewDisableTest()

UIScrollViewDisableTest::~UIScrollViewDisableTest ( )

在文件 UIScrollViewTest.cpp577 行定义.

578{
579}

成员函数说明

◆ CREATE_FUNC()

UIScrollViewDisableTest::CREATE_FUNC ( UIScrollViewDisableTest  )

◆ init()

bool UIScrollViewDisableTest::init ( )
overridevirtual

重载 UIScene .

在文件 UIScrollViewTest.cpp581 行定义.

582{
583 if (UIScene::init())
584 {
585 Size widgetSize = _widget->getContentSize();
586
587 // Add a label in which the scrollview alert will be displayed
588 _displayValueLabel = Text::create("ScrollView Disable Test", "fonts/Marker Felt.ttf", 32);
589 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
590 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
591 widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
592 _uiLayer->addChild(_displayValueLabel);
593
594 // Add the alert
595 Text* alert = Text::create("ScrollView vertical", "fonts/Marker Felt.ttf", 30);
596 alert->setColor(Color3B(159, 168, 176));
597 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
598 _uiLayer->addChild(alert);
599
600 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
601
602 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
603
604 // Create the scrollview by vertical
605 ui::ScrollView* scrollView = ui::ScrollView::create();
606 scrollView->setContentSize(Size(280.0f, 100.0f));
607 Size backgroundSize = background->getContentSize();
608 scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
609 (backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
610 (widgetSize.height - backgroundSize.height) / 2.0f +
611 (backgroundSize.height - scrollView->getContentSize().height) / 2.0f));
612 scrollView->setScrollBarWidth(4);
613 scrollView->setTouchEnabled(false);
614 scrollView->setScrollBarPositionFromCorner(Vec2(2, 2));
615 scrollView->setScrollBarColor(Color3B::WHITE);
616 _uiLayer->addChild(scrollView);
617
618 ImageView* imageView = ImageView::create("cocosui/ccicon.png");
619
620 float innerWidth = scrollView->getContentSize().width;
621 float innerHeight = scrollView->getContentSize().height + imageView->getContentSize().height;
622
623 scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
624
625 Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
626 button->setPosition(Vec2(innerWidth / 2.0f, scrollView->getInnerContainerSize().height - button->getContentSize().height / 2.0f));
627 scrollView->addChild(button);
628
629 Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
630 titleButton->setTitleText("Title Button");
631 titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomBoundary() - button->getContentSize().height));
632 scrollView->addChild(titleButton);
633
634 Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png");
635 button_scale9->setScale9Enabled(true);
636 button_scale9->setContentSize(Size(100.0f, button_scale9->getVirtualRendererSize().height));
637 button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomBoundary() - titleButton->getContentSize().height));
638 scrollView->addChild(button_scale9);
639
640 imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getContentSize().height / 2.0f));
641 scrollView->addChild(imageView);
642
643
644 return true;
645 }
646
647 return false;
648}
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* UIScrollViewDisableTest::_displayValueLabel
protected

在文件 UIScrollViewTest.h142 行定义.

被这些函数引用 init().


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