PuzzleSDK
UITextFieldTest_Password类 参考

#include <UITextFieldTest.h>

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

Public 成员函数

 CREATE_FUNC (UITextFieldTest_Password)
 
 UITextFieldTest_Password ()
 
 ~UITextFieldTest_Password ()
 
virtual bool init () override
 
void textFieldEvent (cocos2d::Ref *sender, cocos2d::ui::TextField::EventType 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::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
 

详细描述

在文件 UITextFieldTest.h63 行定义.

构造及析构函数说明

◆ UITextFieldTest_Password()

UITextFieldTest_Password::UITextFieldTest_Password ( )

在文件 UITextFieldTest.cpp204 行定义.

205: _displayValueLabel(nullptr)
206{
207
208}
cocos2d::ui::Text * _displayValueLabel

◆ ~UITextFieldTest_Password()

UITextFieldTest_Password::~UITextFieldTest_Password ( )

在文件 UITextFieldTest.cpp210 行定义.

211{
212}

成员函数说明

◆ CREATE_FUNC()

UITextFieldTest_Password::CREATE_FUNC ( UITextFieldTest_Password  )

◆ init()

bool UITextFieldTest_Password::init ( )
overridevirtual

重载 UIScene .

在文件 UITextFieldTest.cpp214 行定义.

215{
216 if (UIScene::init())
217 {
218 Size screenSize = Director::getInstance()->getWinSize();
219
220 // Add a label in which the textfield events will be displayed
221 _displayValueLabel = Text::create("No Event","fonts/Marker Felt.ttf",32);
222 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
223 _displayValueLabel->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f + _displayValueLabel->getContentSize().height * 1.5f));
224 _uiLayer->addChild(_displayValueLabel);
225
226 // Add the alert
227 Text *alert = Text::create("TextField password","fonts/Marker Felt.ttf",30);
228 alert->setColor(Color3B(159, 168, 176));
229 alert->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f - alert->getContentSize().height * 3.075f));
230 _uiLayer->addChild(alert);
231
232 // Create the textfield
233 TextField* textField = TextField::create("input password here","Arial",30);
234 textField->setPasswordEnabled(true);
235 textField->setPasswordStyleText("*");
236 textField->setPosition(Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f));
237 textField->addEventListener(CC_CALLBACK_2(UITextFieldTest_Password::textFieldEvent, this));
238 _uiLayer->addChild(textField);
239
240 return true;
241 }
242 return false;
243}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
void textFieldEvent(cocos2d::Ref *sender, cocos2d::ui::TextField::EventType type)

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

+ 函数调用图:

◆ textFieldEvent()

void UITextFieldTest_Password::textFieldEvent ( cocos2d::Ref *  sender,
cocos2d::ui::TextField::EventType  type 
)

在文件 UITextFieldTest.cpp245 行定义.

246{
247 switch (type)
248 {
249 case TextField::EventType::ATTACH_WITH_IME:
250 {
251 TextField* textField = dynamic_cast<TextField*>(pSender);
252 Size screenSize = Director::getInstance()->getWinSize();
253 textField->runAction(MoveTo::create(0.225f,
254 Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f + textField->getContentSize().height / 2.0f)));
255 _displayValueLabel->setString(StringUtils::format("attach with IME password"));
256 }
257 break;
258
259 case TextField::EventType::DETACH_WITH_IME:
260 {
261 TextField* textField = dynamic_cast<TextField*>(pSender);
262 Size screenSize = Director::getInstance()->getWinSize();
263 textField->runAction(MoveTo::create(0.175f, Vec2(screenSize.width / 2.0f, screenSize.height / 2.0f)));
264 _displayValueLabel->setString(StringUtils::format("detach with IME password"));
265 }
266 break;
267
268 case TextField::EventType::INSERT_TEXT:
269 _displayValueLabel->setString(StringUtils::format("insert words password"));
270 break;
271
272 case TextField::EventType::DELETE_BACKWARD:
273 _displayValueLabel->setString(StringUtils::format("delete word password"));
274 break;
275
276 default:
277 break;
278 }
279}

引用了 _displayValueLabel.

被这些函数引用 init().

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

类成员变量说明

◆ _displayValueLabel

cocos2d::ui::Text* UITextFieldTest_Password::_displayValueLabel
protected

在文件 UITextFieldTest.h75 行定义.

被这些函数引用 init() , 以及 textFieldEvent().


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