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

#include <UIHelper.h>

Static Public Member Functions

static WidgetseekWidgetByTag (Widget *root, int tag)
 Find a widget with a specific tag from root widget. More...
 
static WidgetseekWidgetByName (Widget *root, const std::string &name)
 Find a widget with a specific name from root widget. More...
 
static WidgetseekActionWidgetByActionTag (Widget *root, int tag)
 Find a widget with a specific action tag from root widget This search will be recursive throught all child widgets. More...
 
static std::string getSubStringOfUTF8String (const std::string &str, std::string::size_type start, std::string::size_type length)
 Get a UTF8 substring from a std::string with a given start position and length Sample: std::string str = "中国中国中国"; substr = getSubStringOfUTF8String(str,0,2) will = "中国". More...
 
static void doLayout (Node *rootNode)
 Refresh object and it's children layout state. More...
 
static void changeLayoutSystemActiveState (bool active)
 Change the active property of Layout's. More...
 
static Rect restrictCapInsetRect (const Rect &capInsets, const Size &textureSize)
 restrict capInsetSize, when the capInsets's width is larger than the textureSize, it will restrict to 0, the height goes the same way as width. More...
 

Member Function Documentation

static void
changeLayoutSystemActiveState
( bool  active)
static

Change the active property of Layout's.

See also
LayoutComponent
Parameters
activeA boolean value.
static void doLayout ( Node rootNode)
static

Refresh object and it's children layout state.

Parameters
rootNodeA Node* or Node* descendant instance pointer.
static std::string
getSubStringOfUTF8String
( const std::string &  str,
std::string::size_type  start,
std::string::size_type  length 
)
static

Get a UTF8 substring from a std::string with a given start position and length Sample: std::string str = "中国中国中国"; substr = getSubStringOfUTF8String(str,0,2) will = "中国".

Parameters
startThe start position of the substring.
lengthThe length of the substring in UTF8 count
Returns
a UTF8 substring
static Rect restrictCapInsetRect ( const Rect capInsets,
const Size textureSize 
)
static

restrict capInsetSize, when the capInsets's width is larger than the textureSize, it will restrict to 0, the height goes the same way as width.

Parameters
capInsetsA user defined capInsets.
textureSizeThe size of a scale9enabled texture
Returns
a restricted capInset.
static Widget*
seekActionWidgetByActionTag
( Widget root,
int  tag 
)
static

Find a widget with a specific action tag from root widget This search will be recursive throught all child widgets.

Parameters
rootThe be searched root widget.
tagThe widget action's tag.
Returns
Widget instance pointer.
static Widget* seekWidgetByName ( Widget root,
const std::string &  name 
)
static

Find a widget with a specific name from root widget.

This search will be recursive throught all child widgets.

Parameters
rootThe be searched root widget.
nameThe widget name.
Returns
Widget isntance pointer.
static Widget* seekWidgetByTag ( Widget root,
int  tag 
)
static

Find a widget with a specific tag from root widget.

This search will be recursive throught all child widgets.

Parameters
rootThe be seached root widget.
tagThe widget tag.
Returns
Widget instance pointer.

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