cocos2d-x  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
UITextField Class Reference

class UITextField : public UIWidget More...

#include <UITextField.h>

Inheritance diagram for UITextField:
UIWidget CCObject CCCopying

Public Member Functions

 UITextField ()
virtual ~UITextField ()
virtual bool init ()
virtual void initRenderer ()
void setTouchSize (const CCSize &size)
void setText (const char *text)
void setPlaceHolder (const char *value)
void setFontSize (int size)
void setFontName (const char *name)
virtual void didNotSelectSelf ()
const char * getStringValue ()
virtual bool onTouchBegan (const CCPoint &touchPoint)
 A call back function called when widget is selected, and on touch began. More...
 
void setMaxLengthEnabled (bool enable)
bool isMaxLengthEnabled ()
void setMaxLength (int length)
int getMaxLength ()
void setPasswordEnabled (bool enable)
bool isPasswordEnabled ()
void setPasswordStyleText (const char *styleText)
virtual void update (float dt)
bool getAttachWithIME ()
void setAttachWithIME (bool attach)
bool getDetachWithIME ()
void setDetachWithIME (bool detach)
bool getInsertText ()
void setInsertText (bool insertText)
bool getDeleteBackward ()
void setDeleteBackward (bool deleteBackward)
void addEventListenerTextField (CCObject *target, SEL_TextFieldEvent selecor)
void addAttachWithIMEEvent (CCObject *target, SEL_TextFieldAttachWithIMEEvent selecor)
void addDetachWithIMEEvent (CCObject *target, SEL_TextFieldDetachWithIMEEvent selecor)
void addInsertTextEvent (CCObject *target, SEL_TextFieldInsertTextEvent selecor)
void addDeleteBackwardEvent (CCObject *target, SEL_TextFieldDeleteBackwardEvent selecor)
virtual void setAnchorPoint (const CCPoint &pt)
 Sets the anchor point in percent. More...
 
virtual void setColor (const ccColor3B &color)
 Sets color to widget. More...
 
virtual void setOpacity (int opacity)
 Sets opacity to widget. More...
 
virtual const char * getDescription () const
 Returns the "class name" of widget. More...
 
void setMaxLengthEnable (bool is)
 These methods will be removed. More...
 
void setPasswordEnable (bool is)
virtual const CCSizegetContentSize () const
 Gets the content size of widget. More...
 
virtual CCNodegetVirtualRenderer ()
 Gets the Virtual Renderer of widget. More...
 
void attachWithIME ()
- Public Member Functions inherited from UIWidget
 UIWidget (void)
virtual ~UIWidget ()
 Default destructor. More...
 
virtual void setEnabled (bool enabled)
 Sets whether the widget is enabled. More...
 
bool isEnabled () const
 Determines if the widget is enabled. More...
 
void setVisible (bool visible)
 Sets whether the widget is visible. More...
 
bool isVisible () const
 Determines if the widget is visible. More...
 
void setBright (bool bright)
 Sets whether the widget is bright. More...
 
bool isBright () const
 Determines if the widget is bright. More...
 
virtual void setTouchEnabled (bool enabled)
 Sets whether the widget is touch enabled. More...
 
void setBrightStyle (BrightStyle style)
 To set the bright style of widget. More...
 
bool isTouchEnabled () const
 Determines if the widget is touch enabled. More...
 
bool isFocused () const
 Determines if the widget is on focused. More...
 
void setFocused (bool fucosed)
 Sets whether the widget is on focused. More...
 
void setZOrder (int z)
 Sets the Z order which stands for the drawing order, and reorder this widget in its parent's children array. More...
 
int getZOrder ()
 Gets the Z order of this widget. More...
 
float getLeftInParent ()
 Gets the left boundary position of this widget. More...
 
float getBottomInParent ()
 Gets the bottom boundary position of this widget. More...
 
var getBottomInParent ()
 Gets the bottom boundary position of this widget. More...
 
