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

C++ wrapper for an LVGL progress-bar widget. More...

#include <lvgl.hpp>

Inheritance diagram for ove::lvgl::Bar:
Inheritance graph
[legend]
Collaboration diagram for ove::lvgl::Bar:
Collaboration graph
[legend]

Public Member Functions

 Bar (lv_obj_t *obj)
 Constructs a Bar wrapping an existing LVGL bar object.
 
Barvalue (int32_t val)
 Sets the current value of the bar with animation enabled.
 
Barvalue (int32_t val, lv_anim_enable_t anim)
 Sets the current value of the bar with explicit animation control.
 
Barrange (int32_t min, int32_t max)
 Sets the minimum and maximum values for the bar.
 
Barindicator_color (lv_color_t c)
 Sets the background color of the indicator (filled) part.
 
Barbar_color (lv_color_t c)
 Sets the background color of the bar track (unfilled) part.
 
- Public Member Functions inherited from ove::lvgl::ObjectView
 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.
 
- Public Member Functions inherited from ove::lvgl::ObjectMixin< Bar >
Barsize (int32_t w, int32_t h)
 Sets both width and height of the object.
 
Barwidth (int32_t w)
 Sets the width of the object.
 
Barheight (int32_t h)
 Sets the height of the object.
 
Barpos (int32_t x, int32_t y)
 Sets the position of the object relative to its parent.
 
Barcenter ()
 Centers the object within its parent.
 
Baralign (lv_align_t a, int32_t x_ofs=0, int32_t y_ofs=0)
 Aligns the object to an anchor with an optional offset.
 
Barhide ()
 Hides the object by adding LV_OBJ_FLAG_HIDDEN.
 
Barshow ()
 Shows the object by removing LV_OBJ_FLAG_HIDDEN.
 
Barvisible (bool v)
 Conditionally shows or hides the object.
 
Baradd_flag (lv_obj_flag_t f)
 Adds one or more object flags.
 
Barremove_flag (lv_obj_flag_t f)
 Removes one or more object flags.
 
Baradd_state (lv_state_t s)
 Adds one or more object states.
 
Barremove_state (lv_state_t s)
 Removes one or more object states.
 
Baruser_data (void *data)
 Stores an arbitrary user data pointer on the LVGL object.
 
Barclickable (bool on)
 Enables or disables click events on the object.
 
- Public Member Functions inherited from ove::lvgl::EventMixin< Bar >
Baron (lv_event_code_t code, F &&fn)
 Registers a stateless callback for the given event code.
 
Baron (lv_event_code_t code, T *instance)
 Registers a member function pointer as an event callback — zero-cost trampoline.
 
Baron_click (F &&fn)
 Registers a stateless click callback (shorthand for on(LV_EVENT_CLICKED, fn)).
 
Baron_click (T *instance)
 Registers a member function click callback.
 
Baron_value_changed (F &&fn)
 Registers a stateless value-changed callback (shorthand for on(LV_EVENT_VALUE_CHANGED, fn)).
 
Baron_value_changed (T *instance)
 Registers a member function value-changed callback.
 
- Public Member Functions inherited from ove::lvgl::StyleMixin< Bar >
Barbg_color (lv_color_t c)
 Sets the background color of the object.
 
Barbg_opa (lv_opa_t opa)
 Sets the background opacity.
 
Barborder_color (lv_color_t c)
 Sets the border color.
 
Barborder_width (int32_t w)
 Sets the border width in pixels.
 
Barradius (int32_t r)
 Sets the corner radius.
 
Barpad_all (int32_t p)
 Sets uniform padding on all four sides.
 
Barpad_hor (int32_t p)
 Sets horizontal (left + right) padding.
 
Barpad_ver (int32_t p)
 Sets vertical (top + bottom) padding.
 
Barpad_gap (int32_t g)
 Sets the gap between children in flex/grid layouts.
 
Bartext_color (lv_color_t c)
 Sets the text color.
 
Bartext_font (const lv_font_t *f)
 Sets the font used to render text.
 

Static Public Member Functions

static Bar create (ObjectView parent)
 Factory method — creates a new LVGL bar as a child of parent.
 
- Static Public Member Functions inherited from ove::lvgl::ObjectView
static ObjectView screen_active ()
 Returns an ObjectView wrapping the currently active screen.
 

Additional Inherited Members

- Protected Attributes inherited from ove::lvgl::ObjectView
lv_obj_t * obj_
 Raw pointer to the wrapped LVGL object.
 

Detailed Description

C++ wrapper for an LVGL progress-bar widget.

Bar combines ObjectView, ObjectMixin, EventMixin, and StyleMixin to provide a fully fluent API for LVGL bar objects. All instances are pointer-sized (asserted via static_assert).

Create a bar using the static factory method Bar::create(parent).

Note
Does not own the underlying LVGL object. Use del() to destroy it.
lv_bar_bind_value() is not available in LVGL 9.2–9.3 and is therefore absent from this wrapper.

Constructor & Destructor Documentation

◆ Bar()

ove::lvgl::Bar::Bar ( lv_obj_t obj)
inlineexplicit

Constructs a Bar wrapping an existing LVGL bar object.

Parameters
[in]objPointer to an LVGL bar created via lv_bar_create().

Member Function Documentation

◆ create()

static Bar ove::lvgl::Bar::create ( ObjectView  parent)
inlinestatic

Factory method — creates a new LVGL bar as a child of parent.

Parameters
[in]parentThe parent ObjectView.
Returns
A Bar wrapping the newly created LVGL bar.

◆ value() [1/2]

Bar & ove::lvgl::Bar::value ( int32_t  val)
inline

Sets the current value of the bar with animation enabled.

Parameters
[in]valNew value (should be within the range set by range()).
Returns
Reference to this bar for method chaining.

◆ value() [2/2]

Bar & ove::lvgl::Bar::value ( int32_t  val,
lv_anim_enable_t  anim 
)
inline

Sets the current value of the bar with explicit animation control.

Parameters
[in]valNew value.
[in]animLV_ANIM_ON to animate the transition, LV_ANIM_OFF to jump immediately.
Returns
Reference to this bar for method chaining.

◆ range()

Bar & ove::lvgl::Bar::range ( int32_t  min,
int32_t  max 
)
inline

Sets the minimum and maximum values for the bar.

Parameters
[in]minMinimum value (maps to 0% fill).
[in]maxMaximum value (maps to 100% fill).
Returns
Reference to this bar for method chaining.

◆ indicator_color()

Bar & ove::lvgl::Bar::indicator_color ( lv_color_t  c)
inline

Sets the background color of the indicator (filled) part.

Parameters
[in]cIndicator color.
Returns
Reference to this bar for method chaining.

◆ bar_color()

Bar & ove::lvgl::Bar::bar_color ( lv_color_t  c)
inline

Sets the background color of the bar track (unfilled) part.

Parameters
[in]cTrack background color.
Returns
Reference to this bar for method chaining.

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