|
ZeroZero Game Engine
v0.0
A 3D game engine using Vulkan & Jolt
|
Base class for all UI widgets
Public Types | |
| enum | Type { WIDGET, PANEL, BOX, LINE, FRAME, BUTTON, TOGGLEBUTTON, TEXT, TEXTEDIT, SCROLLBAR, TREEVIEW, IMAGE } |
| Widget type. More... | |
| enum | AlignmentType { , FILL, CENTER, HCENTER, VCENTER, TOP, BOTTOM, LEFT, RIGHT, TOPCENTER, BOTTOMCENTER, LEFTCENTER, RIGHTCENTER, TOPLEFT, BOTTOMLEFT, BOTTOMRIGHT, TOPRIGHT, LEFTTOP, LEFTBOTTOM, RIGHTBOTTOM, RIGHTTOP } |
| Widget placement (relative to the parent widget) More... | |
Public Member Functions | |
| Widget (Type=WIDGET) | |
| Type | getType () const |
| bool | isVisible () const |
| void | show (bool=true) |
| bool | isEnabled () const |
| void | enable (bool isEnabled=true) |
| void | setPos (float x, float y) |
| float | getWidth () const |
| float | getHeight () const |
| virtual void | setSize (float width, float height) |
| const Rect & | getRect () const |
| void | setRect (float x, float y, float width, float height) |
| void | setRect (const Rect &) |
| AlignmentType | getAlignment () const |
| void | setAlignment (AlignmentType) |
| Font & | getFont () |
| void | setFont (const shared_ptr< Font > &) |
| bool | isFocused () const |
| Widget * | getParent () const |
| template<typename T > | |
| shared_ptr< T > | add (shared_ptr< T > child, const AlignmentType alignment, const string &resource="", const bool overlap=false) |
| virtual void | remove (const shared_ptr< Widget > &child) |
| virtual void | removeAll () |
| void | setPadding (float) |
| float | getPadding () const |
| bool | isDrawBackground () const |
| void | setDrawBackground (bool drawBackground) |
| void | refresh () const |
| void | setResource (shared_ptr< Resource >) |
| uint32_t | getGroupIndex () const |
| void | setGroupIndex (int32_t) |
| void * | getUserData () const |
| void | setUserData (void *) |
| float | getTransparency () const |
| void | setTransparency (float alpha) |
Public Member Functions inherited from Object | |
| void | connect (const Signal::signal &name, const Signal::Handler &handler) |
| void | connect (const Signal::signal &name, const function< void ()> &handler) |
| void | emit (const Signal::signal &name, void *params=nullptr) |
| virtual string | toString () const |
| enum AlignmentType |
Widget placement (relative to the parent widget)
| enum Type |
Widget type.
| Enum Values | Documentation |
|---|---|
| WIDGET | transparent widget |
| PANEL | rectangular widget with only a background |
| BOX | rectangular widget with a border and a background |
| LINE | A horizontal or vertical line |
| FRAME | A box with a title |
| BUTTON | A push button |
| TOGGLEBUTTON | A two states button |
| TEXT | A single line of text |
| TEXTEDIT | An editable single line of text. |
| SCROLLBAR | A scroll bar. with min, max & pos |
| TREEVIEW | Tree of Widget. |
| IMAGE | 2D Image |
|
explicit |
Creates a widget of a particular type
|
inline |
Adds a child widget. Children widgets will be destroyed on parent destruction.
| child | : child widget to add |
| alignment | placement |
| resource | : resource string |
| overlap | : overlap widget on top of other widgets |
| void enable | ( | bool | isEnabled = true | ) |
Enables or disables widget reactions to input events
|
nodiscard |
Returns the current widget placement
|
nodiscard |
Returns the current font of the widget
|
nodiscard |
Return the user defined group index
|
nodiscardinline |
Returns the height of the widget, in pixels
|
nodiscard |
Returns current children padding (space between children)
|
inline |
Returns the parent widget, or nullptr
|
nodiscard |
Returns the size & the position of the widget
|
nodiscardinline |
Return the transparency alpha value
|
nodiscard |
Returns the type of the widget
| void* getUserData | ( | ) | const |
Returns the user data
|
nodiscardinline |
Returns the width of the widget, in pixels
|
nodiscard |
Returns false if the background is transparent
|
nodiscard |
Returns true is the widget is reactive to user action (mouse & keyboard)
|
nodiscard |
Returns true if the widget have keyboard focus
|
nodiscard |
Returns true if the widget is visible
| void refresh | ( | ) | const |
Force a refresh of the entire widget
|
virtual |
Removes a child widget
|
virtual |
Removes all children widgets recursively
| void setAlignment | ( | AlignmentType | ) |
Sets the widget placement. Calling this method involve redrawing the parent widget & resizing all the children widgets
| void setDrawBackground | ( | bool | drawBackground | ) |
Sets to false make the widget background transparent
| void setFont | ( | const shared_ptr< Font > & | ) |
Sets the current font of the widget
| void setGroupIndex | ( | int32_t | ) |
Set the user defined group index
| void setPadding | ( | float | ) |
Changes children padding (space between children)
| void setPos | ( | float | x, |
| float | y | ||
| ) |
Moves the widget to a particular position.
| void setRect | ( | const Rect & | ) |
Changes the size & position of the widget
| void setRect | ( | float | x, |
| float | y, | ||
| float | width, | ||
| float | height | ||
| ) |
Changes the size & position of the widget
| void setResource | ( | shared_ptr< Resource > | ) |
Changes widget resources. Use with caution !
|
virtual |
Resizes the widget
| void setTransparency | ( | float | alpha | ) |
Changes the transparency alpha value
| void setUserData | ( | void * | ) |
set user data
| void show | ( | bool | = true | ) |
Shows or hides the widget
1.7.0