PuzzleSDK
UIScrollViewInnerSize类 参考

#include <UIScrollViewTest.h>

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

Public 成员函数

 CREATE_FUNC (UIScrollViewInnerSize)
 
 UIScrollViewInnerSize ()
 
 ~UIScrollViewInnerSize ()
 
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.h145 行定义.

构造及析构函数说明

◆ UIScrollViewInnerSize()

UIScrollViewInnerSize::UIScrollViewInnerSize ( )

在文件 UIScrollViewTest.cpp652 行定义.

653 : _displayValueLabel(nullptr)
654{
655}
cocos2d::ui::Text * _displayValueLabel

◆ ~UIScrollViewInnerSize()

UIScrollViewInnerSize::~UIScrollViewInnerSize ( )

在文件 UIScrollViewTest.cpp657 行定义.

658{
659}

成员函数说明

◆ CREATE_FUNC()

UIScrollViewInnerSize::CREATE_FUNC ( UIScrollViewInnerSize  )

◆ init()

bool UIScrollViewInnerSize::init ( )
overridevirtual

重载 UIScene .

在文件 UIScrollViewTest.cpp661 行定义.

662{
663 if (UIScene::init())
664 {
665 Size widgetSize = _widget->getContentSize();
666
667 // Add a label in which the scrollview alert will be displayed
668 _displayValueLabel = Text::create("ScrollView InnerSize Test", "fonts/Marker Felt.ttf", 32);
669 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
670 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
671 widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
672 _uiLayer->addChild(_displayValueLabel);
673
674 // Add the alert
675 Text* alert = Text::create("ScrollView & InnerContainer should be align to the left and top point", "fonts/Marker Felt.ttf", 10);
676 alert->setColor(Color3B(159, 168, 176));
677 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
678 _uiLayer->addChild(alert);
679
680 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
681
682 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
683
684 // Create the scrollview by vertical
685 ui::ScrollView* scrollView = ui::ScrollView::create();
686 scrollView->setContentSize(Size(200.0f, 50.0f));
687 Size backgroundSize = background->getContentSize();
688 scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
689 (backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
690 (widgetSize.height - backgroundSize.height) / 2.0f +
691 (backgroundSize.height - scrollView->getContentSize().height) / 2.0f));
692 scrollView->setScrollBarWidth(4);
693 scrollView->setTouchEnabled(false);
694 scrollView->setScrollBarPositionFromCorner(Vec2(2, 2));
695 scrollView->setScrollBarColor(Color3B::WHITE);
696 scrollView->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
697 scrollView->setBackGroundColor(Color3B(150, 150, 100));
698 scrollView->getInnerContainer()->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
699 scrollView->getInnerContainer()->setBackGroundColor(Color3B(50, 100, 50));
700 scrollView->getInnerContainer()->setBackGroundColorOpacity(100);
701 scrollView->setClippingEnabled(false);
702 _uiLayer->addChild(scrollView);
703
704 scrollView->setInnerContainerSize(Size(250.f, 100.f));
705
706 return true;
707 }
708
709 return false;
710}
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* UIScrollViewInnerSize::_displayValueLabel
protected

在文件 UIScrollViewTest.h156 行定义.

被这些函数引用 init().


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