oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::lvgl::ObjectMixin< Derived > Class Template Reference

CRTP mixin that adds fluent layout and visibility setters to widget classes. More...

#include <lvgl.hpp>

Public Member Functions

Derived & size (int32_t w, int32_t h)
 Sets both width and height of the object.
 
Derived & width (int32_t w)
 Sets the width of the object.
 
Derived & height (int32_t h)
 Sets the height of the object.
 
Derived & pos (int32_t x, int32_t y)
 Sets the position of the object relative to its parent.
 
Derived & center ()
 Centers the object within its parent.
 
Derived & align (lv_align_t a, int32_t x_ofs=0, int32_t y_ofs=0)
 Aligns the object to an anchor with an optional offset.
 
Derived & hide ()
 Hides the object by adding LV_OBJ_FLAG_HIDDEN.
 
Derived & show ()
 Shows the object by removing LV_OBJ_FLAG_HIDDEN.
 
Derived & visible (bool v)
 Conditionally shows or hides the object.
 
Derived & add_flag (lv_obj_flag_t f)
 Adds one or more object flags.
 
Derived & remove_flag (lv_obj_flag_t f)
 Removes one or more object flags.
 
Derived & add_state (lv_state_t s)
 Adds one or more object states.
 
Derived & remove_state (lv_state_t s)
 Removes one or more object states.
 
Derived & user_data (void *data)
 Stores an arbitrary user data pointer on the LVGL object.
 
Derived & clickable (bool on)
 Enables or disables click events on the object.
 

Detailed Description

template<typename Derived>
class ove::lvgl::ObjectMixin< Derived >

CRTP mixin that adds fluent layout and visibility setters to widget classes.

Derive from ObjectMixin<Derived> to gain a chainable API for the most common LVGL object properties (size, position, alignment, flags, state, user data, clickability). All methods return Derived & to support method chaining.

Template Parameters
DerivedThe concrete widget class inheriting this mixin. Must expose a get() method returning lv_obj_t*.

Member Function Documentation

◆ size()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::size ( int32_t  w,
int32_t  h 
)
inline

Sets both width and height of the object.

Parameters
[in]wWidth in pixels (or LV_SIZE_CONTENT / LV_PCT(...)).
[in]hHeight in pixels.
Returns
Reference to the derived object for method chaining.

◆ width()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::width ( int32_t  w)
inline

Sets the width of the object.

Parameters
[in]wWidth in pixels.
Returns
Reference to the derived object for method chaining.

◆ height()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::height ( int32_t  h)
inline

Sets the height of the object.

Parameters
[in]hHeight in pixels.
Returns
Reference to the derived object for method chaining.

◆ pos()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::pos ( int32_t  x,
int32_t  y 
)
inline

Sets the position of the object relative to its parent.

Parameters
[in]xX coordinate in pixels.
[in]yY coordinate in pixels.
Returns
Reference to the derived object for method chaining.

◆ center()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::center ( )
inline

Centers the object within its parent.

Returns
Reference to the derived object for method chaining.

◆ align()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::align ( lv_align_t  a,
int32_t  x_ofs = 0,
int32_t  y_ofs = 0 
)
inline

Aligns the object to an anchor with an optional offset.

Parameters
[in]aAlignment value (e.g., LV_ALIGN_CENTER).
[in]x_ofsHorizontal offset in pixels (default: 0).
[in]y_ofsVertical offset in pixels (default: 0).
Returns
Reference to the derived object for method chaining.

◆ hide()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::hide ( )
inline

Hides the object by adding LV_OBJ_FLAG_HIDDEN.

Returns
Reference to the derived object for method chaining.

◆ show()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::show ( )
inline

Shows the object by removing LV_OBJ_FLAG_HIDDEN.

Returns
Reference to the derived object for method chaining.

◆ visible()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::visible ( bool  v)
inline

Conditionally shows or hides the object.

Parameters
[in]vtrue to show, false to hide.
Returns
Reference to the derived object for method chaining.

◆ add_flag()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::add_flag ( lv_obj_flag_t  f)
inline

Adds one or more object flags.

Parameters
[in]fFlag bitmask (e.g., LV_OBJ_FLAG_CLICKABLE).
Returns
Reference to the derived object for method chaining.

◆ remove_flag()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::remove_flag ( lv_obj_flag_t  f)
inline

Removes one or more object flags.

Parameters
[in]fFlag bitmask to clear.
Returns
Reference to the derived object for method chaining.

◆ add_state()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::add_state ( lv_state_t  s)
inline

Adds one or more object states.

Parameters
[in]sState bitmask (e.g., LV_STATE_CHECKED).
Returns
Reference to the derived object for method chaining.

◆ remove_state()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::remove_state ( lv_state_t  s)
inline

Removes one or more object states.

Parameters
[in]sState bitmask to clear.
Returns
Reference to the derived object for method chaining.

◆ user_data()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::user_data ( void *  data)
inline

Stores an arbitrary user data pointer on the LVGL object.

Parameters
[in]dataOpaque pointer to associate with the object.
Returns
Reference to the derived object for method chaining.

◆ clickable()

template<typename Derived >
Derived & ove::lvgl::ObjectMixin< Derived >::clickable ( bool  on)
inline

Enables or disables click events on the object.

Parameters
[in]ontrue to make the object clickable, false to disable.
Returns
Reference to the derived object for method chaining.

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