Cocos2d-x  v3.12
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
UICCTextField Class Reference

A helper class which inherit from. More...

Inherits TextFieldTTF, and TextFieldDelegate.

Public Member Functions

 UICCTextField ()
 Default constructor.
 
 ~UICCTextField ()
 Default destructor.
 
virtual bool onTextFieldAttachWithIME (TextFieldTTF *pSender) override
 The callback method of IME attached on the TextField. More...
 
virtual bool onTextFieldDetachWithIME (TextFieldTTF *pSender) override
 The callback method of IME detached on the TextField. More...
 
virtual bool onTextFieldInsertText (TextFieldTTF *pSender, const char *text, size_t nLen) override
 The callback method of text inserted on the TextField. More...
 
virtual bool onTextFieldDeleteBackward (TextFieldTTF *pSender, const char *delText, size_t nLen) override
 The callback method of text will be delete on the TextField. More...
 
void insertText (const char *text, size_t len) override
 insert text
 
void deleteBackward () override
 delete back ward
 
void openIME ()
 Open up the IME.
 
void closeIME ()
 Close the IME.
 
void setMaxLengthEnabled (bool enable)
 Toggle enable max length limitation. More...
 
bool isMaxLengthEnabled () const
 Query max length enable state. More...
 
void setMaxLength (int length)
 Set maxmize length. More...
 
int getMaxLength () const
 Get maximize length. More...
 
std::size_t getCharCount () const
 Return the total inputed charaters. More...
 
void setPasswordEnabled (bool enable)
 Toggle password input mode. More...
 
bool isPasswordEnabled () const
 Query whether password input mode is enabled or not. More...
 
void setPasswordStyleText (const std::string &styleText)
 Change password style text. More...
 
void setPasswordText (const std::string &text)
 Set the password text content. More...
 
void setAttachWithIME (bool attach)
 Toggle attach with IME. More...
 
bool getAttachWithIME () const
 Query whether the IME is attached or not. More...
 
void setDetachWithIME (bool detach)
 Toggle detach with IME. More...
 
bool getDetachWithIME () const
 Query whether IME is detached or not. More...
 
void setInsertText (bool insert)
 Toggle enable text insert. More...
 
bool getInsertText () const
 Query whether insert text is enabled or not. More...
 
void setDeleteBackward (bool deleteBackward)
 Toggle enable delete backward. More...
 
bool getDeleteBackward () const
 Query whether delete backward is enabled or not. More...
 
- Public Member Functions inherited from TextFieldTTF
 TextFieldTTF ()
 Default constructor.
 
virtual ~TextFieldTTF ()
 Default destructor.
 
bool initWithPlaceHolder (const std::string &placeholder, const Size &dimensions, TextHAlignment alignment, const std::string &fontName, float fontSize)
 Initializes the TextFieldTTF with a font name, alignment, dimension and font size. More...
 
bool initWithPlaceHolder (const std::string &placeholder, const std::string &fontName, float fontSize)
 Creates a TextFieldTTF from placeholder, a fontname and font size. More...
 
virtual bool attachWithIME () override
 Open keyboard and receive input text. More...
 
virtual bool detachWithIME () override
 End text input and close keyboard. More...
 
var detachWithIME ()
 End text input and close keyboard. More...
 
local detachWithIME ()
 End text input and close keyboard. More...
 
std::size_t getCharCount () const
 Query the currently inputed character count. More...
 
local getCharCount ()
 Query the currently inputed character count. More...
 
virtual const Color4BgetColorSpaceHolder ()
 Query the color of place holder. More...
 
var getColorSpaceHolder ()
 Query the color of place holder. More...
 
local getColorSpaceHolder ()
 Query the color of place holder. More...
 
virtual void setColorSpaceHolder (const Color3B &color)
 Change input placeholder color. More...
 
local setColorSpaceHolder ( local color)
 Change input placeholder color. More...
 
virtual void setColorSpaceHolder (const Color4B &color)
 Change the placeholder color. More...
 
local setColorSpaceHolder ( local color)
 Change the placeholder color. More...
 
virtual void setTextColor (const Color4B &textColor) override
 Change the color of input text. More...
 
local setTextColor ( local textColor)
 Change the color of input text. More...
 
virtual void setString (const std::string &text) override
 Change input text of TextField. More...
 
local setString ( local text)
 Change input text of TextField. More...
 
virtual void appendString (const std::string &text)
 Append to input text of TextField. More...
 
local appendString ( local text)
 Append to input text of TextField. More...
 
virtual const std::string & getString () const override
 Query the input text of TextField. More...
 
local getString ()
 Query the input text of TextField. More...
 
virtual void setPlaceHolder (const std::string &text)
 Change placeholder text. More...
 
local setPlaceHolder ( local text)
 Change placeholder text. More...
 
virtual const std::string & getPlaceHolder () const
 Query the placeholder string. More...
 
local getPlaceHolder ()
 Query the placeholder string. More...
 
virtual void setSecureTextEntry (bool value)
 Set enable secure text entry representation. More...
 
local setSecureTextEntry ( local value)
 Set enable secure text entry representation. More...
 
virtual bool isSecureTextEntry () const
 Query whether the currently display mode is secure text entry or not. More...
 
local isSecureTextEntry ()
 Query whether the currently display mode is secure text entry or not. More...
 
void setCursorEnabled (bool enabled)
 Set enable cursor use.
 
