PuzzleSDK
UIScrollViewRotated类 参考

#include <UIScrollViewTest.h>

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

Public 成员函数

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

构造及析构函数说明

◆ UIScrollViewRotated()

UIScrollViewRotated::UIScrollViewRotated ( )

在文件 UIScrollViewTest.cpp491 行定义.

492: _displayValueLabel(nullptr)
493{
494}
cocos2d::ui::Text * _displayValueLabel

◆ ~UIScrollViewRotated()

UIScrollViewRotated::~UIScrollViewRotated ( )

在文件 UIScrollViewTest.cpp496 行定义.

497{
498}

成员函数说明

◆ CREATE_FUNC()

UIScrollViewRotated::CREATE_FUNC ( UIScrollViewRotated  )

◆ init()

bool UIScrollViewRotated::init ( )
overridevirtual

重载 UIScene .

在文件 UIScrollViewTest.cpp500 行定义.

501{
502 if (UIScene::init())
503 {
504 Size widgetSize = _widget->getContentSize();
505
506 // Add a label in which the scrollview alert will be displayed
507 _displayValueLabel = Text::create("Move by vertical direction", "fonts/Marker Felt.ttf", 32);
508 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
509 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
510 widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
511 _uiLayer->addChild(_displayValueLabel);
512
513 // Add the alert
514 Text* alert = Text::create("ScrollView vertical", "fonts/Marker Felt.ttf", 30);
515 alert->setColor(Color3B(159, 168, 176));
516 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
517 _uiLayer->addChild(alert);
518
519 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
520
521 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
522
523 // Create the scrollview by vertical
524 ui::ScrollView* scrollView = ui::ScrollView::create();
525 scrollView->setContentSize(Size(280.0f, 150.0f));
526 scrollView->setDirection(ui::ScrollView::Direction::VERTICAL);
527 Size backgroundSize = background->getContentSize();
528 scrollView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
529 (backgroundSize.width - scrollView->getContentSize().width) / 2.0f,
530 (widgetSize.height - backgroundSize.height) / 2.0f +
531 (backgroundSize.height - scrollView->getContentSize().height) / 2.0f + 100) );
532 scrollView->setRotation(45);
533 scrollView->setScrollBarPositionFromCorner(Vec2(4, 4));
534 scrollView->setScrollBarColor(Color3B::WHITE);
535 _uiLayer->addChild(scrollView);
536
537 ImageView* imageView = ImageView::create("cocosui/ccicon.png");
538
539 float innerWidth = scrollView->getContentSize().width;
540 float innerHeight = scrollView->getContentSize().height + imageView->getContentSize().height;
541
542 scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
543
544 Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
545 button->setPosition(Vec2(innerWidth / 2.0f, scrollView->getInnerContainerSize().height - button->getContentSize().height / 2.0f));
546 scrollView->addChild(button);
547
548 Button* titleButton = Button::create("cocosui/backtotopnormal.png", "cocosui/backtotoppressed.png");
549 titleButton->setTitleText("Title Button");
550 titleButton->setPosition(Vec2(innerWidth / 2.0f, button->getBottomBoundary() - button->getContentSize().height));
551 scrollView->addChild(titleButton);
552
553 Button* button_scale9 = Button::create("cocosui/button.png", "cocosui/buttonHighlighted.png");
554 button_scale9->setScale9Enabled(true);
555 button_scale9->setContentSize(Size(100.0f, button_scale9->getVirtualRendererSize().height));
556 button_scale9->setPosition(Vec2(innerWidth / 2.0f, titleButton->getBottomBoundary() - titleButton->getContentSize().height));
557 scrollView->addChild(button_scale9);
558
559 imageView->setPosition(Vec2(innerWidth / 2.0f, imageView->getContentSize().height / 2.0f));
560 scrollView->addChild(imageView);
561
562
563
564 return true;
565 }
566
567 return false;
568}
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* UIScrollViewRotated::_displayValueLabel
protected

在文件 UIScrollViewTest.h128 行定义.

被这些函数引用 init().


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