Skip to content

File include/brisk/gui/Component.hpp


Component class

Component

Base class for creating a UI component.

This class provides the basic structure and behavior for any UI component in the application. It manages the lifecycle of the component, its event handling, and its associated window.

window function (Component::window)

RC<GUIWindow> window()

Gets the GUIWindow associated with this component.
Returns RC<GUIWindow> A reference-counted pointer to the GUIWindow.

tree function (Component::tree)

WidgetTree &tree()

Returns the WidgetTree for the component.
Returns WidgetTree& A reference to the WidgetTree.

makeWindow function (Component::makeWindow)

virtual RC<GUIWindow> makeWindow()

This method is called on the main thread and is expected to return the window object that the component will use.
Returns RC<GUIWindow> A reference-counted pointer to the GUIWindow.

build function (Component::build)

virtual RC<Widget> build()

Called to build the component's widget hierarchy.

This function should be overridden to construct and return the root widget of the component.
Returns RC<Widget> A reference-counted pointer to the root widget.

unhandledEvent function (Component::unhandledEvent)

virtual void unhandledEvent(Event &event)

Handles any unhandled events.

If an event is not handled by the widget tree, this function will be called. It can be overridden to provide custom handling for specific events.
Param event The unhandled event.

onScaleChanged function (Component::onScaleChanged)

virtual void onScaleChanged()

Called when the UI scale is changed.

This can be used to adjust the component's appearance for different screen scales.

configureWindow function (Component::configureWindow)

virtual void configureWindow(RC<GUIWindow> window)

Configures the window for the component.

This is called before the window is shown and allows customization of the window (title, size etc).
Param window The window to configure.

beforeFrame function (Component::beforeFrame)

virtual void beforeFrame()

Called before rendering a new frame.

This is typically used for pre-frame updates, such as preparing data or animations.

closeWindow function (Component::closeWindow)

void closeWindow()

Closes the associated window.

This will hide and optionally destroy the window tied to the component.


Auto-generated from sources, Revision , https://github.com/brisklib/brisk/blob//include/brisk/