Loading [MathJax]/extensions/MathMenu.js

⚠️ This documentation corresponds to the latest development branch of axmol. It might diverge from the official releases.

Axmol Engine 3.0.0-dff292a
Loading...
Searching...
No Matches
Helper Class Reference

Helper class for traversing children in widget tree. More...

#include <UIHelper.h>

Classes

class  VisibleRect
 CLASS VisibleRect. More...

Public Types

enum  AlignType
 align type defination

Static Public Member Functions

static WidgetseekWidgetByTag (Widget *root, int tag)
 Find a widget with a specific tag from root widget.
static WidgetseekWidgetByName (Widget *root, std::string_view name)
 Find a widget with a specific name from root widget.
static WidgetseekActionWidgetByActionTag (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.
static void setDesignSizeFixedEdge (const Vec2 &designSize)
 adatpe design size with fixed edge, normally, use this function for screen adatpe
static void setDesignSizeNoBorder (const Vec2 &designSize)
 adapte design size with no border
static Vec2 getNodeGroupSize (const std::vector< ax::Node * > &nodes)
 Get node group size.
static void setNodeGroupSize (const std::vector< ax::Node * > &nodes, const Vec2 &newSize)
 Set nodes group size.
static float getNodeGroupLeft (const std::vector< ax::Node * > &nodes)
 Get Node group left.
static float getNodeGroupTop (const std::vector< ax::Node * > &nodes)
 Get node group top.
static float getNodeGroupRight (const std::vector< ax::Node * > &nodes)
 Get node group right.
static float getNodeGroupBottom (const std::vector< ax::Node * > &nodes)
 Get node group bottom.
static void centerHorizontally (const std::vector< ax::Node * > &nodes)
 Center horiz to parent.
static void centerVertically (const std::vector< ax::Node * > &nodes)
 Center vertical to parent.
static void centerToParent (const std::vector< ax::Node * > &nodes)
 Center to parent.
static void alignLefts (const std::vector< ax::Node * > &nodes)
 Align lefts.
static void alignRights (const std::vector< ax::Node * > &nodes)
 Align rights.
static void alignTops (const std::vector< ax::Node * > &nodes)
 Align tops.
static void alignBottoms (const std::vector< ax::Node * > &nodes)
 Align bottoms.
static void alignHorizontals (const std::vector< ax::Node * > &nodes)
 Align horiz.
static void alignVerticals (const std::vector< ax::Node * > &nodes)
 Align vertical.
static void alignCenters (const std::vector< ax::Node * > &nodes)
 Align centers.
static void makeSameWidth (const std::vector< ax::Node * > &nodes)
 Make same width.
static void makeSameHeight (const std::vector< ax::Node * > &nodes)
 Make same height.
static void makeSameSize (const std::vector< ax::Node * > &nodes)
 Make same size.
static void makeHorizontalSpacingEqual (std::vector< ax::Node * > &nodes)
 Make horiz spacing equal.
static void makeVerticalSpacingEqual (std::vector< ax::Node * > &nodes)
 Make vertical spacing equal.
static void increaseHorizontalSpacing (std::vector< ax::Node * > &nodes, float theSpacing)
 Increease horiz spacing.
static void increaseVerticalSpacing (std::vector< ax::Node * > &nodes, float theSpacing)
 Increase vertical spacing.
static void decreaseHorizontalSpacing (std::vector< ax::Node * > &nodes, float theSpacing)
 Decrease horiz spacing.
static void decreaseVerticalSpacing (std::vector< ax::Node * > &nodes, float theSpacing)
 Decrease vertical spacing.
static void removeHorizontalSpacing (const std::vector< ax::Node * > &nodes)
 Remove horiz spacing.
static void removeVerticalSpacing (const std::vector< ax::Node * > &nodes)
 Remove Vertical spacing.
static void makeHorizontalSpacingEqual (const std::vector< ax::Node * > &nodes, float theSpacing)
 maybe for internal use
static void makeVerticalSpacingEqual (const std::vector< ax::Node * > &nodes, float theSpacing)
 maybe for internal use

Detailed Description

Helper class for traversing children in widget tree.

It also provides some helper functions for layout.

Member Function Documentation

◆ seekWidgetByTag()

Widget * seekWidgetByTag ( Widget * root,
int tag )
static

Find a widget with a specific tag from root widget.

This search will be recursive through all child widgets.

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

◆ seekWidgetByName()

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
rootThe be searched root widget.
nameThe widget name.
Returns
Widget instance pointer.

◆ seekActionWidgetByActionTag()

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
rootThe be searched root widget.
tagThe widget action's tag.
Returns
Widget instance pointer.

◆ getSubStringOfUTF8String()

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
strThe source string.
startThe start position of the substring.
lengthThe length of the substring in UTF8 count
Returns
a UTF8 substring

◆ doLayout()

void doLayout ( Node * rootNode)
static

Refresh object and it's children layout state.

Parameters
rootNodeA Node* or Node* descendant instance pointer.

◆ changeLayoutSystemActiveState()

void changeLayoutSystemActiveState ( bool active)
static

Change the active property of Layout's.

See also
LayoutComponent
Parameters
activeA boolean value.

◆ restrictCapInsetRect()

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
capInsetsA user defined capInsets.
textureSizeThe size of a scale9enabled texture
Returns
a restricted capInset.

◆ convertBoundingBoxToScreen()

Rect convertBoundingBoxToScreen ( Node * node)
static

Convert a node's boundingBox rect into screen coordinates.

Parameters
nodeAny node pointer.
Returns
A Rect in screen coordinates.

◆ setDesignSizeFixedEdge()

void setDesignSizeFixedEdge ( const Vec2 & designSize)
static

adatpe design size with fixed edge, normally, use this function for screen adatpe

Parameters
designSize

◆ setDesignSizeNoBorder()

void setDesignSizeNoBorder ( const Vec2 & designSize)
static

adapte design size with no border

Parameters
designSize

◆ centerHorizontally()

void centerHorizontally ( const std::vector< ax::Node * > & nodes)
static

Center horiz to parent.

Parameters
nodes

◆ centerVertically()

void centerVertically ( const std::vector< ax::Node * > & nodes)
static

Center vertical to parent.

Parameters
nodes

◆ centerToParent()

void centerToParent ( const std::vector< ax::Node * > & nodes)
static

Center to parent.

Parameters
nodes

◆ alignLefts()

void alignLefts ( const std::vector< ax::Node * > & nodes)
static

Align lefts.

Parameters
nodes

◆ alignRights()

void alignRights ( const std::vector< ax::Node * > & nodes)
static

Align rights.

Parameters
nodes

◆ alignTops()

void alignTops ( const std::vector< ax::Node * > & nodes)
static

Align tops.

Parameters
nodes

◆ alignBottoms()

void alignBottoms ( const std::vector< ax::Node * > & nodes)
static

Align bottoms.

Parameters
nodes

◆ alignHorizontals()

void alignHorizontals ( const std::vector< ax::Node * > & nodes)
static

Align horiz.

Parameters
nodes

◆ alignVerticals()

void alignVerticals ( const std::vector< ax::Node * > & nodes)
static

Align vertical.

Parameters
nodes

◆ alignCenters()

void alignCenters ( const std::vector< ax::Node * > & nodes)
static

Align centers.

Parameters
nodes

◆ makeSameWidth()

void makeSameWidth ( const std::vector< ax::Node * > & nodes)
static

Make same width.

Parameters
nodes

◆ makeSameHeight()

void makeSameHeight ( const std::vector< ax::Node * > & nodes)
static

Make same height.

Parameters
nodes

◆ makeSameSize()

void makeSameSize ( const std::vector< ax::Node * > & nodes)
static

Make same size.

Parameters
nodes

◆ makeHorizontalSpacingEqual() [1/2]

void makeHorizontalSpacingEqual ( std::vector< ax::Node * > & nodes)
static

Make horiz spacing equal.

Parameters
nodes

◆ makeVerticalSpacingEqual() [1/2]

void makeVerticalSpacingEqual ( std::vector< ax::Node * > & nodes)
static

Make vertical spacing equal.

Parameters
nodes

◆ increaseHorizontalSpacing()

void increaseHorizontalSpacing ( std::vector< ax::Node * > & nodes,
float theSpacing )
static

Increease horiz spacing.

Parameters
nodes

◆ increaseVerticalSpacing()

void increaseVerticalSpacing ( std::vector< ax::Node * > & nodes,
float theSpacing )
static

Increase vertical spacing.

Parameters
nodes

◆ decreaseHorizontalSpacing()

void decreaseHorizontalSpacing ( std::vector< ax::Node * > & nodes,
float theSpacing )
static

Decrease horiz spacing.

Parameters
nodes

◆ decreaseVerticalSpacing()

void decreaseVerticalSpacing ( std::vector< ax::Node * > & nodes,
float theSpacing )
static

Decrease vertical spacing.

Parameters
nodes

◆ removeHorizontalSpacing()

void removeHorizontalSpacing ( const std::vector< ax::Node * > & nodes)
static

Remove horiz spacing.

Parameters
nodes

◆ removeVerticalSpacing()

void removeVerticalSpacing ( const std::vector< ax::Node * > & nodes)
static

Remove Vertical spacing.

Parameters
nodes

◆ makeHorizontalSpacingEqual() [2/2]

void makeHorizontalSpacingEqual ( const std::vector< ax::Node * > & nodes,
float theSpacing )
static

maybe for internal use

Parameters
nodes

◆ makeVerticalSpacingEqual() [2/2]

void makeVerticalSpacingEqual ( const std::vector< ax::Node * > & nodes,
float theSpacing )
static

maybe for internal use

Parameters
nodes

The documentation for this class was generated from the following file:
  • UIHelper.h