local setCursorEnabled ( local enabled)
 Set enable cursor use.
 
void setCursorChar (char cursor)
 Set char showing cursor.
 
void setCursorPosition (std::size_t cursorPosition)
 Set cursor position, if enabled. More...
 
local setCursorPosition ( local cursorPosition)
 Set cursor position, if enabled. More...
 
void setCursorFromPoint (const Vec2 &point, const Camera *camera)
 Set cursor position to hit letter, if enabled. More...
 
local setCursorFromPoint ( local point, local camera)
 Set cursor position to hit letter, if enabled. More...
 
- Public Member Functions inherited from IMEDelegate
virtual ~IMEDelegate ()
 Default destructor.
 
- Public Member Functions inherited from TextFieldDelegate
virtual ~TextFieldDelegate ()
 Destructor for TextFieldDelegate.
 
virtual bool onVisit (TextFieldTTF *sender, Renderer *renderer, const Mat4 &transform, uint32_t flags)
 The callback method of the TextField will be drawn. More...
 

Static Public Member Functions

static UICCTextFieldcreate (const std::string &placeholder, const std::string &fontName, float fontSize)
 Create a UICCTextField intance with a placeholder, a fontName and a fontSize. More...
 
- Static Public Member Functions inherited from TextFieldTTF
static TextFieldTTFtextFieldWithPlaceHolder (const std::string &placeholder, const Size &dimensions, TextHAlignment alignment, const std::string &fontName, float fontSize)
 Creates a TextFieldTTF from placeholder, a fontname, alignment, dimension and font size. More...
 
local textFieldWithPlaceHolder ( local placeholder, local dimensions, local alignment, local fontName, local fontSize)
 Creates a TextFieldTTF from placeholder, a fontname, alignment, dimension and font size. More...
 
static TextFieldTTFtextFieldWithPlaceHolder (const std::string &placeholder, const std::string &fontName, float fontSize)
 Creates a TextFieldTTF from placeholder, a fontname and font size. More...
 

Detailed Description

A helper class which inherit from.

See also
TextFieldTTF and implements the
TextFieldDelegate protocol. It is mainly be used internally by
UITextField class.

Member Function Documentation

static UICCTextField* create ( const std::string &  placeholder,
const std::string &  fontName,
float  fontSize 
)
static

Create a UICCTextField intance with a placeholder, a fontName and a fontSize.

Placeholder in string. Font name in string. Font size in float. A UICCTextField instance.

virtual bool
onTextFieldAttachWithIME
( TextFieldTTF sender)
overridevirtual

The callback method of IME attached on the TextField.

The TextField object. If the sender doesn't want to attach to the IME, return true.

Reimplemented from TextFieldDelegate.

virtual bool
onTextFieldDetachWithIME
( TextFieldTTF sender)
overridevirtual

The callback method of IME detached on the TextField.

The TextField object. If the sender doesn't want to attach to the IME, return true.

Reimplemented from TextFieldDelegate.

virtual bool onTextFieldInsertText ( TextFieldTTF sender,
const char *  text,
size_t  nLen 
)
overridevirtual

The callback method of text inserted on the TextField.

The TextField object. The text will be inserted. The length of the inserted text. If the sender doesn't want to insert text, return true.

Reimplemented from TextFieldDelegate.

virtual bool
onTextFieldDeleteBackward
( TextFieldTTF sender,
const char *  delText,
size_t  nLen 
)
overridevirtual

The callback method of text will be delete on the TextField.

The TextField object. The text will be deleted. The length of the deleted text. If the sender doesn't want to delete text, return true.

Reimplemented from TextFieldDelegate.

void setMaxLengthEnabled ( bool  enable)

Toggle enable max length limitation.

True to enable max length, false otherwise.

bool isMaxLengthEnabled ( ) const

Query max length enable state.

Whether max length is enabled or not.

void setMaxLength ( int  length)

Set maxmize length.

The maxmize length in integer.

int getMaxLength ( ) const

Get maximize length.

Maximize length.

std::size_t getCharCount ( ) const

Return the total inputed charaters.

Total inputed character count.

void setPasswordEnabled ( bool  enable)

Toggle password input mode.

True if enable password input, false otherwise.

bool isPasswordEnabled ( ) const

Query whether password input mode is enabled or not.

True if password input is enabled, false otherwise.

void setPasswordStyleText ( const std::string &  styleText)

Change password style text.

The styleText for password mask, the default value is "*".

void setPasswordText ( const std::string &  text)

Set the password text content.

The content of password.

void setAttachWithIME ( bool  attach)

Toggle attach with IME.

True if attach with IME, false otherwise.

bool getAttachWithIME ( ) const

Query whether the IME is attached or not.

True if IME is attached, false otherwise.

void setDetachWithIME ( bool  detach)

Toggle detach with IME.

True if detach with IME, false otherwise.

bool getDetachWithIME ( ) const

Query whether IME is detached or not.

if IME is detached, false otherwise.

void setInsertText ( bool  insert)

Toggle enable text insert.

True if enable insert text, false otherwise.

bool getInsertText ( ) const

Query whether insert text is enabled or not.

True if insert text is enabled, false otherwise.

void setDeleteBackward ( bool  deleteBackward)

Toggle enable delete backward.

True if enable delete backward, false otherwise.

bool getDeleteBackward ( ) const

Query whether delete backward is enabled or not.

True if delete backward is enabled, false otherwise.


The documentation for this class was generated from the following file: