![]() |
Lysa UI
0.0
Lysa UI —UI components for the Lysa Engine
|
Inheritance diagram for Window:Public Types | |
| enum | ResizeableBorder { RESIZEABLE_NONE = 0b0000, RESIZEABLE_LEFT = 0b0001, RESIZEABLE_RIGHT = 0b0010, RESIZEABLE_TOP = 0b0100, RESIZEABLE_BOTTOM = 0b1000 } |
Public Member Functions | |
| Window (const Rect &rect) | |
| ~Window () override = default | |
| bool | isAttached () const |
| void | setResizeableBorders (const uint32 borders) |
| auto | getResizeableBorders () const |
| auto | isModal () const |
| void | setModal (const bool modal) |
| Style & | getStyle () const |
| void | setStyle (const std::shared_ptr< Style > &style) |
| Widget & | getWidget () const |
| void | setWidget (std::shared_ptr< Widget > child=nullptr, const std::string &resources="", float padding=0) |
| 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 (const std::shared_ptr< T > &child, const Alignment alignment, const std::string &resource="", const bool overlap=false) const |
| void | remove (const std::shared_ptr< Widget > &child) const |
| void | setFocusedWidget (const std::shared_ptr< Widget > &widget) |
| auto | getWidth () const |
| auto | getHeight () const |
| void | setRect (const Rect &newRect) |
| void | setWidth (float width) |
| void | setHeight (float height) |
| void | setPos (float x, float y) |
| void | setPos (const float2 &pos) |
| float | getX () const |
| float | getY () const |
| void | setX (float x) |
| void | setY (float y) |
| const auto & | getRect () const |
| float | getAspectRatio () const |
| auto | isVisible () const |
| void | setVisible (bool isVisible) |
| void | hide () |
| void | show () |
| void | setTransparency (float alpha) |
| virtual void | onAttach () |
| virtual void | onDetach () |
| virtual void | onShow () |
| virtual void | onHide () |
| virtual void | onResize () |
| virtual void | onMove () |
| virtual bool | onKeyDown (Key key) |
| virtual bool | onTextInput (const std::string &text) |
| virtual bool | onKeyUp (Key key) |
| virtual bool | onMouseDown (MouseButton button, float x, float y) |
| virtual bool | onMouseUp (MouseButton button, float x, float y) |
| virtual bool | onMouseMove (uint32 buttonsState, float x, float y) |
| virtual void | onGotFocus () |
| virtual void | onLostFocus () |
| void | setMinimumSize (float width, float height) |
| void | setMaximumSize (float width, float height) |
| auto | getMinimumWidth () const |
| auto | getMinimumHeight () const |
| auto | getMaximumWidth () const |
| auto | getMaximumHeight () const |
| std::shared_ptr< Font > | getFont () const |
| void | setFont (const std::shared_ptr< Font > &font) |
| float | getFontScale () const |
| void | setFontScale (float fontScale) |
| void | refresh () const |
| void | attach (WindowManager *windowManager) |
| void | close () |
| Vector2DRenderer & | getRenderer () const |
| RenderingWindow & | getRenderingWindow () const |
| WindowManager & | getWindowManager () const |
| void | subscribe (const event_type &type, unique_id id, EventHandlerCallback callback) |
| void | subscribe (const event_type &type, EventHandlerCallback callback) |
| void | unsubscribe (unique_id id) |
| enum ResizeableBorder |
| Window | ( | const Rect & | rect | ) |
Creates a virtual UI window with a given position & size.
| rect | The initial rectangle (position and size). |
|
overridedefault |
|
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. |
| void attach | ( | WindowManager * | windowManager | ) |
Attach the window to a Window manager
| void close | ( | ) |
Remove the window from the currently attached Window manager and destroy it.
|
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 | Placement alignment. |
| args | 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 | Resource string. |
| alignment | Placement alignment. |
| args | Arguments to pass to the widget constructor. |
| float getAspectRatio | ( | ) | const |
Returns the aspect ratio (width / height) of the Window client area.
| std::shared_ptr<Font> getFont | ( | ) | const |
Returns the default font loaded at startup.
| float getFontScale | ( | ) | const |
Returns the default font scale.
|
inline |
Returns the height of the client area.
|
inline |
Returns the maximum height of the Window.
|
inline |
Returns the maximum width of the Window.
|
inline |
Returns the minimum height of the Window.
|
inline |
Returns the minimum width of the Window.
|
inline |
Returns the size & position of the widget.
| Vector2DRenderer& getRenderer | ( | ) | const |
Returns the 2D renderer associated with this Window.
| RenderingWindow& getRenderingWindow | ( | ) | const |
|
inline |
Returns the borders that can be used to resize the Window.
| Style& getStyle | ( | ) | const |
Returns the current style.
| Widget& getWidget | ( | ) | const |
|
inline |
Returns the width of the client area.
| WindowManager& getWindowManager | ( | ) | const |
|
inline |
Returns the X position of the Window, bottom-left.
|
inline |
Returns the Y position of the Window, bottom-left.
| void hide | ( | ) |
|
inline |
|
inline |
Returns true if the Window blocks the input events of all the other Windows.
|
inline |
Returns true if Window is currently visible.
|
inlinevirtual |
Event called after the Window have been attached to a WindowManager
Reimplemented in lysa::ui::ColorModalDialog::onAttach()
|
inlinevirtual |
Event called before the Window will be detached to the WindowManager
|
inlinevirtual |
Event called when the Window got the keyboard focus.
|
inlinevirtual |
|
inlinevirtual |
Event called when a key was pressed.
| key | The key pressed. |
|
inlinevirtual |
Event called when a key was released.
| key | The key released. |
|
inlinevirtual |
Event called when the Window lost the keyboard focus.
|
inlinevirtual |
Event called when a mouse button was pressed inside the Window.
| button | The mouse button. |
| x | Mouse X coordinate. |
| y | Mouse Y coordinate. |
|
inlinevirtual |
Event called when the mouse is moved above the Window client area.
| buttonsState | State of mouse buttons. |
| x | Mouse X coordinate. |
| y | Mouse Y coordinate. |
|
inlinevirtual |
Event called when a mouse button was released inside the Window.
| button | The mouse button. |
| x | Mouse X coordinate. |
| y | Mouse Y coordinate. |
|
inlinevirtual |
Event called after a position change.
|
inlinevirtual |
Event called after a size change.
|
inlinevirtual |
|
inlinevirtual |
Event called on user input
| void refresh | ( | ) | const |
Forces a full redraw of the Window on the next frame.
|
inline |
Removes a child widget.
| void setFocusedWidget | ( | const std::shared_ptr< Widget > & | widget | ) |
Changes the focus to a specific widget.
| void setFont | ( | const std::shared_ptr< Font > & | font | ) |
Sets the default font.
| void setFontScale | ( | float | fontScale | ) |
Sets the default font scale.
| void setHeight | ( | float | height | ) |
Sets the height of the client area.
| void setMaximumSize | ( | float | width, |
| float | height | ||
| ) |
Sets the maximum size of the Window (default to VECTOR_SCALE).
| void setMinimumSize | ( | float | width, |
| float | height | ||
| ) |
Sets the minimum size of the Window (default to {2.0f, 2.0f}).
|
inline |
Makes the Window block the input events of all the other Windows
| void setPos | ( | const float2 & | pos | ) |
Sets the position of the Window, bottom-left.
| void setPos | ( | float | x, |
| float | y | ||
| ) |
Sets the position of the Window, bottom-left.
| void setRect | ( | const Rect & | newRect | ) |
Sets the client area position & size.
|
inline |
Sets the borders that can be used to resize the Window.
| borders | Bitmask of ResizeableBorder. |
| void setStyle | ( | const std::shared_ptr< Style > & | style | ) |
Sets the current style layout.
| void setTransparency | ( | float | alpha | ) |
Sets the alpha value for transparency.
| void setVisible | ( | bool | isVisible | ) |
Sets the Window visibility.
The change will be effective at the start of the next frame.
| void setWidget | ( | std::shared_ptr< Widget > | child = nullptr, |
| const std::string & | resources = "", |
||
| float | padding = 0 |
||
| ) |
Sets the root widget with optional resource string.
Call setStyle(nullptr) if no layout have been set previously.
| child | Child widget to set as root. |
| resources | Resource string for the root widget. |
| padding | Padding for the root widget |
| void setWidth | ( | float | width | ) |
Sets the width of the client area.
| void setX | ( | float | x | ) |
Sets the X position of the Window, bottom-left.
| void setY | ( | float | y | ) |
Sets the Y position of the Window, bottom-left.
| void show | ( | ) |
Shows the Window.
The change will be effective at the start of the next frame.
| void subscribe | ( | const event_type & | type, |
| EventHandlerCallback | callback | ||
| ) |
Subscribe to an event and register the subscriber for the auto-unsubscribe mechanism
| void subscribe | ( | const event_type & | type, |
| unique_id | id, | ||
| EventHandlerCallback | callback | ||
| ) |
Subscribe to an event and register the subscriber for the auto-unsubscribe mechanism
| void unsubscribe | ( | unique_id | id | ) |
Unsubscribe a registered event subscriber
|
friend |