|
|
| Component ()=default |
| | Default constructor — component starts in the unmounted state.
|
| |
|
| Component (const Component &)=delete |
| |
|
Component & | operator= (const Component &)=delete |
| |
| void | mount (ObjectView parent) |
| | Builds and mounts the component under the given parent.
|
| |
| void | unmount () |
| | Unmounts and deletes the component's widget subtree.
|
| |
| bool | is_mounted () const |
| | Returns true if the component is currently mounted.
|
| |
| ObjectView | root () const |
| | Returns an ObjectView of the component's root widget.
|
| |
|
void | hide () |
| | Hides the component's root widget if mounted.
|
| |
|
void | show () |
| | Shows the component's root widget if mounted.
|
| |
template<typename Derived>
class ove::lvgl::Component< Derived >
CRTP base class for reusable, self-contained LVGL UI components.
A Component encapsulates a subtree of LVGL widgets behind a mount() / unmount() lifecycle. The derived class must implement a build(ObjectView parent) method that constructs and returns the root widget of the component.
The root object's user-data pointer is set to this so that event handlers can recover the component instance via from_event(). An internal LV_EVENT_DELETE callback clears the cached root reference if the LVGL object tree is deleted externally (e.g., by a screen transition).
- Template Parameters
-
| Derived | The concrete component class. Must implement: ObjectView build(ObjectView parent). |
- Note
- Non-copyable.
-
All methods must be called from within the LVGL task context or while holding an
LvglGuard lock.
template<typename Derived >
Builds and mounts the component under the given parent.
Calls Derived::build(parent) to create the widget subtree, stores the component pointer in the root's user-data slot, and registers an internal LV_EVENT_DELETE callback. If the component is already mounted, this call is a no-op.
- Parameters
-
| [in] | parent | The parent ObjectView to attach the component to. |