float getRightInParent ()
 Gets the right boundary position of this widget. More...
 
float getTopInParent ()
 Gets the top boundary position of this widget. More...
 
virtual bool addChild (UIWidget *child)
 Adds a child to the container. More...
 
virtual bool removeChild (UIWidget *child)
 Removes a child from the container with a cleanup. More...
 
virtual void removeFromParent ()
 Removes this widget itself from its parent widget. More...
 
virtual void removeAllChildren ()
 Removes all children from the container, and do a cleanup to all running actions depending on the cleanup parameter. More...
 
virtual void reorderChild (UIWidget *child)
 Reorders a child according to a new z value. More...
 
UIWidgetgetChildByName (const char *name)
 Gets a child from the container with its name. More...
 
UIWidgetgetChildByTag (int tag)
 Gets a child from the container with its tag. More...
 
virtual CCArraygetChildren ()
 Return an array of children. More...
 
CCNodegetRenderer ()
 Gets the renderer of widget. More...
 
void addRenderer (CCNode *renderer, int zOrder)
 Add a CCNode for rendering. More...
 
void removeRenderer (CCNode *renderer, bool cleanup)
 Remove a CCNode from widget. More...
 
void setParent (UIWidget *parent)
 Sets the parent widget. More...
 
UIWidgetgetParent ()
 Returns a pointer to the parent widget. More...
 
void addTouchEventListener (CCObject *target, SEL_TouchEvent selector)
 Sets the touch event target/selector of the menu item. More...
 
var addTouchEventListener ( var target, var selector)
 Sets the touch event target/selector of the menu item. More...
 
void setPosition (const CCPoint &pos)
 Changes the position (x,y) of the widget in OpenGL coordinates. More...
 
void setPositionPercent (const CCPoint &percent)
 Changes the position (x,y) of the widget in OpenGL coordinates. More...
 
var setPositionPercent ( var percent)
 Changes the position (x,y) of the widget in OpenGL coordinates. More...
 
const CCPointgetPosition ()
 Gets the position (x,y) of the widget in OpenGL coordinates. More...
 
const CCPointgetPositionPercent ()
 Gets the percent (x,y) of the widget in OpenGL coordinates. More...
 
void setPositionType (PositionType type)
 Changes the position type of the widget. More...
 
PositionType getPositionType () const
 Gets the position type of the widget. More...
 
const CCPointgetAnchorPoint ()
 Returns the anchor point in percent. More...
 
virtual void setScale (float fScale)
 Changes both X and Y scale factor of the widget. More...
 
float getScale ()
 Gets the scale factor of the widget, when X and Y have the same scale factor. More...
 
virtual void setScaleX (float fScaleX)
 Changes the scale factor on X axis of this widget. More...
 
float getScaleX ()
 Returns the scale factor on X axis of this widget. More...
 
virtual void setScaleY (float fScaleY)
 Changes the scale factor on Y axis of this widget. More...
 
float getScaleY ()
 Returns the scale factor on Y axis of this widget. More...
 
void setRotation (float rotation)
 Sets the rotation (angle) of the widget in degrees. More...
 
float getRotation ()
 Returns the rotation of the widget in degrees. More...
 
void setRotationX (float rotationX)
 Sets the X rotation (angle) of the widget in degrees which performs a horizontal rotational skew. More...
 
float getRotationX ()
 Gets the X rotation (angle) of the widget in degrees which performs a horizontal rotation skew. More...
 
void setRotationY (float rotationY)
 Sets the Y rotation (angle) of the widget in degrees which performs a vertical rotational skew. More...
 
float getRotationY ()
 Gets the Y rotation (angle) of the widget in degrees which performs a vertical rotational skew. More...
 
virtual void setFlipX (bool flipX)
 Sets whether the widget should be flipped horizontally or not. More...
 
virtual bool isFlipX ()
 Returns the flag which indicates whether the widget is flipped horizontally or not. More...
 
virtual void setFlipY (bool flipY)
 Sets whether the widget should be flipped vertically or not. More...
 
