![]() |
Lysa UI
0.0
Lysa UI —UI components for the Lysa Engine
|
Base class for all UI widgets.
Inheritance diagram for Widget:Public Types | |
| enum | Type { WIDGET, PANEL, BOX, LINE, FRAME, BUTTON, TOGGLEBUTTON, TEXT, TEXTEDIT, SCROLLBAR, TREEVIEW, IMAGE } |
Public Member Functions | |
| Widget (Type type=WIDGET) | |
| virtual | ~Widget () = default |
| Type | getType () const |
| bool | isVisible () const |
| void | show (bool show=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 &rect) |
| Alignment | getAlignment () const |
| void | setAlignment (Alignment alignment) |
| std::shared_ptr< Font > | getFont () const |
| void | setFont (const std::shared_ptr< Font > &font) |
| float | getFontScale () const |
| virtual void | setFontScale (float fontScale) |
| bool | isFocused () const |
| Widget * | getParent () const |
| template<typename T , typename... Args> | |
| std::shared_ptr< T > | create (const std::string &resource, const Alignment alignment, Args &&...args) |
| template<typename T , typename... Args> | |
| std::shared_ptr< T > | create (const Alignment alignment, Args &&...args) |
| template<typename T > | |
| std::shared_ptr< T > | add (std::shared_ptr< T > child, const Alignment alignment, const std::string &resource="", const bool overlap=false) |
| virtual void | remove (const std::shared_ptr< Widget > &child) |
| virtual void | removeAll () |
| void | setPadding (float padding) |
| float | getPadding () const |
| float | getVBorder () const |
| float | getHBorder () const |
| void | setVBorder (float size) |
| void | setHBorder (float size) |
| bool | isDrawBackground () const |
| void | setDrawBackground (bool drawBackground) |
| bool | isPushed () const |
| bool | isPointed () const |
| bool | isFreezed () const |
| bool | isRedrawOnMouseEvent () const |
| bool | isOverlapping () const |
| Rect | getChildrenRect () const |
| void | setFreezed (const bool f) |
| void | setPushed (const bool p) |
| void | refresh () const |
| void | setResource (std::shared_ptr< UIResource > resource) |
| uint32 | getGroupIndex () const |
| void | setGroupIndex (int32 index) |
| void * | getUserData () const |
| void | setUserData (void *data) |
| float | getTransparency () const |
| void | setTransparency (float alpha) |
| void | resizeChildren () |
| std::shared_ptr< Widget > | setFocus (bool=true) |
| virtual void | eventCreate () |
| virtual void | eventDestroy () |
| virtual void | eventShow () |
| virtual void | eventHide () |
| virtual void | eventEnable () |
| virtual void | eventDisable () |
| virtual void | eventMove (float x, float y) |
| virtual void | eventResize () |
| virtual bool | eventTextInput (const std::string &text) |
| virtual bool | eventKeyDown (Key key) |
| virtual bool | eventKeyUp (Key key) |
| virtual bool | eventMouseDown (MouseButton button, float x, float y) |
| virtual bool | eventMouseUp (MouseButton button, float x, float y) |
| virtual bool | eventMouseMove (uint32, float x, float y) |
| virtual void | eventGotFocus () |
| virtual void | eventLostFocus () |
Protected Attributes | |
| const Type | type |
| Rect | rect |
| Rect | defaultRect |
| float | hborder {0} |
| float | vborder {0} |
| float | padding {0} |
| bool | overlap {false} |
| bool | focused {false} |
| bool | allowFocus {false} |
| bool | allowChildren {true} |
| bool | drawBackground {true} |
| bool | moveChildrenOnPush {false} |
| bool | redrawOnMouseEvent {false} |
| bool | redrawOnMouseMove {false} |
| float | transparency {1.0f} |
| Widget * | parent {nullptr} |
| Alignment | alignment {Alignment::NONE} |
| std::shared_ptr< UIResource > | resource |
| std::list< std::shared_ptr< Widget > > | children |
| void * | window {nullptr} |
| void * | style {nullptr} |
| bool | mouseMoveOnFocus {false} |
| float | fontScale {0.0f} |
| enum Type |
Widget type enumeration.
| 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 |
| Widget | ( | Type | type = WIDGET | ) |
Creates a widget of a particular type.
| ctx | The engine context. |
| type | The type of the widget. |
|
virtualdefault |
|
inline |
Adds a child widget.
Children widgets will be destroyed on parent destruction.
| T | The type of the widget to add. |
| child | Child widget to add. |
| alignment | Placement alignment. |
| resource | Resource string. |
| overlap | Overlap widget on top of other widgets. |
|
inline |
Creates & adds a child widget.
| T | The type of the widget to create. |
| Args | The types of the arguments to pass to the widget constructor. |
| alignment | The alignment of the child widget. |
| args | The arguments to pass to the widget constructor. |
|
inline |
Creates & adds a child widget using a resource string.
| T | The type of the widget to create. |
| Args | The types of the arguments to pass to the widget constructor. |
| resource | The resource string defining the widget style or properties. |
| alignment | The alignment of the child widget. |
| args | The arguments to pass to the widget constructor. |
| void enable | ( | bool | isEnabled = true | ) |
Enables or disables widget reactions to input events.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Reimplemented in lysa::ui::TextEdit::eventKeyDown()
|
virtual |
|
virtual |
|
virtual |
Reimplemented in lysa::ui::CheckWidget::eventMouseDown()
|
virtual |
|
virtual |
Reimplemented in lysa::ui::Button::eventMouseUp(), lysa::ui::ToggleButton::eventMouseUp()
|
virtual |
|
virtual |
Reimplemented in lysa::ui::ValueSelect::eventResize()
|
virtual |
|
virtual |
Reimplemented in lysa::ui::TextEdit::eventTextInput()
| Alignment getAlignment | ( | ) | const |
Returns the current widget placement.
| Rect getChildrenRect | ( | ) | const |
Returns the rectangle enclosing all children.
| std::shared_ptr<Font> getFont | ( | ) | const |
Returns the current font of the widget.
| float getFontScale | ( | ) | const |
Returns the font scale.
| uint32 getGroupIndex | ( | ) | const |
Returns the user defined group index.
| float getHBorder | ( | ) | const |
Returns horizontal border size.
|
inline |
Returns the height of the widget, in pixels.
| float getPadding | ( | ) | const |
Returns current children padding.
|
inline |
Returns the parent widget, or nullptr.
| const Rect& getRect | ( | ) | const |
Returns the size & the position of the widget.
|
inline |
Returns the transparency alpha value.
| Type getType | ( | ) | const |
Returns the type of the widget.
| void* getUserData | ( | ) | const |
Returns the user data.
| float getVBorder | ( | ) | const |
Returns vertical border size.
|
inline |
Returns the width of the widget, in pixels.
| bool isDrawBackground | ( | ) | const |
Returns false if the background is transparent.
| bool isEnabled | ( | ) | const |
Returns true if the widget is reactive to user action (mouse & keyboard).
| bool isFocused | ( | ) | const |
Returns true if the widget has keyboard focus.
| bool isFreezed | ( | ) | const |
Returns true if the widget is freezed (not responding to events).
|
inline |
Returns true if the widget is overlapping other widgets.
| bool isPointed | ( | ) | const |
Returns true if the widget is currently pointed by the mouse.
| bool isPushed | ( | ) | const |
Returns true if the widget is currently pushed (e.g. mouse button down).
| bool isRedrawOnMouseEvent | ( | ) | const |
Returns true if the widget should redraw on mouse events.
| bool isVisible | ( | ) | const |
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 resizeChildren | ( | ) |
Resizes children widgets.
| void setAlignment | ( | Alignment | alignment | ) |
Sets the widget placement.
Calling this method involves redrawing the parent widget & resizing all the children widgets.
| void setDrawBackground | ( | bool | drawBackground | ) |
Sets whether to draw the widget background.
| std::shared_ptr<Widget> setFocus | ( | bool | = true | ) |
| void setFont | ( | const std::shared_ptr< Font > & | font | ) |
Sets the current font of the widget.
|
virtual |
Sets the font scale.
Reimplemented in lysa::ui::Text::setFontScale()
|
inline |
Sets whether the widget is freezed.
| void setGroupIndex | ( | int32 | index | ) |
Sets the user defined group index.
| void setHBorder | ( | float | size | ) |
Sets horizontal border size.
| void setPadding | ( | float | padding | ) |
Changes children padding (space between children).
| void setPos | ( | float | x, |
| float | y | ||
| ) |
Moves the widget to a particular position.
|
inline |
Sets whether the widget is pushed.
| void setRect | ( | const Rect & | 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 | ( | std::shared_ptr< UIResource > | resource | ) |
Changes widget resources.
|
virtual |
Resizes the widget, in pixels.
| void setTransparency | ( | float | alpha | ) |
Changes the transparency alpha value.
| void setUserData | ( | void * | data | ) |
Sets user data.
| void setVBorder | ( | float | size | ) |
Sets vertical border size.
| void show | ( | bool | show = true | ) |
Shows or hides the widget.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |