PuzzleSDK
Issue8316类 参考

#include <UIListViewTest.h>

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

Public 成员函数

 CREATE_FUNC (Issue8316)
 
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
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- 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
 

详细描述

在文件 UIListViewTest.h114 行定义.

成员函数说明

◆ CREATE_FUNC()

Issue8316::CREATE_FUNC ( Issue8316  )

◆ init()

bool Issue8316::init ( )
overridevirtual

重载 UIScene .

在文件 UIListViewTest.cpp582 行定义.

583{
584 if (UIScene::init())
585 {
586 Size widgetSize = _widget->getContentSize();
587
588 auto label = Text::create("Issue 8316", "fonts/Marker Felt.ttf", 32);
589 label->setAnchorPoint(Vec2(0.5f, -1.0f));
590 label->setPosition(Vec2(widgetSize.width / 2.0f,
591 widgetSize.height / 2.0f + label->getContentSize().height * 1.5f));
592 _uiLayer->addChild(label);
593
594 Text* alert = Text::create("Can not scroll list view", "fonts/Marker Felt.ttf", 20);
595 alert->setColor(Color3B(159, 168, 176));
596 alert->setPosition(Vec2(widgetSize.width / 2.0f,
597 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 Size backgroundSize = background->getContentSize();
604
605 // Create the list view ex
606 ListView* listView = ListView::create();
607 // set list view ex direction
608 listView->setDirection(ui::ScrollView::Direction::VERTICAL);
609 listView->setBounceEnabled(true);
610 listView->setTouchEnabled(false);
611 listView->setBackGroundImage("cocosui/green_edit.png");
612 listView->setBackGroundImageScale9Enabled(true);
613 listView->setContentSize(Size(240.0f, 130.0f));
614 listView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
615 (backgroundSize.width - listView->getContentSize().width) / 2.0f,
616 (widgetSize.height - backgroundSize.height) / 2.0f +
617 (backgroundSize.height - listView->getContentSize().height) / 2.0f));
618 listView->setScrollBarPositionFromCorner(Vec2(7, 7));
619 listView->setClippingEnabled(true);
620 listView->setClippingType(ui::Layout::ClippingType::SCISSOR);
621 listView->setName("listview1");
622
623 {
624 Button* default_button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png");
625 default_button->setName("Title Button");
626
627 Layout* default_item = Layout::create();
628 default_item->setTouchEnabled(true);
629 default_item->setContentSize(default_button->getContentSize());
630 default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f,
631 default_item->getContentSize().height / 2.0f));
632 default_item->addChild(default_button);
633
634 // set model
635 listView->setItemModel(default_item);
636 listView->pushBackDefaultItem();
637 listView->pushBackDefaultItem();
638 listView->pushBackDefaultItem();
639 }
640
641 _uiLayer->addChild(listView);
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

引用了 UIScene::_uiLayer, UIScene::_widget , 以及 UIScene::init().

+ 函数调用图:

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