virtual bool isFlipY ()
 Return the flag which indicates whether the widget is flipped vertically or not. More...
 
virtual const ccColor3BgetColor ()
 Gets color of widget. More...
 
virtual int getOpacity ()
 Gets opacity of widget. More...
 
virtual bool isCascadeOpacityEnabled ()
virtual void setCascadeOpacityEnabled (bool cascadeOpacityEnabled)
virtual bool isCascadeColorEnabled ()
virtual void setCascadeColorEnabled (bool cascadeColorEnabled)
void setBlendFunc (ccBlendFunc blendFunc)
virtual void setActionManager (CCActionManager *actionManager)
virtual CCActionManagergetActionManager ()
CCActionrunAction (CCAction *action)
void stopAllActions (void)
void stopAction (CCAction *action)
void stopActionByTag (int tag)
CCActiongetActionByTag (int tag)
void didNotSelectSelf ()
 A call back function when widget lost of focus. More...
 
var didNotSelectSelf ()
 A call back function when widget lost of focus. More...
 
bool clippingParentAreaContainPoint (const CCPoint &pt)
virtual void checkChildInfo (int handleState, UIWidget *sender, const CCPoint &touchPoint)
const CCPointgetTouchStartPos ()
const CCPointgetTouchMovePos ()
const CCPointgetTouchEndPos ()
void setTag (int tag)
 Changes the tag that is used to identify the widget easily. More...
 
int getTag () const
 Returns a tag that is used to identify the widget easily. More...
 
void setName (const char *name)
 Changes the name that is used to identify the widget easily. More...
 
const char * getName () const
 Returns a name that is used to identify the widget easily. More...
 
var getName ()
 Returns a name that is used to identify the widget easily. More...
 
WidgetType getWidgetType () const
 Returns a type that is widget's type. More...
 
virtual void setSize (const CCSize &size)
 Changes the size that is widget's size. More...
 
virtual void setSizePercent (const CCPoint &percent)
 Changes the percent that is widget's percent size. More...
 
void setSizeType (SizeType type)
 Changes the size type of widget. More...
 
SizeType getSizeType () const
 Gets the size type of widget. More...
 
const CCSizegetSize () const
 Returns size of widget. More...
 
const CCPointgetSizePercent () const
 Returns size percent of widget. More...
 
virtual bool hitTest (const CCPoint &pt)
 Checks a point if is in widget's space. More...
 
virtual void onTouchMoved (const CCPoint &touchPoint)
 A call back function called when widget is selected, and on touch moved. More...
 
virtual void onTouchEnded (const CCPoint &touchPoint)
 A call back function called when widget is selected, and on touch ended. More...
 
virtual void onTouchCancelled (const CCPoint &touchPoint)
 A call back function called when widget is selected, and on touch canceled. More...
 
virtual void onTouchLongClicked (const CCPoint &touchPoint)
 A call back function called when widget is selected, and on touch long clicked. More...
 
var onTouchLongClicked ( var touchPoint)
 A call back function called when widget is selected, and on touch long clicked. More...
 
void setLayoutParameter (UILayoutParameter *parameter)
 Sets a LayoutParameter to widget. More...
 
UILayoutParametergetLayoutParameter (LayoutParameterType type)
 Gets LayoutParameter of widget. More...
 
virtual void ignoreContentAdaptWithSize (bool ignore)
 Ignore the widget size. More...
 
bool isIgnoreContentAdaptWithSize () const
 Gets the widget if is ignore it's size. More...
 
CCPoint getWorldPosition ()
 Gets world position of widget. More...
 
CCPoint convertToWorldSpace (const CCPoint &pt)
 Converts a Point to world space coordinates. More...
 
void setUpdateEnabled (bool enable)
 Schedules the "update" method. More...
 
bool isUpdateEnabled ()
 is the "update" method scheduled. More...
 
