oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ove::lvgl::ObjectView Class Reference

Non-owning, pointer-sized wrapper around an lv_obj_t*. More...

#include <lvgl.hpp>

Inheritance diagram for ove::lvgl::ObjectView:
Inheritance graph
[legend]

Public Member Functions

 ObjectView ()
 Constructs a null ObjectView (no associated LVGL object).
 
 ObjectView (lv_obj_t *obj)
 Constructs an ObjectView wrapping the given lv_obj_t*.
 
lv_obj_t * get () const
 Returns the raw lv_obj_t* pointer.
 
 operator lv_obj_t * () const
 Implicit conversion to lv_obj_t* for use with LVGL C APIs.
 
 operator bool () const
 Contextual bool conversion — true if the object pointer is non-null.
 
ObjectView parent () const
 Returns an ObjectView wrapping the parent of this object.
 
uint32_t child_count () const
 Returns the number of direct children of this object.
 
int32_t get_width () const
 Returns the current rendered width of this object.
 
int32_t get_height () const
 Returns the current rendered height of this object.
 
void del ()
 Deletes the LVGL object and all its children, then nulls the pointer.
 
void clean ()
 Deletes all children of this object without deleting the object itself.
 

Static Public Member Functions

static ObjectView screen_active ()
 Returns an ObjectView wrapping the currently active screen.
 

Protected Attributes

lv_obj_t * obj_
 Raw pointer to the wrapped LVGL object.
 

Detailed Description

Non-owning, pointer-sized wrapper around an lv_obj_t*.

ObjectView does not manage the lifetime of the underlying LVGL object. It provides safe, ergonomic access to the raw lv_obj_t* and exposes a small set of read/query operations. Widget classes (Label, Bar, Box) inherit from ObjectView to gain these capabilities.

The class is guaranteed to be pointer-sized (asserted via static_assert).

Note
Destroying an ObjectView does NOT delete the underlying LVGL object. Use del() to explicitly delete the LVGL object tree.

Constructor & Destructor Documentation

◆ ObjectView()

ove::lvgl::ObjectView::ObjectView ( lv_obj_t *  obj)
inlineexplicit

Constructs an ObjectView wrapping the given lv_obj_t*.

Parameters
[in]objPointer to an existing LVGL object; may be null.

Member Function Documentation

◆ get()

lv_obj_t * ove::lvgl::ObjectView::get ( ) const
inline

Returns the raw lv_obj_t* pointer.

Returns
Pointer to the wrapped LVGL object, or null.

◆ operator lv_obj_t *()

ove::lvgl::ObjectView::operator lv_obj_t * ( ) const
inline

Implicit conversion to lv_obj_t* for use with LVGL C APIs.

Returns
Pointer to the wrapped LVGL object.

◆ operator bool()

ove::lvgl::ObjectView::operator bool ( ) const
inlineexplicit

Contextual bool conversion — true if the object pointer is non-null.

Returns
true when wrapping a valid LVGL object.

◆ parent()

ObjectView ove::lvgl::ObjectView::parent ( ) const
inline

Returns an ObjectView wrapping the parent of this object.

Returns
ObjectView of the parent, or a null view if there is none.

◆ child_count()

uint32_t ove::lvgl::ObjectView::child_count ( ) const
inline

Returns the number of direct children of this object.

Returns
Child count as a uint32_t.

◆ get_width()

int32_t ove::lvgl::ObjectView::get_width ( ) const
inline

Returns the current rendered width of this object.

Returns
Width in pixels.

◆ get_height()

int32_t ove::lvgl::ObjectView::get_height ( ) const
inline

Returns the current rendered height of this object.

Returns
Height in pixels.

◆ del()

void ove::lvgl::ObjectView::del ( )
inline

Deletes the LVGL object and all its children, then nulls the pointer.

After calling this method the ObjectView is in a null/invalid state.

◆ screen_active()

static ObjectView ove::lvgl::ObjectView::screen_active ( )
inlinestatic

Returns an ObjectView wrapping the currently active screen.

Returns
ObjectView of the active LVGL screen.

The documentation for this class was generated from the following file: