mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 02:45:05 +00:00
LVGL 9.6.0 (#680)
This commit is contained in:
parent
33a830cecf
commit
13d77bc547
@ -104,9 +104,10 @@ def main():
|
||||
# lvgl (basics)
|
||||
{'src': 'build/esp-idf/lvgl__lvgl/liblvgl__lvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
|
||||
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/lvgl_private.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/include/**/*.h', 'dst': 'Libraries/lvgl/include/include/'},
|
||||
{'src': 'Libraries/lvgl/LICENCE*.*', 'dst': 'Libraries/lvgl/'},
|
||||
{'src': 'Libraries/lvgl/src/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/include/lv_conf.h'},
|
||||
{'src': 'Libraries/lvgl/include/lvgl/config/lv_conf_kconfig.h', 'dst': 'Libraries/lvgl/include/lv_conf.h'},
|
||||
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/include/src/'},
|
||||
# elf_loader
|
||||
{'src': 'managed_components/espressif__elf_loader/*.cmake', 'dst': 'Libraries/elf_loader/'},
|
||||
|
||||
@ -69,7 +69,8 @@ def main():
|
||||
# lvgl (basics)
|
||||
{'src': 'buildsim/Libraries/lvgl/lib/liblvgl.a', 'dst': 'Libraries/lvgl/binary/liblvgl.a'},
|
||||
{'src': 'Libraries/lvgl/lvgl.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/lv_version.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/lvgl_private.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/include/**/*.h', 'dst': 'Libraries/lvgl/include/include/'},
|
||||
{'src': 'Libraries/lvgl/LICENCE*.*', 'dst': 'Libraries/lvgl/'},
|
||||
{'src': 'lv_conf.h', 'dst': 'Libraries/lvgl/include/'},
|
||||
{'src': 'Libraries/lvgl/src/**/*.h', 'dst': 'Libraries/lvgl/include/src/'},
|
||||
|
||||
@ -31,7 +31,6 @@ CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
|
||||
# size, and a smaller buffer fails mid-transfer with MBEDTLS_ERR_SSL_INVALID_RECORD (-0x7200).
|
||||
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
|
||||
# LVGL
|
||||
CONFIG_LV_USE_USER_DATA=y
|
||||
CONFIG_LV_USE_FS_STDIO=y
|
||||
CONFIG_LV_FS_STDIO_LETTER=65
|
||||
CONFIG_LV_FS_STDIO_PATH=""
|
||||
|
||||
@ -215,7 +215,8 @@ if (NOT DEFINED ENV{ESP_IDF_VERSION})
|
||||
set(CONFIG_LV_BUILD_DEMOS OFF CACHE BOOL "" FORCE)
|
||||
set(CONFIG_LV_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory(Libraries/lvgl) # Added as idf component for ESP and as library for other targets
|
||||
target_link_libraries(lvgl PRIVATE SDL2-static)
|
||||
# PUBLIC: lvgl.h includes the SDL driver headers when LV_USE_PRIVATE_API is set
|
||||
target_link_libraries(lvgl PUBLIC SDL2-static)
|
||||
|
||||
# Tests
|
||||
add_subdirectory(Tests)
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit e9db313f8ccc07e27f6afd0f34fe3cf6f20596f0
|
||||
Subproject commit 60b614c23c816ca5edc5f2840c9945eff7da0ad4
|
||||
36
Modules/lvgl-module/include/lvgl/widgets/list.h
Normal file
36
Modules/lvgl-module/include/lvgl/widgets/list.h
Normal file
@ -0,0 +1,36 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Creates a list: a flex column of full-width text rows and buttons.
|
||||
* @param[in] parent the parent object for the new list
|
||||
* @return the created list
|
||||
*/
|
||||
lv_obj_t* lvgl_list_create(lv_obj_t* parent);
|
||||
|
||||
/**
|
||||
* @brief Adds a full-width text row (a section header) to a list.
|
||||
* @param[in] list the list created with lvgl_list_create()
|
||||
* @param[in] text the text of the row, or NULL to leave it empty
|
||||
* @return the created label
|
||||
*/
|
||||
lv_obj_t* lvgl_list_add_text(lv_obj_t* list, const char* text);
|
||||
|
||||
/**
|
||||
* @brief Adds a full-width button with an optional icon and text to a list.
|
||||
* @param[in] list the list created with lvgl_list_create()
|
||||
* @param[in] icon an image source (e.g. a symbol), or NULL for no icon
|
||||
* @param[in] text the button text, or NULL for no text
|
||||
* @return the created button
|
||||
*/
|
||||
lv_obj_t* lvgl_list_add_button(lv_obj_t* list, const void* icon, const char* text);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -247,7 +247,7 @@ static void textarea_hide_keyboard(lv_event_t* event) {
|
||||
|
||||
void lvgl_software_keyboard_construct(LvglSoftwareKeyboard* keyboard, lv_obj_t* parent) {
|
||||
keyboard->object = lv_keyboard_create(parent);
|
||||
lv_obj_add_flag(keyboard->object, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(keyboard->object, true);
|
||||
last_software_keyboard = *keyboard;
|
||||
}
|
||||
|
||||
@ -262,13 +262,13 @@ void lvgl_software_keyboard_destruct(LvglSoftwareKeyboard* keyboard) {
|
||||
|
||||
void lvgl_software_keyboard_show(LvglSoftwareKeyboard* keyboard, lv_obj_t* textarea) {
|
||||
assert(keyboard->object != nullptr);
|
||||
lv_obj_clear_flag(keyboard->object, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(keyboard->object, false);
|
||||
lv_keyboard_set_textarea(keyboard->object, textarea);
|
||||
}
|
||||
|
||||
void lvgl_software_keyboard_hide(LvglSoftwareKeyboard* keyboard) {
|
||||
assert(keyboard->object != nullptr);
|
||||
lv_obj_add_flag(keyboard->object, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(keyboard->object, true);
|
||||
}
|
||||
|
||||
bool lvgl_software_keyboard_is_enabled() {
|
||||
|
||||
@ -60,15 +60,15 @@ static void show_cursor(LvglTrackballCtx* ctx, lv_indev_t* indev) {
|
||||
if (ctx->cursor == nullptr) {
|
||||
return;
|
||||
}
|
||||
lv_obj_remove_flag(ctx->cursor, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(ctx->cursor, false);
|
||||
lv_indev_set_cursor(indev, ctx->cursor);
|
||||
}
|
||||
|
||||
lv_image_set_src(ctx->cursor, ctx->cursor_image_src);
|
||||
if (ctx->settings.enabled) {
|
||||
lv_obj_remove_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->cursor, false);
|
||||
} else {
|
||||
lv_obj_add_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->cursor, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ static void hide_cursor(LvglTrackballCtx* ctx) {
|
||||
if (ctx->cursor == nullptr) {
|
||||
return;
|
||||
}
|
||||
lv_obj_add_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->cursor, true);
|
||||
}
|
||||
|
||||
// Reports one key event per read: the button as the enter key, and movement as arrow key presses along its strongest axis.
|
||||
@ -280,9 +280,9 @@ error_t lvgl_trackball_set_settings(lv_indev_t* indev, const struct LvglTrackbal
|
||||
// hide_cursor() just hid above (enabled is independent of mode, and defaults to true).
|
||||
if (ctx->cursor != nullptr && ctx->settings.mode == LVGL_TRACKBALL_MODE_POINTER) {
|
||||
if (ctx->settings.enabled) {
|
||||
lv_obj_remove_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->cursor, false);
|
||||
} else {
|
||||
lv_obj_add_flag(ctx->cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->cursor, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/grid_navigation.h>
|
||||
|
||||
// Marks containers with grid navigation, so the keyboard sends them up and down keys
|
||||
constexpr lv_obj_flag_t GRID_NAVIGATION_FLAG = LV_OBJ_FLAG_USER_1;
|
||||
|
||||
static void remove_from_group(lv_obj_t* child) {
|
||||
if (lv_obj_get_group(child) != nullptr) {
|
||||
lv_group_remove_obj(child);
|
||||
@ -21,7 +18,7 @@ static void on_child_created(lv_event_t* event) {
|
||||
|
||||
// Matches which children grid navigation can focus
|
||||
static bool is_focusable(lv_obj_t* obj) {
|
||||
return !lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN) && lv_obj_has_flag(obj, static_cast<lv_obj_flag_t>(LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_CLICK_FOCUSABLE));
|
||||
return !lv_obj_is_hidden(obj) && lv_obj_is_clickable(obj) && lv_obj_is_click_focusable(obj);
|
||||
}
|
||||
|
||||
// Finds the next focusable child after (or before) the given index
|
||||
@ -138,7 +135,6 @@ void lvgl_grid_navigation_add(lv_obj_t* container) {
|
||||
// Added after grid navigation's own handler, so it runs after it
|
||||
lv_obj_add_event_cb(container, on_container_focused, LV_EVENT_FOCUSED, nullptr);
|
||||
lv_obj_add_event_cb(container, on_container_key, LV_EVENT_KEY, nullptr);
|
||||
lv_obj_add_flag(container, GRID_NAVIGATION_FLAG);
|
||||
|
||||
const uint32_t child_count = lv_obj_get_child_count(container);
|
||||
for (uint32_t i = 0; i < child_count; i++) {
|
||||
@ -164,7 +160,6 @@ void lvgl_grid_navigation_remove(lv_obj_t* container) {
|
||||
lv_obj_remove_event_cb(container, on_child_created);
|
||||
lv_obj_remove_event_cb(container, on_container_focused);
|
||||
lv_obj_remove_event_cb(container, on_container_key);
|
||||
lv_obj_remove_flag(container, GRID_NAVIGATION_FLAG);
|
||||
|
||||
if (group == nullptr) {
|
||||
return;
|
||||
@ -243,5 +238,16 @@ lv_obj_t* lvgl_grid_navigation_get_focused(lv_obj_t* container) {
|
||||
}
|
||||
|
||||
bool lvgl_grid_navigation_is_container(const lv_obj_t* obj) {
|
||||
return obj != nullptr && lv_obj_has_flag(obj, GRID_NAVIGATION_FLAG);
|
||||
if (obj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
// Grid navigation containers are the objects with this module's focus handler
|
||||
auto* container = const_cast<lv_obj_t*>(obj);
|
||||
const uint32_t event_count = lv_obj_get_event_count(container);
|
||||
for (uint32_t i = 0; i < event_count; i++) {
|
||||
if (lv_event_dsc_get_cb(lv_obj_get_event_dsc(container, i)) == on_container_focused) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -30,12 +30,20 @@ static void update_edge_padding(void* data) {
|
||||
// The curve is widest at the object's edge that is nearest to the display's top or bottom
|
||||
const int32_t inset = std::max(lvgl_display_get_row_inset(display, coords.y1), lvgl_display_get_row_inset(display, coords.y2));
|
||||
const int32_t right_edge = lv_display_get_horizontal_resolution(display) - 1;
|
||||
lv_obj_set_style_pad_left(padding->obj, padding->base_left + std::max<int32_t>(0, inset - coords.x1), LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_right(padding->obj, padding->base_right + std::max<int32_t>(0, inset - (right_edge - coords.x2)), LV_STATE_DEFAULT);
|
||||
const int32_t pad_left = padding->base_left + std::max<int32_t>(0, inset - coords.x1);
|
||||
const int32_t pad_right = padding->base_right + std::max<int32_t>(0, inset - (right_edge - coords.x2));
|
||||
// Setting a style marks the layout as dirty, which would resize the object and call this again
|
||||
if (lv_obj_get_style_pad_left(padding->obj, LV_PART_MAIN) != pad_left) {
|
||||
lv_obj_set_style_pad_left(padding->obj, pad_left, LV_STATE_DEFAULT);
|
||||
}
|
||||
if (lv_obj_get_style_pad_right(padding->obj, LV_PART_MAIN) != pad_right) {
|
||||
lv_obj_set_style_pad_right(padding->obj, pad_right, LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
// The position is final once the layout pass that changed the size has finished
|
||||
static void on_size_changed(lv_event_t* event) {
|
||||
lv_async_call_cancel(update_edge_padding, lv_event_get_user_data(event));
|
||||
lv_async_call(update_edge_padding, lv_event_get_user_data(event));
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <src/core/lv_global.h>
|
||||
#include <src/draw/lv_image_decoder_private.h>
|
||||
#include <src/image/lv_image_decoder_private.h>
|
||||
|
||||
#define DECODER_NAME "LODEPNG"
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
#include <lvgl/widgets/card.h>
|
||||
#include <lvgl/widgets/chip.h>
|
||||
#include <lvgl/widgets/icon_button.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/page_indicator.h>
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
@ -25,6 +26,8 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
// Deprecated LVGL functions stay exported for existing apps
|
||||
LV_DEPRECATIONS_IGNORE_BEGIN
|
||||
const struct ModuleSymbol lvgl_module_symbols[] = {
|
||||
// lvgl_module
|
||||
DEFINE_MODULE_SYMBOL(lvgl_lock),
|
||||
@ -94,6 +97,10 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
|
||||
// lvgl_icon_button
|
||||
DEFINE_MODULE_SYMBOL(lvgl_icon_button_create),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_icon_button_create_variant),
|
||||
// lvgl_list
|
||||
DEFINE_MODULE_SYMBOL(lvgl_list_create),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_list_add_text),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_list_add_button),
|
||||
// lvgl_spinner
|
||||
DEFINE_MODULE_SYMBOL(lvgl_spinner_create),
|
||||
// lvgl_toolbar
|
||||
@ -167,6 +174,26 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_valid),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_event_cb),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_flag),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_hidden),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_hidden),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_clickable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_clickable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_click_focusable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_click_focusable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_checkable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_checkable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_scrollable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_scrollable),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_scroll_on_focus),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_scroll_on_focus),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_ignore_layout),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_ignore_layout),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_floating),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_floating),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_event_bubble),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_event_bubble),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_gesture_bubble),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_is_gesture_bubble),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_remove_state),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_pos),
|
||||
DEFINE_MODULE_SYMBOL(lv_obj_set_flex_align),
|
||||
@ -584,3 +611,4 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
|
||||
DEFINE_MODULE_SYMBOL(lv_area_get_height),
|
||||
MODULE_SYMBOL_TERMINATOR,
|
||||
};
|
||||
LV_DEPRECATIONS_IGNORE_END
|
||||
|
||||
@ -18,6 +18,9 @@ extern const lv_obj_class_t lvgl_chip_class;
|
||||
extern const lv_obj_class_t lvgl_badge_class;
|
||||
extern const lv_obj_class_t lvgl_page_indicator_class;
|
||||
extern const lv_obj_class_t lvgl_page_indicator_dot_class;
|
||||
extern const lv_obj_class_t lvgl_list_class;
|
||||
extern const lv_obj_class_t lvgl_list_text_class;
|
||||
extern const lv_obj_class_t lvgl_list_button_class;
|
||||
|
||||
#define NEUTRAL_4 lv_color_hex(0x0E0E0E)
|
||||
#define NEUTRAL_6 lv_color_hex(0x131313)
|
||||
@ -491,18 +494,10 @@ typedef struct {
|
||||
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
|
||||
lv_style_t key_selected;
|
||||
#endif
|
||||
#if LV_USE_LIST
|
||||
lv_style_t list;
|
||||
#endif
|
||||
#if LV_USE_LIST
|
||||
lv_style_t list_item;
|
||||
#endif
|
||||
#if LV_USE_LIST || LV_USE_TABLE
|
||||
lv_style_t list_item_focused;
|
||||
#endif
|
||||
#if LV_USE_LIST
|
||||
lv_style_t list_subheader;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
lv_style_t tabs;
|
||||
#endif
|
||||
@ -1193,7 +1188,6 @@ static void style_init(my_theme_t * theme)
|
||||
lv_style_set_text_color(&theme->styles.key_selected, KEY_SELECTED_TEXT_COLOR);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
style_init_reset(&theme->styles.list);
|
||||
lv_style_set_bg_color(&theme->styles.list, LIST_COLOR);
|
||||
lv_style_set_bg_opa(&theme->styles.list, LV_OPA_COVER);
|
||||
@ -1201,9 +1195,7 @@ static void style_init(my_theme_t * theme)
|
||||
lv_style_set_pad_ver(&theme->styles.list, LIST_PAD);
|
||||
lv_style_set_pad_gap(&theme->styles.list, 0);
|
||||
lv_style_set_clip_corner(&theme->styles.list, true);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
style_init_reset(&theme->styles.list_item);
|
||||
lv_style_set_bg_color(&theme->styles.list_item, LIST_ITEM_COLOR);
|
||||
lv_style_set_bg_opa(&theme->styles.list_item, LIST_ITEM_OPACITY);
|
||||
@ -1214,23 +1206,18 @@ static void style_init(my_theme_t * theme)
|
||||
lv_style_set_border_color(&theme->styles.list_item, LIST_DIVIDER_COLOR);
|
||||
lv_style_set_border_width(&theme->styles.list_item, LIST_DIVIDER_WIDTH);
|
||||
lv_style_set_border_side(&theme->styles.list_item, LV_BORDER_SIDE_BOTTOM);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST || LV_USE_TABLE
|
||||
style_init_reset(&theme->styles.list_item_focused);
|
||||
lv_style_set_bg_color(&theme->styles.list_item_focused, LIST_ITEM_FOCUSED_COLOR);
|
||||
lv_style_set_bg_opa(&theme->styles.list_item_focused, LV_OPA_COVER);
|
||||
lv_style_set_text_color(&theme->styles.list_item_focused, LIST_ITEM_FOCUSED_TEXT_COLOR);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
style_init_reset(&theme->styles.list_subheader);
|
||||
lv_style_set_text_color(&theme->styles.list_subheader, LIST_SUBHEADER_TEXT_COLOR);
|
||||
lv_style_set_text_font(&theme->styles.list_subheader, theme->config.font_small);
|
||||
lv_style_set_pad_hor(&theme->styles.list_subheader, LIST_ITEM_PAD_HOR);
|
||||
lv_style_set_pad_top(&theme->styles.list_subheader, LIST_ITEM_PAD_VER);
|
||||
lv_style_set_pad_bottom(&theme->styles.list_subheader, LIST_PAD);
|
||||
#endif
|
||||
|
||||
#if LV_USE_TABVIEW
|
||||
style_init_reset(&theme->styles.tabs);
|
||||
@ -2096,6 +2083,28 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(lv_obj_check_type(obj, &lvgl_list_class)) {
|
||||
/* flex_list */
|
||||
lv_obj_add_style(obj, &theme->styles.list, 0);
|
||||
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
||||
lv_obj_add_style(obj, &theme->styles.scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED);
|
||||
return;
|
||||
}
|
||||
if(lv_obj_check_type(obj, &lvgl_list_text_class)) {
|
||||
/* flex_list_text */
|
||||
lv_obj_add_style(obj, &theme->styles.list_subheader, 0);
|
||||
return;
|
||||
}
|
||||
if(lv_obj_check_type(obj, &lvgl_list_button_class)) {
|
||||
/* flex_list_button */
|
||||
lv_obj_add_style(obj, &theme->styles.list_item, 0);
|
||||
lv_obj_add_style(obj, &theme->styles.transition_exit, 0);
|
||||
lv_obj_add_style(obj, &theme->styles.state_pressed, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(obj, &theme->styles.transition_enter, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(obj, &theme->styles.list_item_focused, LV_STATE_FOCUS_KEY);
|
||||
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
||||
return;
|
||||
}
|
||||
#if LV_USE_TABLE
|
||||
if(lv_obj_check_type(obj, &lv_table_class)) {
|
||||
/* table */
|
||||
|
||||
@ -18,6 +18,9 @@ extern const lv_obj_class_t lvgl_chip_class;
|
||||
extern const lv_obj_class_t lvgl_badge_class;
|
||||
extern const lv_obj_class_t lvgl_page_indicator_class;
|
||||
extern const lv_obj_class_t lvgl_page_indicator_dot_class;
|
||||
extern const lv_obj_class_t lvgl_list_class;
|
||||
extern const lv_obj_class_t lvgl_list_text_class;
|
||||
extern const lv_obj_class_t lvgl_list_button_class;
|
||||
|
||||
#define BLACK lv_color_black()
|
||||
#define WHITE lv_color_white()
|
||||
@ -312,15 +315,9 @@ typedef struct {
|
||||
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
|
||||
lv_style_t key;
|
||||
#endif
|
||||
#if LV_USE_LIST
|
||||
lv_style_t list;
|
||||
#endif
|
||||
#if LV_USE_LIST
|
||||
lv_style_t list_item;
|
||||
#endif
|
||||
#if LV_USE_LIST
|
||||
lv_style_t list_subheader;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
lv_style_t tabs;
|
||||
#endif
|
||||
@ -858,7 +855,6 @@ static void style_init(my_theme_t * theme)
|
||||
lv_style_set_radius(&theme->styles.key, KEY_SHAPE);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
style_init_reset(&theme->styles.list);
|
||||
lv_style_set_bg_color(&theme->styles.list, COLOR_SURFACE);
|
||||
lv_style_set_bg_opa(&theme->styles.list, LV_OPA_COVER);
|
||||
@ -869,9 +865,7 @@ static void style_init(my_theme_t * theme)
|
||||
lv_style_set_pad_ver(&theme->styles.list, LIST_PAD);
|
||||
lv_style_set_pad_gap(&theme->styles.list, 0);
|
||||
lv_style_set_clip_corner(&theme->styles.list, true);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
style_init_reset(&theme->styles.list_item);
|
||||
lv_style_set_bg_opa(&theme->styles.list_item, LV_OPA_TRANSP);
|
||||
lv_style_set_text_color(&theme->styles.list_item, COLOR_ON_SURFACE);
|
||||
@ -882,16 +876,13 @@ static void style_init(my_theme_t * theme)
|
||||
lv_style_set_pad_hor(&theme->styles.list_item, LIST_ITEM_PAD_HOR);
|
||||
lv_style_set_pad_ver(&theme->styles.list_item, LIST_ITEM_PAD_VER);
|
||||
lv_style_set_pad_column(&theme->styles.list_item, LIST_ITEM_GAP);
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
style_init_reset(&theme->styles.list_subheader);
|
||||
lv_style_set_text_font(&theme->styles.list_subheader, theme->config.font_small);
|
||||
lv_style_set_text_decor(&theme->styles.list_subheader, LV_TEXT_DECOR_UNDERLINE);
|
||||
lv_style_set_pad_hor(&theme->styles.list_subheader, LIST_ITEM_PAD_HOR);
|
||||
lv_style_set_pad_top(&theme->styles.list_subheader, LIST_ITEM_PAD_VER);
|
||||
lv_style_set_pad_bottom(&theme->styles.list_subheader, LIST_PAD);
|
||||
#endif
|
||||
|
||||
#if LV_USE_TABVIEW
|
||||
style_init_reset(&theme->styles.tabs);
|
||||
@ -1662,6 +1653,25 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(lv_obj_check_type(obj, &lvgl_list_class)) {
|
||||
/* flex_list */
|
||||
lv_obj_add_style(obj, &theme->styles.list, 0);
|
||||
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
||||
return;
|
||||
}
|
||||
if(lv_obj_check_type(obj, &lvgl_list_text_class)) {
|
||||
/* flex_list_text */
|
||||
lv_obj_add_style(obj, &theme->styles.list_subheader, 0);
|
||||
return;
|
||||
}
|
||||
if(lv_obj_check_type(obj, &lvgl_list_button_class)) {
|
||||
/* flex_list_button */
|
||||
lv_obj_add_style(obj, &theme->styles.list_item, 0);
|
||||
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
||||
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_FOCUS_KEY);
|
||||
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
||||
return;
|
||||
}
|
||||
#if LV_USE_TABLE
|
||||
if(lv_obj_check_type(obj, &lv_table_class)) {
|
||||
/* table */
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
|
||||
static void badge_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
LV_UNUSED(class_p);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||
lv_obj_set_clickable(obj, false);
|
||||
lv_obj_set_scrollable(obj, false);
|
||||
lv_obj_set_ignore_layout(obj, true);
|
||||
}
|
||||
|
||||
// Not static: the theme styles badges by this class
|
||||
|
||||
84
Modules/lvgl-module/source/widgets/list.cpp
Normal file
84
Modules/lvgl-module/source/widgets/list.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#define LV_USE_PRIVATE_API 1 // For the lv_obj_class_t declaration
|
||||
|
||||
#include <lvgl/widgets/list.h>
|
||||
|
||||
// Not static: the theme styles lists by these classes
|
||||
extern "C" const lv_obj_class_t lvgl_list_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = nullptr,
|
||||
.destructor_cb = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.name = "list",
|
||||
.width_def = (LV_DPI_DEF * 3) / 2,
|
||||
.height_def = LV_DPI_DEF * 2,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_INHERIT,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT,
|
||||
.instance_size = 0,
|
||||
.theme_inheritable = LV_OBJ_CLASS_THEME_INHERITABLE_FALSE
|
||||
};
|
||||
|
||||
extern "C" const lv_obj_class_t lvgl_list_text_class = {
|
||||
.base_class = &lv_label_class,
|
||||
.constructor_cb = nullptr,
|
||||
.destructor_cb = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.name = "list_text",
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = LV_SIZE_CONTENT,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_INHERIT,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT,
|
||||
.instance_size = 0,
|
||||
.theme_inheritable = LV_OBJ_CLASS_THEME_INHERITABLE_FALSE
|
||||
};
|
||||
|
||||
extern "C" const lv_obj_class_t lvgl_list_button_class = {
|
||||
.base_class = &lv_button_class,
|
||||
.constructor_cb = nullptr,
|
||||
.destructor_cb = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.name = "list_button",
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = LV_SIZE_CONTENT,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_INHERIT,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_INHERIT,
|
||||
.instance_size = 0,
|
||||
.theme_inheritable = LV_OBJ_CLASS_THEME_INHERITABLE_FALSE
|
||||
};
|
||||
|
||||
lv_obj_t* lvgl_list_create(lv_obj_t* parent) {
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&lvgl_list_class, parent);
|
||||
lv_obj_class_init_obj(obj);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);
|
||||
return obj;
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_list_add_text(lv_obj_t* list, const char* text) {
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&lvgl_list_text_class, list);
|
||||
lv_obj_class_init_obj(obj);
|
||||
lv_label_set_text(obj, text);
|
||||
return obj;
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_list_add_button(lv_obj_t* list, const void* icon, const char* text) {
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&lvgl_list_button_class, list);
|
||||
lv_obj_class_init_obj(obj);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
|
||||
if (icon != nullptr) {
|
||||
lv_obj_t* image = lv_image_create(obj);
|
||||
lv_image_set_src(image, icon);
|
||||
}
|
||||
|
||||
if (text != nullptr) {
|
||||
lv_obj_t* label = lv_label_create(obj);
|
||||
lv_label_set_text(label, text);
|
||||
lv_label_set_long_mode(label, LV_LABEL_LONG_MODE_SCROLL_CIRCULAR);
|
||||
lv_obj_set_flex_grow(label, 1);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -13,21 +13,23 @@ static void on_style_changed(lv_event_t* event) {
|
||||
|
||||
static void page_indicator_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
LV_UNUSED(class_p);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_clickable(obj, false);
|
||||
lv_obj_set_scrollable(obj, false);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(obj, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
// Shows the page numbers instead of the dots when they don't fit in the indicator's maximum width
|
||||
lv_obj_t* label = lv_label_create(obj);
|
||||
lv_obj_add_flag(label, LV_OBJ_FLAG_HIDDEN);
|
||||
// One line, so the indicator's height doesn't change with its width
|
||||
lv_label_set_long_mode(label, LV_LABEL_LONG_MODE_CLIP);
|
||||
lv_obj_set_hidden(label, true);
|
||||
// A change of the maximum width can switch between dots and numbers
|
||||
lv_obj_add_event_cb(obj, on_style_changed, LV_EVENT_STYLE_CHANGED, nullptr);
|
||||
}
|
||||
|
||||
static void page_indicator_dot_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
LV_UNUSED(class_p);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_clickable(obj, false);
|
||||
lv_obj_set_scrollable(obj, false);
|
||||
}
|
||||
|
||||
// Not static: the theme styles page indicators and their dots by these classes
|
||||
@ -85,11 +87,11 @@ static void refresh(lv_obj_t* obj) {
|
||||
const bool show_numbers = dots_width > lv_obj_get_style_max_width(obj, LV_PART_MAIN);
|
||||
|
||||
lv_obj_t* label = get_label(obj);
|
||||
lv_obj_set_flag(label, LV_OBJ_FLAG_HIDDEN, !show_numbers);
|
||||
lv_obj_set_hidden(label, !show_numbers);
|
||||
uint32_t page = 0;
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
lv_obj_t* dot = get_dot(obj, i);
|
||||
lv_obj_set_flag(dot, LV_OBJ_FLAG_HIDDEN, show_numbers);
|
||||
lv_obj_set_hidden(dot, show_numbers);
|
||||
if (lv_obj_has_state(dot, LV_STATE_CHECKED)) {
|
||||
page = i;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ extern "C" const lv_obj_class_t lvgl_sliderbox_class = {
|
||||
|
||||
static void sliderbox_constructor(const lv_obj_class_t* classPointer, lv_obj_t* obj) {
|
||||
LV_UNUSED(classPointer);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(obj, false);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(obj, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_style_border_width(obj, 0, LV_STATE_DEFAULT);
|
||||
@ -118,7 +118,7 @@ static void on_plus_button_clicked(lv_event_t* event) {
|
||||
|
||||
static lv_obj_t* create_step_button(lv_obj_t* parent, const char* symbol, lv_event_cb_t callback, void* userData, uint32_t size) {
|
||||
auto* button = lv_button_create(parent);
|
||||
lv_obj_remove_flag(button, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(button, false);
|
||||
lv_obj_set_size(button, size, size);
|
||||
lv_obj_set_style_pad_all(button, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_add_event_cb(button, callback, LV_EVENT_SHORT_CLICKED, userData);
|
||||
@ -151,7 +151,7 @@ lv_obj_t* lvgl_sliderbox_create(lv_obj_t* parent, int32_t min, int32_t max, int3
|
||||
sliderBox->minusButton = create_step_button(obj, LV_SYMBOL_MINUS, &on_minus_button_clicked, obj, button_size);
|
||||
|
||||
sliderBox->slider = lv_slider_create(obj);
|
||||
lv_obj_remove_flag(sliderBox->slider, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(sliderBox->slider, false);
|
||||
lv_obj_set_flex_grow(sliderBox->slider, 1);
|
||||
lv_slider_set_range(sliderBox->slider, min, max);
|
||||
lv_obj_add_event_cb(sliderBox->slider, &on_slider_value_changed, LV_EVENT_VALUE_CHANGED, obj);
|
||||
|
||||
@ -42,7 +42,7 @@ static void anim_rotation_callback(void* var, int32_t v) {
|
||||
}
|
||||
|
||||
static void spinner_constructor(const lv_obj_class_t* object_class, lv_obj_t* object) {
|
||||
lv_obj_remove_flag(object, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(object, false);
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
|
||||
@ -81,8 +81,8 @@ static void default_nav_action(lv_event_t* event) {
|
||||
|
||||
static void toolbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
LV_UNUSED(class_p);
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_add_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
||||
lv_obj_set_scrollable(obj, false);
|
||||
lv_obj_set_scroll_on_focus(obj, true);
|
||||
}
|
||||
|
||||
static lv_obj_t* create_action_button(lv_obj_t* parent, bool is_compact) {
|
||||
|
||||
@ -34,6 +34,9 @@
|
||||
@widget badge: lvgl_badge_class;
|
||||
@widget page_indicator: lvgl_page_indicator_class;
|
||||
@widget page_indicator_dot: lvgl_page_indicator_dot_class;
|
||||
@widget flex_list: lvgl_list_class;
|
||||
@widget flex_list_text: lvgl_list_text_class;
|
||||
@widget flex_list_button: lvgl_list_button_class;
|
||||
|
||||
// ============================================================
|
||||
// 1. Base tokens
|
||||
@ -1607,6 +1610,25 @@ apply(list_button) {
|
||||
disabled: state.disabled;
|
||||
}
|
||||
|
||||
apply(flex_list) {
|
||||
list: default;
|
||||
scrollbar: part.scrollbar;
|
||||
scrollbar_scrolled: part.scrollbar, state.scrolled;
|
||||
}
|
||||
|
||||
apply(flex_list_text) {
|
||||
list_subheader: default;
|
||||
}
|
||||
|
||||
apply(flex_list_button) {
|
||||
list_item: default;
|
||||
transition_exit: default;
|
||||
state_pressed: state.pressed;
|
||||
transition_enter: state.pressed;
|
||||
list_item_focused: state.focusKey;
|
||||
disabled: state.disabled;
|
||||
}
|
||||
|
||||
apply(table) {
|
||||
table: default;
|
||||
focus_ring: state.focusKey;
|
||||
|
||||
@ -32,6 +32,9 @@
|
||||
@widget badge: lvgl_badge_class;
|
||||
@widget page_indicator: lvgl_page_indicator_class;
|
||||
@widget page_indicator_dot: lvgl_page_indicator_dot_class;
|
||||
@widget flex_list: lvgl_list_class;
|
||||
@widget flex_list_text: lvgl_list_text_class;
|
||||
@widget flex_list_button: lvgl_list_button_class;
|
||||
|
||||
// ============================================================
|
||||
// 1. Base tokens
|
||||
@ -1223,6 +1226,22 @@ apply(list_button) {
|
||||
disabled: state.disabled;
|
||||
}
|
||||
|
||||
apply(flex_list) {
|
||||
list: default;
|
||||
scrollbar: part.scrollbar;
|
||||
}
|
||||
|
||||
apply(flex_list_text) {
|
||||
list_subheader: default;
|
||||
}
|
||||
|
||||
apply(flex_list_button) {
|
||||
list_item: default;
|
||||
inverted: state.pressed;
|
||||
inverted: state.focusKey;
|
||||
disabled: state.disabled;
|
||||
}
|
||||
|
||||
apply(table) {
|
||||
table: default;
|
||||
focus_ring: state.focusKey;
|
||||
|
||||
@ -101,7 +101,7 @@ lv_obj_t* build_window_widget(lv_obj_t* content, WindowCreateWidgetsFn create_wi
|
||||
// Plain layout container, not meant to scroll on its own - every app already does this
|
||||
// for its own root object. Without it, a sub-pixel flex-layout overflow here can show the
|
||||
// theme's scrollbar styling as a thin line hugging this widget's edges.
|
||||
lv_obj_remove_flag(widget, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(widget, false);
|
||||
if (create_widgets != nullptr) {
|
||||
create_widgets(widget, user_data);
|
||||
}
|
||||
@ -206,7 +206,7 @@ error_t window_manager_start(void) {
|
||||
lv_obj_set_style_border_width(real_widget, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_radius(real_widget, 0, LV_STATE_DEFAULT);
|
||||
// See build_window_widget()'s identical flag removal for why.
|
||||
lv_obj_remove_flag(real_widget, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(real_widget, false);
|
||||
|
||||
content_widget = (screen_init != nullptr) ? screen_init(real_widget) : nullptr;
|
||||
if (content_widget == nullptr) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <src/display/lv_display.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::settings::display {
|
||||
|
||||
|
||||
@ -89,6 +89,9 @@ private:
|
||||
bool swipeNavigation = false;
|
||||
bool keepSelectionOnRepopulate = true;
|
||||
lv_obj_t* grid = nullptr;
|
||||
/** The grid size that the current tiles were laid out for */
|
||||
int32_t populatedWidth = 0;
|
||||
int32_t populatedHeight = 0;
|
||||
lv_obj_t* prevButton = nullptr;
|
||||
lv_obj_t* nextButton = nullptr;
|
||||
lv_obj_t* pageIndicator = nullptr;
|
||||
@ -101,6 +104,7 @@ private:
|
||||
void populate();
|
||||
|
||||
static void onDeferredRepopulate(void* userData);
|
||||
static void onDeferredResize(void* userData);
|
||||
static void onDeferredNextPage(void* userData);
|
||||
static void onDeferredPreviousPage(void* userData);
|
||||
static void onGridDeleted(lv_event_t* e);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <src/display/lv_display.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::service::autorotate {
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ int32_t getSideWidth(lv_obj_t* bar, bool rightSide) {
|
||||
lv_obj_t* child = lv_obj_get_child(bar, static_cast<int32_t>(i));
|
||||
if (lv_obj_get_style_flex_grow(child, LV_PART_MAIN) > 0) {
|
||||
afterSpacer = true;
|
||||
} else if (afterSpacer == rightSide && !lv_obj_has_flag_any(child, static_cast<lv_obj_flag_t>(LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_IGNORE_LAYOUT))) {
|
||||
} else if (afterSpacer == rightSide && !lv_obj_is_hidden(child) && !lv_obj_is_ignore_layout(child)) {
|
||||
width += lv_obj_get_width(child);
|
||||
visible++;
|
||||
}
|
||||
@ -81,7 +81,7 @@ void updatePageIndicatorWidth(void* data) {
|
||||
const uint32_t count = lv_obj_get_child_count(bottom_bar);
|
||||
for (uint32_t i = 0; i < count && indicator == nullptr; i++) {
|
||||
lv_obj_t* child = lv_obj_get_child(bottom_bar, static_cast<int32_t>(i));
|
||||
if (lv_obj_has_flag(child, LV_OBJ_FLAG_IGNORE_LAYOUT)) {
|
||||
if (lv_obj_is_ignore_layout(child)) {
|
||||
indicator = child;
|
||||
}
|
||||
}
|
||||
@ -91,10 +91,15 @@ void updatePageIndicatorWidth(void* data) {
|
||||
const int32_t side_width = std::max(getSideWidth(bottom_bar, false), getSideWidth(bottom_bar, true));
|
||||
const int32_t gaps = 2 * lv_obj_get_style_pad_column(bottom_bar, LV_PART_MAIN);
|
||||
const int32_t available = lv_obj_get_content_width(bottom_bar) - 2 * side_width - gaps;
|
||||
lv_obj_set_style_max_width(indicator, std::max<int32_t>(0, available), LV_STATE_DEFAULT);
|
||||
const int32_t max_width = std::max<int32_t>(0, available);
|
||||
// Setting a style marks the layout as dirty, which would resize the bar and call this again
|
||||
if (lv_obj_get_style_max_width(indicator, LV_PART_MAIN) != max_width) {
|
||||
lv_obj_set_style_max_width(indicator, max_width, LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
void onBottomBarSizeChanged(lv_event_t* event) {
|
||||
lv_async_call_cancel(updatePageIndicatorWidth, lv_event_get_target_obj(event));
|
||||
lv_async_call(updatePageIndicatorWidth, lv_event_get_target_obj(event));
|
||||
}
|
||||
|
||||
@ -116,16 +121,27 @@ void AppGrid::onDeferredRepopulate(void* userData) {
|
||||
static_cast<AppGrid*>(userData)->populate();
|
||||
}
|
||||
|
||||
// A layout pass can resize the grid temporarily (e.g. to its content height, before the parent's flex layout grows it again)
|
||||
void AppGrid::onDeferredResize(void* userData) {
|
||||
auto* self = static_cast<AppGrid*>(userData);
|
||||
if (lv_obj_get_width(self->grid) != self->populatedWidth || lv_obj_get_height(self->grid) != self->populatedHeight) {
|
||||
self->populate();
|
||||
}
|
||||
}
|
||||
|
||||
void AppGrid::onGridDeleted(lv_event_t* e) {
|
||||
// Cancels a still-pending repopulate scheduled right before the grid itself was deleted (e.g. the app closing)
|
||||
lv_async_call_cancel(onDeferredRepopulate, lv_event_get_user_data(e));
|
||||
lv_async_call_cancel(onDeferredResize, lv_event_get_user_data(e));
|
||||
lv_async_call_cancel(onDeferredNextPage, lv_event_get_user_data(e));
|
||||
lv_async_call_cancel(onDeferredPreviousPage, lv_event_get_user_data(e));
|
||||
}
|
||||
|
||||
// Deferred: page size depends on the grid size, which is final only after the layout pass that triggered this.
|
||||
void AppGrid::onGridSizeChanged(lv_event_t* e) {
|
||||
lv_async_call(onDeferredRepopulate, lv_event_get_user_data(e));
|
||||
// One pending check is enough, also when the size changes several times before it runs
|
||||
lv_async_call_cancel(onDeferredResize, lv_event_get_user_data(e));
|
||||
lv_async_call(onDeferredResize, lv_event_get_user_data(e));
|
||||
}
|
||||
|
||||
// Changing the page doesn't keep the selected app selected: that would return to the selected app's page
|
||||
@ -209,6 +225,8 @@ void AppGrid::populate() {
|
||||
// Centers a full page of rows, so a partially filled last page keeps its rows in the same positions.
|
||||
lv_obj_set_style_pad_top(grid, 0, LV_STATE_DEFAULT);
|
||||
const PageLayout layout = computePageLayout(grid);
|
||||
populatedWidth = lv_obj_get_width(grid);
|
||||
populatedHeight = lv_obj_get_height(grid);
|
||||
lv_obj_set_style_pad_top(grid, layout.topOffset, LV_STATE_DEFAULT);
|
||||
|
||||
const uint32_t item_count = items.size();
|
||||
@ -225,9 +243,9 @@ void AppGrid::populate() {
|
||||
page = std::min(page, page_count - 1);
|
||||
pageCount = page_count;
|
||||
|
||||
lv_obj_set_flag(pageIndicator, LV_OBJ_FLAG_HIDDEN, page_count <= 1);
|
||||
lv_obj_set_flag(prevButton, LV_OBJ_FLAG_HIDDEN, page_count <= 1);
|
||||
lv_obj_set_flag(nextButton, LV_OBJ_FLAG_HIDDEN, page_count <= 1);
|
||||
lv_obj_set_hidden(pageIndicator, page_count <= 1);
|
||||
lv_obj_set_hidden(prevButton, page_count <= 1);
|
||||
lv_obj_set_hidden(nextButton, page_count <= 1);
|
||||
lvgl_page_indicator_set_page_count(pageIndicator, page_count);
|
||||
lvgl_page_indicator_set_page(pageIndicator, page);
|
||||
|
||||
@ -303,13 +321,13 @@ void AppGrid::createGrid(lv_obj_t* parent) {
|
||||
lv_obj_set_style_pad_row(grid, TILE_GAP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(grid, TILE_GAP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(grid, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(grid, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(grid, false);
|
||||
// The arrow keys move between the tiles in rows and columns
|
||||
lvgl_grid_navigation_add(grid);
|
||||
lv_obj_add_event_cb(grid, onGridDeleted, LV_EVENT_DELETE, this);
|
||||
if (swipeNavigation) {
|
||||
// LVGL sends a gesture to the first object, starting at the touched one, that doesn't pass it on to its parent
|
||||
lv_obj_remove_flag(grid, LV_OBJ_FLAG_GESTURE_BUBBLE);
|
||||
lv_obj_set_gesture_bubble(grid, false);
|
||||
lv_obj_add_event_cb(grid, onGridGesture, LV_EVENT_GESTURE, this);
|
||||
}
|
||||
}
|
||||
@ -318,7 +336,7 @@ void AppGrid::createGrid(lv_obj_t* parent) {
|
||||
void AppGrid::onBottomBarFocused(lv_event_t* e) {
|
||||
const auto* self = static_cast<AppGrid*>(lv_event_get_user_data(e));
|
||||
lv_obj_t* current = lvgl_grid_navigation_get_focused(self->bottomBar);
|
||||
lv_obj_t* target = lv_obj_has_flag(self->prevButton, LV_OBJ_FLAG_HIDDEN) ? lv_obj_get_child(self->bottomBar, 0) : self->prevButton;
|
||||
lv_obj_t* target = lv_obj_is_hidden(self->prevButton) ? lv_obj_get_child(self->bottomBar, 0) : self->prevButton;
|
||||
if (current == nullptr || target == current || target == self->barSpacer) {
|
||||
return;
|
||||
}
|
||||
@ -336,7 +354,7 @@ void AppGrid::createWidgetsWithBottomBar(lv_obj_t* parent) {
|
||||
lv_obj_set_style_border_width(bottomBar, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_flex_flow(bottomBar, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(bottomBar, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(bottomBar, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(bottomBar, false);
|
||||
lvgl_obj_add_edge_padding(bottomBar);
|
||||
lv_obj_add_event_cb(bottomBar, onBottomBarSizeChanged, LV_EVENT_SIZE_CHANGED, nullptr);
|
||||
lv_obj_add_event_cb(bottomBar, onBottomBarDeleted, LV_EVENT_DELETE, nullptr);
|
||||
@ -348,7 +366,7 @@ void AppGrid::createWidgetsWithBottomBar(lv_obj_t* parent) {
|
||||
barSpacer = lv_obj_create(bottomBar);
|
||||
lv_obj_set_size(barSpacer, 0, 0);
|
||||
lv_obj_set_flex_grow(barSpacer, 1);
|
||||
lv_obj_remove_flag(barSpacer, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(barSpacer, false);
|
||||
prevButton = lvgl_icon_button_create(bottomBar);
|
||||
lv_label_set_text(lv_label_create(prevButton), "<");
|
||||
lv_obj_add_event_cb(prevButton, onPrevPressed, LV_EVENT_SHORT_CLICKED, this);
|
||||
@ -356,7 +374,7 @@ void AppGrid::createWidgetsWithBottomBar(lv_obj_t* parent) {
|
||||
lv_label_set_text(lv_label_create(nextButton), ">");
|
||||
lv_obj_add_event_cb(nextButton, onNextPressed, LV_EVENT_SHORT_CLICKED, this);
|
||||
pageIndicator = lvgl_page_indicator_create(bottomBar);
|
||||
lv_obj_add_flag(pageIndicator, LV_OBJ_FLAG_IGNORE_LAYOUT);
|
||||
lv_obj_set_ignore_layout(pageIndicator, true);
|
||||
lv_obj_align(pageIndicator, LV_ALIGN_CENTER, 0, 0);
|
||||
// The arrow keys move between all buttons of the bar as one row
|
||||
lvgl_grid_navigation_add(bottomBar);
|
||||
|
||||
@ -171,9 +171,9 @@ size_t getCharacterCount(const std::string& path) {
|
||||
|
||||
void setHidden(lv_obj_t* object, bool hidden) {
|
||||
if (hidden) {
|
||||
lv_obj_add_flag(object, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(object, true);
|
||||
} else {
|
||||
lv_obj_remove_flag(object, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(object, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,7 +459,7 @@ lv_obj_t* createRow(lv_obj_t* parent) {
|
||||
lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_style_pad_column(row, lv_obj_get_style_pad_column(parent, LV_PART_MAIN), LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
return row;
|
||||
}
|
||||
|
||||
@ -500,8 +500,8 @@ ColorRowWidgets createColorRow(lv_obj_t* parent, size_t index, Context* ctx) {
|
||||
// The colour preview: its colour is the setting, its border uses the theme's text colour
|
||||
widgets.swatch = lv_obj_create(widgets.row);
|
||||
lv_obj_remove_style_all(widgets.swatch);
|
||||
lv_obj_remove_flag(widgets.swatch, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_remove_flag(widgets.swatch, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_scrollable(widgets.swatch, false);
|
||||
lv_obj_set_clickable(widgets.swatch, false);
|
||||
lv_obj_set_style_bg_opa(widgets.swatch, LV_OPA_COVER, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(widgets.swatch, 1, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(widgets.swatch, lv_obj_get_style_text_color(widgets.swatch, LV_PART_MAIN), LV_STATE_DEFAULT);
|
||||
@ -586,7 +586,7 @@ FontRowWidgets createFontRow(lv_obj_t* parent, const char* title, lv_event_cb_t
|
||||
lv_obj_set_height(texts, LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_grow(texts, 1);
|
||||
lv_obj_set_flex_flow(texts, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_remove_flag(texts, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(texts, false);
|
||||
|
||||
auto* label = lv_label_create(texts);
|
||||
lv_obj_set_width(label, LV_PCT(100));
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/widgets/card.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
@ -109,7 +110,7 @@ void showRefreshFailedError(Context* ctx, const char* message) {
|
||||
lv_label_set_long_mode(label, LV_LABEL_LONG_MODE_WRAP);
|
||||
lv_label_set_text(label, message);
|
||||
|
||||
lv_obj_remove_flag(ctx->refreshButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->refreshButton, false);
|
||||
}
|
||||
|
||||
void showNoInternet(Context* ctx) {
|
||||
@ -143,7 +144,7 @@ void showApps(Context* ctx) {
|
||||
lv_obj_set_style_clip_corner(card, true, LV_STATE_DEFAULT);
|
||||
|
||||
// The card provides the background
|
||||
auto* list = lv_list_create(card);
|
||||
auto* list = lvgl_list_create(card);
|
||||
lv_obj_set_style_pad_all(list, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_size(list, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_bg_opa(list, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
@ -153,7 +154,7 @@ void showApps(Context* ctx) {
|
||||
LOG_I(TAG, "Adding %s", entry.appName.c_str());
|
||||
AppManifest manifest;
|
||||
const char* icon = app_manager_find_manifest(entry.appId.c_str(), &manifest) == ERROR_NONE ? LV_SYMBOL_OK : nullptr;
|
||||
auto* entry_button = lv_list_add_button(list, icon, entry.appName.c_str());
|
||||
auto* entry_button = lvgl_list_add_button(list, icon, entry.appName.c_str());
|
||||
auto int_as_voidptr = reinterpret_cast<void*>(i);
|
||||
lv_obj_set_user_data(entry_button, int_as_voidptr);
|
||||
lv_obj_add_event_cb(entry_button, onAppPressed, LV_EVENT_SHORT_CLICKED, ctx);
|
||||
@ -179,7 +180,7 @@ void refresh(Context* ctx) {
|
||||
lv_obj_clean(ctx->contentWrapper);
|
||||
auto* spinner = lvgl_spinner_create(ctx->contentWrapper);
|
||||
lv_obj_align(spinner, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_add_flag(ctx->refreshButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->refreshButton, true);
|
||||
lvgl_unlock();
|
||||
|
||||
WifiStationState station_state = WIFI_STATION_STATE_DISCONNECTED;
|
||||
@ -261,7 +262,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
// The global toolbar nav callback only knows how to stop old-model apps.
|
||||
lvgl_toolbar_set_nav_action(toolbar, LV_SYMBOL_CLOSE, onBackPressed, ctx);
|
||||
ctx->refreshButton = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_REFRESH, onRefreshPressed, ctx);
|
||||
lv_obj_add_flag(ctx->refreshButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->refreshButton, true);
|
||||
|
||||
ctx->contentWrapper = lv_obj_create(parent);
|
||||
lv_obj_set_style_border_width(ctx->contentWrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -94,7 +94,7 @@ void uninstallApp(Context* ctx) {
|
||||
LOG_I(TAG, "Uninstall");
|
||||
|
||||
lvgl_lock();
|
||||
lv_obj_remove_flag(ctx->spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->spinner, false);
|
||||
lvgl_unlock();
|
||||
|
||||
app_uninstall(ctx->entry.appId.c_str());
|
||||
@ -172,7 +172,7 @@ void installApp(Context* ctx) {
|
||||
LOG_I(TAG, "Install");
|
||||
|
||||
lvgl_lock();
|
||||
lv_obj_remove_flag(ctx->spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->spinner, false);
|
||||
lvgl_unlock();
|
||||
|
||||
doInstall(ctx);
|
||||
@ -182,7 +182,7 @@ void updateApp(Context* ctx) {
|
||||
LOG_I(TAG, "Update");
|
||||
|
||||
lvgl_lock();
|
||||
lv_obj_remove_flag(ctx->spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->spinner, false);
|
||||
lvgl_unlock();
|
||||
|
||||
LOG_I(TAG, "Removing previous version");
|
||||
@ -195,8 +195,8 @@ void updateViews(Context* ctx) {
|
||||
lvgl_toolbar_clear_actions(ctx->toolbar);
|
||||
auto app_id = ctx->entry.appId.c_str();
|
||||
ctx->spinner = lvgl_toolbar_add_spinner_action(ctx->toolbar);
|
||||
lv_obj_add_flag(ctx->spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->updateLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->spinner, true);
|
||||
lv_obj_set_hidden(ctx->updateLabel, true);
|
||||
|
||||
char install_path[128];
|
||||
bool is_installed = app_get_install_path(app_id, install_path, sizeof(install_path)) == ERROR_NONE
|
||||
@ -208,7 +208,7 @@ void updateViews(Context* ctx) {
|
||||
if (app_package_manifest_parse(metadata_path.c_str(), &package, nullptr, 0) == ERROR_NONE
|
||||
&& package.version_code < ctx->entry.appVersionCode) {
|
||||
ctx->updateButton = lvgl_toolbar_add_image_button_action(ctx->toolbar, LV_SYMBOL_DOWNLOAD, onUpdatePressed, ctx);
|
||||
lv_obj_remove_flag(ctx->updateLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->updateLabel, false);
|
||||
}
|
||||
lvgl_toolbar_add_image_button_action(ctx->toolbar, LV_SYMBOL_TRASH, onUninstallPressed, ctx);
|
||||
} else {
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <TactilityCpp/Allocator.h>
|
||||
|
||||
#include <lvgl/widgets/card.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <lvgl.h>
|
||||
#include <algorithm>
|
||||
@ -51,7 +52,7 @@ void createPackageWidget(const PackageManifest* package, lv_obj_t* list) {
|
||||
// A v2 package's single app shares its id, and its name is the nicer label. Otherwise show the package id.
|
||||
AppManifest appManifest;
|
||||
const char* label = (app_manager_find_manifest(package->id, &appManifest) == ERROR_NONE) ? appManifest.name : package->id;
|
||||
lv_obj_t* btn = lv_list_add_button(list, LVGL_ICON_SHARED_DEPLOYED_CODE, label);
|
||||
lv_obj_t* btn = lvgl_list_add_button(list, LVGL_ICON_SHARED_DEPLOYED_CODE, label);
|
||||
lv_obj_t* image = lv_obj_get_child(btn, 0);
|
||||
lv_obj_set_style_text_font(image, lvgl_get_shared_icon_default_font(), LV_PART_MAIN);
|
||||
lv_obj_add_event_cb(btn, &onPackagePressed, LV_EVENT_SHORT_CLICKED, const_cast<PackageManifest*>(package));
|
||||
@ -101,7 +102,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_clip_corner(card, true, LV_STATE_DEFAULT);
|
||||
|
||||
// The card provides the background
|
||||
lv_obj_t* list = lv_list_create(card);
|
||||
lv_obj_t* list = lvgl_list_create(card);
|
||||
lv_obj_set_size(list, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_bg_opa(list, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(list, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -44,7 +44,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
auto* ctx = static_cast<Context*>(userData);
|
||||
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(parent, false);
|
||||
|
||||
auto* toolbar = lvgl_toolbar_create(parent, "AP Web Server");
|
||||
// The global toolbar nav callback only knows how to stop old-model apps.
|
||||
|
||||
@ -48,7 +48,7 @@ void onInputEnabledSwitch(lv_event_t* event) {
|
||||
auto* sw = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
bool enabled = lv_obj_has_state(sw, LV_STATE_CHECKED);
|
||||
service::audio::setInputEnabled(enabled);
|
||||
lv_obj_set_flag(ctx->inputCard, LV_OBJ_FLAG_HIDDEN, !enabled);
|
||||
lv_obj_set_hidden(ctx->inputCard, !enabled);
|
||||
}
|
||||
|
||||
void onOutputEnabledSwitch(lv_event_t* event) {
|
||||
@ -56,7 +56,7 @@ void onOutputEnabledSwitch(lv_event_t* event) {
|
||||
auto* sw = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
bool enabled = lv_obj_has_state(sw, LV_STATE_CHECKED);
|
||||
service::audio::setOutputEnabled(enabled);
|
||||
lv_obj_set_flag(ctx->outputCard, LV_OBJ_FLAG_HIDDEN, !enabled);
|
||||
lv_obj_set_hidden(ctx->outputCard, !enabled);
|
||||
}
|
||||
|
||||
void onInputMuteSwitch(lv_event_t* event) {
|
||||
@ -90,7 +90,7 @@ lv_obj_t* createRow(lv_obj_t* parent) {
|
||||
lv_obj_set_size(row, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
return row;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ Section createSection(lv_obj_t* parent, const char* title, bool enabled, lv_even
|
||||
auto* card = lvgl_card_create(parent);
|
||||
lv_obj_set_size(card, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flag(card, LV_OBJ_FLAG_HIDDEN, !enabled);
|
||||
lv_obj_set_hidden(card, !enabled);
|
||||
|
||||
return { sw, card };
|
||||
}
|
||||
@ -152,7 +152,7 @@ void refresh(Context* ctx) {
|
||||
if (ctx->inputEnabledSwitch) {
|
||||
const bool enabled = service::audio::isInputEnabled();
|
||||
lv_obj_set_state(ctx->inputEnabledSwitch, LV_STATE_CHECKED, enabled);
|
||||
lv_obj_set_flag(ctx->inputCard, LV_OBJ_FLAG_HIDDEN, !enabled);
|
||||
lv_obj_set_hidden(ctx->inputCard, !enabled);
|
||||
}
|
||||
if (ctx->inputMuteSwitch) {
|
||||
if (service::audio::isInputMuted()) lv_obj_add_state(ctx->inputMuteSwitch, LV_STATE_CHECKED);
|
||||
@ -165,7 +165,7 @@ void refresh(Context* ctx) {
|
||||
if (ctx->outputEnabledSwitch) {
|
||||
const bool enabled = service::audio::isOutputEnabled();
|
||||
lv_obj_set_state(ctx->outputEnabledSwitch, LV_STATE_CHECKED, enabled);
|
||||
lv_obj_set_flag(ctx->outputCard, LV_OBJ_FLAG_HIDDEN, !enabled);
|
||||
lv_obj_set_hidden(ctx->outputCard, !enabled);
|
||||
}
|
||||
if (ctx->outputMuteSwitch) {
|
||||
if (service::audio::isOutputMuted()) lv_obj_add_state(ctx->outputMuteSwitch, LV_STATE_CHECKED);
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <app/event.h>
|
||||
#include <lvgl/widgets/card.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
namespace tt::app::btmanage {
|
||||
@ -111,7 +112,7 @@ static lv_obj_t* createSection(lv_obj_t* parent, const char* title) {
|
||||
lv_obj_set_style_clip_corner(card, true, LV_STATE_DEFAULT);
|
||||
|
||||
// The card provides the background
|
||||
auto* list = lv_list_create(card);
|
||||
auto* list = lvgl_list_create(card);
|
||||
lv_obj_set_size(list, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_bg_opa(list, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(list, 0, LV_STATE_DEFAULT);
|
||||
@ -127,7 +128,7 @@ void View::createPeerListItem(lv_obj_t* list, const bluetooth::PeerRecord& recor
|
||||
percentage)
|
||||
: std::format("{} {}%", record.name, percentage);
|
||||
|
||||
auto* button = lv_list_add_button(list, nullptr, label.c_str());
|
||||
auto* button = lvgl_list_add_button(list, nullptr, label.c_str());
|
||||
|
||||
auto* item_data = new PeerListItemData { context, state, bindings, index, isPaired };
|
||||
lv_obj_set_user_data(button, item_data);
|
||||
@ -174,9 +175,9 @@ void View::updateEnableOnBootToggle() {
|
||||
|
||||
void View::updateScanning() {
|
||||
if (state->getRadioState() == bluetooth::RadioState::On && state->isScanning()) {
|
||||
lv_obj_remove_flag(scanning_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(scanning_spinner, false);
|
||||
} else {
|
||||
lv_obj_add_flag(scanning_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(scanning_spinner, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +193,7 @@ void View::updatePeerList() {
|
||||
lv_obj_set_style_bg_opa(enable_on_boot_wrapper, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_flex_flow(enable_on_boot_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(enable_on_boot_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(enable_on_boot_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(enable_on_boot_wrapper, false);
|
||||
|
||||
auto* enable_label = lv_label_create(enable_on_boot_wrapper);
|
||||
lv_label_set_text(enable_label, "Enable on boot");
|
||||
@ -223,7 +224,7 @@ void View::updatePeerList() {
|
||||
createPeerListItem(available_section, scan_results[i], false, i);
|
||||
}
|
||||
} else if (!state->isScanning()) {
|
||||
lv_list_add_text(available_section, "No devices found.");
|
||||
lvgl_list_add_text(available_section, "No devices found.");
|
||||
}
|
||||
// Never hide peers_list: it always contains the "Enable on boot" row.
|
||||
// While scanning with no results the spinner in the toolbar provides feedback.
|
||||
|
||||
@ -49,12 +49,12 @@ bool isCurrentlyConnected(const Context* ctx) {
|
||||
|
||||
void updateViews(const Context* ctx) {
|
||||
if (isCurrentlyConnected(ctx)) {
|
||||
lv_obj_remove_flag(ctx->disconnectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->connectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->disconnectButton, false);
|
||||
lv_obj_set_hidden(ctx->connectButton, true);
|
||||
lv_obj_remove_state(ctx->disconnectButton, LV_STATE_DISABLED);
|
||||
} else {
|
||||
lv_obj_add_flag(ctx->disconnectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx->connectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->disconnectButton, true);
|
||||
lv_obj_set_hidden(ctx->connectButton, false);
|
||||
lv_obj_remove_state(ctx->connectButton, LV_STATE_DISABLED);
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_size(auto_connect_wrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(auto_connect_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(auto_connect_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(auto_connect_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(auto_connect_wrapper, false);
|
||||
lvgl::obj_set_style_bg_invisible(auto_connect_wrapper);
|
||||
lv_obj_set_style_pad_all(auto_connect_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(auto_connect_wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -71,7 +71,7 @@ static void anim_opa_cb(void* var, int32_t v) {
|
||||
|
||||
static void toast_fade_out_ready_cb(lv_anim_t* a) {
|
||||
lv_obj_t* toast = (lv_obj_t*)a->var;
|
||||
lv_obj_add_flag(toast, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(toast, true);
|
||||
}
|
||||
|
||||
static void toastTimerCb(lv_timer_t *timer) {
|
||||
@ -101,7 +101,7 @@ static void showToast(Context* ctx, const char *text) {
|
||||
lv_anim_delete(ctx->toastLabel, anim_opa_cb);
|
||||
|
||||
lv_label_set_text(ctx->toastLabel, text);
|
||||
lv_obj_remove_flag(ctx->toastLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->toastLabel, false);
|
||||
lv_obj_move_foreground(ctx->toastLabel);
|
||||
|
||||
lv_anim_t a;
|
||||
@ -361,7 +361,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
auto* ctx = static_cast<Context*>(userData);
|
||||
ctx->stopping.store(false);
|
||||
|
||||
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(parent, false);
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -378,7 +378,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_height(main_wrapper, LV_PCT(100));
|
||||
lv_obj_set_style_pad_all(main_wrapper, 6, 0);
|
||||
lv_obj_set_style_border_width(main_wrapper, 0, 0);
|
||||
lv_obj_remove_flag(main_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(main_wrapper, false);
|
||||
|
||||
ctx->previewContainer = lv_obj_create(main_wrapper);
|
||||
lv_obj_set_size(ctx->previewContainer, LV_PCT(100), LV_PCT(100));
|
||||
@ -386,7 +386,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_border_width(ctx->previewContainer, 0, 0);
|
||||
lv_obj_set_style_pad_all(ctx->previewContainer, 0, 0);
|
||||
lv_obj_set_style_radius(ctx->previewContainer, 0, 0);
|
||||
lv_obj_remove_flag(ctx->previewContainer, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(ctx->previewContainer, false);
|
||||
|
||||
ctx->previewCanvas = lv_canvas_create(ctx->previewContainer);
|
||||
lv_obj_set_style_bg_color(ctx->previewCanvas, lv_color_black(), 0);
|
||||
@ -406,7 +406,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_border_color(ctx->toastLabel, lv_color_hex(0x3B82F6), 0);
|
||||
lv_obj_set_style_shadow_width(ctx->toastLabel, 16, 0);
|
||||
lv_obj_set_style_shadow_color(ctx->toastLabel, lv_color_black(), 0);
|
||||
lv_obj_add_flag(ctx->toastLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->toastLabel, true);
|
||||
|
||||
lv_display_t* disp = lv_display_get_default();
|
||||
if (disp) {
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include <app/event.h>
|
||||
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
#include <cstdio>
|
||||
@ -48,7 +49,7 @@ void ChatView::createInputBar(lv_obj_t* parent) {
|
||||
lv_obj_set_style_pad_all(wrapper, 0, 0);
|
||||
lv_obj_set_style_pad_column(wrapper, 4, 0);
|
||||
lv_obj_set_style_border_opa(wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(wrapper, false);
|
||||
|
||||
inputField = lv_textarea_create(wrapper);
|
||||
lv_obj_set_flex_grow(inputField, 1);
|
||||
@ -72,7 +73,7 @@ void ChatView::createSettingsPanel(lv_obj_t* parent) {
|
||||
lv_obj_set_flex_flow(settingsPanel, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_all(settingsPanel, 8, 0);
|
||||
lv_obj_set_style_pad_row(settingsPanel, 6, 0);
|
||||
lv_obj_add_flag(settingsPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(settingsPanel, true);
|
||||
|
||||
// Nickname
|
||||
auto* nickLabel = lv_label_create(settingsPanel);
|
||||
@ -121,7 +122,7 @@ void ChatView::createChannelPanel(lv_obj_t* parent) {
|
||||
lv_obj_set_flex_flow(channelPanel, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_all(channelPanel, 8, 0);
|
||||
lv_obj_set_style_pad_row(channelPanel, 6, 0);
|
||||
lv_obj_add_flag(channelPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(channelPanel, true);
|
||||
|
||||
auto* label = lv_label_create(channelPanel);
|
||||
lv_label_set_text(label, "Channel (e.g. #general):");
|
||||
@ -167,7 +168,7 @@ void ChatView::init(lv_obj_t* parent) {
|
||||
updateToolbarTitle();
|
||||
|
||||
// Message list
|
||||
msgList = lv_list_create(parent);
|
||||
msgList = lvgl_list_create(parent);
|
||||
lv_obj_set_flex_grow(msgList, 1);
|
||||
lv_obj_set_width(msgList, LV_PCT(100));
|
||||
if (lv_display_get_color_format(lv_obj_get_display(parent)) != LV_COLOR_FORMAT_L8) {
|
||||
@ -224,16 +225,16 @@ void ChatView::showSettings(const ChatSettingsData& current) {
|
||||
lv_textarea_set_text(keyInput, "");
|
||||
}
|
||||
|
||||
lv_obj_add_flag(msgList, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(inputWrapper, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(settingsPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(msgList, true);
|
||||
lv_obj_set_hidden(inputWrapper, true);
|
||||
lv_obj_set_hidden(settingsPanel, false);
|
||||
}
|
||||
|
||||
void ChatView::hideSettings() {
|
||||
if (!settingsPanel || !msgList || !inputWrapper) return;
|
||||
lv_obj_add_flag(settingsPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(msgList, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(inputWrapper, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(settingsPanel, true);
|
||||
lv_obj_set_hidden(msgList, false);
|
||||
lv_obj_set_hidden(inputWrapper, false);
|
||||
}
|
||||
|
||||
void ChatView::showChannelSelector() {
|
||||
@ -242,16 +243,16 @@ void ChatView::showChannelSelector() {
|
||||
std::string current = state->getCurrentChannel();
|
||||
lv_textarea_set_text(channelInput, current.c_str());
|
||||
|
||||
lv_obj_add_flag(msgList, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(inputWrapper, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(channelPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(msgList, true);
|
||||
lv_obj_set_hidden(inputWrapper, true);
|
||||
lv_obj_set_hidden(channelPanel, false);
|
||||
}
|
||||
|
||||
void ChatView::hideChannelSelector() {
|
||||
if (!channelPanel || !msgList || !inputWrapper) return;
|
||||
lv_obj_add_flag(channelPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(msgList, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(inputWrapper, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(channelPanel, true);
|
||||
lv_obj_set_hidden(msgList, false);
|
||||
lv_obj_set_hidden(inputWrapper, false);
|
||||
}
|
||||
|
||||
void ChatView::onSendClicked(lv_event_t* e) {
|
||||
|
||||
@ -141,7 +141,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_size(enable_wrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(enable_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(enable_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(enable_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(enable_wrapper, false);
|
||||
lvgl::obj_set_style_bg_invisible(enable_wrapper);
|
||||
lv_obj_set_style_border_width(enable_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(enable_wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -156,9 +156,9 @@ void setCheckedChip(lv_obj_t* chips, settings::display::Orientation orientation)
|
||||
/** Shows the manual orientation or the sensor mounting, depending on whether auto-rotate is on */
|
||||
void updateOrientationVisibility(Context* ctx) {
|
||||
const bool auto_rotate = ctx->autoRotateSwitch != nullptr && ctx->displaySettings.autoRotateEnabled;
|
||||
lv_obj_set_flag(ctx->orientationGroup, LV_OBJ_FLAG_HIDDEN, auto_rotate);
|
||||
lv_obj_set_hidden(ctx->orientationGroup, auto_rotate);
|
||||
if (ctx->mountRotationGroup != nullptr) {
|
||||
lv_obj_set_flag(ctx->mountRotationGroup, LV_OBJ_FLAG_HIDDEN, !auto_rotate);
|
||||
lv_obj_set_hidden(ctx->mountRotationGroup, !auto_rotate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ lv_obj_t* createCardGroup(lv_obj_t* card, const char* title) {
|
||||
lv_obj_set_style_bg_opa(group, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(group, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(group, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(group, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(group, false);
|
||||
|
||||
auto* label = lv_label_create(group);
|
||||
lv_label_set_text(label, title);
|
||||
@ -248,7 +248,7 @@ void onTimeoutSwitch(lv_event_t* event) {
|
||||
ctx->displaySettings.backlightTimeoutEnabled = enabled;
|
||||
ctx->displaySettingsUpdated = true;
|
||||
if (ctx->timeoutCard) {
|
||||
lv_obj_set_flag(ctx->timeoutCard, LV_OBJ_FLAG_HIDDEN, !enabled);
|
||||
lv_obj_set_hidden(ctx->timeoutCard, !enabled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -330,7 +330,7 @@ lv_obj_t* createValueRow(lv_obj_t* card, const char* title, lv_event_cb_t onChan
|
||||
lv_obj_set_style_border_width(row, 0, LV_STATE_DEFAULT);
|
||||
// The card provides the background
|
||||
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
|
||||
auto* title_label = lv_label_create(row);
|
||||
lv_label_set_text(title_label, title);
|
||||
@ -396,7 +396,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_flex_align(auto_rotate_row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_style_border_width(auto_rotate_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(auto_rotate_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(auto_rotate_row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(auto_rotate_row, false);
|
||||
|
||||
auto* auto_rotate_label = lv_label_create(auto_rotate_row);
|
||||
lv_label_set_text(auto_rotate_label, "Auto-rotate");
|
||||
@ -435,7 +435,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_flex_align(timeout_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_style_pad_all(timeout_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(timeout_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(timeout_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(timeout_wrapper, false);
|
||||
|
||||
auto* timeout_label = lv_label_create(timeout_wrapper);
|
||||
lv_label_set_text(timeout_label, "Auto screen off");
|
||||
@ -450,7 +450,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
auto* timeout_card = lvgl_card_create(main_wrapper);
|
||||
lv_obj_set_size(timeout_card, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(timeout_card, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_flag(timeout_card, LV_OBJ_FLAG_HIDDEN, !ctx->displaySettings.backlightTimeoutEnabled);
|
||||
lv_obj_set_hidden(timeout_card, !ctx->displaySettings.backlightTimeoutEnabled);
|
||||
ctx->timeoutCard = timeout_card;
|
||||
|
||||
ctx->timeoutValueLabel = createValueRow(timeout_card, "Timeout", onChangeTimeoutPressed, ctx);
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include <app/stream.h>
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
#include <Tactility/app/files/SupportedFiles.h>
|
||||
@ -356,7 +357,7 @@ void View::createDirEntryWidget(lv_obj_t* list, dirent& dir_entry) {
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_t* button = lv_list_add_button(list, symbol, label_text.c_str());
|
||||
lv_obj_t* button = lvgl_list_add_button(list, symbol, label_text.c_str());
|
||||
lv_obj_add_event_cb(button, &onDirEntryPressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
lv_obj_add_event_cb(button, &onDirEntryLongPressedCallback, LV_EVENT_LONG_PRESSED, this);
|
||||
lv_obj_add_event_cb(button, &onDirEntryKeyCallback, LV_EVENT_KEY, this);
|
||||
@ -431,20 +432,20 @@ void View::onNewFolderPressed() {
|
||||
}
|
||||
|
||||
void View::addCommonFileActions() {
|
||||
auto* copy_button = lv_list_add_button(action_list, LV_SYMBOL_COPY, "Copy");
|
||||
auto* copy_button = lvgl_list_add_button(action_list, LV_SYMBOL_COPY, "Copy");
|
||||
lv_obj_add_event_cb(copy_button, onCopyPressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
auto* cut_button = lv_list_add_button(action_list, LV_SYMBOL_CUT, "Cut");
|
||||
auto* cut_button = lvgl_list_add_button(action_list, LV_SYMBOL_CUT, "Cut");
|
||||
lv_obj_add_event_cb(cut_button, onCutPressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
auto* rename_button = lv_list_add_button(action_list, LV_SYMBOL_EDIT, "Rename");
|
||||
auto* rename_button = lvgl_list_add_button(action_list, LV_SYMBOL_EDIT, "Rename");
|
||||
lv_obj_add_event_cb(rename_button, onRenamePressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
auto* delete_button = lv_list_add_button(action_list, LV_SYMBOL_TRASH, "Delete");
|
||||
auto* delete_button = lvgl_list_add_button(action_list, LV_SYMBOL_TRASH, "Delete");
|
||||
lv_obj_add_event_cb(delete_button, onDeletePressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
}
|
||||
|
||||
void View::showActions() {
|
||||
lv_obj_clean(action_list);
|
||||
addCommonFileActions();
|
||||
lv_obj_remove_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(action_list, false);
|
||||
}
|
||||
|
||||
void View::showActionsForDirectory() { showActions(); }
|
||||
@ -453,21 +454,21 @@ void View::showActionsForFile() {
|
||||
lv_obj_clean(action_list);
|
||||
|
||||
if (isExecutablePath(state->getSelectedChildPath())) {
|
||||
auto* run_button = lv_list_add_button(action_list, LV_SYMBOL_PLAY, "Run");
|
||||
auto* run_button = lvgl_list_add_button(action_list, LV_SYMBOL_PLAY, "Run");
|
||||
lv_obj_add_event_cb(run_button, onRunPressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
}
|
||||
|
||||
addCommonFileActions();
|
||||
lv_obj_remove_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(action_list, false);
|
||||
}
|
||||
|
||||
void View::showActionsForMountPoint() {
|
||||
lv_obj_clean(action_list);
|
||||
|
||||
auto* eject_button = lv_list_add_button(action_list, LV_SYMBOL_EJECT, "Eject");
|
||||
auto* eject_button = lvgl_list_add_button(action_list, LV_SYMBOL_EJECT, "Eject");
|
||||
lv_obj_add_event_cb(eject_button, onEjectPressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
|
||||
lv_obj_remove_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(action_list, false);
|
||||
}
|
||||
|
||||
void View::onRunPressed() {
|
||||
@ -517,7 +518,7 @@ void View::update(size_t start_index) {
|
||||
size_t count = 0;
|
||||
|
||||
if (!is_root && current_start_index > 0) {
|
||||
auto* back_btn = lv_list_add_btn(dir_entry_list, LV_SYMBOL_LEFT, "Back");
|
||||
auto* back_btn = lvgl_list_add_button(dir_entry_list, LV_SYMBOL_LEFT, "Back");
|
||||
lv_obj_add_event_cb(back_btn, [](lv_event_t* event) {
|
||||
auto* view = static_cast<View*>(lv_event_get_user_data(event));
|
||||
size_t new_index = (view->current_start_index >= view->MAX_BATCH) ?
|
||||
@ -541,7 +542,7 @@ void View::update(size_t start_index) {
|
||||
if (!is_root && last_loaded_index < total_entries) {
|
||||
if (total_entries > current_start_index &&
|
||||
(total_entries - current_start_index) > MAX_BATCH) {
|
||||
auto* next_btn = lv_list_add_btn(dir_entry_list, LV_SYMBOL_RIGHT, "Next");
|
||||
auto* next_btn = lvgl_list_add_button(dir_entry_list, LV_SYMBOL_RIGHT, "Next");
|
||||
lv_obj_add_event_cb(next_btn, [](lv_event_t* event) {
|
||||
auto* view = static_cast<View*>(lv_event_get_user_data(event));
|
||||
view->update(view->last_loaded_index); }, LV_EVENT_SHORT_CLICKED, this);
|
||||
@ -552,15 +553,15 @@ void View::update(size_t start_index) {
|
||||
});
|
||||
|
||||
if (is_root) {
|
||||
lv_obj_add_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(navigate_up_button, true);
|
||||
} else {
|
||||
lv_obj_remove_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(navigate_up_button, false);
|
||||
}
|
||||
|
||||
if (state->hasClipboard() && !is_root) {
|
||||
lv_obj_remove_flag(paste_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(paste_button, false);
|
||||
} else {
|
||||
lv_obj_add_flag(paste_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(paste_button, true);
|
||||
}
|
||||
|
||||
lvgl_unlock();
|
||||
@ -579,7 +580,7 @@ void View::init(uint32_t appInstanceId, lv_obj_t* parent) {
|
||||
new_file_button = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_FILE, &onNewFilePressedCallback, this);
|
||||
new_folder_button = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_DIRECTORY, &onNewFolderPressedCallback, this);
|
||||
paste_button = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_PASTE, &onPastePressedCallback, this);
|
||||
lv_obj_add_flag(paste_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(paste_button, true);
|
||||
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapper, LV_PCT(100));
|
||||
@ -588,30 +589,30 @@ void View::init(uint32_t appInstanceId, lv_obj_t* parent) {
|
||||
lv_obj_set_flex_grow(wrapper, 1);
|
||||
lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_ROW);
|
||||
|
||||
dir_entry_list = lv_list_create(wrapper);
|
||||
dir_entry_list = lvgl_list_create(wrapper);
|
||||
lv_obj_set_height(dir_entry_list, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(dir_entry_list, 1);
|
||||
|
||||
lv_obj_add_event_cb(dir_entry_list, dirEntryListScrollBeginCallback, LV_EVENT_SCROLL_BEGIN, this);
|
||||
|
||||
action_list = lv_list_create(wrapper);
|
||||
action_list = lvgl_list_create(wrapper);
|
||||
lv_obj_set_height(action_list, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(action_list, 1);
|
||||
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(action_list, true);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void View::onDirEntryListScrollBegin() {
|
||||
if (lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(action_list, true);
|
||||
lvgl_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void View::onNavigate() {
|
||||
if (lvgl_try_lock(500 / portTICK_PERIOD_MS)) {
|
||||
lv_obj_add_flag(action_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(action_list, true);
|
||||
lvgl_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
#include <tactility/log.h>
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
#include <cstring>
|
||||
@ -103,9 +104,9 @@ void View::onPathTextChanged(lv_event_t* event) {
|
||||
auto* view = static_cast<View*>(lv_event_get_user_data(event));
|
||||
const char* path = lv_textarea_get_text(view->path_textarea);
|
||||
if (isSelectableFilePath(path)) {
|
||||
lv_obj_remove_flag(view->select_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(view->select_button, false);
|
||||
} else {
|
||||
lv_obj_add_flag(view->select_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(view->select_button, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +118,7 @@ void View::createDirEntryWidget(lv_obj_t* list, dirent& dir_entry) {
|
||||
} else {
|
||||
symbol = LV_SYMBOL_FILE;
|
||||
}
|
||||
lv_obj_t* button = lv_list_add_button(list, symbol, dir_entry.d_name);
|
||||
lv_obj_t* button = lvgl_list_add_button(list, symbol, dir_entry.d_name);
|
||||
lv_obj_add_event_cb(button, &onDirEntryPressedCallback, LV_EVENT_SHORT_CLICKED, this);
|
||||
}
|
||||
|
||||
@ -153,9 +154,9 @@ void View::update() {
|
||||
});
|
||||
|
||||
if (state->getCurrentPath() == "/") {
|
||||
lv_obj_add_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(navigate_up_button, true);
|
||||
} else {
|
||||
lv_obj_remove_flag(navigate_up_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(navigate_up_button, false);
|
||||
}
|
||||
|
||||
lvgl_unlock();
|
||||
@ -177,7 +178,7 @@ void View::init(lv_obj_t* parent, Mode mode) {
|
||||
lv_obj_set_flex_grow(wrapper, 1);
|
||||
lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_ROW);
|
||||
|
||||
dir_entry_list = lv_list_create(wrapper);
|
||||
dir_entry_list = lvgl_list_create(wrapper);
|
||||
lv_obj_set_height(dir_entry_list, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(dir_entry_list, 1);
|
||||
|
||||
@ -196,7 +197,7 @@ void View::init(lv_obj_t* parent, Mode mode) {
|
||||
auto* select_button_label = lv_label_create(select_button);
|
||||
lv_label_set_text(select_button_label, "Select");
|
||||
lv_obj_add_event_cb(select_button, onSelectButtonPressed, LV_EVENT_SHORT_CLICKED, this);
|
||||
lv_obj_add_flag(select_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(select_button, true);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ void updateViews(Context* ctx) {
|
||||
|
||||
lv_obj_clean(ctx->scanListWidget);
|
||||
if (ctx->scanState == ScanStateStopped) {
|
||||
lv_obj_remove_flag(ctx->scanListWidget, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->scanListWidget, false);
|
||||
|
||||
// A grid with the title in the first row, then an address and the devicetree device names per row
|
||||
const size_t count = ctx->scannedAddresses.size();
|
||||
@ -204,7 +204,7 @@ void updateViews(Context* ctx) {
|
||||
auto* address_label = lv_label_create(ctx->scanListWidget);
|
||||
lv_label_set_text(address_label, getAddressText(address).c_str());
|
||||
// Keys and encoders move through the addresses, which scrolls the results into view
|
||||
lv_obj_add_flag(address_label, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(address_label, true);
|
||||
lv_obj_set_grid_cell(address_label, LV_GRID_ALIGN_START, 0, 1, LV_GRID_ALIGN_START, row, 1);
|
||||
|
||||
auto* names_label = lv_label_create(ctx->scanListWidget);
|
||||
@ -213,7 +213,7 @@ void updateViews(Context* ctx) {
|
||||
lv_obj_set_grid_cell(names_label, LV_GRID_ALIGN_STRETCH, 1, 1, LV_GRID_ALIGN_START, row, 1);
|
||||
}
|
||||
} else {
|
||||
lv_obj_add_flag(ctx->scanListWidget, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->scanListWidget, true);
|
||||
}
|
||||
|
||||
ctx->mutex.unlock();
|
||||
@ -310,7 +310,7 @@ void startScanning(Context* ctx) {
|
||||
if (ctx->mutex.lock(100 / portTICK_PERIOD_MS)) {
|
||||
ctx->scannedAddresses.clear();
|
||||
|
||||
lv_obj_add_flag(ctx->scanListWidget, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->scanListWidget, true);
|
||||
lv_obj_clean(ctx->scanListWidget);
|
||||
|
||||
ctx->scanState = ScanStateScanning;
|
||||
@ -422,7 +422,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_size(scan_list, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_layout(scan_list, LV_LAYOUT_GRID);
|
||||
lvgl_grid_navigation_add(scan_list);
|
||||
lv_obj_add_flag(scan_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(scan_list, true);
|
||||
ctx->scanListWidget = scan_list;
|
||||
|
||||
struct Device* dummy;
|
||||
|
||||
@ -132,7 +132,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_size(bl_wrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(bl_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(bl_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(bl_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(bl_wrapper, false);
|
||||
lv_obj_set_style_pad_all(bl_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(bl_wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -165,7 +165,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_size(to_enable_wrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(to_enable_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(to_enable_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(to_enable_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(to_enable_wrapper, false);
|
||||
lv_obj_set_style_pad_all(to_enable_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(to_enable_wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include <app/scheduler.h>
|
||||
|
||||
#include <lvgl_window_manager/window_manager.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/sliderbox.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
@ -82,9 +83,9 @@ void applyAndLog(Context& ctx) {
|
||||
void updateVisibility(Context& ctx) {
|
||||
const bool hasSecondary = ctx.settings.pattern != settings::ledstrip::Pattern::Solid;
|
||||
if (hasSecondary) {
|
||||
lv_obj_remove_flag(ctx.secondaryRow, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx.secondaryRow, false);
|
||||
} else {
|
||||
lv_obj_add_flag(ctx.secondaryRow, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx.secondaryRow, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,9 +94,9 @@ void onNavigationPressed(lv_event_t* event);
|
||||
void returnToMain(Context& ctx) {
|
||||
ctx.page = Context::Page::Main;
|
||||
ctx.choiceKind = Context::ChoiceKind::None;
|
||||
lv_obj_add_flag(ctx.choicePanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx.customPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx.mainPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx.choicePanel, true);
|
||||
lv_obj_set_hidden(ctx.customPanel, true);
|
||||
lv_obj_set_hidden(ctx.mainPanel, false);
|
||||
lv_obj_update_layout(ctx.mainPanel);
|
||||
lvgl_toolbar_set_title(ctx.toolbar, "LED Strip");
|
||||
lvgl_toolbar_set_nav_action(ctx.toolbar, LV_SYMBOL_CLOSE, onNavigationPressed, &ctx);
|
||||
@ -117,11 +118,11 @@ void openCustomEditor(Context& ctx, bool secondary) {
|
||||
ctx.page = Context::Page::CustomColor;
|
||||
ctx.choiceKind = Context::ChoiceKind::None;
|
||||
ctx.editingSecondary = secondary;
|
||||
lv_obj_add_flag(ctx.choicePanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx.mainPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx.customPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(secondary ? ctx.primaryEditor : ctx.secondaryEditor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(secondary ? ctx.secondaryEditor : ctx.primaryEditor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx.choicePanel, true);
|
||||
lv_obj_set_hidden(ctx.mainPanel, true);
|
||||
lv_obj_set_hidden(ctx.customPanel, false);
|
||||
lv_obj_set_hidden(secondary ? ctx.primaryEditor : ctx.secondaryEditor, true);
|
||||
lv_obj_set_hidden(secondary ? ctx.secondaryEditor : ctx.primaryEditor, false);
|
||||
lvgl_toolbar_set_title(ctx.toolbar, secondary ? "Custom second color" : "Custom color");
|
||||
lvgl_toolbar_set_nav_action(ctx.toolbar, LV_SYMBOL_LEFT, onNavigationPressed, &ctx);
|
||||
lv_obj_update_layout(ctx.customPanel);
|
||||
@ -203,15 +204,15 @@ void openChoice(Context& ctx, Context::ChoiceKind kind, lv_obj_t* returnFocus) {
|
||||
const size_t selected = currentChoice(ctx);
|
||||
lv_obj_t* selectedButton = nullptr;
|
||||
for (size_t index = 0; index < choiceCount(kind); index++) {
|
||||
auto* button = lv_list_add_button(ctx.choiceList, index == selected ? LV_SYMBOL_OK : nullptr, choiceName(kind, index));
|
||||
auto* button = lvgl_list_add_button(ctx.choiceList, index == selected ? LV_SYMBOL_OK : nullptr, choiceName(kind, index));
|
||||
lv_obj_add_event_cb(button, onChoiceSelected, LV_EVENT_SHORT_CLICKED, &ctx);
|
||||
if (index == selected) selectedButton = button;
|
||||
}
|
||||
|
||||
lvgl_toolbar_set_title(ctx.toolbar, choiceTitle(kind));
|
||||
lvgl_toolbar_set_nav_action(ctx.toolbar, LV_SYMBOL_LEFT, onNavigationPressed, &ctx);
|
||||
lv_obj_add_flag(ctx.mainPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx.choicePanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx.mainPanel, true);
|
||||
lv_obj_set_hidden(ctx.choicePanel, false);
|
||||
if (selectedButton != nullptr) {
|
||||
lv_group_focus_obj(selectedButton);
|
||||
}
|
||||
@ -286,7 +287,7 @@ lv_obj_t* createRow(lv_obj_t* parent, const char* title) {
|
||||
lv_obj_set_style_border_width(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
auto* label = lv_label_create(row);
|
||||
lv_label_set_text(label, title);
|
||||
lv_obj_set_flex_grow(label, 1);
|
||||
@ -339,14 +340,14 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_flex_grow(ctx->mainPanel, 1);
|
||||
lv_obj_set_flex_flow(ctx->mainPanel, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(ctx->mainPanel, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_add_flag(ctx->mainPanel, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(ctx->mainPanel, true);
|
||||
|
||||
ctx->customPanel = lv_obj_create(parent);
|
||||
lv_obj_set_style_border_width(ctx->customPanel, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_width(ctx->customPanel, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(ctx->customPanel, 1);
|
||||
lv_obj_set_flex_flow(ctx->customPanel, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_add_flag(ctx->customPanel, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->customPanel, true);
|
||||
|
||||
auto* outputRow = createRow(ctx->mainPanel, "Output");
|
||||
auto* outputSwitch = lv_switch_create(outputRow);
|
||||
@ -370,7 +371,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_add_event_cb(primaryButton, onPrimaryColorPressed, LV_EVENT_SHORT_CLICKED, ctx);
|
||||
|
||||
createRgbEditor(ctx->customPanel, "Red / Green / Blue", ctx->settings.primaryCustom, ctx->primarySliderBoxes, ctx, true);
|
||||
lv_obj_add_flag(ctx->primaryEditor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->primaryEditor, true);
|
||||
|
||||
ctx->secondaryRow = createRow(ctx->mainPanel, "Second color");
|
||||
auto* secondaryButton = lv_button_create(ctx->secondaryRow);
|
||||
@ -381,7 +382,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_add_event_cb(secondaryButton, onSecondaryColorPressed, LV_EVENT_SHORT_CLICKED, ctx);
|
||||
|
||||
createRgbEditor(ctx->customPanel, "Red / Green / Blue", ctx->settings.secondaryCustom, ctx->secondarySliderBoxes, ctx, false);
|
||||
lv_obj_add_flag(ctx->secondaryEditor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->secondaryEditor, true);
|
||||
|
||||
auto* brightnessRow = createRow(ctx->mainPanel, "Brightness");
|
||||
ctx->brightnessValue = lv_label_create(brightnessRow);
|
||||
@ -395,8 +396,8 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_width(ctx->choicePanel, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(ctx->choicePanel, 1);
|
||||
lv_obj_set_flex_flow(ctx->choicePanel, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_add_flag(ctx->choicePanel, LV_OBJ_FLAG_HIDDEN);
|
||||
ctx->choiceList = lv_list_create(ctx->choicePanel);
|
||||
lv_obj_set_hidden(ctx->choicePanel, true);
|
||||
ctx->choiceList = lvgl_list_create(ctx->choicePanel);
|
||||
lv_obj_set_width(ctx->choiceList, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(ctx->choiceList, 1);
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_flex_flow(language_row, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(language_row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_set_style_border_width(language_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(language_row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(language_row, false);
|
||||
|
||||
// The title with the language below it, which take the width that the button leaves. Texts that don't fit scroll.
|
||||
auto* texts = lv_obj_create(language_row);
|
||||
@ -173,7 +173,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_pad_row(texts, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(texts, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(texts, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(texts, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(texts, false);
|
||||
|
||||
ctx->languageLabel = lv_label_create(texts);
|
||||
lv_obj_set_width(ctx->languageLabel, LV_PCT(100));
|
||||
|
||||
@ -124,7 +124,7 @@ void appNotesEventCb(lv_event_t* e) {
|
||||
void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
auto* ctx = static_cast<Context*>(userData);
|
||||
|
||||
lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(parent, false);
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -148,7 +148,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_pad_all(wrapper, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_row(wrapper, 0, LV_PART_MAIN);
|
||||
lv_obj_set_style_border_width(wrapper, 0, LV_PART_MAIN);
|
||||
lv_obj_remove_flag(wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(wrapper, false);
|
||||
|
||||
ctx->uiNoteText = lv_textarea_create(wrapper);
|
||||
lv_obj_set_width(ctx->uiNoteText, LV_PCT(100));
|
||||
@ -174,7 +174,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_width(footer, LV_PCT(100));
|
||||
lv_obj_set_height(footer, LV_PCT(14));
|
||||
lv_obj_set_style_pad_all(footer, 0, LV_PART_MAIN);
|
||||
lv_obj_remove_flag(footer, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(footer, false);
|
||||
|
||||
ctx->uiCurrentFileName = lv_label_create(footer);
|
||||
lv_label_set_long_mode(ctx->uiCurrentFileName, LV_LABEL_LONG_MODE_SCROLL_CIRCULAR);
|
||||
|
||||
@ -183,7 +183,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_height(switch_container, LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(switch_container, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(switch_container, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(switch_container, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(switch_container, false);
|
||||
lv_obj_set_style_pad_all(switch_container, 0, 0);
|
||||
lv_obj_set_style_pad_gap(switch_container, 0, 0);
|
||||
lvgl::obj_set_style_bg_invisible(switch_container);
|
||||
@ -205,7 +205,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_height(qc_container, LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(qc_container, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(qc_container, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(qc_container, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(qc_container, false);
|
||||
lv_obj_set_style_pad_all(qc_container, 0, 0);
|
||||
lv_obj_set_style_pad_gap(qc_container, 0, 0);
|
||||
lvgl::obj_set_style_bg_invisible(qc_container);
|
||||
|
||||
@ -80,7 +80,7 @@ void updateScreenshotMode(Context* ctx) {
|
||||
for (uint32_t i = 0; i < chip_count; i++) {
|
||||
lv_obj_set_state(lv_obj_get_child(ctx->modeChips, static_cast<int32_t>(i)), LV_STATE_CHECKED, MODE_OPTIONS[i].mode == ctx->mode);
|
||||
}
|
||||
lv_obj_set_flag(ctx->delayRow, LV_OBJ_FLAG_HIDDEN, ctx->mode != CaptureMode::Timer);
|
||||
lv_obj_set_hidden(ctx->delayRow, ctx->mode != CaptureMode::Timer);
|
||||
}
|
||||
|
||||
void onBackPressed(lv_event_t* event) {
|
||||
@ -144,7 +144,7 @@ lv_obj_t* createRow(lv_obj_t* card, const char* title) {
|
||||
lv_obj_set_style_pad_all(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
lv_label_set_text(lv_label_create(row), title);
|
||||
return row;
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include <tactility/log.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
namespace tt::app::selectiondialog {
|
||||
@ -52,7 +53,7 @@ void onItemSelected(lv_event_t* e) {
|
||||
}
|
||||
|
||||
void createChoiceItem(Context* ctx, lv_obj_t* list, const std::string& title, int32_t index) {
|
||||
lv_obj_t* btn = lv_list_add_button(list, nullptr, title.c_str());
|
||||
lv_obj_t* btn = lvgl_list_add_button(list, nullptr, title.c_str());
|
||||
auto* itemCtx = new ItemContext { ctx, index };
|
||||
lv_obj_add_event_cb(btn, onItemSelected, LV_EVENT_SHORT_CLICKED, itemCtx);
|
||||
lv_obj_add_event_cb(btn, onItemDeleted, LV_EVENT_DELETE, itemCtx);
|
||||
@ -78,7 +79,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
const char* title = (argv[0][0] != '\0') ? argv[0] : DEFAULT_TITLE;
|
||||
lvgl_toolbar_create(parent, title);
|
||||
|
||||
auto* list = lv_list_create(parent);
|
||||
auto* list = lvgl_list_create(parent);
|
||||
lv_obj_set_width(list, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(list, 1);
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ void renderCurrent(Context* ctx) {
|
||||
lv_label_set_text(ctx->titleLabel, "Welcome");
|
||||
auto device_names = string::split(std::string(CONFIG_TT_DEVICE_NAME_SIMPLE), ",");
|
||||
lv_label_set_text_fmt(ctx->descriptionLabel, "It's time to set up your %s!", device_names.front().c_str());
|
||||
lv_obj_add_flag(ctx->skipButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->skipButton, true);
|
||||
lv_label_set_text(lv_obj_get_child(ctx->continueButton, 0), "Continue");
|
||||
break;
|
||||
}
|
||||
@ -115,7 +115,7 @@ void renderCurrent(Context* ctx) {
|
||||
const auto& step = ctx->steps[ctx->stepIndex];
|
||||
lv_label_set_text(ctx->titleLabel, step.title.c_str());
|
||||
lv_label_set_text(ctx->descriptionLabel, step.description.c_str());
|
||||
lv_obj_remove_flag(ctx->skipButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->skipButton, false);
|
||||
lv_label_set_text(lv_obj_get_child(ctx->skipButton, 0), "Skip");
|
||||
lv_label_set_text(lv_obj_get_child(ctx->continueButton, 0), "Continue");
|
||||
break;
|
||||
@ -123,7 +123,7 @@ void renderCurrent(Context* ctx) {
|
||||
case Phase::Done:
|
||||
lv_label_set_text(ctx->titleLabel, "Setup Complete");
|
||||
lv_label_set_text(ctx->descriptionLabel, "You're all set.");
|
||||
lv_obj_add_flag(ctx->skipButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->skipButton, true);
|
||||
lv_label_set_text(lv_obj_get_child(ctx->continueButton, 0), "Finish");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ void updateRtosTasks(lv_obj_t* parent, std::vector<std::string>& taskNames) {
|
||||
auto* row = i < lv_obj_get_child_count(parent) ? lv_obj_get_child(parent, static_cast<int32_t>(i)) : lv_label_create(parent);
|
||||
lv_label_set_text_fmt(row, "%s (%s)", getTaskName(tasks[i]), getTaskState(tasks[i]));
|
||||
// Keys and encoders move through the tasks, which scrolls the list
|
||||
lv_obj_add_flag(row, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(row, true);
|
||||
taskNames.emplace_back(getTaskName(tasks[i]));
|
||||
}
|
||||
free(tasks);
|
||||
|
||||
@ -42,7 +42,7 @@ void onClosePressed(lv_event_t* event) {
|
||||
|
||||
void onCanvasClicked(lv_event_t* event) {
|
||||
auto* toolbar = static_cast<lv_obj_t*>(lv_event_get_user_data(event));
|
||||
lv_obj_set_flag(toolbar, LV_OBJ_FLAG_HIDDEN, !lv_obj_has_flag(toolbar, LV_OBJ_FLAG_HIDDEN));
|
||||
lv_obj_set_hidden(toolbar, !lv_obj_is_hidden(toolbar));
|
||||
}
|
||||
|
||||
void createWidgets(lv_obj_t* root, void* userData) {
|
||||
@ -60,10 +60,10 @@ void createWidgets(lv_obj_t* root, void* userData) {
|
||||
if (lvgl_indev_exists(LV_INDEV_TYPE_POINTER)) {
|
||||
auto* toolbar = lvgl_toolbar_create(root, "Terminal");
|
||||
lvgl_toolbar_set_nav_action(toolbar, LV_SYMBOL_CLOSE, onClosePressed, ctx);
|
||||
lv_obj_add_flag(toolbar, LV_OBJ_FLAG_FLOATING);
|
||||
lv_obj_set_floating(toolbar, true);
|
||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
lv_obj_add_flag(toolbar, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(canvas, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_hidden(toolbar, true);
|
||||
lv_obj_set_clickable(canvas, true);
|
||||
lv_obj_add_event_cb(canvas, onCanvasClicked, LV_EVENT_SHORT_CLICKED, toolbar);
|
||||
}
|
||||
|
||||
|
||||
@ -119,7 +119,7 @@ lv_obj_t* createTitleAndValue(lv_obj_t* row, const char* title) {
|
||||
lv_obj_set_style_pad_row(texts, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(texts, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(texts, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(texts, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(texts, false);
|
||||
|
||||
auto* title_label = lv_label_create(texts);
|
||||
lv_obj_set_width(title_label, LV_PCT(100));
|
||||
@ -162,7 +162,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_border_width(time_format_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(time_format_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(time_format_row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(time_format_row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(time_format_row, false);
|
||||
|
||||
auto* time_24h_label = lv_label_create(time_format_row);
|
||||
lv_label_set_text(time_24h_label, "24-hour format");
|
||||
@ -185,7 +185,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_border_width(date_format_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(date_format_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(date_format_row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(date_format_row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(date_format_row, false);
|
||||
|
||||
ctx->dateFormatLabel = createTitleAndValue(date_format_row, "Date format");
|
||||
lv_label_set_text(ctx->dateFormatLabel, getDateFormat().c_str());
|
||||
@ -203,7 +203,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_border_width(timezone_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(timezone_row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(timezone_row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(timezone_row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(timezone_row, false);
|
||||
|
||||
ctx->timeZoneLabel = createTitleAndValue(timezone_row, "Timezone");
|
||||
std::string timeZoneName = settings::getTimeZoneName();
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
#include <memory>
|
||||
@ -84,7 +85,7 @@ void onTextareaValueChanged(lv_event_t* e) {
|
||||
}
|
||||
|
||||
void createListItem(Context* ctx, lv_obj_t* list, const std::string& title, size_t index) {
|
||||
auto* btn = lv_list_add_button(list, nullptr, title.c_str());
|
||||
auto* btn = lvgl_list_add_button(list, nullptr, title.c_str());
|
||||
struct ButtonContext {
|
||||
Context* ctx;
|
||||
size_t index;
|
||||
@ -219,7 +220,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
ctx->filterTextareaWidget = textarea;
|
||||
lv_obj_set_flex_grow(textarea, 1);
|
||||
|
||||
auto* list = lv_list_create(parent);
|
||||
auto* list = lvgl_list_create(parent);
|
||||
lv_obj_set_width(list, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(list, 1);
|
||||
lv_obj_set_style_border_width(list, 0, 0);
|
||||
|
||||
@ -100,7 +100,7 @@ void finishCalibration(Context* ctx) {
|
||||
if (xSpan <= 0 || ySpan <= 0) {
|
||||
lv_label_set_text(ctx->titleLabel, "Calibration Failed");
|
||||
lv_label_set_text(ctx->hintLabel, "Screen too small. Tap to close.");
|
||||
lv_obj_add_flag(ctx->target, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->target, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,14 +119,14 @@ void finishCalibration(Context* ctx) {
|
||||
if (!settings::touch::isValid(settings)) {
|
||||
lv_label_set_text(ctx->titleLabel, "Calibration Failed");
|
||||
lv_label_set_text(ctx->hintLabel, "Range invalid. Tap to close.");
|
||||
lv_obj_add_flag(ctx->target, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->target, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!settings::touch::save(settings)) {
|
||||
lv_label_set_text(ctx->titleLabel, "Calibration Failed");
|
||||
lv_label_set_text(ctx->hintLabel, "Unable to save settings. Tap to close.");
|
||||
lv_obj_add_flag(ctx->target, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->target, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ void finishCalibration(Context* ctx) {
|
||||
LOG_I(TAG, "Saved calibration x=[%d, %d] y=[%d, %d]", xMin, xMax, yMin, yMax);
|
||||
lv_label_set_text(ctx->titleLabel, "Calibration Complete");
|
||||
lv_label_set_text(ctx->hintLabel, "Touch anywhere to continue.");
|
||||
lv_obj_add_flag(ctx->target, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->target, true);
|
||||
}
|
||||
|
||||
void onPress(lv_event_t* event) {
|
||||
@ -207,13 +207,13 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_style_radius(ctx->target, LV_RADIUS_CIRCLE, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(ctx->target, lv_palette_main(LV_PALETTE_RED), LV_STATE_DEFAULT);
|
||||
// Ensure root receives all presses for sampling.
|
||||
lv_obj_remove_flag(ctx->target, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(ctx->target, false);
|
||||
|
||||
auto* targetLabel = lv_label_create(ctx->target);
|
||||
lv_label_set_text(targetLabel, "+");
|
||||
lv_obj_center(targetLabel);
|
||||
|
||||
lv_obj_add_flag(ctx->root, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(ctx->root, true);
|
||||
lv_obj_add_event_cb(ctx->root, onPress, LV_EVENT_PRESSED, ctx);
|
||||
|
||||
updateUi(ctx);
|
||||
|
||||
@ -101,13 +101,13 @@ void applyLive(Context* ctx) {
|
||||
|
||||
/** Shows the settings of the enabled trackball and its mode */
|
||||
void updateWidgets(Context* ctx) {
|
||||
lv_obj_set_flag(ctx->settingsCard, LV_OBJ_FLAG_HIDDEN, !ctx->tbSettings.enabled);
|
||||
lv_obj_set_hidden(ctx->settingsCard, !ctx->tbSettings.enabled);
|
||||
const uint32_t chip_count = lv_obj_get_child_count(ctx->modeChips);
|
||||
for (uint32_t i = 0; i < chip_count; i++) {
|
||||
lv_obj_set_state(lv_obj_get_child(ctx->modeChips, static_cast<int32_t>(i)), LV_STATE_CHECKED, MODE_OPTIONS[i].mode == ctx->tbSettings.mode);
|
||||
}
|
||||
lv_obj_set_flag(ctx->keySensitivityGroup, LV_OBJ_FLAG_HIDDEN, ctx->tbSettings.mode != LVGL_TRACKBALL_MODE_KEYS);
|
||||
lv_obj_set_flag(ctx->pointerSensitivityGroup, LV_OBJ_FLAG_HIDDEN, ctx->tbSettings.mode != LVGL_TRACKBALL_MODE_POINTER);
|
||||
lv_obj_set_hidden(ctx->keySensitivityGroup, ctx->tbSettings.mode != LVGL_TRACKBALL_MODE_KEYS);
|
||||
lv_obj_set_hidden(ctx->pointerSensitivityGroup, ctx->tbSettings.mode != LVGL_TRACKBALL_MODE_POINTER);
|
||||
}
|
||||
|
||||
void onTrackballSwitch(lv_event_t* e) {
|
||||
@ -155,7 +155,7 @@ lv_obj_t* createSpeedGroup(lv_obj_t* parent, const char* title, int32_t value, l
|
||||
lv_obj_set_style_pad_all(group, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(group, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(group, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(group, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(group, false);
|
||||
|
||||
lv_label_set_text(lv_label_create(group), title);
|
||||
|
||||
|
||||
@ -70,10 +70,10 @@ void updateVisibility(Context* ctx, bool accessPoint, bool openNetwork, bool aut
|
||||
for (uint32_t i = 0; i < chip_count; i++) {
|
||||
lv_obj_set_state(lv_obj_get_child(ctx->wifiModeChips, static_cast<int32_t>(i)), LV_STATE_CHECKED, (i == 1) == accessPoint);
|
||||
}
|
||||
lv_obj_set_flag(ctx->apGroup, LV_OBJ_FLAG_HIDDEN, !accessPoint);
|
||||
lv_obj_set_flag(ctx->apPasswordRow, LV_OBJ_FLAG_HIDDEN, openNetwork);
|
||||
lv_obj_set_flag(ctx->authCard, LV_OBJ_FLAG_HIDDEN, !authEnabled);
|
||||
lv_obj_set_flag(ctx->urlCard, LV_OBJ_FLAG_HIDDEN, !serverEnabled);
|
||||
lv_obj_set_hidden(ctx->apGroup, !accessPoint);
|
||||
lv_obj_set_hidden(ctx->apPasswordRow, openNetwork);
|
||||
lv_obj_set_hidden(ctx->authCard, !authEnabled);
|
||||
lv_obj_set_hidden(ctx->urlCard, !serverEnabled);
|
||||
}
|
||||
|
||||
void updateVisibility(Context* ctx) {
|
||||
@ -214,7 +214,7 @@ lv_obj_t* createGroup(lv_obj_t* parent) {
|
||||
lv_obj_set_style_pad_all(group, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(group, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(group, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(group, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(group, false);
|
||||
return group;
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ lv_obj_t* createRow(lv_obj_t* parent, const char* title) {
|
||||
lv_obj_set_style_pad_all(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
auto* label = lv_label_create(row);
|
||||
lv_label_set_text(label, title);
|
||||
lv_obj_set_flex_grow(label, 1);
|
||||
|
||||
@ -141,12 +141,12 @@ void onPressDisconnect(lv_event_t* event) {
|
||||
|
||||
void updateConnectButton(Context* ctx) {
|
||||
if (isConnectedToSsid(ctx)) {
|
||||
lv_obj_remove_flag(ctx->disconnectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->connectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->disconnectButton, false);
|
||||
lv_obj_set_hidden(ctx->connectButton, true);
|
||||
lv_obj_remove_state(ctx->disconnectButton, LV_STATE_DISABLED);
|
||||
} else {
|
||||
lv_obj_add_flag(ctx->disconnectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx->connectButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->disconnectButton, true);
|
||||
lv_obj_set_hidden(ctx->connectButton, false);
|
||||
lv_obj_remove_state(ctx->connectButton, LV_STATE_DISABLED);
|
||||
}
|
||||
}
|
||||
@ -157,9 +157,9 @@ void updateBusySpinner(Context* ctx) {
|
||||
wifi_get_station_state(ctx->wifiDevice, &station_state);
|
||||
}
|
||||
if (station_state == WIFI_STATION_STATE_CONNECTION_PENDING) {
|
||||
lv_obj_remove_flag(ctx->busySpinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->busySpinner, false);
|
||||
} else {
|
||||
lv_obj_add_flag(ctx->busySpinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->busySpinner, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,12 +173,12 @@ void updateAutoConnectSection(Context* ctx) {
|
||||
} else {
|
||||
lv_obj_remove_state(ctx->autoConnectSwitch, LV_STATE_CHECKED);
|
||||
}
|
||||
lv_obj_remove_flag(ctx->forgetButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx->autoConnectWrapper, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->forgetButton, false);
|
||||
lv_obj_set_hidden(ctx->autoConnectWrapper, false);
|
||||
} else {
|
||||
LOG_W(TAG, "No settings found");
|
||||
lv_obj_add_flag(ctx->forgetButton, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->autoConnectWrapper, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->forgetButton, true);
|
||||
lv_obj_set_hidden(ctx->autoConnectWrapper, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
auto* forget_button_label = lv_label_create(ctx->forgetButton);
|
||||
lv_obj_align(forget_button_label, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_label_set_text(forget_button_label, "Forget");
|
||||
lv_obj_add_flag(ctx->forgetButton, LV_OBJ_FLAG_HIDDEN); // shown by updateAutoConnectSection()
|
||||
lv_obj_set_hidden(ctx->forgetButton, true); // shown by updateAutoConnectSection()
|
||||
|
||||
// Auto-connect
|
||||
|
||||
@ -257,11 +257,11 @@ void createWidgets(lv_obj_t* parent, void* userData) {
|
||||
lv_obj_set_size(ctx->autoConnectWrapper, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(ctx->autoConnectWrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(ctx->autoConnectWrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(ctx->autoConnectWrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(ctx->autoConnectWrapper, false);
|
||||
lvgl::obj_set_style_bg_invisible(ctx->autoConnectWrapper);
|
||||
lv_obj_set_style_pad_all(ctx->autoConnectWrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ctx->autoConnectWrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_add_flag(ctx->autoConnectWrapper, LV_OBJ_FLAG_HIDDEN); // shown by updateAutoConnectSection()
|
||||
lv_obj_set_hidden(ctx->autoConnectWrapper, true); // shown by updateAutoConnectSection()
|
||||
|
||||
auto* auto_connect_label = lv_label_create(ctx->autoConnectWrapper);
|
||||
lv_label_set_text(auto_connect_label, "Auto-connect");
|
||||
|
||||
@ -105,21 +105,21 @@ void onWifiEvent(Context* ctx, WifiEvent event) {
|
||||
}
|
||||
|
||||
void resetErrors(Context* ctx) {
|
||||
lv_obj_add_flag(ctx->password_error, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->ssid_error, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->connection_error, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->password_error, true);
|
||||
lv_obj_set_hidden(ctx->ssid_error, true);
|
||||
lv_obj_set_hidden(ctx->connection_error, true);
|
||||
}
|
||||
|
||||
void setLoading(Context* ctx, bool loading) {
|
||||
if (loading) {
|
||||
lv_obj_add_flag(ctx->connect_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(ctx->connecting_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->connect_button, true);
|
||||
lv_obj_set_hidden(ctx->connecting_spinner, false);
|
||||
lv_obj_add_state(ctx->password_textarea, LV_STATE_DISABLED);
|
||||
lv_obj_add_state(ctx->ssid_textarea, LV_STATE_DISABLED);
|
||||
lv_obj_add_state(ctx->remember_checkbox, LV_STATE_DISABLED);
|
||||
} else {
|
||||
lv_obj_remove_flag(ctx->connect_button, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(ctx->connecting_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->connect_button, false);
|
||||
lv_obj_set_hidden(ctx->connecting_spinner, true);
|
||||
lv_obj_remove_state(ctx->password_textarea, LV_STATE_DISABLED);
|
||||
lv_obj_remove_state(ctx->ssid_textarea, LV_STATE_DISABLED);
|
||||
lv_obj_remove_state(ctx->remember_checkbox, LV_STATE_DISABLED);
|
||||
@ -135,7 +135,7 @@ void updateView(Context* ctx) {
|
||||
setLoading(ctx, false);
|
||||
resetErrors(ctx);
|
||||
lv_label_set_text(ctx->connection_error, "Connection failed");
|
||||
lv_obj_remove_flag(ctx->connection_error, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->connection_error, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,7 +150,7 @@ void onConnectPressed(lv_event_t* event) {
|
||||
if (ssid_len > WIFI_SETTINGS_SSID_LIMIT) {
|
||||
LOG_E(TAG, "SSID too long");
|
||||
lv_label_set_text(ctx->ssid_error, "SSID too long");
|
||||
lv_obj_remove_flag(ctx->ssid_error, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->ssid_error, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ void onConnectPressed(lv_event_t* event) {
|
||||
if (password_len > WIFI_SETTINGS_PASSWORD_LIMIT) {
|
||||
LOG_E(TAG, "Password too long");
|
||||
lv_label_set_text(ctx->password_error, "Password too long");
|
||||
lv_obj_remove_flag(ctx->password_error, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->password_error, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ void createBottomButtons(Context* ctx, lv_obj_t* parent) {
|
||||
lv_obj_add_state(ctx->remember_checkbox, LV_STATE_CHECKED);
|
||||
|
||||
ctx->connecting_spinner = lvgl_spinner_create(button_container);
|
||||
lv_obj_add_flag(ctx->connecting_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->connecting_spinner, true);
|
||||
|
||||
ctx->connect_button = lv_btn_create(button_container);
|
||||
auto* connect_label = lv_label_create(ctx->connect_button);
|
||||
@ -243,7 +243,7 @@ lv_obj_t* createRow(lv_obj_t* parent, const char* title) {
|
||||
lv_obj_set_style_pad_all(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(row, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(row, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(row, false);
|
||||
auto* label = lv_label_create(row);
|
||||
lv_label_set_text(label, title);
|
||||
lv_obj_set_flex_grow(label, 1);
|
||||
@ -261,7 +261,7 @@ lv_obj_t* createErrorLabel(lv_obj_t* parent) {
|
||||
lvgl_theme_get_settings(&theme_settings);
|
||||
lv_obj_set_style_text_color(label, theme_settings.color_error, LV_STATE_DEFAULT);
|
||||
}
|
||||
lv_obj_add_flag(label, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(label, true);
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <app/event.h>
|
||||
#include <lvgl/widgets/list.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
#include <tactility/log.h>
|
||||
@ -120,7 +121,7 @@ static lv_obj_t* createSection(lv_obj_t* parent, const char* title) {
|
||||
lv_obj_set_style_clip_corner(card, true, LV_STATE_DEFAULT);
|
||||
|
||||
// The card provides the background
|
||||
auto* list = lv_list_create(card);
|
||||
auto* list = lvgl_list_create(card);
|
||||
lv_obj_set_size(list, LV_PCT(100), LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_bg_opa(list, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(list, 0, LV_STATE_DEFAULT);
|
||||
@ -129,13 +130,13 @@ static lv_obj_t* createSection(lv_obj_t* parent, const char* title) {
|
||||
|
||||
void View::createSsidListItem(lv_obj_t* list, const WifiApRecord& record, bool isConnecting, size_t index) {
|
||||
if (isConnecting) {
|
||||
auto* button = lv_list_add_button(list, LV_SYMBOL_WIFI, record.ssid);
|
||||
auto* button = lvgl_list_add_button(list, LV_SYMBOL_WIFI, record.ssid);
|
||||
lv_obj_add_event_cb(button, showDetails, LV_EVENT_SHORT_CLICKED, this);
|
||||
} else {
|
||||
const std::string auth_info = (record.authentication_type == WIFI_AUTHENTICATION_TYPE_OPEN) ? "(open) " : " ";
|
||||
const auto percentage = mapRssiToPercentage(record.rssi);
|
||||
const auto label = std::format("{} {}{}%", std::string(record.ssid), auth_info, percentage);
|
||||
auto* button = lv_list_add_button(list, nullptr, label.c_str());
|
||||
auto* button = lvgl_list_add_button(list, nullptr, label.c_str());
|
||||
lv_obj_set_user_data(button, reinterpret_cast<void*>(index));
|
||||
if (wifi_settings_contains(record.ssid)) {
|
||||
lv_obj_add_event_cb(button, showDetails, LV_EVENT_SHORT_CLICKED, this);
|
||||
@ -151,9 +152,9 @@ void View::updateConnectToHidden() {
|
||||
}
|
||||
|
||||
if (state->getRadioState() == WIFI_RADIO_STATE_ON) {
|
||||
lv_obj_remove_flag(connect_to_hidden, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(connect_to_hidden, false);
|
||||
} else {
|
||||
lv_obj_add_flag(connect_to_hidden, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(connect_to_hidden, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +170,7 @@ void View::updateNetworkList() {
|
||||
lv_obj_set_style_bg_opa(enable_on_boot_wrapper, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_flex_flow(enable_on_boot_wrapper, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(enable_on_boot_wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(enable_on_boot_wrapper, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(enable_on_boot_wrapper, false);
|
||||
|
||||
auto* enable_label = lv_label_create(enable_on_boot_wrapper);
|
||||
lv_label_set_text(enable_label, "Enable on boot");
|
||||
@ -222,13 +223,13 @@ void View::updateNetworkList() {
|
||||
used_ssids.insert(record.ssid);
|
||||
}
|
||||
}
|
||||
lv_obj_clear_flag(networks_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(networks_list, false);
|
||||
} else if (!state->hasScannedAfterRadioOn() || state->isScanning()) {
|
||||
// hasScannedAfterRadioOn() prevents briefly showing "No networks found" when turning radio on.
|
||||
lv_obj_add_flag(networks_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(networks_list, true);
|
||||
} else {
|
||||
lv_obj_clear_flag(networks_list, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_list_add_text(networks_section, "No networks found.");
|
||||
lv_obj_set_hidden(networks_list, false);
|
||||
lvgl_list_add_text(networks_section, "No networks found.");
|
||||
}
|
||||
|
||||
connect_to_hidden = lv_button_create(networks_list);
|
||||
@ -250,9 +251,9 @@ void View::updateNetworkList() {
|
||||
|
||||
void View::updateScanning() {
|
||||
if (state->getRadioState() == WIFI_RADIO_STATE_ON && state->getStationState() == WIFI_STATION_STATE_DISCONNECTED && state->isScanning()) {
|
||||
lv_obj_remove_flag(scanning_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(scanning_spinner, false);
|
||||
} else {
|
||||
lv_obj_add_flag(scanning_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(scanning_spinner, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ static void hidHostMouseReadCb(lv_indev_t* /*indev*/, lv_indev_data_t* data) {
|
||||
if (!hid_host_mouse_active.load()) {
|
||||
hid_host_mouse_active.store(true);
|
||||
if (hid_host_ctx && hid_host_ctx->mouseCursor) {
|
||||
lv_obj_remove_flag(hid_host_ctx->mouseCursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(hid_host_ctx->mouseCursor, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -353,8 +353,8 @@ static void hidHostHandleMouseReport(const uint8_t* data, uint16_t len) {
|
||||
lv_indev_set_type(ms, LV_INDEV_TYPE_POINTER);
|
||||
lv_indev_set_read_cb(ms, hidHostMouseReadCb);
|
||||
auto* cur = lv_image_create(lv_layer_sys());
|
||||
lv_obj_remove_flag(cur, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_add_flag(cur, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_clickable(cur, false);
|
||||
lv_obj_set_hidden(cur, true);
|
||||
lv_image_set_src(cur, TT_ASSETS_UI_CURSOR);
|
||||
lv_indev_set_cursor(ms, cur);
|
||||
hid_host_ctx->mouseIndev = ms;
|
||||
|
||||
@ -80,7 +80,7 @@ static lv_obj_t* windowManagerScreenInit(lv_obj_t* root) {
|
||||
lv_obj_set_style_bg_opa(vertical_container, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(vertical_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_radius(vertical_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_remove_flag(vertical_container, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(vertical_container, false);
|
||||
|
||||
// The statusbar fits itself into the top of round and rounded displays
|
||||
auto* statusbar = lvgl::statusbar_create(vertical_container);
|
||||
@ -91,7 +91,7 @@ static lv_obj_t* windowManagerScreenInit(lv_obj_t* root) {
|
||||
lv_obj_set_width(app_container, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(app_container, 1);
|
||||
lv_obj_set_flex_flow(app_container, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_remove_flag(app_container, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(app_container, false);
|
||||
|
||||
// Keeps the apps inside the visible area of round displays.
|
||||
// On rounded displays, the widgets along the edges move their content inward from the corners instead.
|
||||
|
||||
@ -141,7 +141,7 @@ static void onTimeChanged(struct SystemEvent* /*event*/, void* /*context*/) {
|
||||
static void statusbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
LV_UNUSED(class_p);
|
||||
LV_TRACE_OBJ_CREATE("begin");
|
||||
lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(obj, false);
|
||||
LV_TRACE_OBJ_CREATE("finished");
|
||||
|
||||
// Deliberately does NOT subscribe to statusbar_data.pubsub here - that happens at the end of
|
||||
@ -163,11 +163,11 @@ static void statusbar_destructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
static void update_icon(lv_obj_t* image, const StatusbarIcon* icon) {
|
||||
if (!icon->image.empty() && icon->visible && icon->claimed) {
|
||||
lv_image_set_src(image, icon->image.c_str());
|
||||
lv_obj_remove_flag(image, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(image, false);
|
||||
} else {
|
||||
lv_obj_add_flag(image, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(image, true);
|
||||
}
|
||||
lv_obj_set_flag(image, LV_OBJ_FLAG_CLICKABLE, !icon->appId.empty());
|
||||
lv_obj_set_clickable(image, !icon->appId.empty());
|
||||
}
|
||||
|
||||
static void onIconClicked(lv_event_t* event) {
|
||||
@ -240,8 +240,8 @@ lv_obj_t* statusbar_create(lv_obj_t* parent) {
|
||||
update_time(statusbar);
|
||||
|
||||
auto* left_spacer = lv_obj_create(obj);
|
||||
lv_obj_remove_flag(left_spacer, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_remove_flag(left_spacer, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_scrollable(left_spacer, false);
|
||||
lv_obj_set_clickable(left_spacer, false);
|
||||
lv_obj_set_size(left_spacer, 1, 1);
|
||||
lv_obj_set_flex_grow(left_spacer, 1);
|
||||
lv_obj_set_style_bg_opa(left_spacer, LV_OPA_0, LV_STATE_DEFAULT);
|
||||
|
||||
@ -193,7 +193,7 @@ static void addMouseIndev(UsbHidInputCtx* ctx) {
|
||||
lv_indev_set_user_data(ctx->mouse_indev, ctx);
|
||||
if (ctx->mouse_cursor != nullptr) {
|
||||
lv_indev_set_cursor(ctx->mouse_indev, ctx->mouse_cursor);
|
||||
lv_obj_remove_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->mouse_cursor, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ static void removeMouseIndev(UsbHidInputCtx* ctx) {
|
||||
ctx->mouse_indev = nullptr;
|
||||
}
|
||||
if (ctx->mouse_cursor != nullptr) {
|
||||
lv_obj_add_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->mouse_cursor, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,9 +385,9 @@ void startUsbHidInput() {
|
||||
lv_obj_t* sys_layer = lv_layer_sys();
|
||||
if (sys_layer != nullptr) {
|
||||
ctx->mouse_cursor = lv_image_create(sys_layer);
|
||||
lv_obj_remove_flag(ctx->mouse_cursor, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(ctx->mouse_cursor, false);
|
||||
lv_image_set_src(ctx->mouse_cursor, TT_ASSETS_UI_CURSOR);
|
||||
lv_obj_add_flag(ctx->mouse_cursor, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(ctx->mouse_cursor, true);
|
||||
}
|
||||
lvgl_unlock();
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ void DisplayIdleService::activateScreensaver() {
|
||||
lv_obj_set_pos(screensaverOverlay, 0, 0);
|
||||
lv_obj_set_style_bg_color(screensaverOverlay, lv_color_black(), 0);
|
||||
lv_obj_set_style_bg_opa(screensaverOverlay, LV_OPA_COVER, 0);
|
||||
lv_obj_add_flag(screensaverOverlay, LV_OBJ_FLAG_CLICKABLE);
|
||||
lv_obj_set_clickable(screensaverOverlay, true);
|
||||
lv_obj_add_event_cb(screensaverOverlay, stopScreensaverCb, LV_EVENT_CLICKED, this);
|
||||
|
||||
// Create and start the screensaver based on settings
|
||||
|
||||
@ -105,7 +105,7 @@ void MystifyScreensaver::update(lv_coord_t screenW, lv_coord_t screenH) {
|
||||
if (t >= validTrailCount) {
|
||||
for (int e = 0; e < NUM_VERTICES; e++) {
|
||||
if (trailLines[e]) {
|
||||
lv_obj_add_flag(trailLines[e], LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(trailLines[e], true);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@ -118,7 +118,7 @@ void MystifyScreensaver::update(lv_coord_t screenW, lv_coord_t screenH) {
|
||||
for (int e = 0; e < NUM_VERTICES; e++) {
|
||||
if (!trailLines[e]) continue;
|
||||
|
||||
lv_obj_remove_flag(trailLines[e], LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_set_hidden(trailLines[e], false);
|
||||
|
||||
int v2 = (e + 1) % NUM_VERTICES;
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ void StackChanScreensaver::start(lv_obj_t* overlay, lv_coord_t screenW, lv_coord
|
||||
lv_obj_set_style_bg_opa(logo_, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_bg_color(logo_, lv_color_hex(COLORS[0]), 0);
|
||||
lv_obj_set_style_radius(logo_, 0, 0);
|
||||
lv_obj_clear_flag(logo_, LV_OBJ_FLAG_SCROLLABLE);
|
||||
lv_obj_set_scrollable(logo_, false);
|
||||
|
||||
leftEye_ = makeFacePart(logo_, eyeSize, eyeSize, -eyeOffX, eyeOffY, true);
|
||||
rightEye_ = makeFacePart(logo_, eyeSize, eyeSize, eyeOffX, eyeOffY, true);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <display/lv_display.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
|
||||
@ -80,8 +80,8 @@ dependencies:
|
||||
version: "2.2.1"
|
||||
rules:
|
||||
- if: "target in [esp32s3, esp32p4]"
|
||||
espressif/esp_lvgl_port: "2.7.2"
|
||||
lvgl/lvgl: "9.4.0"
|
||||
espressif/esp_lvgl_port: "2.9.0"
|
||||
lvgl/lvgl: "9.6.0~1"
|
||||
epdiy:
|
||||
git: https://github.com/vroland/epdiy.git
|
||||
version: 2.1.3
|
||||
|
||||
@ -288,7 +288,6 @@ def write_lvgl_variables(output_file, device_properties: dict):
|
||||
color_depth = get_property_or_exit(device_properties, "lvgl.colorDepth")
|
||||
output_file.write(f"CONFIG_LV_COLOR_DEPTH={color_depth}\n")
|
||||
output_file.write(f"CONFIG_LV_COLOR_DEPTH_{color_depth}=y\n")
|
||||
output_file.write("CONFIG_LV_DISP_DEF_REFR_PERIOD=10\n")
|
||||
has_statusbar_colors_inverted = get_boolean_property_or_false(device_properties, "lvgl.statusbarColorsInverted")
|
||||
if has_statusbar_colors_inverted:
|
||||
output_file.write("CONFIG_TT_LVGL_STATUSBAR_COLORS_INVERTED=y\n")
|
||||
|
||||
14
lv_conf.h
14
lv_conf.h
@ -24,8 +24,8 @@
|
||||
COLOR SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*Color depth: 8 (A8), 16 (RGB565), 24 (RGB888), 32 (XRGB8888)*/
|
||||
#define LV_COLOR_DEPTH 32
|
||||
/*Default color format of displays and images*/
|
||||
#define LV_COLOR_FORMAT_DEFAULT LV_COLOR_FORMAT_XRGB8888
|
||||
|
||||
/*=========================
|
||||
STDLIB WRAPPER SETTINGS
|
||||
@ -240,7 +240,6 @@
|
||||
#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/
|
||||
|
||||
/*Add a custom handler when assert happens e.g. to restart the MCU*/
|
||||
#define LV_ASSERT_HANDLER_INCLUDE <stdint.h>
|
||||
#define LV_ASSERT_HANDLER while(1); /*Halt by default*/
|
||||
|
||||
/*-------------
|
||||
@ -296,7 +295,7 @@
|
||||
#define LV_USE_OBJ_ID_BUILTIN 0
|
||||
|
||||
/*Use obj property set/get API*/
|
||||
#define LV_USE_OBJ_PROPERTY 1
|
||||
#define LV_USE_OBJ_PROPERTY 0
|
||||
|
||||
/* VG-Lite Simulator */
|
||||
/*Requires: LV_USE_THORVG_INTERNAL or LV_USE_THORVG_EXTERNAL */
|
||||
@ -480,13 +479,6 @@
|
||||
#define LV_USE_CALENDAR 1
|
||||
#if LV_USE_CALENDAR
|
||||
#define LV_CALENDAR_WEEK_STARTS_MONDAY 0
|
||||
#if LV_CALENDAR_WEEK_STARTS_MONDAY
|
||||
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}
|
||||
#else
|
||||
#define LV_CALENDAR_DEFAULT_DAY_NAMES {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"}
|
||||
#endif
|
||||
|
||||
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
|
||||
#define LV_USE_CALENDAR_HEADER_ARROW 1
|
||||
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
|
||||
#endif /*LV_USE_CALENDAR*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user