UIWidgetclone ()
virtual void onEnter ()
virtual void onExit ()
virtual CCObjectgetUserObject ()
 Returns a user assigned CCObject. More...
 
virtual void setUserObject (CCObject *pUserObject)
 Returns a user assigned CCObject. More...
 
void setTouchEnable (bool enabled, bool containChildren=false)
 These methods will be removed. More...
 
void disable (bool containChildren=false)
void active (bool containChildren=false)
bool isActive ()
var isActive ()
void setBright (bool bright, bool containChild)
CCRect getRect ()
CCNodegetValidNode ()
void setWidgetZOrder (int z)
int getWidgetZOrder ()
float getRelativeLeftPos ()
var getRelativeLeftPos ()
float getRelativeBottomPos ()
float getRelativeRightPos ()
float getRelativeTopPos ()
CCNodegetContainerNode ()
void setWidgetParent (UIWidget *parent)
UIWidgetgetWidgetParent ()
void setWidgetTag (int tag)
int getWidgetTag ()
void addCCNode (CCNode *node)
void addPushDownEvent (CCObject *target, SEL_PushEvent selector)
var addPushDownEvent ( var target, var selector)
void addMoveEvent (CCObject *target, SEL_MoveEvent selector)
void addReleaseEvent (CCObject *target, SEL_ReleaseEvent selector)
void addCancelEvent (CCObject *target, SEL_CancelEvent selector)
bool removeChild (UIWidget *child, bool cleanup)
void removeFromParentAndCleanup (bool cleanup)
void removeAllChildrenAndCleanUp (bool cleanup)
void setActionTag (int tag)
int getActionTag ()
void updateSizeAndPosition ()
var updateSizeAndPosition ()
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (void)
bool isSingleReference (void) const
unsigned int retainCount (void) const
virtual bool isEqual (const CCObject *pObject)
virtual void acceptVisitor (CCDataVisitor &visitor)
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)

Static Public Member Functions

static UITextFieldcreate ()
- Static Public Member Functions inherited from UIWidget
static UIWidgetcreate ()
 Allocates and initializes a widget. More...
 

Protected Member Functions

void attachWithIMEEvent ()
void detachWithIMEEvent ()
void insertTextEvent ()
void deleteBackwardEvent ()
virtual void onSizeChanged ()
void textfieldRendererScaleChangedWithSize ()
virtual UIWidgetcreateCloneInstance ()
virtual void copySpecialProperties (UIWidget *model)
- Protected Member Functions inherited from UIWidget
virtual void onPressStateChangedToNormal ()
virtual void onPressStateChangedToPressed ()
virtual void onPressStateChangedToDisabled ()
void pushDownEvent ()
void moveEvent ()
void releaseUpEvent ()
void cancelUpEvent ()
void longClickEvent ()
void updateAnchorPoint ()
var updateAnchorPoint ()
void copyProperties (UIWidget *model)
virtual void copyClonedWidgetChildren (UIWidget *model)

Protected Attributes

UICCTextFieldm_pTextFieldRenderer
float m_fTouchWidth
float m_fTouchHeight
bool m_bUseTouchArea
CCObjectm_pTextFieldEventListener
SEL_TextFieldEvent m_pfnTextFieldEventSelector
std::string m_strPasswordStyleText
CCObjectm_pAttachWithIMEListener
CCObjectm_pDetachWithIMEListener
CCObjectm_pInsertTextListener
CCObjectm_pDeleteBackwardListener
SEL_TextFieldAttachWithIMEEvent m_pfnAttachWithIMESelector
SEL_TextFieldDetachWithIMEEvent m_pfnDetachWithIMESelector
SEL_TextFieldInsertTextEvent m_pfnInsertTextSelector
SEL_TextFieldDeleteBackwardEvent m_pfnDeleteBackwardSelector
- Protected Attributes inherited from UIWidget
bool m_bEnabled
 Highest control of widget. More...
 
bool m_bVisible
 is this widget visible More...
 
bool m_bBright
 is this widget bright More...
 
