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::Style Class Reference

RAII wrapper around an lv_style_t object. More...

#include <lvgl.hpp>

Public Member Functions

 Style ()
 Constructs and initialises an empty LVGL style.
 
 ~Style ()
 Destroys the style, releasing any resources held by LVGL.
 
 Style (const Style &)=delete
 
Styleoperator= (const Style &)=delete
 
 Style (Style &&other) noexcept
 Move constructor — transfers the style data and reinitialises the source.
 
Styleoperator= (Style &&other) noexcept
 Move-assignment operator — transfers the style data and reinitialises the source.
 
lv_style_t * get ()
 Returns a mutable pointer to the underlying lv_style_t.
 
const lv_style_t * get () const
 Returns a const pointer to the underlying lv_style_t.
 
Stylebg_color (lv_color_t c)
 Sets the background color.
 
Stylebg_opa (lv_opa_t opa)
 Sets the background opacity.
 
Styleradius (int32_t r)
 Sets the corner radius.
 
Styleborder_color (lv_color_t c)
 Sets the border color.
 
Styleborder_width (int32_t w)
 Sets the border width in pixels.
 
Stylepad_all (int32_t p)
 Sets uniform padding on all four sides.
 
Styletext_color (lv_color_t c)
 Sets the text color.
 
Styletext_font (const lv_font_t *f)
 Sets the font used to render text.
 

Detailed Description

RAII wrapper around an lv_style_t object.

Initialises the LVGL style on construction and resets (frees) it on destruction. Provides a fluent, chainable API for the most common style properties. Once populated, a Style can be applied to one or more LVGL objects via lv_obj_add_style().

Note
Non-copyable; movable. On move, the source style is left in a freshly initialised (empty) state rather than null so that LVGL does not hold a dangling pointer.

Constructor & Destructor Documentation

◆ Style()

ove::lvgl::Style::Style ( Style &&  other)
inlinenoexcept

Move constructor — transfers the style data and reinitialises the source.

Parameters
otherThe source style; left in a valid, empty state after the move.

Member Function Documentation

◆ operator=()

Style & ove::lvgl::Style::operator= ( Style &&  other)
inlinenoexcept

Move-assignment operator — transfers the style data and reinitialises the source.

Parameters
otherThe source style; left in a valid, empty state after the move.
Returns
Reference to this object.

◆ get() [1/2]

lv_style_t * ove::lvgl::Style::get ( )
inline

Returns a mutable pointer to the underlying lv_style_t.

Returns
Pointer to the internal LVGL style struct.

◆ get() [2/2]

const lv_style_t * ove::lvgl::Style::get ( ) const
inline

Returns a const pointer to the underlying lv_style_t.

Returns
Const pointer to the internal LVGL style struct.

◆ bg_color()

Style & ove::lvgl::Style::bg_color ( lv_color_t  c)
inline

Sets the background color.

Parameters
[in]cBackground color.
Returns
Reference to this style for method chaining.

◆ bg_opa()

Style & ove::lvgl::Style::bg_opa ( lv_opa_t  opa)
inline

Sets the background opacity.

Parameters
[in]opaOpacity value (0–255).
Returns
Reference to this style for method chaining.

◆ radius()

Style & ove::lvgl::Style::radius ( int32_t  r)
inline

Sets the corner radius.

Parameters
[in]rRadius in pixels.
Returns
Reference to this style for method chaining.

◆ border_color()

Style & ove::lvgl::Style::border_color ( lv_color_t  c)
inline

Sets the border color.

Parameters
[in]cBorder color.
Returns
Reference to this style for method chaining.

◆ border_width()

Style & ove::lvgl::Style::border_width ( int32_t  w)
inline

Sets the border width in pixels.

Parameters
[in]wBorder width.
Returns
Reference to this style for method chaining.

◆ pad_all()

Style & ove::lvgl::Style::pad_all ( int32_t  p)
inline

Sets uniform padding on all four sides.

Parameters
[in]pPadding in pixels.
Returns
Reference to this style for method chaining.

◆ text_color()

Style & ove::lvgl::Style::text_color ( lv_color_t  c)
inline

Sets the text color.

Parameters
[in]cText color.
Returns
Reference to this style for method chaining.

◆ text_font()

Style & ove::lvgl::Style::text_font ( const lv_font_t *  f)
inline

Sets the font used to render text.

Parameters
[in]fPointer to an LVGL font descriptor.
Returns
Reference to this style for method chaining.

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