PuzzleSDK
Issue12692类 参考

#include <UIListViewTest.h>

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

Public 成员函数

 CREATE_FUNC (Issue12692)
 
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.h106 行定义.

成员函数说明

◆ CREATE_FUNC()

Issue12692::CREATE_FUNC ( Issue12692  )

◆ init()

bool Issue12692::init ( )
overridevirtual

重载 UIScene .

在文件 UIListViewTest.cpp486 行定义.

487{
488 if (UIScene::init())
489 {
490 Size widgetSize = _widget->getContentSize();
491
492 auto label = Text::create("Issue 12692", "fonts/Marker Felt.ttf", 32);
493 label->setName("Text Title");
494 label->setAnchorPoint(Vec2(0.5f, -1.0f));
495 label->setPosition(Vec2(widgetSize.width / 2.0f,
496 widgetSize.height / 2.0f + label->getContentSize().height * 1.5f));
497 _uiLayer->addChild(label);
498
499
500 Text* alert = Text::create("ListView in ListView enable Scissor Clipping", "fonts/Marker Felt.ttf", 20);
501 alert->setName("Text Alert");
502 alert->setColor(Color3B(159, 168, 176));
503 alert->setPosition(Vec2(widgetSize.width / 2.0f,
504 widgetSize.height / 2.0f - alert->getContentSize().height * 3.075f));
505 _uiLayer->addChild(alert);
506
507 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
508
509 Layout* background = dynamic_cast<Layout*>(root->getChildByName("background_Panel"));
510 Size backgroundSize = background->getContentSize();
511
512 // Create the list view ex
513 ListView* listView = ListView::create();
514 // set list view ex direction
515 listView->setDirection(ui::ScrollView::Direction::VERTICAL);
516 listView->setBounceEnabled(true);
517 listView->setBackGroundImage("cocosui/green_edit.png");
518 listView->setBackGroundImageScale9Enabled(true);
519 listView->setContentSize(Size(240.0f, 130.0f));
520 listView->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
521 (backgroundSize.width - listView->getContentSize().width) / 2.0f,
522 (widgetSize.height - backgroundSize.height) / 2.0f +
523 (backgroundSize.height - listView->getContentSize().height) / 2.0f));
524 listView->setScrollBarPositionFromCorner(Vec2(7, 7));
525 listView->setClippingEnabled(true);
526 listView->setClippingType(ui::Layout::ClippingType::SCISSOR);
527 listView->setName("listview1");
528 _uiLayer->addChild(listView);
529
530 auto list2 = ListView::create();
531 list2->setDirection(ui::ScrollView::Direction::VERTICAL);
532 list2->setBounceEnabled(true);
533 list2->setBackGroundImage("cocosui/green_edit.png");
534 list2->setBackGroundImageScale9Enabled(true);
535 list2->setContentSize(Size(240, 65));
536 list2->setClippingEnabled(true);
537 list2->setClippingType(ui::Layout::ClippingType::SCISSOR);
538 list2->setName("listview2");
539 listView->insertCustomItem(list2, 0);
540
541 {
542 Button* default_button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png");
543 default_button->setName("Title Button");
544
545 Layout* default_item = Layout::create();
546 default_item->setTouchEnabled(true);
547 default_item->setContentSize(default_button->getContentSize());
548 default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f,
549 default_item->getContentSize().height / 2.0f));
550 default_item->addChild(default_button);
551
552 // set model
553 listView->setItemModel(default_item);
554 listView->pushBackDefaultItem();
555 listView->pushBackDefaultItem();
556 listView->pushBackDefaultItem();
557 }
558 {
559 Button* default_button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png");
560 default_button->setName("Title Button 2");
561
562 Layout* default_item = Layout::create();
563 default_item->setTouchEnabled(true);
564 default_item->setContentSize(default_button->getContentSize());
565 default_button->setPosition(Vec2(default_item->getContentSize().width / 2.0f,
566 default_item->getContentSize().height / 2.0f));
567 default_item->addChild(default_button);
568
569 // set model
570 list2->setItemModel(default_item);
571 list2->pushBackDefaultItem();
572 list2->pushBackDefaultItem();
573 list2->pushBackDefaultItem();
574 }
575 return true;
576 }
577
578 return false;
579}
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().

+ 函数调用图:

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