bool m_bTouchEnabled
 is this widget touch endabled More...
 
var m_bTouchEnabled
 is this widget touch endabled More...
 
bool m_bTouchPassedEnabled
 is the touch event should be passed More...
 
bool m_bFocus
 is the widget on focus More...
 
int m_nWidgetZOrder
 z-order value that affects the draw order and touch order More...
 
CCPoint m_anchorPoint
 anchor point normalized More...
 
UIWidgetm_pWidgetParent
 parent of widget More...
 
var m_pWidgetParent
 parent of widget More...
 
BrightStyle m_eBrightStyle
 bright style More...
 
bool m_bUpdateEnabled
 is "update" method scheduled More...
 
var m_bUpdateEnabled
 is "update" method scheduled More...
 
CCNodem_pRenderer
 base renderer More...
 
CCPoint m_touchStartPos
 touch began point More...
 
var m_touchStartPos
 touch began point More...
 
CCPoint m_touchMovePos
 touch moved point More...
 
CCPoint m_touchEndPos
 touch ended point More...
 
var m_touchEndPos
 touch ended point More...
 
CCObjectm_pTouchEventListener
SEL_TouchEvent m_pfnTouchEventSelector
var m_pfnTouchEventSelector
int m_nWidgetTag
std::string m_strName
var m_strName
WidgetType m_WidgetType
var m_WidgetType
int m_nActionTag
var m_nActionTag
CCSize m_size
var m_size
CCSize m_customSize
var m_customSize
CCDictionarym_pLayoutParameterDictionary
var m_pLayoutParameterDictionary
bool m_bIgnoreSize
var m_bIgnoreSize
CCArraym_children
var m_children
bool m_bAffectByClipping
var m_bAffectByClipping
CCSchedulerm_pScheduler
SizeType m_eSizeType
var m_eSizeType
CCPoint m_sizePercent
var m_sizePercent
PositionType m_ePositionType
var m_ePositionType
CCPoint m_positionPercent
var m_positionPercent
bool m_bIsRunning
CCObjectm_pUserObject
var m_pUserObject
CCObjectm_pPushListener
var m_pPushListener
SEL_PushEvent m_pfnPushSelector
var m_pfnPushSelector
CCObjectm_pMoveListener
SEL_MoveEvent m_pfnMoveSelector
var m_pfnMoveSelector
CCObjectm_pReleaseListener
SEL_ReleaseEvent m_pfnReleaseSelector
var m_pfnReleaseSelector
CCObjectm_pCancelListener
var m_pCancelListener
SEL_ReleaseEvent m_pfnCancelSelector
var m_pfnCancelSelector
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Detailed Description

class UITextField : public UIWidget

Constructor & Destructor Documentation

virtual ~UITextField ( )
virtual

Member Function Documentation

void addAttachWithIMEEvent ( CCObject target,
SEL_TextFieldAttachWithIMEEvent  selecor 
)
void addDeleteBackwardEvent ( CCObject target,
SEL_TextFieldDeleteBackwardEvent  selecor 
)
void addDetachWithIMEEvent ( CCObject target,
SEL_TextFieldDetachWithIMEEvent  selecor 
)
void addEventListenerTextField ( CCObject target,
SEL_TextFieldEvent  selecor 
)
void addInsertTextEvent ( CCObject target,
SEL_TextFieldInsertTextEvent  selecor 
)
void attachWithIME ( )
void attachWithIMEEvent ( )
protected
virtual void copySpecialProperties ( UIWidget model)
protectedvirtual

Reimplemented from UIWidget.

static UITextField* create ( )
static
virtual UIWidget*
createCloneInstance
( )
protectedvirtual

Reimplemented from UIWidget.

void deleteBackwardEvent ( )
protected
void detachWithIMEEvent ( )
protected
virtual void didNotSelectSelf ( )
virtual
bool getAttachWithIME ( )
virtual const CCSize&
getContentSize
( ) const
virtual

