PuzzleSDK
UIRichTextXMLOutline类 参考

#include <UIRichTextTest.h>

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

Public 成员函数

 CREATE_FUNC (UIRichTextXMLOutline)
 
bool init () override
 
void touchEvent (cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
 
void switchWrapMode (cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
 
void switchAlignment (cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
 
- 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::RichText * _richText
 
- 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
 

详细描述

在文件 UIRichTextTest.h213 行定义.

成员函数说明

◆ CREATE_FUNC()

UIRichTextXMLOutline::CREATE_FUNC ( UIRichTextXMLOutline  )

◆ init()

bool UIRichTextXMLOutline::init ( )
overridevirtual

重载 UIScene .

在文件 UIRichTextTest.cpp1347 行定义.

1348{
1349 if (UIScene::init())
1350 {
1351 Size widgetSize = _widget->getContentSize();
1352
1353 // Add the alert
1354 Text *alert = Text::create("Outline", "fonts/Marker Felt.ttf", 30);
1355 alert->setColor(Color3B(159, 168, 176));
1356 alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 3.125));
1357 _widget->addChild(alert);
1358
1359
1360 Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
1361 button->setTouchEnabled(true);
1362 button->setTitleText("switch");
1363 button->setPosition(Vec2(widgetSize.width * 1 / 3, widgetSize.height / 2.0f + button->getContentSize().height * 2.5));
1364 button->addTouchEventListener(CC_CALLBACK_2(UIRichTextXMLOutline::touchEvent, this));
1365 button->setLocalZOrder(10);
1366 _widget->addChild(button);
1367
1368 Button* button2 = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
1369 button2->setTouchEnabled(true);
1370 button2->setTitleText("wrap mode");
1371 button2->setPosition(Vec2(widgetSize.width / 2, widgetSize.height / 2.0f + button2->getContentSize().height * 2.5));
1372 button2->addTouchEventListener(CC_CALLBACK_2(UIRichTextXMLOutline::switchWrapMode, this));
1373 button2->setLocalZOrder(10);
1374 _widget->addChild(button2);
1375
1376 Button* button3 = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png");
1377 button3->setTouchEnabled(true);
1378 button3->setTitleText("alignment");
1379 button3->setPosition(Vec2(widgetSize.width * 2 / 3, widgetSize.height / 2.0f + button2->getContentSize().height * 2.5));
1380 button3->addTouchEventListener(CC_CALLBACK_2(UIRichTextXMLOutline::switchAlignment, this));
1381 button3->setLocalZOrder(10);
1382 _widget->addChild(button3);
1383
1384 // RichText
1385 _richText = RichText::createWithXML("<font face='fonts/Marker Felt.ttf' size=\"24\"><outline color=\"#D2B48C\" size=\"2\">OUTLINE</outline></font>");
1386 _richText->ignoreContentAdaptWithSize(false);
1387 _richText->setContentSize(Size(100, 100));
1388
1389 _richText->setPosition(Vec2(widgetSize.width / 2, widgetSize.height / 2));
1390 _richText->setLocalZOrder(10);
1391
1392
1393 _widget->addChild(_richText);
1394
1395 // test remove all children, this call won't effect the test
1396 _richText->removeAllChildren();
1397
1398 return true;
1399 }
1400 return false;
1401}
void touchEvent(cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
void switchWrapMode(cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
void switchAlignment(cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
cocos2d::ui::RichText * _richText
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

引用了 _richText, UIScene::_widget, UIScene::init(), switchAlignment(), switchWrapMode() , 以及 touchEvent().

+ 函数调用图:

◆ switchAlignment()

void UIRichTextXMLOutline::switchAlignment ( cocos2d::Ref *  sender,
cocos2d::ui::Widget::TouchEventType  type 
)

在文件 UIRichTextTest.cpp1436 行定义.

1436 {
1437 if (type == Widget::TouchEventType::ENDED)
1438 {
1439 auto alignment = _richText->getHorizontalAlignment();
1440 alignment = static_cast<RichText::HorizontalAlignment>((static_cast<std::underlying_type<RichText::HorizontalAlignment>::type>(alignment) + 1) % 3);
1441 _richText->setHorizontalAlignment(alignment);
1442 }
1443}

引用了 _richText.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

◆ switchWrapMode()

void UIRichTextXMLOutline::switchWrapMode ( cocos2d::Ref *  sender,
cocos2d::ui::Widget::TouchEventType  type 
)

在文件 UIRichTextTest.cpp1426 行定义.

1427{
1428 if (type == Widget::TouchEventType::ENDED)
1429 {
1430 auto wrapMode = _richText->getWrapMode();
1431 wrapMode = (wrapMode == RichText::WRAP_PER_WORD) ? RichText::WRAP_PER_CHAR : RichText::WRAP_PER_WORD;
1432 _richText->setWrapMode(wrapMode);
1433 }
1434}

引用了 _richText.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

◆ touchEvent()

void UIRichTextXMLOutline::touchEvent ( cocos2d::Ref *  sender,
cocos2d::ui::Widget::TouchEventType  type 
)

在文件 UIRichTextTest.cpp1403 行定义.

1404{
1405 switch (type)
1406 {
1407 case Widget::TouchEventType::ENDED:
1408 {
1409 if (_richText->isIgnoreContentAdaptWithSize())
1410 {
1411 _richText->ignoreContentAdaptWithSize(false);
1412 _richText->setContentSize(Size(100, 100));
1413 }
1414 else
1415 {
1416 _richText->ignoreContentAdaptWithSize(true);
1417 }
1418 }
1419 break;
1420
1421 default:
1422 break;
1423 }
1424}

引用了 _richText.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

类成员变量说明

◆ _richText

cocos2d::ui::RichText* UIRichTextXMLOutline::_richText
protected

在文件 UIRichTextTest.h224 行定义.

被这些函数引用 init(), switchAlignment(), switchWrapMode() , 以及 touchEvent().


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