Helper class for traversing children in widget tree.
More...
#include <UIHelper.h>
|
static Widget * | seekWidgetByTag (Widget *root, int tag) |
| Find a widget with a specific tag from root widget.
|
|
static Widget * | seekWidgetByName (Widget *root, std::string_view name) |
| Find a widget with a specific name from root widget.
|
|
static Widget * | seekActionWidgetByActionTag (Widget *root, int tag) |
| Find a widget with a specific action tag from root widget This search will be recursive through all child widgets.
|
|
static std::string | getSubStringOfUTF8String (std::string_view 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 = "中国".
|
|
static void | doLayout (Node *rootNode) |
| Refresh object and it's children layout state.
|
|
static void | changeLayoutSystemActiveState (bool active) |
| Change the active property of Layout's.
|
|
static Rect | restrictCapInsetRect (const Rect &capInsets, const Vec2 &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.
|
|
static Rect | convertBoundingBoxToScreen (Node *node) |
| Convert a node's boundingBox rect into screen coordinates.
|
|
Helper class for traversing children in widget tree.
It also provides some helper functions for layout.
◆ seekWidgetByTag()
Find a widget with a specific tag from root widget.
This search will be recursive through all child widgets.
- Parameters
-
root | The be searched root widget. |
tag | The widget tag. |
- Returns
- Widget instance pointer.
◆ seekWidgetByName()
static Widget * seekWidgetByName |
( |
Widget * | root, |
|
|
std::string_view | name ) |
|
static |
Find a widget with a specific name from root widget.
This search will be recursive through all child widgets.
- Parameters
-
root | The be searched root widget. |
name | The widget name. |
- Returns
- Widget instance pointer.
◆ seekActionWidgetByActionTag()
static Widget * seekActionWidgetByActionTag |
( |
Widget * | root, |
|
|
int | tag ) |
|
static |
Find a widget with a specific action tag from root widget This search will be recursive through all child widgets.
- Parameters
-
root | The be searched root widget. |
tag | The widget action's tag. |
- Returns
- Widget instance pointer.
◆ getSubStringOfUTF8String()
static std::string getSubStringOfUTF8String |
( |
std::string_view | 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
-
str | The source string. |
start | The start position of the substring. |
length | The length of the substring in UTF8 count |
- Returns
- a UTF8 substring @js NA
◆ doLayout()
static void doLayout |
( |
Node * | rootNode | ) |
|
|
static |
Refresh object and it's children layout state.
- Parameters
-
rootNode | A Node* or Node* descendant instance pointer. |
◆ changeLayoutSystemActiveState()
static void changeLayoutSystemActiveState |
( |
bool | active | ) |
|
|
static |
◆ restrictCapInsetRect()
static Rect restrictCapInsetRect |
( |
const Rect & | capInsets, |
|
|
const Vec2 & | 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
-
capInsets | A user defined capInsets. |
textureSize | The size of a scale9enabled texture |
- Returns
- a restricted capInset.
◆ convertBoundingBoxToScreen()
static Rect convertBoundingBoxToScreen |
( |
Node * | node | ) |
|
|
static |
Convert a node's boundingBox rect into screen coordinates.
- Parameters
-
- Returns
- A Rect in screen coordinates.
The documentation for this class was generated from the following file: