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

A simple text input field with TTF font. More...

Inherits Label, and IMEDelegate.

Inherited by UICCTextField.

Public Member Functions

 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.
 

Static Public Member Functions

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 simple text input field with TTF font.

Member Function Documentation

static TextFieldTTF*
textFieldWithPlaceHolder
( const std::string &  placeholder,
const Size dimensions,
TextHAlignment  alignment,
const std::string &  fontName,
float  fontSize 
)
static

Creates a TextFieldTTF from placeholder, a fontname, alignment, dimension and font size.

The place holder string. The size of the TextField. The alignment of the TextField. The font name of the TextField. The font size of the TextField. A TextFieldTTF object.

local textFieldWithPlaceHolder ( local  placeholder,
local  dimensions,
local  alignment,
local  fontName,
local  fontSize 
)
static

Creates a TextFieldTTF from placeholder, a fontname, alignment, dimension and font size.

The place holder string. The size of the TextField. The alignment of the TextField. The font name of the TextField. The font size of the TextField. A TextFieldTTF object.

static TextFieldTTF*
textFieldWithPlaceHolder
( const std::string &  placeholder,
const std::string &  fontName,
float  fontSize 
)
static

Creates a TextFieldTTF from placeholder, a fontname and font size.

The place holder string. The font name of the TextField. The font size of the TextField. A TextFieldTTF object.

local textFieldWithPlaceHolder ( local  placeholder,
local  fontName,
local  fontSize 
)
static

Creates a TextFieldTTF from placeholder, a fontname and font size.

The place holder string. The font name of the TextField. The font size of the TextField. A TextFieldTTF object.

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.

The place holder string. The size of the TextField. The alignment of the TextField. The font name of the TextField. The font size of the TextField. If the initialization success, return true; else, return false.

var initWithPlaceHolder ( var  placeholder,
var  dimensions,
var  alignment,
var  fontName,
var  fontSize 
)

Initializes the TextFieldTTF with a font name, alignment, dimension and font size.

The place holder string. The size of the TextField. The alignment of the TextField. The font name of the TextField. The font size of the TextField. If the initialization success, return true; else, return false.

local initWithPlaceHolder ( local  placeholder,
local  dimensions,
local  alignment,
local  fontName,
local  fontSize 
)

Initializes the TextFieldTTF with a font name, alignment, dimension and font size.

The place holder string. The size of the TextField. The alignment of the TextField. The font name of the TextField. The font size of the TextField. If the initialization success, return true; else, return false.

bool initWithPlaceHolder ( const std::string &  placeholder,
const std::string &  fontName,
float  fontSize 
)

Creates a TextFieldTTF from placeholder, a fontname and font size.

The place holder string. The font name of the TextField. The font size of the TextField. If the initialization success, return true; else, return false.

var initWithPlaceHolder ( var  placeholder,
var  fontName,
var  fontSize 
)

Creates a TextFieldTTF from placeholder, a fontname and font size.

The place holder string. The font name of the TextField. The font size of the TextField. If the initialization success, return true; else, return false.

local initWithPlaceHolder ( local  placeholder,
local  fontName,
local  fontSize 
)

Creates a TextFieldTTF from placeholder, a fontname and font size.

The place holder string. The font name of the TextField. The font size of the TextField. If the initialization success, return true; else, return false.

virtual bool attachWithIME ( )
overridevirtual

Open keyboard and receive input text.

If the action success, return true; else return false.

Reimplemented from IMEDelegate.

var attachWithIME ( )
overridevirtual

Open keyboard and receive input text.

If the action success, return true; else return false.

Reimplemented from IMEDelegate.

local attachWithIME ( )
overridevirtual

Open keyboard and receive input text.

If the action success, return true; else return false.

Reimplemented from IMEDelegate.

virtual bool detachWithIME ( )
overridevirtual

End text input and close keyboard.

If the action success, return true; else return false.

Reimplemented from IMEDelegate.

var detachWithIME ( )
overridevirtual

End text input and close keyboard.

If the action success, return true; else return false.

Reimplemented from IMEDelegate.

local detachWithIME ( )
overridevirtual

End text input and close keyboard.

If the action success, return true; else return false.

Reimplemented from IMEDelegate.

