lv_observer.h
API reference for lv_observer.h
Functions
lv_subject_set_int
Set value of an integer Subject and notify Observers.
void lv_subject_set_int(lv_subject_t *subject, int32_t value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
value | int32_t | new value |
lv_subject_set_min_value_int
Set a minimum value for an integer subject
void lv_subject_set_min_value_int(lv_subject_t *subject, int32_t min_value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
min_value | int32_t | the minimum value |
lv_subject_set_max_value_int
Set a maximum value for an integer subject
void lv_subject_set_max_value_int(lv_subject_t *subject, int32_t max_value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
max_value | int32_t | the maximum value |
lv_subject_set_float
Set value of an float Subject and notify Observers.
void lv_subject_set_float(lv_subject_t *subject, float value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
value | float | new value |
lv_subject_set_min_value_float
Set a minimum value for a float subject
void lv_subject_set_min_value_float(lv_subject_t *subject, float min_value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
min_value | float | the minimum value |
lv_subject_set_max_value_float
Set a maximum value for a float subject
void lv_subject_set_max_value_float(lv_subject_t *subject, float max_value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
max_value | float | the maximum value |
lv_subject_set_string_buffer_static
Set the buffers where a string subject will store its value The buffers must out-live the subject
void lv_subject_set_string_buffer_static(lv_subject_t *subject, char *buf, char *prev_buf, size_t size)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
buf | char * | pointer to buffer to store string |
prev_buf | char * | pointer to buffer to store previous string. May be NULL. When NULL the previous string is not tracked. |
size | size_t | size of buffer(s) |
A string Subject stores its own copy of the string, not just the pointer.
lv_subject_set_string
Set a Subject's string value and notify Observers if it changed.
void lv_subject_set_string(lv_subject_t *subject, const char *buf)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
buf | const char * | new string |
The Subject stores its own copy of the string, not just the pointer.
lv_subject_set_pointer
Set value of a pointer Subject and notify Observers (regardless of whether it changed).
void lv_subject_set_pointer(lv_subject_t *subject, void *ptr)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
ptr | void * | new value May be NULL. |
lv_subject_set_color
Set value of a color Subject and notify Observers if it changed.
void lv_subject_set_color(lv_subject_t *subject, lv_color_t color)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
color | lv_color_t | new value |
lv_subject_set_group_list_static
Set the subject list of a group subject
void lv_subject_set_group_list_static(lv_subject_t *subject, lv_subject_t *list[], uint32_t list_len)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to group Subject |
list | lv_subject_t * | list of other Subject addresses; when any of these have values updated, Observers of group_subject will be notified. |
list_len | uint32_t | number of elements in list[] |
lv_subject_set_external_data
Attaches external user data to an integer Subject with lifecycle management.
Associates arbitrary user-defined data with an LVGL observer and registers a destructor callback that will be automatically invoked when the observer is deleted. This enables:
- Safe resource cleanup through the destructor mechanism
- Contextual data storage for observer callbacks
- Proper memory management for observer-related resources
void lv_subject_set_external_data(lv_subject_t *subject, void *data, void(*free_cb)(void *data))| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
data | void * | User-defined data pointer to associate May be NULL. |
free_cb | void(*)(void *data) | Cleanup function called when: May be NULL.- Observer is explicitly deleted - Observed object is deleted - New data replaces current association NULL indicates no cleanup required |
lv_observer_set_user_data
Set Observer's user data.
void lv_observer_set_user_data(lv_observer_t *observer, void *user_data)| Name | Type | Description |
|---|---|---|
observer | lv_observer_t * | pointer to Observer |
user_data | void * | pointer to user-owned data (may be NULL) May be NULL. |
lv_obj_set_subject_increment_event_min_value
Set the minimum subject value to set by the event
void lv_obj_set_subject_increment_event_min_value(lv_obj_t *obj, lv_subject_increment_dsc_t *dsc, int32_t min_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to the Widget to which the event is attached |
dsc | lv_subject_increment_dsc_t * | pointer to the descriptor returned by lv_obj_add_subject_increment_event() |
min_value | int32_t | the minimum value to set |
lv_obj_set_subject_increment_event_max_value
Set the maximum subject value to set by the event
void lv_obj_set_subject_increment_event_max_value(lv_obj_t *obj, lv_subject_increment_dsc_t *dsc, int32_t max_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to the Widget to which the event is attached |
dsc | lv_subject_increment_dsc_t * | pointer to the descriptor returned by lv_obj_add_subject_increment_event() |
max_value | int32_t | the maximum value to set |
lv_obj_set_subject_increment_event_rollover
Set what to do when the min/max value is crossed.
void lv_obj_set_subject_increment_event_rollover(lv_obj_t *obj, lv_subject_increment_dsc_t *dsc, bool rollover)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to the Widget to which the event is attached |
dsc | lv_subject_increment_dsc_t * | pointer to the descriptor returned by lv_obj_add_subject_increment_event() |
rollover | bool | false: stop at the min/max value; true: jump to the other end |
the subject also can have min/max values and always the smaller range will be considered
lv_obj_add_subject_set_int_event
Set the value of an integer subject.
void lv_obj_add_subject_set_int_event(lv_obj_t *obj, lv_subject_t *subject, lv_event_code_t trigger, int32_t value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a widget |
subject | lv_subject_t * | pointer to a subject to change |
trigger | lv_event_code_t | the trigger on which the subject should be changed |
value | int32_t | the value to set |
lv_obj_add_subject_set_float_event
Set the value of a float subject.
void lv_obj_add_subject_set_float_event(lv_obj_t *obj, lv_subject_t *subject, lv_event_code_t trigger, float value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a widget |
subject | lv_subject_t * | pointer to a subject to change |
trigger | lv_event_code_t | the trigger on which the subject should be changed |
value | float | the value to set |
lv_obj_add_subject_set_string_event
Set the value of a string subject.
void lv_obj_add_subject_set_string_event(lv_obj_t *obj, lv_subject_t *subject, lv_event_code_t trigger, const char *value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a widget |
subject | lv_subject_t * | pointer to a subject to change |
trigger | lv_event_code_t | the trigger on which the subject should be changed |
value | const char * | the value to set |
lv_subject_get_int
Get current value of an integer Subject.
int32_t lv_subject_get_int(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: int32_t — current value
lv_subject_get_previous_int
Get previous value of an integer Subject.
int32_t lv_subject_get_previous_int(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: int32_t — current value
lv_subject_get_float
Get current value of an float Subject.
float lv_subject_get_float(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: float — current value
lv_subject_get_previous_float
Get previous value of an float Subject.
float lv_subject_get_previous_float(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: float — current value
lv_subject_get_string
Get current value of a string Subject.
const char * lv_subject_get_string(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: const char * — pointer to buffer containing current value
lv_subject_get_previous_string
Get previous value of a string Subject.
const char * lv_subject_get_previous_string(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: const char * — pointer to buffer containing previous value
lv_subject_get_pointer
Get current value of a pointer Subject.
const void * lv_subject_get_pointer(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: const void * — current value
lv_subject_get_previous_pointer
Get previous value of a pointer Subject.
const void * lv_subject_get_previous_pointer(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: const void * — previous value
lv_subject_get_color
Get current value of a color Subject.
lv_color_t lv_subject_get_color(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: lv_color_t — current value
lv_subject_get_previous_color
Get previous value of a color Subject.
lv_color_t lv_subject_get_previous_color(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
Returns: lv_color_t — previous value
lv_subject_get_group_element
Get an element from Subject Group's list.
lv_subject_t * lv_subject_get_group_element(lv_subject_t *subject, int32_t index)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Group-type Subject |
index | int32_t | index of element to get |
Returns: lv_subject_t * — pointer to indexed Subject from list, or NULL if index is out of bounds
lv_observer_get_target
Get target of an Observer.
void * lv_observer_get_target(lv_observer_t *observer)| Name | Type | Description |
|---|---|---|
observer | lv_observer_t * | pointer to Observer |
Returns: void * — pointer to saved target
lv_observer_get_target_obj
Get target Widget of Observer. This is the same as lv_observer_get_target(), except it returns target as an lv_obj_t *.
lv_obj_t * lv_observer_get_target_obj(lv_observer_t *observer)| Name | Type | Description |
|---|---|---|
observer | lv_observer_t * | pointer to Observer |
Returns: lv_obj_t * — pointer to saved Widget target
lv_observer_get_user_data
Get Observer's user data.
void * lv_observer_get_user_data(const lv_observer_t *observer)| Name | Type | Description |
|---|---|---|
observer | const lv_observer_t * | pointer to Observer |
Returns: void * — void pointer to saved user data
lv_subject_create
Create a subject of type type
lv_subject_t * lv_subject_create(lv_subject_type_t type)| Name | Type | Description |
|---|---|---|
type | lv_subject_type_t | the type of the subject. See lv_subject_type_t |
lv_subject_delete
Delete a subject
void lv_subject_delete(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | the subject to delete May be NULL. |
lv_subject_init_int
Initialize an integer-type Subject.
> Deprecated: The subject init API is deprecated, use lv_subject_create instead
void lv_subject_init_int(lv_subject_t *subject, int32_t value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
value | int32_t | initial value |
lv_subject_init_float
Initialize an float-type Subject.
> Deprecated: The subject init API is deprecated, use lv_subject_create instead
void lv_subject_init_float(lv_subject_t *subject, float value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
value | float | initial value |
lv_subject_init_string
Initialize a string-type Subject.
> Deprecated: The subject init API is deprecated, use lv_subject_create instead
void lv_subject_init_string(lv_subject_t *subject, char *buf, char *prev_buf, size_t size, const char *value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
buf | char * | pointer to buffer to store string |
prev_buf | char * | pointer to buffer to store previous string. May be NULL. When NULL the previous string is not tracked. |
size | size_t | size of buffer(s) |
value | const char * | initial value of string, e.g. "hello" |
A string Subject stores its own copy of the string, not just the pointer.
lv_subject_snprintf
Format a new string, updating Subject, and notify Observers if it changed.
void lv_subject_snprintf(lv_subject_t *subject, const char *format,...)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
format | const char * | format string |
... |
lv_subject_init_pointer
Initialize a pointer-type Subject.
> Deprecated: The subject init API is deprecated, use lv_subject_create instead
void lv_subject_init_pointer(lv_subject_t *subject, void *value)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
value | void * | initial value May be NULL. |
lv_subject_init_color
Initialize a color-type Subject.
> Deprecated: The subject init API is deprecated, use lv_subject_create instead
void lv_subject_init_color(lv_subject_t *subject, lv_color_t color)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
color | lv_color_t | initial value |
lv_subject_init_group
Initialize a Group-type Subject.
> Deprecated: The subject init API is deprecated, use lv_subject_create instead
void lv_subject_init_group(lv_subject_t *group_subject, lv_subject_t *list[], uint32_t list_len)| Name | Type | Description |
|---|---|---|
group_subject | lv_subject_t * | pointer to Group-type Subject |
list | lv_subject_t * | list of other Subject addresses; when any of these have values updated, Observers of group_subject will be notified. |
list_len | uint32_t | number of elements in list[] |
lv_subject_deinit
Remove all Observers from a Subject and free allocated memory, and delete any associated Widget-Binding events. This leaves subject "disconnected" from all Observers and all associated Widget events established through Widget Binding.
> Deprecated: The subject init API is deprecated, use lv_subject_create/lv_subject_delete instead
void lv_subject_deinit(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject May be NULL. |
This can safely be called regardless of whether any Observers added with lv_subject_add_observer_obj() or bound to a Widget Property with one of the ..._bind_...() functions.
lv_subject_add_observer
Add Observer to Subject. When Subject's value changes observer_cb will be called.
lv_observer_t * lv_subject_add_observer(lv_subject_t *subject, lv_observer_cb_t observer_cb, void *user_data)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
observer_cb | lv_observer_cb_t | notification callback |
user_data | void * | optional user data May be NULL. |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_subject_add_observer_obj
Add Observer to Subject for a Widget. When the Widget is deleted, Observer will be unsubscribed from Subject automatically.
lv_observer_t * lv_subject_add_observer_obj(lv_subject_t *subject, lv_observer_cb_t observer_cb, lv_obj_t *obj, void *user_data)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
observer_cb | lv_observer_cb_t | notification callback |
obj | lv_obj_t * | pointer to Widget. May be NULL. When NULL the Observer is not bound to a Widget. |
user_data | void * | optional user data May be NULL. |
Returns: lv_observer_t * — pointer to newly-created Observer
Do not call lv_observer_delete() on Observers created this way. Only clean up such Observers by either:
- deleting the Widget, or
- calling
lv_subject_deinit()to gracefully de-couple and remove all Observers.
lv_subject_add_observer_with_target
Add an Observer to a Subject and also save a target pointer.
lv_observer_t * lv_subject_add_observer_with_target(lv_subject_t *subject, lv_observer_cb_t observer_cb, void *target, void *user_data)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
observer_cb | lv_observer_cb_t | notification callback |
target | void * | any pointer May be NULL. |
user_data | void * | optional user data May be NULL. |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_observer_delete
Remove Observer from its Subject.
void lv_observer_delete(lv_observer_t *observer)| Name | Type | Description |
|---|---|---|
observer | lv_observer_t * | pointer to Observer May be NULL. |
lv_obj_remove_from_subject
Remove Observers associated with Widget obj from specified subject or all Subjects.
void lv_obj_remove_from_subject(lv_obj_t *obj, lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget whose Observers should be removed |
subject | lv_subject_t * | Subject to remove Widget from. May be NULL. When NULL the Widget is removed from all Subjects. |
This function can be used e.g. when a Widget's Subject(s) needs to be replaced by other Subject(s)
lv_subject_notify
Notify all Observers of Subject.
void lv_subject_notify(lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
subject | lv_subject_t * | pointer to Subject |
lv_obj_add_subject_increment_event
Add an event handler to increment (or decrement) the value of a subject on a trigger.
lv_subject_increment_dsc_t * lv_obj_add_subject_increment_event(lv_obj_t *obj, lv_subject_t *subject, lv_event_code_t trigger, int32_t step)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a widget |
subject | lv_subject_t * | pointer to a subject to change |
trigger | lv_event_code_t | the trigger on which the subject should be changed |
step | int32_t | value to add on trigger if the minimum value is reached, the maximum value will be set on rollover. |
lv_obj_add_subject_toggle_event
Toggle the value of an integer subject on an event. If it was != 0 it will be 0. If it was 0, it will be 1.
void lv_obj_add_subject_toggle_event(lv_obj_t *obj, lv_subject_t *subject, lv_event_code_t trigger)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a widget |
subject | lv_subject_t * | pointer to a subject to toggle |
trigger | lv_event_code_t | the trigger on which the subject should be changed |
lv_obj_bind_bool
Bind a boolean value to a Widget: set_bool_cb is called with the Subject's value (as a bool) on subscribing and whenever it changes. A dedicated per-flag setter such as lv_obj_set_hidden can be passed directly.
lv_observer_t * lv_obj_bind_bool(lv_obj_t *obj, lv_subject_t *subject, lv_obj_set_bool_t set_bool_cb)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to an integer Subject |
set_bool_cb | lv_obj_set_bool_t | callback that applies the boolean value to the Widget |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_int
Bind an integer value to a Widget: set_int_cb is called with the Subject's value on subscribing and whenever it changes.
lv_observer_t * lv_obj_bind_int(lv_obj_t *obj, lv_subject_t *subject, lv_obj_set_int_t set_int_cb)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to an integer Subject |
set_int_cb | lv_obj_set_int_t | callback that applies the integer value to the Widget |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_float
Bind a float value to a Widget: set_float_cb is called with the Subject's value on subscribing and whenever it changes.
lv_observer_t * lv_obj_bind_float(lv_obj_t *obj, lv_subject_t *subject, lv_obj_set_float_t set_float_cb)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to a float Subject |
set_float_cb | lv_obj_set_float_t | callback that applies the float value to the Widget |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_string
Bind a string value to a Widget: set_string_cb is called with the Subject's value on subscribing and whenever it changes.
lv_observer_t * lv_obj_bind_string(lv_obj_t *obj, lv_subject_t *subject, lv_obj_set_string_t set_string_cb)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to a string Subject |
set_string_cb | lv_obj_set_string_t | callback that applies the string value to the Widget |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_color
Bind a color value to a Widget: set_color_cb is called with the Subject's value on subscribing and whenever it changes.
lv_observer_t * lv_obj_bind_color(lv_obj_t *obj, lv_subject_t *subject, lv_obj_set_color_t set_color_cb)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to a color Subject |
set_color_cb | lv_obj_set_color_t | callback that applies the color value to the Widget |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_pointer
Bind a pointer value to a Widget: set_pointer_cb is called with the Subject's value on subscribing and whenever it changes.
lv_observer_t * lv_obj_bind_pointer(lv_obj_t *obj, lv_subject_t *subject, lv_obj_set_pointer_t set_pointer_cb)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to a pointer Subject |
set_pointer_cb | lv_obj_set_pointer_t | callback that applies the pointer value to the Widget |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_flag_if_eq
Set Widget's flag(s) if an integer Subject's value is equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_flag_if_eq(lv_obj_t *obj, lv_subject_t *subject, lv_obj_flag_t flag, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
flag | lv_obj_flag_t | flag(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_OBJ_FLAG_HIDDEN) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_flag_if_not_eq
Set Widget's flag(s) if an integer Subject's value is not equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_flag_if_not_eq(lv_obj_t *obj, lv_subject_t *subject, lv_obj_flag_t flag, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
flag | lv_obj_flag_t | flag(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_OBJ_FLAG_HIDDEN) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_flag_if_gt
Set Widget's flag(s) if an integer Subject's value is greater than a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_flag_if_gt(lv_obj_t *obj, lv_subject_t *subject, lv_obj_flag_t flag, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
flag | lv_obj_flag_t | flag(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_OBJ_FLAG_HIDDEN) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_flag_if_ge
Set Widget's flag(s) if an integer Subject's value is greater than or equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_flag_if_ge(lv_obj_t *obj, lv_subject_t *subject, lv_obj_flag_t flag, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
flag | lv_obj_flag_t | flag(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_OBJ_FLAG_HIDDEN) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_flag_if_lt
Set Widget's flag(s) if an integer Subject's value is less than a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_flag_if_lt(lv_obj_t *obj, lv_subject_t *subject, lv_obj_flag_t flag, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
flag | lv_obj_flag_t | flag(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_OBJ_FLAG_HIDDEN) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_flag_if_le
Set Widget's flag(s) if an integer Subject's value is less than or equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_flag_if_le(lv_obj_t *obj, lv_subject_t *subject, lv_obj_flag_t flag, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
flag | lv_obj_flag_t | flag(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_OBJ_FLAG_HIDDEN) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_state_if_eq
Set Widget's state(s) if an integer Subject's value is equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_state_if_eq(lv_obj_t *obj, lv_subject_t *subject, lv_state_t state, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
state | lv_state_t | state(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_STATE_CHECKED) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_state_if_not_eq
Set a Widget's state(s) if an integer Subject's value is not equal to a reference value, clear flag otherwise
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_state_if_not_eq(lv_obj_t *obj, lv_subject_t *subject, lv_state_t state, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
state | lv_state_t | state(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_STATE_CHECKED) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_state_if_gt
Set Widget's state(s) if an integer Subject's value is greater than a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_state_if_gt(lv_obj_t *obj, lv_subject_t *subject, lv_state_t state, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
state | lv_state_t | state(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_STATE_CHECKED) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_state_if_ge
Set Widget's state(s) if an integer Subject's value is greater than or equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_state_if_ge(lv_obj_t *obj, lv_subject_t *subject, lv_state_t state, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
state | lv_state_t | state(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_STATE_CHECKED) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_state_if_lt
Set Widget's state(s) if an integer Subject's value is less than a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_state_if_lt(lv_obj_t *obj, lv_subject_t *subject, lv_state_t state, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
state | lv_state_t | state(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_STATE_CHECKED) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_state_if_le
Set Widget's state(s) if an integer Subject's value is less than or equal to a reference value, clear flag otherwise.
> Deprecated: Use lv_obj_bind_bool() or lv_subject_add_observer_obj() instead.
lv_observer_t * lv_obj_bind_state_if_le(lv_obj_t *obj, lv_subject_t *subject, lv_state_t state, int32_t ref_value)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to Subject |
state | lv_state_t | state(s) (can be bit-wise OR-ed) to set or clear (e.g. LV_STATE_CHECKED) |
ref_value | int32_t | reference value to compare Subject's value with |
Returns: lv_observer_t * — pointer to newly-created Observer
lv_obj_bind_checked
Set an integer Subject to 1 when a Widget is checked and set it 0 when unchecked, and clear Widget's checked state when Subject's value changes to 0 and set it when non-zero.
lv_observer_t * lv_obj_bind_checked(lv_obj_t *obj, lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Widget |
subject | lv_subject_t * | pointer to a Subject |
Returns: lv_observer_t * — pointer to newly-created Observer
Ensure Widget's LV_OBJ_FLAG_CHECKABLE flag is set.
Enums
lv_subject_type_t
Values for lv_subject_t's type field
| Name | Value | Description |
|---|---|---|
LV_SUBJECT_TYPE_INVALID | 0 | indicates Subject not initialized yet |
LV_SUBJECT_TYPE_NONE | 1 | a null value like None or NILt |
LV_SUBJECT_TYPE_INT | 2 | an int32_t |
LV_SUBJECT_TYPE_FLOAT | 3 | a float, requires LV_USE_FLOAT 1 |
LV_SUBJECT_TYPE_POINTER | 4 | a void pointer |
LV_SUBJECT_TYPE_COLOR | 5 | an lv_color_t |
LV_SUBJECT_TYPE_GROUP | 6 | an array of Subjects |
LV_SUBJECT_TYPE_STRING | 7 | a char pointer |
Used by 1 function
lv_subject_create— paramtype
Structs
lv_subject_value_t
A common type to handle all the various observable types in the same way
| Member | Type | Description |
|---|---|---|
num | int32_t | Integer number (opacity, enums, booleans or "normal" numbers) |
pointer | const void * | Constant pointer (string buffer, format string, font, cone text, etc.) |
color | lv_color_t | Color |
float_v | float | Floating point value |
_lv_subject_t
The Subject (an observable value)
| Member | Type | Description |
|---|---|---|
ext_data | lv_ext_data_t | |
subs_ll | lv_ll_t | Subscribers |
value | lv_subject_value_t | Current value |
prev_value | lv_subject_value_t | Previous value |
min_value | lv_subject_value_t | Minimum value for min. int or float |
max_value | lv_subject_value_t | Maximum value for max. int or float |
user_data | void * | Additional parameter, can be used freely by user |
type | uint32_t | One of the LV_SUBJECT_TYPE_... values |
size | uint32_t | String buffer size or group length |
notify_restart_query | uint32_t | If an Observer was deleted during notification, start notifying from the beginning. |
Typedefs
lv_observer_cb_t
typedef void(* lv_observer_cb_t) (lv_observer_t *observer, lv_subject_t *subject)Callback called to notify Observer that Subject's value has changed
Used by 3 functions
lv_subject_add_observer— paramobserver_cblv_subject_add_observer_obj— paramobserver_cblv_subject_add_observer_with_target— paramobserver_cb
lv_obj_set_bool_t
typedef void(* lv_obj_set_bool_t) (lv_obj_t *obj, bool value)Generic callback called to set a boolean value on a Widget.
Used by 1 function
lv_obj_bind_bool— paramset_bool_cb
lv_obj_set_int_t
typedef void(* lv_obj_set_int_t) (lv_obj_t *obj, int32_t value)Generic callback called to set an int value on a Widget.
Used by 1 function
lv_obj_bind_int— paramset_int_cb
lv_obj_set_float_t
typedef void(* lv_obj_set_float_t) (lv_obj_t *obj, float value)Generic callback called to set a float value on a Widget.
Used by 1 function
lv_obj_bind_float— paramset_float_cb
lv_obj_set_string_t
typedef void(* lv_obj_set_string_t) (lv_obj_t *obj, const char *value)Generic callback called to set a string value on a Widget.
Used by 1 function
lv_obj_bind_string— paramset_string_cb
lv_obj_set_color_t
typedef void(* lv_obj_set_color_t) (lv_obj_t *obj, lv_color_t value)Generic callback called to set a color value on a Widget.
Used by 1 function
lv_obj_bind_color— paramset_color_cb
lv_obj_set_pointer_t
typedef void(* lv_obj_set_pointer_t) (lv_obj_t *obj, const void *value)Generic callback called to set a pointer value on a Widget.
Used by 1 function
lv_obj_bind_pointer— paramset_pointer_cb
Dependencies
Indirect dependencies
lv_anim.hlv_area.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_conf_internal.hlv_display.hlv_draw.hlv_draw_arc.hlv_draw_blur.hlv_draw_buf.hlv_draw_image.hlv_draw_label.hlv_draw_line.hlv_draw_rect.hlv_draw_triangle.hlv_event.hlv_flex.hlv_font.hlv_fs.hlv_grad.hlv_grid.hlv_group.hlv_image_decoder.hlv_image_dsc.hlv_indev.hlv_layout.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_obj_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_property.hlv_obj_scroll.hlv_obj_style.hlv_obj_style_gen.hlv_obj_tree.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style.hlv_style_gen.hlv_symbol_def.hlv_text.hlv_timer.hlv_types.h
Last updated on