PuzzleSDK
UIScrollViewTest_ScrollToPercentBothDirection类 参考

#include <UIScrollViewTest.h>

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

Public 成员函数

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

构造及析构函数说明

◆ UIScrollViewTest_ScrollToPercentBothDirection()

UIScrollViewTest_ScrollToPercentBothDirection::UIScrollViewTest_ScrollToPercentBothDirection ( )

在文件 UIScrollViewTest.cpp272 行定义.

273: _displayValueLabel(nullptr)
274{
275
276}

◆ ~UIScrollViewTest_ScrollToPercentBothDirection()

UIScrollViewTest_ScrollToPercentBothDirection::~UIScrollViewTest_ScrollToPercentBothDirection ( )

在文件 UIScrollViewTest.cpp278 行定义.

279{
280}

成员函数说明

◆ CREATE_FUNC()

UIScrollViewTest_ScrollToPercentBothDirection::CREATE_FUNC ( UIScrollViewTest_ScrollToPercentBothDirection  )

◆ init()

bool UIScrollViewTest_ScrollToPercentBothDirection::init ( )
overridevirtual

重载 UIScene .

在文件 UIScrollViewTest.cpp282 行定义.

283{
284 if (UIScene::init())
285 {
286 Size widgetSize = _widget->getContentSize();
287
288 // Add a label in which the dragpanel events will be displayed
289 _displayValueLabel = Text::create("No Event", "fonts/Marker Felt.ttf",30);
290 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
291 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
292 _uiLayer->addChild(_displayValueLabel);
293
294 // Add the alert
295 Text* alert = Text::create("ScrollView scroll to percent both direction without scroll bar","fonts/Marker Felt.ttf",20);
296 alert->setColor(Color3B(159, 168, 176));
297 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 4.5));
298 _uiLayer->addChild(alert);
299
300 Layout* root = static_cast<Layout*>(_uiLayer->getChildByTag(81));
301
302 Layout* background = static_cast<Layout*>(root->getChildByName("background_Panel"));
303
304 ui::ScrollView* sc = ui::ScrollView::create();
305 sc->setBackGroundColor(Color3B::GREEN);
306 sc->setBackGroundColorType(Layout::BackGroundColorType::SOLID);
307 sc->setDirection(ui::ScrollView::Direction::BOTH);
308 sc->setInnerContainerSize(Size(480.0f, 320.0f));
309 sc->setContentSize(Size(100.0f,100.0f));
310 sc->setScrollBarEnabled(false);
311 Size backgroundSize = background->getContentSize();
312 sc->setPosition(Vec2((widgetSize.width - backgroundSize.width) / 2.0f +
313 (backgroundSize.width - sc->getContentSize().width) / 2.0f,
314 (widgetSize.height - backgroundSize.height) / 2.0f +
315 (backgroundSize.height - sc->getContentSize().height) / 2.0f));
316 sc->scrollToPercentBothDirection(Vec2(50, 50), 1, true);
317 ImageView* iv = ImageView::create("cocosui/Hello.png");
318 iv->setPosition(Vec2(240.0f, 160.0f));
319 sc->addChild(iv);
320 _uiLayer->addChild(sc);
321
322 return true;
323 }
324 return false;
325}
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* UIScrollViewTest_ScrollToPercentBothDirection::_displayValueLabel
protected

在文件 UIScrollViewTest.h86 行定义.

被这些函数引用 init().


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