std::size_t getCharCount ( ) const
inline

Query the currently inputed character count.

The total input character count.

var getCharCount ( )
inline

Query the currently inputed character count.

The total input character count.

local getCharCount ( )
inline

Query the currently inputed character count.

The total input character count.

virtual const Color4B&
getColorSpaceHolder
( )
virtual

Query the color of place holder.

The place holder color.

var getColorSpaceHolder ( )
virtual

Query the color of place holder.

The place holder color.

local getColorSpaceHolder ( )
virtual

Query the color of place holder.

The place holder color.

virtual void setColorSpaceHolder ( const Color3B color)
virtual

Change input placeholder color.

A color value in Color3B.

var setColorSpaceHolder ( var  color)
virtual

Change input placeholder color.

A color value in Color3B.

local setColorSpaceHolder ( local  color)
virtual

Change input placeholder color.

A color value in Color3B.

virtual void setColorSpaceHolder ( const Color4B color)
virtual

Change the placeholder color.

The placeholder color in Color4B.

var setColorSpaceHolder ( var  color)
virtual

Change the placeholder color.

The placeholder color in Color4B.

local setColorSpaceHolder ( local  color)
virtual

Change the placeholder color.

The placeholder color in Color4B.

virtual void setTextColor ( const Color4B textColor)
overridevirtual

Change the color of input text.

The text color in Color4B.

var setTextColor ( var  textColor)
overridevirtual

Change the color of input text.

The text color in Color4B.

local setTextColor ( local  textColor)
overridevirtual

Change the color of input text.

The text color in Color4B.

virtual void setString ( const std::string &  text)
overridevirtual

Change input text of TextField.

The input text of TextField.

var setString ( var  text)
overridevirtual

Change input text of TextField.

The input text of TextField.

local setString ( local  text)
overridevirtual

Change input text of TextField.

The input text of TextField.

virtual void appendString ( const std::string &  text)
virtual

Append to input text of TextField.

The append text of TextField.

var appendString ( var  text)
virtual

Append to input text of TextField.

The append text of TextField.

local appendString ( local  text)
virtual

Append to input text of TextField.

The append text of TextField.

virtual const std::string&
getString
( ) const
overridevirtual

Query the input text of TextField.

Get the input text of TextField.

var getString ( )
overridevirtual

Query the input text of TextField.

Get the input text of TextField.

local getString ( )
overridevirtual

Query the input text of TextField.

Get the input text of TextField.

virtual void setPlaceHolder ( const std::string &  text)
virtual

Change placeholder text.

place holder text displayed when there is no text in the text field. The place holder string.

var setPlaceHolder ( var  text)
virtual

Change placeholder text.

place holder text displayed when there is no text in the text field. The place holder string.

local setPlaceHolder ( local  text)
virtual

Change placeholder text.

place holder text displayed when there is no text in the text field. The place holder string.

virtual const std::string&
getPlaceHolder
( ) const
virtual

Query the placeholder string.

The placeholder string.

var getPlaceHolder ( )
virtual

Query the placeholder string.

The placeholder string.

local getPlaceHolder ( )
virtual

Query the placeholder string.

The placeholder string.

virtual void setSecureTextEntry ( bool  value)
virtual

Set enable secure text entry representation.

If you want to display password in TextField, this option is very helpful. Whether or not to display text with secure text entry.

local setSecureTextEntry ( local  value)
virtual

Set enable secure text entry representation.

If you want to display password in TextField, this option is very helpful. Whether or not to display text with secure text entry.

virtual bool isSecureTextEntry ( ) const
virtual

Query whether the currently display mode is secure text entry or not.

Whether current text is displayed as secure text entry.

local isSecureTextEntry ( )
virtual

Query whether the currently display mode is secure text entry or not.

Whether current text is displayed as secure text entry.

void setCursorPosition ( std::size_t  cursorPosition)

Set cursor position, if enabled.

local setCursorPosition ( local  cursorPosition)

Set cursor position, if enabled.

void setCursorFromPoint ( const Vec2 point,
const Camera camera 
)

Set cursor position to hit letter, if enabled.

local setCursorFromPoint ( local  point,
local  camera 
)

Set cursor position to hit letter, if enabled.


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