Gets the content size of widget.

Content size is widget's texture size.

Reimplemented from UIWidget.

bool getDeleteBackward ( )
virtual const char* getDescription ( ) const
virtual

Returns the "class name" of widget.

Reimplemented from UIWidget.

bool getDetachWithIME ( )
bool getInsertText ( )
int getMaxLength ( )
const char* getStringValue ( )
virtual CCNode* getVirtualRenderer ( )
virtual

Gets the Virtual Renderer of widget.

For example, a button's Virtual Renderer is it's texture renderer.

Returns
CCNode pointer.

Reimplemented from UIWidget.

virtual bool init ( )
virtual

Reimplemented from UIWidget.

virtual void initRenderer ( )
virtual

Reimplemented from UIWidget.

void insertTextEvent ( )
protected
bool isMaxLengthEnabled ( )
bool isPasswordEnabled ( )
virtual void onSizeChanged ( )
protectedvirtual

Reimplemented from UIWidget.

virtual bool onTouchBegan ( const CCPoint touchPoint)
virtual

A call back function called when widget is selected, and on touch began.

Parameters
touchpoint
Returns
true if the event should be pass to parent, flase otherwise.

Reimplemented from UIWidget.

virtual void setAnchorPoint ( const CCPoint pt)
virtual

Sets the anchor point in percent.

anchorPoint is the point around which all transformations and positioning manipulations take place. It's like a pin in the widget where it is "attached" to its parent. The anchorPoint is normalized, like a percentage. (0,0) means the bottom-left corner and (1,1) means the top-right corner. But you can use values higher than (1,1) and lower than (0,0) too. The default anchorPoint is (0.5,0.5), so it starts in the center of the widget.

Parameters
anchorPointThe anchor point of widget.

Reimplemented from UIWidget.

void setAttachWithIME ( bool  attach)
virtual void setColor ( const ccColor3B color)
virtual

Sets color to widget.

It default change the color of widget's children.

Parameters
color

Reimplemented from UIWidget.

void setDeleteBackward ( bool  deleteBackward)
void setDetachWithIME ( bool  detach)
void setFontName ( const char *  name)
void setFontSize ( int  size)
void setInsertText ( bool  insertText)
void setMaxLength ( int  length)
void setMaxLengthEnable ( bool  is)
inline

These methods will be removed.

void setMaxLengthEnabled ( bool  enable)
virtual void setOpacity ( int  opacity)
virtual

Sets opacity to widget.

It default change the opacity of widget's children.

Parameters
color

Reimplemented from UIWidget.

void setPasswordEnable ( bool  is)
inline
void setPasswordEnabled ( bool  enable)
void setPasswordStyleText ( const char *  styleText)
void setPlaceHolder ( const char *  value)
void setText ( const char *  text)
void setTouchSize ( const CCSize size)
void
textfieldRendererScaleChangedWithSize
( )
protected
virtual void update ( float  dt)
virtual

Reimplemented from CCObject.

Member Data Documentation

bool m_bUseTouchArea
protected
float m_fTouchHeight
protected
float m_fTouchWidth
protected
CCObject* m_pAttachWithIMEListener
protected
CCObject* m_pDeleteBackwardListener
protected
CCObject* m_pDetachWithIMEListener
protected
SEL_TextFieldAttachWithIMEEvent
m_pfnAttachWithIMESelector
protected
SEL_TextFieldDeleteBackwardEvent
m_pfnDeleteBackwardSelector
protected
SEL_TextFieldDetachWithIMEEvent
m_pfnDetachWithIMESelector
protected
SEL_TextFieldInsertTextEvent
m_pfnInsertTextSelector
protected
SEL_TextFieldEvent
m_pfnTextFieldEventSelector
protected
CCObject* m_pInsertTextListener
protected
CCObject* m_pTextFieldEventListener
protected
UICCTextField* m_pTextFieldRenderer
protected
std::string m_strPasswordStyleText
protected

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