Lines Matching refs:subject
35 //Initialize the subject as integer with the default value of 10
47 //Will be called when the related subject's value changes
48 static void some_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
50 int32_t v = lv_subject_get_int(subject);
56 //Subscribe to a subject
68 //Set the subject's value to 30. It will notify `some_observer_cb`
83 To initialize a subject use ``lv_subject_init_<type>(&subject, params, init_value)``.
86 - **Integer** ``void lv_subject_init_int(lv_subject_t * subject, int32_t value)``
87 - **String** ``void lv_subject_init_string(lv_subject_t * subject, char * buf, char * prev_buf, siz…
88 - **Pointer** ``void lv_subject_init_pointer(lv_subject_t * subject, void * value)``
89 - **Color** ``void lv_subject_init_color(lv_subject_t * subject, lv_color_t color)``
90 - **Group** ``void lv_subject_init_group(lv_subject_t * subject, lv_subject_t * list[], uint32_t li…
93 Set subject value
96 The following functions can be used to set a subject's value:
98 - **Integer** ``void lv_subject_set_int(lv_subject_t * subject, int32_t value)``
99 - **String** ``void lv_subject_copy_string(lv_subject_t * subject, char * buf)``
100 - **Pointer** ``void lv_subject_set_pointer(lv_subject_t * subject, void * ptr)``
101 - **Color** ``void lv_subject_set_color(lv_subject_t * subject, lv_color_t color)``
103 Get subject's value
106 The following functions can be used to get a subject's value:
109 - **Integer** ``int32_t lv_subject_get_int(lv_subject_t * subject)``
110 - **String** ``const char * lv_subject_get_string(lv_subject_t * subject)``
111 - **Pointer** ``const void * lv_subject_get_pointer(lv_subject_t * subject)``
112 - **Color** ``lv_color_t lv_subject_get_color(lv_subject_t * subject)``
115 Get subject's previous value
118 The following functions can be used to get a subject's previous value:
121 - **Integer** ``int32_t lv_subject_get_previous_int(lv_subject_t * subject)``
122 - **String** ``const char * lv_subject_get_previous_string(lv_subject_t * subject)``
123 - **Pointer** ``const void * lv_subject_get_previous_pointer(lv_subject_t * subject)``
124 - **Color** ``lv_color_t lv_subject_get_previous_color(lv_subject_t * subject)``
131 Subscribe to a subject
134 To subscribe to a subject the following function can be used:
145 static void some_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
151 It's also possible to save a target widget when subscribing to a subject.
152 In this case when widget is deleted, it will automatically unsubscribe from the subject.
169 Unsubscribe from a subject
177 To unsubscribe a widget from a given or all subject use:
181 lv_obj_remove_from_subject(widget, subject); /* `subject` can be NULL to unsubscribe from all */
188 There are cases when a subject changes and the value of some other subjects are also required by th…
200 this array as a parameter when you initialize a subject with group type.
207 You can add observers to subject groups in the regular way.
208 The trick is that when any element of the group is notified the subject group will be notified as w…
219 lv_subject_t subject_all; //It will be the subject group
231 static void all_observer_cb(lv_observer_t * observer, lv_subject_t * subject)
234 lv_subject_t * subject_mode = lv_subject_get_group_element(subject, 0);
235 lv_subject_t * subject_value = lv_subject_get_group_element(subject, 1);
236 lv_subject_t * subject_unit = lv_subject_get_group_element(subject, 2);
254 Set a Widget flag if an integer subject's value is equal to a reference value, clear the flag other…
258 observer = lv_obj_bind_flag_if_eq(widget, &subject, LV_OBJ_FLAG_*, ref_value);
260 Set a Widget flag if an integer subject's value is not equal to a reference value, clear the flag o…
264 observer = lv_obj_bind_flag_if_not_eq(widget, &subject, LV_OBJ_FLAG_*, ref_value);
266 Set a Widget state if an integer subject's value is equal to a reference value, clear the flag othe…
270 observer = lv_obj_bind_state_if_eq(widget, &subject, LV_STATE_*, ref_value);
272 Set a Widget state if an integer subject's value is not equal to a reference value, clear the flag …
276 observer = lv_obj_bind_state_if_not_eq(widget, &subject, LV_STATE_*, ref_value);
278 Set an integer subject to 1 when a Widget is checked and set it 0 when unchecked.
282 observer = lv_obj_bind_checked(widget, &subject);
287 Bind an integer, string, or pointer (pointing to a string) subject to a label.
293 observer = lv_label_bind_text(widget, &subject, format_string);
299 Bind an integer subject to an arc's value.
303 observer = lv_arc_bind_value(widget, &subject);
308 Bind an integer subject to a slider's value
312 observer = lv_slider_bind_value(widget, &subject);
317 Bind an integer subject to a roller's value
321 observer = lv_roller_bind_value(widget, &subject);
326 Bind an integer subject to a drop-down's value
330 observer = lv_dropdown_bind_value(widget, &subject);