small wlvgl work

This commit is contained in:
Mitchell Marino 2025-04-05 00:20:38 -05:00
parent 10648045a3
commit 219f1f1507
2 changed files with 47 additions and 5 deletions

View File

@ -7,14 +7,33 @@ static std::vector<lv_style_t*> style_table;
/// A table that maps an incrementing integer to a style reference /// A table that maps an incrementing integer to a style reference
static std::vector<lv_obj_t*> obj_table; static std::vector<lv_obj_t*> obj_table;
static int index_of_style(lv_style_t* style) {
for (size_t i = 0; i < style_table.size(); i++) {
if (style_table[i] == style) {
return i;
}
}
return -1;
}
static int index_of_obj(lv_obj_t* obj) {
for (size_t i = 0; i < obj_table.size(); i++) {
if (obj_table[i] == obj) {
return i;
}
}
return -1;
}
void reset_wlv_tables() { void reset_wlv_tables() {
style_table.clear(); style_table.clear();
obj_table.clear(); obj_table.clear();
} }
lv_obj_t wlv_obj_create(lv_obj_t* parent) { lv_obj_t * wlv_obj_create(lv_obj_t* parent) {
// initialize the obj // initialize the obj
lv_obj_t value = lv_obj_create(parent); lv_obj_t* value = lv_obj_create(parent);
if (is_state_tracking()) { if (is_state_tracking()) {
// add the style to the table // add the style to the table
@ -47,8 +66,9 @@ void wlv_obj_set_style_bg_color(lv_obj_t* obj, lv_color_t value, lv_style_select
lv_obj_set_style_bg_color(obj, value, selector); lv_obj_set_style_bg_color(obj, value, selector);
if (is_state_tracking()) { if (is_state_tracking()) {
char buf[8]; int obj_index = index_of_obj(obj);
sprintf(buf, "%d", style_index); char buf[64];
sprintf(buf, "%d,%d,%ld", obj_index, value.full, selector);
event_occured("lv_obj_set_style_bg_color", buf); event_occured("lv_obj_set_style_bg_color", buf);
} }
} }

View File

@ -6,8 +6,30 @@
void reset_wlv_tables(); void reset_wlv_tables();
void wlv_obj_create(lv_obj_t* parent); lv_obj_t* wlv_obj_create(lv_obj_t* parent);
void wlv_style_init(lv_style_t* style); void wlv_style_init(lv_style_t* style);
void wlv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void wlv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector);
// lv_style_set_text_color
// lv_style_set_text_align
// lv_obj_align
// lv_obj_set_size
// lv_obj_add_style
// lv_obj_set_style_text_align
// lv_label_set_text
// lv_scr_load
// lv_scr_act
// lv_style_set_bg_color
// lv_style_set_bg_opa
// lv_style_set_text_align
// lv_obj_set_width
// lv_style_set_text_font
// lv_obj_add_style
// lv_style_set_text_color
// lv_label_create
// lv_obj_del
// lv_obj_center
// lv_obj_remove_style
// lv_obj_add_flag
// lv_obj_clear_flag
#endif /* WLVGL_H */ #endif /* WLVGL_H */