mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-21 17:35:06 +00:00
Compare commits
No commits in common. "b98a813f3cfd65ed95d8ff8f4ef745b66b1770c5" and "d4ef83e31631f71c5545505c88af814604b8558f" have entirely different histories.
b98a813f3c
...
d4ef83e316
@ -52,7 +52,6 @@
|
||||
|
||||
## Lower Priority
|
||||
|
||||
- lvgl-module's spinner relies on hard-coded spinner asset from Tactility main project.
|
||||
- Localize all apps
|
||||
- Support hot-plugging SD card (note: this is not possible if they require the CS pin hack)
|
||||
- Explore LVGL9's FreeRTOS functionality
|
||||
|
||||
@ -40,7 +40,8 @@ struct LvglModuleConfig {
|
||||
|
||||
/**
|
||||
* @brief Configures the LVGL module.
|
||||
* @warning Must not be called when module is started.
|
||||
*
|
||||
* @warning This must be called before starting the module.
|
||||
* @param config The configuration to apply.
|
||||
*/
|
||||
void lvgl_module_configure(struct LvglModuleConfig config);
|
||||
|
||||
@ -1,41 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Create a SliderBox: a slider flanked by "-" and "+" buttons with a value label.
|
||||
* @param[in] parent the parent object
|
||||
* @param[in] min minimum value (inclusive)
|
||||
* @param[in] max maximum value (inclusive)
|
||||
* @param[in] step the amount each +/- button press changes the value by
|
||||
* @param[in] value the initial value
|
||||
* @return the created SliderBox instance
|
||||
*/
|
||||
lv_obj_t* lvgl_sliderbox_create(lv_obj_t* parent, int32_t min, int32_t max, int32_t step, int32_t value);
|
||||
|
||||
/** @return the current value of the SliderBox */
|
||||
int32_t lvgl_sliderbox_get_value(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Set the current value of the SliderBox (clamped to its [min, max] range).
|
||||
* Updates the slider position and the value label.
|
||||
*/
|
||||
void lvgl_sliderbox_set_value(lv_obj_t* obj, int32_t value, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Register a callback that is fired with LV_EVENT_VALUE_CHANGED whenever the value
|
||||
* changes, whether the change came from the slider or from the +/- buttons.
|
||||
* @param[in] obj the SliderBox instance
|
||||
* @param[in] callback the callback to invoke
|
||||
* @param[in] userData user data that is attached to the event
|
||||
*/
|
||||
void lvgl_sliderbox_add_value_changed_cb(lv_obj_t* obj, lv_event_cb_t callback, void* userData);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,19 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Creates the Tactility spinner widget.
|
||||
* @param[in] parent the parent object for the new spinner
|
||||
* @return the created spinner
|
||||
*/
|
||||
lv_obj_t* lvgl_spinner_create(lv_obj_t* parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,86 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TOOLBAR_ACTION_LIMIT 4
|
||||
|
||||
/** Configuration for toolbar-wide defaults */
|
||||
typedef struct {
|
||||
/** Callback invoked when a toolbar's default navigation (top-left) button is pressed */
|
||||
lv_event_cb_t nav_action_callback;
|
||||
} ToolbarConfig;
|
||||
|
||||
/**
|
||||
* @brief Configure toolbar-wide defaults. Must be called before any toolbar is created (e.g. during LVGL startup).
|
||||
* @param[in] config the configuration to apply
|
||||
*/
|
||||
void lvgl_toolbar_configure(const ToolbarConfig* config);
|
||||
|
||||
/**
|
||||
* @brief Create a toolbar widget with the given title.
|
||||
* @param[in] parent the parent object for the new toolbar
|
||||
* @param[in] title the toolbar title
|
||||
* @return the created toolbar
|
||||
*/
|
||||
lv_obj_t* lvgl_toolbar_create(lv_obj_t* parent, const char* title);
|
||||
|
||||
/** Sets the toolbar title */
|
||||
void lvgl_toolbar_set_title(lv_obj_t* obj, const char* title);
|
||||
|
||||
/**
|
||||
* Sets the navigation action of the toolbar (button on the top-left)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] icon the icon to set on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] userData the user data that is attached to the callback event object
|
||||
*/
|
||||
void lvgl_toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* userData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with an image to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] imagePath the path to an image file to shown on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
*/
|
||||
lv_obj_t* lvgl_toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with text to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] text the button text
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
*/
|
||||
lv_obj_t* lvgl_toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add a switch to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by lv_switch_create()
|
||||
*/
|
||||
lv_obj_t* lvgl_toolbar_add_switch_action(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Create and add a spinner to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by lvgl_spinner_create()
|
||||
*/
|
||||
lv_obj_t* lvgl_toolbar_add_spinner_action(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Remove all actions from the toolbar
|
||||
* @param[in] obj the toolbar instance
|
||||
*/
|
||||
void lvgl_toolbar_clear_actions(lv_obj_t* obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -6,11 +6,8 @@
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/module.h>
|
||||
#include <tactility/error.h>
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/time.h>
|
||||
|
||||
#define TAG "lvgl_esp32"
|
||||
|
||||
extern struct LvglModuleConfig lvgl_module_config;
|
||||
extern void lvgl_devices_attach();
|
||||
extern void lvgl_devices_detach();
|
||||
@ -70,6 +67,7 @@ error_t lvgl_arch_stop() {
|
||||
}
|
||||
|
||||
initialized = false;
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
#include <lvgl/devices/display.h>
|
||||
#include <lvgl/devices/keyboard.h>
|
||||
#include <lvgl/devices/pointer.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/display.h>
|
||||
#include <tactility/drivers/keyboard.h>
|
||||
#include <tactility/drivers/pointer.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_display.h>
|
||||
#include <lvgl/lvgl_keyboard.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/lvgl_pointer.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
@ -115,5 +115,5 @@ void lvgl_devices_detach() {
|
||||
display = lv_disp_get_next(NULL);
|
||||
}
|
||||
|
||||
lvgl_unlock();
|
||||
lvgl_lock();
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/devices/display.h>
|
||||
#include <lvgl/lvgl_display.h>
|
||||
|
||||
#include <lvgl/ppa.h>
|
||||
#include <lvgl/lvgl_ppa.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/driver.h>
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <tactility/check.h>
|
||||
|
||||
// The preprocessor definitions that are used below are defined in the CMakeLists.txt from this module.
|
||||
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/devices/keyboard.h>
|
||||
#include <lvgl/lvgl_keyboard.h>
|
||||
|
||||
#include <tactility/drivers/keyboard.h>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/devices/pointer.h>
|
||||
#include <lvgl/lvgl_pointer.h>
|
||||
|
||||
#include <tactility/drivers/pointer.h>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/ppa.h>
|
||||
#include <lvgl/lvgl_ppa.h>
|
||||
|
||||
#include <tactility/log.h>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/module.h>
|
||||
#include <string.h>
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/module.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
@ -23,9 +22,8 @@ struct LvglModuleConfig lvgl_module_config = {
|
||||
};
|
||||
|
||||
void lvgl_module_configure(const struct LvglModuleConfig config) {
|
||||
check(!is_running);
|
||||
lvgl_module_config = config;
|
||||
is_configured = true;
|
||||
memcpy(&lvgl_module_config, &config, sizeof(struct LvglModuleConfig));
|
||||
}
|
||||
|
||||
static error_t start() {
|
||||
|
||||
@ -1,15 +1,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/module.h>
|
||||
|
||||
#include <lvgl/devices/display.h>
|
||||
#include <lvgl/devices/keyboard.h>
|
||||
#include <lvgl/devices/pointer.h>
|
||||
|
||||
#include <lvgl/widgets/sliderbox.h>
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
|
||||
#include <tactility/module.h>
|
||||
|
||||
@ -34,35 +26,6 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
|
||||
DEFINE_MODULE_SYMBOL(lvgl_get_launcher_icon_font_height),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_get_statusbar_icon_font),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_get_statusbar_icon_font_height),
|
||||
// lvgl_display
|
||||
DEFINE_MODULE_SYMBOL(lvgl_display_add),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_display_remove),
|
||||
// lvgl_keyboard
|
||||
DEFINE_MODULE_SYMBOL(lvgl_keyboard_add),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_keyboard_remove),
|
||||
// lvgl_pointer
|
||||
DEFINE_MODULE_SYMBOL(lvgl_pointer_set_calibration),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_pointer_get_calibration),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_pointer_get_default),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_pointer_add),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_pointer_remove),
|
||||
// lvgl_spinner
|
||||
DEFINE_MODULE_SYMBOL(lvgl_spinner_create),
|
||||
// lvgl_toolbar
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_configure),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_create),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_set_title),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_set_nav_action),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_add_image_button_action),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_add_text_button_action),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_add_switch_action),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_add_spinner_action),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_toolbar_clear_actions),
|
||||
// lvgl_sliderbox
|
||||
DEFINE_MODULE_SYMBOL(lvgl_sliderbox_create),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_sliderbox_get_value),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_sliderbox_set_value),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_sliderbox_add_value_changed_cb),
|
||||
// lv_event
|
||||
DEFINE_MODULE_SYMBOL(lv_event_get_code),
|
||||
DEFINE_MODULE_SYMBOL(lv_event_get_indev),
|
||||
|
||||
@ -1,260 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/drivers/pointer.h>
|
||||
|
||||
static uint32_t getToolbarHeight(UiDensity uiDensity) {
|
||||
if (uiDensity == LVGL_UI_DENSITY_COMPACT) {
|
||||
return lvgl_get_text_font_height(FONT_SIZE_DEFAULT) * 1.4f;
|
||||
} else {
|
||||
return lvgl_get_text_font_height(FONT_SIZE_LARGE) * 2.2f;
|
||||
}
|
||||
}
|
||||
|
||||
static const _lv_font_t* getToolbarFont(UiDensity uiDensity) {
|
||||
if (uiDensity == LVGL_UI_DENSITY_COMPACT) {
|
||||
return lvgl_get_text_font(FONT_SIZE_DEFAULT);
|
||||
} else {
|
||||
return lvgl_get_text_font(FONT_SIZE_LARGE);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t getActionIconPadding(UiDensity uiDensity) {
|
||||
auto toolbar_height = getToolbarHeight(uiDensity);
|
||||
// Minimal 8 pixels total padding for selection/animation (4+4 pixels)
|
||||
return (uiDensity != LVGL_UI_DENSITY_COMPACT) ? (uint32_t)(toolbar_height * 0.2f) : 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helps with button expansion and also with vertical alignment of content,
|
||||
* as the parent flex doesn't allow for vertical alignment
|
||||
*/
|
||||
static lv_obj_t* create_action_wrapper(lv_obj_t* parent, UiDensity ui_density) {
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
lv_obj_set_size(wrapper, LV_SIZE_CONTENT, toolbar_height);
|
||||
|
||||
auto icon_padding = getActionIconPadding(ui_density);
|
||||
auto icon_padding_half = icon_padding / 2;
|
||||
|
||||
lv_obj_set_style_pad_all(wrapper, icon_padding_half, LV_STATE_DEFAULT); // For selection and touch animation
|
||||
lv_obj_set_style_bg_opa(wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_obj_t* title_label;
|
||||
lv_obj_t* close_button;
|
||||
lv_obj_t* close_button_image;
|
||||
lv_obj_t* action_container;
|
||||
uint8_t action_count;
|
||||
} Toolbar;
|
||||
|
||||
static void toolbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj);
|
||||
|
||||
static lv_obj_class_t toolbar_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = &toolbar_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.name = nullptr,
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = 0,
|
||||
.editable = false,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE,
|
||||
.instance_size = sizeof(Toolbar),
|
||||
.theme_inheritable = false
|
||||
};
|
||||
|
||||
static lv_event_cb_t nav_action_callback = nullptr;
|
||||
|
||||
void lvgl_toolbar_configure(const ToolbarConfig* config) {
|
||||
nav_action_callback = config->nav_action_callback;
|
||||
}
|
||||
|
||||
static void default_nav_action(lv_event_t* event) {
|
||||
if (nav_action_callback != nullptr) {
|
||||
nav_action_callback(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_t* lvgl_toolbar_create(lv_obj_t* parent, const char* title) {
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
toolbar_class.height_def = toolbar_height;
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&toolbar_class, parent);
|
||||
lv_obj_class_init_obj(obj);
|
||||
lv_obj_set_height(obj, toolbar_height);
|
||||
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_obj_set_width(obj, LV_PCT(100));
|
||||
lv_obj_set_style_pad_all(obj, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(obj, 0, LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_center(obj);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
|
||||
auto icon_padding = getActionIconPadding(ui_density);
|
||||
|
||||
auto* close_button_wrapper = create_action_wrapper(obj, ui_density);
|
||||
|
||||
toolbar->close_button = lv_button_create(close_button_wrapper);
|
||||
if (ui_density == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_bg_opa(toolbar->close_button, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
lv_obj_set_size(toolbar->close_button, toolbar_height - icon_padding, toolbar_height - icon_padding);
|
||||
|
||||
lv_obj_set_style_pad_all(toolbar->close_button, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_align(toolbar->close_button, LV_ALIGN_CENTER, 0, 0);
|
||||
toolbar->close_button_image = lv_image_create(toolbar->close_button);
|
||||
lv_obj_align(toolbar->close_button_image, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
auto* title_wrapper = lv_obj_create(obj);
|
||||
uint32_t title_left_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? icon_padding : 2;
|
||||
uint32_t title_right_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? (icon_padding / 2) : 2;
|
||||
lv_obj_set_size(title_wrapper, LV_SIZE_CONTENT, LV_PCT(100));
|
||||
lv_obj_set_style_bg_opa(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_left(title_wrapper, title_left_padding, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_right(title_wrapper, title_right_padding, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_ver(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_flex_grow(title_wrapper, 1);
|
||||
|
||||
toolbar->title_label = lv_label_create(title_wrapper);
|
||||
lv_obj_set_style_text_font(toolbar->title_label, getToolbarFont(ui_density), LV_STATE_DEFAULT);
|
||||
lv_label_set_text(toolbar->title_label, title);
|
||||
lv_label_set_long_mode(toolbar->title_label, LV_LABEL_LONG_MODE_SCROLL);
|
||||
lv_obj_set_style_text_align(toolbar->title_label, LV_TEXT_ALIGN_LEFT, LV_STATE_DEFAULT);
|
||||
lv_obj_align(toolbar->title_label, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
lv_obj_set_width(toolbar->title_label, LV_PCT(100));
|
||||
|
||||
toolbar->action_container = lv_obj_create(obj);
|
||||
lv_obj_set_width(toolbar->action_container, LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(toolbar->action_container, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_style_pad_all(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
|
||||
lvgl_toolbar_set_nav_action(obj, LV_SYMBOL_CLOSE, &default_nav_action, nullptr);
|
||||
|
||||
// If we don't have a touch device, we assume there's some other kind of input like a keyboard, an encoder or button control
|
||||
// In that scenario we want to automatically have the close button selected so the user doesn't have to press the widget selection
|
||||
// an extra time for every screen.
|
||||
if (!device_has_active_by_type(&POINTER_TYPE)) {
|
||||
lv_group_focus_obj(toolbar->close_button);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
void lvgl_toolbar_set_title(lv_obj_t* obj, const char* title) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_label_set_text(toolbar->title_label, title);
|
||||
}
|
||||
|
||||
void lvgl_toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_obj_add_event_cb(toolbar->close_button, callback, LV_EVENT_SHORT_CLICKED, user_data);
|
||||
lv_image_set_src(toolbar->close_button_image, icon); // e.g. LV_SYMBOL_CLOSE
|
||||
}
|
||||
|
||||
static lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* imageOrButton, bool isImage, lv_event_cb_t callback, void* user_data) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
check(toolbar->action_count < TOOLBAR_ACTION_LIMIT, "max actions reached");
|
||||
toolbar->action_count++;
|
||||
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
|
||||
auto padding = getActionIconPadding(ui_density);
|
||||
|
||||
lv_obj_t* action_button = lv_button_create(wrapper);
|
||||
lv_obj_set_size(action_button, toolbar_height - padding, toolbar_height - padding);
|
||||
lv_obj_set_style_pad_all(action_button, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_align(action_button, LV_ALIGN_CENTER, 0, 0);
|
||||
if (ui_density == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_bg_opa(action_button, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
lv_obj_add_event_cb(action_button, callback, LV_EVENT_SHORT_CLICKED, user_data);
|
||||
lv_obj_t* button_content;
|
||||
if (isImage) {
|
||||
button_content = lv_image_create(action_button);
|
||||
lv_image_set_src(button_content, imageOrButton);
|
||||
} else {
|
||||
button_content = lv_label_create(action_button);
|
||||
lv_label_set_text(button_content, imageOrButton);
|
||||
}
|
||||
lv_obj_align(button_content, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
return action_button;
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* user_data) {
|
||||
return toolbar_add_button_action(obj, imagePath, true, callback, user_data);
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* user_data) {
|
||||
return toolbar_add_button_action(obj, text, false, callback, user_data);
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
check(toolbar->action_count < TOOLBAR_ACTION_LIMIT, "max actions reached");
|
||||
toolbar->action_count++;
|
||||
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
lv_obj_set_style_pad_hor(wrapper, 4, LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t* widget = lv_switch_create(wrapper);
|
||||
lv_obj_set_align(widget, LV_ALIGN_CENTER);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_toolbar_add_spinner_action(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
check(toolbar->action_count < TOOLBAR_ACTION_LIMIT, "max actions reached");
|
||||
toolbar->action_count++;
|
||||
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
|
||||
auto* spinner = lvgl_spinner_create(wrapper);
|
||||
lv_obj_set_align(spinner, LV_ALIGN_CENTER);
|
||||
|
||||
if (lv_display_get_color_format(lv_obj_get_display(obj)) == LV_COLOR_FORMAT_L8) {
|
||||
lv_obj_set_style_image_recolor(spinner, lv_theme_get_color_secondary(obj), LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_image_recolor_opa(spinner, LV_OPA_COVER, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
return spinner;
|
||||
}
|
||||
|
||||
void lvgl_toolbar_clear_actions(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_obj_clean(toolbar->action_container);
|
||||
toolbar->action_count = 0;
|
||||
}
|
||||
36
Tactility/Include/Tactility/lvgl/SliderBox.h
Normal file
36
Tactility/Include/Tactility/lvgl/SliderBox.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
/**
|
||||
* Create a SliderBox: a slider flanked by "-" and "+" buttons with a value label.
|
||||
* @param parent the parent object
|
||||
* @param min minimum value (inclusive)
|
||||
* @param max maximum value (inclusive)
|
||||
* @param step the amount each +/- button press changes the value by
|
||||
* @param value the initial value
|
||||
* @return the created SliderBox instance
|
||||
*/
|
||||
lv_obj_t* sliderbox_create(lv_obj_t* parent, int32_t min, int32_t max, int32_t step, int32_t value);
|
||||
|
||||
/** @return the current value of the SliderBox */
|
||||
int32_t sliderbox_get_value(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Set the current value of the SliderBox (clamped to its [min, max] range).
|
||||
* Updates the slider position and the value label.
|
||||
*/
|
||||
void sliderbox_set_value(lv_obj_t* obj, int32_t value, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Register a callback that is fired with LV_EVENT_VALUE_CHANGED whenever the value
|
||||
* changes, whether the change came from the slider or from the +/- buttons.
|
||||
* @param obj the SliderBox instance
|
||||
* @param callback the callback to invoke
|
||||
* @param userData user data that is attached to the event
|
||||
*/
|
||||
void sliderbox_add_value_changed_cb(lv_obj_t* obj, lv_event_cb_t callback, void* userData);
|
||||
|
||||
} // namespace tt::lvgl
|
||||
12
Tactility/Include/Tactility/lvgl/Spinner.h
Normal file
12
Tactility/Include/Tactility/lvgl/Spinner.h
Normal file
@ -0,0 +1,12 @@
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
/**
|
||||
* Create the Tactility spinner widget
|
||||
* @param parent pointer to an object, it will be the parent of the new spinner.
|
||||
* @return the created spinner
|
||||
*/
|
||||
lv_obj_t* spinner_create(lv_obj_t* parent);
|
||||
|
||||
}
|
||||
@ -2,11 +2,67 @@
|
||||
|
||||
#include "../app/AppContext.h"
|
||||
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
#define TOOLBAR_ACTION_LIMIT 4
|
||||
|
||||
/** Create a toolbar widget that shows the app name as title */
|
||||
lv_obj_t* toolbar_create(lv_obj_t* parent, const app::AppContext& app);
|
||||
|
||||
/** Create a toolbar widget with the provided title*/
|
||||
lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title);
|
||||
|
||||
/** Sets the toolbar title */
|
||||
void toolbar_set_title(lv_obj_t* obj, const std::string& title);
|
||||
|
||||
/** Sets the navigation action of the toolbar (button on the top-left)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] icon the icon to set on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackEventUserData the user data that is attached to the callback event object
|
||||
*/
|
||||
void toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* userData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with an image to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] imagePath the path to an image file to shown on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
*/
|
||||
lv_obj_t* toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with text to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] text the button text
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
*/
|
||||
lv_obj_t* toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add a switch to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by lv_switch_create()
|
||||
*/
|
||||
lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Create and add a spinner to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by Tactility's spinner_create()
|
||||
*/
|
||||
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Remove all actions from the toolbar
|
||||
* @param[in] obj the toolbar instance
|
||||
*/
|
||||
void toolbar_clear_actions(lv_obj_t* obj);
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -17,18 +17,6 @@ void addService(std::shared_ptr<const ServiceManifest> manifest, bool autoStart
|
||||
*/
|
||||
void addService(const ServiceManifest& manifest, bool autoStart = true);
|
||||
|
||||
/** Unregister a service. Stops it first if it is running.
|
||||
* @param[in] the service manifest
|
||||
* @return true on success
|
||||
*/
|
||||
bool removeService(const std::string& id);
|
||||
|
||||
/** Unregister a service. Stops it first if it is running.
|
||||
* @param[in] the service manifest
|
||||
* @return true on success
|
||||
*/
|
||||
bool removeService(const ServiceManifest& manifest);
|
||||
|
||||
/** Start a service.
|
||||
* @param[in] the service id as defined in its manifest
|
||||
* @return true on success
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
#include <Tactility/SystemEvents.h>
|
||||
#include <Tactility/service/Service.h>
|
||||
#include <Tactility/service/ServiceContext.h>
|
||||
#include <Tactility/service/rtctime/RtcTime.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@
|
||||
#include <memory>
|
||||
|
||||
// Forward declarations
|
||||
typedef _lv_obj_t lv_obj_t;
|
||||
typedef _lv_event_t lv_event_t;
|
||||
typedef struct _lv_obj_t lv_obj_t;
|
||||
typedef struct _lv_event_t lv_event_t;
|
||||
|
||||
namespace tt::service::displayidle {
|
||||
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
|
||||
#include <crypt/module.h>
|
||||
#include <lvgl/module.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <tactility/concurrent/thread.h>
|
||||
#include <tactility/drivers/audio_stream.h>
|
||||
#include <tactility/drivers/display.h>
|
||||
@ -42,6 +41,7 @@
|
||||
#endif
|
||||
|
||||
#include "Tactility/Paths.h"
|
||||
#include "Tactility/SystemEvents.h"
|
||||
#include "Tactility/hal/SdCard.h"
|
||||
|
||||
#include <Tactility/bluetooth/Bluetooth.h>
|
||||
@ -296,7 +296,27 @@ static void registerInstalledAppsFromFileSystems() {
|
||||
});
|
||||
}
|
||||
|
||||
static void registerAndStartServices() {
|
||||
static void registerAndStartSecondaryServices() {
|
||||
LOG_I(TAG, "Registering and starting secondary system services");
|
||||
addService(service::loader::manifest);
|
||||
addService(service::gui::manifest);
|
||||
addService(service::statusbar::manifest);
|
||||
addService(service::memorychecker::manifest);
|
||||
#if defined(ESP_PLATFORM)
|
||||
if (device_exists_of_type(&RTC_TYPE)) {
|
||||
addService(service::rtctime::manifest);
|
||||
}
|
||||
addService(service::displayidle::manifest);
|
||||
#if defined(CONFIG_TT_TDECK_WORKAROUND)
|
||||
addService(service::keyboardidle::manifest);
|
||||
#endif
|
||||
#endif
|
||||
#if TT_FEATURE_SCREENSHOT_ENABLED
|
||||
addService(service::screenshot::manifest);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void registerAndStartPrimaryServices() {
|
||||
LOG_I(TAG, "Registering and starting primary system services");
|
||||
if (device_exists_of_type(&AUDIO_STREAM_TYPE)) {
|
||||
addService(service::audio::manifest);
|
||||
@ -311,12 +331,6 @@ static void registerAndStartServices() {
|
||||
#endif
|
||||
#ifdef ESP_PLATFORM
|
||||
addService(service::webserver::manifest);
|
||||
#endif
|
||||
addService(service::loader::manifest);
|
||||
#if defined(ESP_PLATFORM)
|
||||
if (device_exists_of_type(&RTC_TYPE)) {
|
||||
addService(service::rtctime::manifest);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -351,43 +365,6 @@ void registerApps() {
|
||||
registerInstalledAppsFromFileSystems();
|
||||
}
|
||||
|
||||
static void stopAppFromToolbar(lv_event_t*) {
|
||||
app::stop();
|
||||
}
|
||||
|
||||
static void onLvglStarted() {
|
||||
ToolbarConfig toolbar_config = { .nav_action_callback = stopAppFromToolbar };
|
||||
lvgl_toolbar_configure(&toolbar_config);
|
||||
|
||||
addService(service::gui::manifest);
|
||||
addService(service::statusbar::manifest);
|
||||
addService(service::memorychecker::manifest);
|
||||
#if defined(ESP_PLATFORM)
|
||||
addService(service::displayidle::manifest);
|
||||
#endif
|
||||
#if defined(CONFIG_TT_TDECK_WORKAROUND)
|
||||
addService(service::keyboardidle::manifest);
|
||||
#endif
|
||||
#if TT_FEATURE_SCREENSHOT_ENABLED
|
||||
addService(service::screenshot::manifest);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void onLvglStopped() {
|
||||
#if TT_FEATURE_SCREENSHOT_ENABLED
|
||||
check(service::removeService(service::screenshot::manifest.id));
|
||||
#endif
|
||||
#if defined(CONFIG_TT_TDECK_WORKAROUND)
|
||||
check(service::removeService(service::keyboardidle::manifest.id));
|
||||
#endif
|
||||
#if defined(ESP_PLATFORM)
|
||||
check(service::removeService(service::displayidle::manifest.id));
|
||||
#endif
|
||||
check(service::removeService(service::memorychecker::manifest.id));
|
||||
check(service::removeService(service::statusbar::manifest.id));
|
||||
check(service::removeService(service::gui::manifest.id));
|
||||
}
|
||||
|
||||
void run(Module* dtsModules[], DtsDevice dtsDevices[]) {
|
||||
LOG_I(TAG, "Tactility v%s on %s (%s)", TT_VERSION, CONFIG_TT_DEVICE_NAME, CONFIG_TT_DEVICE_ID);
|
||||
|
||||
@ -413,14 +390,14 @@ void run(Module* dtsModules[], DtsDevice dtsDevices[]) {
|
||||
network::ntp::init();
|
||||
bluetooth::systemStart();
|
||||
|
||||
registerAndStartServices();
|
||||
registerAndStartPrimaryServices();
|
||||
|
||||
// Must start right before LVGL
|
||||
initFileMutexForLvgl();
|
||||
|
||||
lvgl_module_configure((LvglModuleConfig) {
|
||||
.on_start = onLvglStarted,
|
||||
.on_stop = onLvglStopped,
|
||||
.on_start = nullptr,
|
||||
.on_stop = nullptr,
|
||||
.task_priority = THREAD_PRIORITY_HIGHER,
|
||||
/** Minimum seems to be about 3500. In some scenarios, the WiFi app crashes at 8192,
|
||||
* so we now have 9120 to run in a stable manner. We should figure out a way to avoid this.
|
||||
@ -432,6 +409,8 @@ void run(Module* dtsModules[], DtsDevice dtsDevices[]) {
|
||||
});
|
||||
check(module_ensure_started(&lvgl_module) == ERROR_NONE);
|
||||
|
||||
registerAndStartSecondaryServices();
|
||||
|
||||
LOG_I(TAG, "Core systems ready");
|
||||
|
||||
LOG_I(TAG, "Starting boot app");
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/drivers/uart_controller.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <gps/gps.h>
|
||||
#include <gps/gps_settings.h>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "Tactility/app/alertdialog/AlertDialog.h"
|
||||
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include "Tactility/lvgl/Toolbar.h"
|
||||
#include "Tactility/service/loader/Loader.h"
|
||||
|
||||
#include <Tactility/StringUtils.h>
|
||||
@ -98,7 +98,7 @@ public:
|
||||
check(parameters != nullptr, "Parameters missing");
|
||||
|
||||
std::string title = getTitleParameter(app.getParameters());
|
||||
lv_obj_t* toolbar = lvgl_toolbar_create(parent, title.c_str());
|
||||
lv_obj_t* toolbar = lvgl::toolbar_create(parent, title);
|
||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
|
||||
lv_obj_t* message_label = lv_label_create(parent);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||
#include <tactility/check.h>
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <format>
|
||||
@ -51,7 +51,7 @@ public:
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
auto title = std::format("{} details", manifest->appName);
|
||||
lvgl_toolbar_create(parent, title.c_str());
|
||||
lvgl::toolbar_create(parent, title);
|
||||
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapper, LV_PCT(100));
|
||||
|
||||
@ -3,18 +3,18 @@
|
||||
#include <Tactility/app/apphubdetails/AppHubDetailsApp.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/network/Http.h>
|
||||
#include <Tactility/Paths.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <algorithm>
|
||||
#include <format>
|
||||
#include <lvgl.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <algorithm>
|
||||
#include <format>
|
||||
|
||||
namespace tt::app::apphub {
|
||||
|
||||
@ -125,7 +125,7 @@ class AppHubApp final : public App {
|
||||
|
||||
void refresh() {
|
||||
lv_obj_clean(contentWrapper);
|
||||
auto* spinner = lvgl_spinner_create(contentWrapper);
|
||||
auto* spinner = lvgl::spinner_create(contentWrapper);
|
||||
lv_obj_align(spinner, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
lv_obj_add_flag(refreshButton, LV_OBJ_FLAG_HIDDEN);
|
||||
@ -165,7 +165,7 @@ public:
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
auto* toolbar = lvgl::toolbar_create(parent, app);
|
||||
refreshButton = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_REFRESH, onRefreshPressed, this);
|
||||
refreshButton = lvgl::toolbar_add_image_button_action(toolbar, LV_SYMBOL_REFRESH, onRefreshPressed, this);
|
||||
lv_obj_add_flag(refreshButton, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
contentWrapper = lv_obj_create(parent);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <Tactility/app/AppRegistration.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/network/Http.h>
|
||||
#include <Tactility/Paths.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
@ -154,19 +154,19 @@ class AppHubDetailsApp final : public App {
|
||||
}
|
||||
|
||||
void updateViews() {
|
||||
lvgl_toolbar_clear_actions(toolbar);
|
||||
lvgl::toolbar_clear_actions(toolbar);
|
||||
const auto manifest = findAppManifestById(entry.appId);
|
||||
spinner = lvgl_toolbar_add_spinner_action(toolbar);
|
||||
spinner = lvgl::toolbar_add_spinner_action(toolbar);
|
||||
lv_obj_add_flag(spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_add_flag(updateLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
if (manifest != nullptr) {
|
||||
if (manifest->appVersionCode < entry.appVersionCode) {
|
||||
updateButton = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_DOWNLOAD, onUpdatePressed, this);
|
||||
updateButton = lvgl::toolbar_add_image_button_action(toolbar, LV_SYMBOL_DOWNLOAD, onUpdatePressed, this);
|
||||
lv_obj_remove_flag(updateLabel, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_TRASH, onUninstallPressed, this);
|
||||
lvgl::toolbar_add_image_button_action(toolbar, LV_SYMBOL_TRASH, onUninstallPressed, this);
|
||||
} else {
|
||||
lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_DOWNLOAD, onInstallPressed, this);
|
||||
lvgl::toolbar_add_image_button_action(toolbar, LV_SYMBOL_DOWNLOAD, onInstallPressed, this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ public:
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
toolbar = lvgl_toolbar_create(parent, entry.appName.c_str());
|
||||
toolbar = lvgl::toolbar_create(parent, entry.appName.c_str());
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapper, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(wrapper, 1);
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#include <lvgl.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::applist {
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <Tactility/app/AppRegistration.h>
|
||||
#include <Tactility/app/appdetails/AppDetails.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <algorithm>
|
||||
@ -29,7 +29,7 @@ class AppSettingsApp final : public App {
|
||||
public:
|
||||
|
||||
void onShow(AppContext& app, lv_obj_t* parent) override {
|
||||
auto* toolbar = lvgl_toolbar_create(parent, "Installed Apps");
|
||||
auto* toolbar = lvgl::toolbar_create(parent, "Installed Apps");
|
||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
|
||||
lv_obj_t* list = lv_list_create(parent);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <Tactility/PubSub.h>
|
||||
#include <Tactility/app/App.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/lvgl/SliderBox.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/audio/Audio.h>
|
||||
#include <lvgl/widgets/sliderbox.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
@ -52,13 +52,13 @@ class AudioSettingsApp final : public App {
|
||||
|
||||
static void onInputVolumeSlider(lv_event_t* event) {
|
||||
auto* sliderBox = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
float percent = static_cast<float>(lvgl_sliderbox_get_value(sliderBox));
|
||||
float percent = static_cast<float>(lvgl::sliderbox_get_value(sliderBox));
|
||||
service::audio::setInputVolume(percent);
|
||||
}
|
||||
|
||||
static void onOutputVolumeSlider(lv_event_t* event) {
|
||||
auto* sliderBox = static_cast<lv_obj_t*>(lv_event_get_target(event));
|
||||
float percent = static_cast<float>(lvgl_sliderbox_get_value(sliderBox));
|
||||
float percent = static_cast<float>(lvgl::sliderbox_get_value(sliderBox));
|
||||
service::audio::setOutputVolume(percent);
|
||||
}
|
||||
|
||||
@ -102,10 +102,10 @@ class AudioSettingsApp final : public App {
|
||||
lv_label_set_text(row_label, label);
|
||||
lv_obj_align(row_label, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
|
||||
auto* sliderBox = lvgl_sliderbox_create(row, 0, 100, 10, initialValue);
|
||||
auto* sliderBox = lvgl::sliderbox_create(row, 0, 100, 10, initialValue);
|
||||
lv_obj_set_width(sliderBox, LV_PCT(50));
|
||||
lv_obj_align(sliderBox, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lvgl_sliderbox_add_value_changed_cb(sliderBox, cb, userData);
|
||||
lvgl::sliderbox_add_value_changed_cb(sliderBox, cb, userData);
|
||||
|
||||
return sliderBox;
|
||||
}
|
||||
@ -192,7 +192,7 @@ public:
|
||||
else lv_obj_remove_state(inputMuteSwitch, LV_STATE_CHECKED);
|
||||
}
|
||||
if (inputVolumeSlider) {
|
||||
lvgl_sliderbox_set_value(inputVolumeSlider, static_cast<int32_t>(service::audio::getInputVolume()), LV_ANIM_OFF);
|
||||
lvgl::sliderbox_set_value(inputVolumeSlider, static_cast<int32_t>(service::audio::getInputVolume()), LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
if (outputEnabledSwitch) {
|
||||
@ -204,7 +204,7 @@ public:
|
||||
else lv_obj_remove_state(outputMuteSwitch, LV_STATE_CHECKED);
|
||||
}
|
||||
if (outputVolumeSlider) {
|
||||
lvgl_sliderbox_set_value(outputVolumeSlider, static_cast<int32_t>(service::audio::getOutputVolume()), LV_ANIM_OFF);
|
||||
lvgl::sliderbox_set_value(outputVolumeSlider, static_cast<int32_t>(service::audio::getOutputVolume()), LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::btmanage {
|
||||
|
||||
|
||||
@ -222,9 +222,9 @@ void View::init(const AppContext& app, lv_obj_t* parent) {
|
||||
// Toolbar
|
||||
auto* toolbar = lvgl::toolbar_create(parent, app);
|
||||
|
||||
scanning_spinner = lvgl_toolbar_add_spinner_action(toolbar);
|
||||
scanning_spinner = lvgl::toolbar_add_spinner_action(toolbar);
|
||||
|
||||
enable_switch = lvgl_toolbar_add_switch_action(toolbar);
|
||||
enable_switch = lvgl::toolbar_add_switch_action(toolbar);
|
||||
lv_obj_add_event_cb(enable_switch, onEnableSwitchChanged, LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
|
||||
// Peer list
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include <Tactility/bluetooth/BluetoothPairedDevice.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/drivers/bluetooth.h>
|
||||
#include <tactility/log.h>
|
||||
@ -138,7 +138,7 @@ public:
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
lvgl_toolbar_create(parent, title.c_str());
|
||||
lvgl::toolbar_create(parent, title);
|
||||
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapper, LV_PCT(100));
|
||||
|
||||
@ -10,11 +10,11 @@
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <cstdlib>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <vector>
|
||||
|
||||
namespace tt::app::chat {
|
||||
|
||||
@ -34,7 +34,7 @@ void ChatView::updateToolbarTitle() {
|
||||
if (!state || !toolbar) return;
|
||||
std::string channel = state->getCurrentChannel();
|
||||
std::string title = "Chat: " + channel;
|
||||
lvgl_toolbar_set_title(toolbar, title.c_str());
|
||||
lvgl::toolbar_set_title(toolbar, title);
|
||||
}
|
||||
|
||||
void ChatView::createInputBar(lv_obj_t* parent) {
|
||||
@ -149,8 +149,8 @@ void ChatView::init(AppContext& appContext, lv_obj_t* parent) {
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
toolbar = lvgl::toolbar_create(parent, appContext);
|
||||
lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_LIST, onChannelClicked, this);
|
||||
lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_SETTINGS, onSettingsClicked, this);
|
||||
lvgl::toolbar_add_text_button_action(toolbar, LV_SYMBOL_LIST, onChannelClicked, this);
|
||||
lvgl::toolbar_add_text_button_action(toolbar, LV_SYMBOL_SETTINGS, onSettingsClicked, this);
|
||||
updateToolbarTitle();
|
||||
|
||||
// Message list
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <cstring>
|
||||
#include <lvgl.h>
|
||||
@ -98,7 +98,7 @@ public:
|
||||
|
||||
lv_obj_t* toolbar = lvgl::toolbar_create(parent, app);
|
||||
|
||||
enableSwitch = lvgl_toolbar_add_switch_action(toolbar);
|
||||
enableSwitch = lvgl::toolbar_add_switch_action(toolbar);
|
||||
lv_obj_add_event_cb(enableSwitch, onEnableSwitchChanged, LV_EVENT_VALUE_CHANGED, this);
|
||||
|
||||
if (service->isEnabled()) {
|
||||
|
||||
@ -523,10 +523,10 @@ void View::init(const AppContext& appContext, lv_obj_t* parent) {
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
auto* toolbar = lvgl::toolbar_create(parent, appContext);
|
||||
navigate_up_button = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_UP, &onNavigateUpPressedCallback, this);
|
||||
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);
|
||||
navigate_up_button = lvgl::toolbar_add_image_button_action(toolbar, LV_SYMBOL_UP, &onNavigateUpPressedCallback, this);
|
||||
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(lv_obj_get_parent(paste_button), LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include <Tactility/file/File.h>
|
||||
#include <Tactility/Platform.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
@ -181,8 +181,8 @@ void View::init(lv_obj_t* parent, Mode mode) {
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
auto* toolbar = lvgl_toolbar_create(parent, "Select File");
|
||||
navigate_up_button = lvgl_toolbar_add_image_button_action(toolbar, LV_SYMBOL_UP, &onNavigateUpPressedCallback, this);
|
||||
auto* toolbar = lvgl::toolbar_create(parent, "Select File");
|
||||
navigate_up_button = lvgl::toolbar_add_image_button_action(toolbar, LV_SYMBOL_UP, &onNavigateUpPressedCallback, this);
|
||||
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapper, LV_PCT(100));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/Timer.h>
|
||||
@ -223,7 +223,7 @@ public:
|
||||
uint8_t margin = (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) ? 2 : 8;
|
||||
|
||||
auto* toolbar = lvgl::toolbar_create(parent, app);
|
||||
lvgl_toolbar_add_text_button_action(toolbar, LV_SYMBOL_PLUS, onAddGpsCallback, this);
|
||||
lvgl::toolbar_add_text_button_action(toolbar, LV_SYMBOL_PLUS, onAddGpsCallback, this);
|
||||
lv_obj_set_style_margin_bottom(toolbar, margin, LV_STATE_DEFAULT);
|
||||
|
||||
deviceListWrapper = lv_obj_create(parent);
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/grove.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
|
||||
#include <format>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::i2cscanner {
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include <Tactility/app/inputdialog/InputDialog.h>
|
||||
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/TactilityCore.h>
|
||||
#include <tactility/log.h>
|
||||
@ -83,7 +83,7 @@ public:
|
||||
check(parameters != nullptr, "Parameters missing");
|
||||
|
||||
std::string title = getTitleParameter(app.getParameters());
|
||||
auto* toolbar = lvgl_toolbar_create(parent, title.c_str());
|
||||
auto* toolbar = lvgl::toolbar_create(parent, title);
|
||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
|
||||
auto* message_label = lv_label_create(parent);
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/backlight.h>
|
||||
#include <tactility/drivers/display.h>
|
||||
#include <tactility/error.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/backlight.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
#include <Tactility/settings/KeyboardSettings.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/backlight.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
|
||||
@ -10,12 +10,12 @@
|
||||
#include <cstring>
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <lvgl/icons/launcher.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/power_supply.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl_icon_launcher.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace tt::app::launcher {
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include <Tactility/settings/Language.h>
|
||||
#include <Tactility/settings/SystemSettings.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <map>
|
||||
|
||||
@ -7,9 +7,9 @@
|
||||
|
||||
#include <Tactility/file/File.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::notes {
|
||||
|
||||
|
||||
@ -6,9 +6,9 @@
|
||||
|
||||
#include <Tactility/Timer.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/power_supply.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
|
||||
@ -6,11 +6,11 @@
|
||||
#include <Tactility/app/AppRegistration.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/power_supply.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::poweroff {
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
#include <Tactility/Paths.h>
|
||||
#include <Tactility/Timer.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::screenshot {
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include <Tactility/app/selectiondialog/SelectionDialog.h>
|
||||
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
#include <Tactility/StringUtils.h>
|
||||
#include <tactility/log.h>
|
||||
@ -73,7 +73,7 @@ public:
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
std::string title = getTitleParameter(app.getParameters());
|
||||
lvgl_toolbar_create(parent, title.c_str());
|
||||
lvgl::toolbar_create(parent, title);
|
||||
|
||||
auto* list = lv_list_create(parent);
|
||||
lv_obj_set_width(list, LV_PCT(100));
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <tactility/check.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <Tactility/app/App.h>
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#include <lvgl.h>
|
||||
#include <utility>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::timedatesettings {
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <Tactility/app/AppContext.h>
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/devices/pointer.h>
|
||||
#include <lvgl/lvgl_pointer.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <lvgl.h>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
@ -117,7 +117,7 @@ public:
|
||||
|
||||
lv_obj_t* toolbar = lvgl::toolbar_create(parent, app);
|
||||
|
||||
switchTrackball = lvgl_toolbar_add_switch_action(toolbar);
|
||||
switchTrackball = lvgl::toolbar_add_switch_action(toolbar);
|
||||
lv_obj_add_event_cb(switchTrackball, onTrackballSwitch, LV_EVENT_VALUE_CHANGED, this);
|
||||
if (tbSettings.trackballEnabled) lv_obj_add_state(switchTrackball, LV_STATE_CHECKED);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#define TAG "usb_settings"
|
||||
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <lvgl.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
#include <esp_netif.h>
|
||||
#include <esp_wifi.h>
|
||||
@ -192,7 +192,7 @@ public:
|
||||
lv_obj_t* toolbar = lvgl::toolbar_create(parent, app);
|
||||
|
||||
// Web Server Enable toggle
|
||||
switchWebServerEnabled = lvgl_toolbar_add_switch_action(toolbar);
|
||||
switchWebServerEnabled = lvgl::toolbar_add_switch_action(toolbar);
|
||||
if (wsSettings.webServerEnabled) {
|
||||
lv_obj_add_state(switchWebServerEnabled, LV_STATE_CHECKED);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
#include <Tactility/app/alertdialog/AlertDialog.h>
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/service/wifi/Wifi.h>
|
||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
||||
|
||||
@ -138,8 +138,8 @@ public:
|
||||
lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN);
|
||||
lv_obj_set_style_pad_row(parent, 0, LV_STATE_DEFAULT);
|
||||
|
||||
auto* toolbar = lvgl_toolbar_create(parent, ssid.c_str());
|
||||
busySpinner = lvgl_toolbar_add_spinner_action(toolbar);
|
||||
auto* toolbar = lvgl::toolbar_create(parent, ssid);
|
||||
busySpinner = lvgl::toolbar_add_spinner_action(toolbar);
|
||||
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
lv_obj_set_width(wrapper, LV_PCT(100));
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <Tactility/app/wificonnect/View.h>
|
||||
#include <Tactility/app/wificonnect/WifiConnect.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
#include <Tactility/service/wifi/WifiApSettings.h>
|
||||
#include <Tactility/service/wifi/WifiGlobals.h>
|
||||
|
||||
@ -98,7 +98,7 @@ void View::createBottomButtons(lv_obj_t* parent) {
|
||||
lv_obj_align(remember_label, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align_to(remember_label, remember_switch, LV_ALIGN_OUT_RIGHT_MID, 4, 0);
|
||||
|
||||
connecting_spinner = lvgl_spinner_create(button_container);
|
||||
connecting_spinner = tt::lvgl::spinner_create(button_container);
|
||||
lv_obj_align(connecting_spinner, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
lv_obj_add_flag(connecting_spinner, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
|
||||
@ -302,9 +302,9 @@ void View::init(const AppContext& app, lv_obj_t* parent) {
|
||||
|
||||
lv_obj_t* toolbar = lvgl::toolbar_create(parent, app);
|
||||
|
||||
scanning_spinner = lvgl_toolbar_add_spinner_action(toolbar);
|
||||
scanning_spinner = lvgl::toolbar_add_spinner_action(toolbar);
|
||||
|
||||
enable_switch = lvgl_toolbar_add_switch_action(toolbar);
|
||||
enable_switch = lvgl::toolbar_add_switch_action(toolbar);
|
||||
lv_obj_add_event_cb(enable_switch, onEnableSwitchChanged, LV_EVENT_VALUE_CHANGED, bindings);
|
||||
|
||||
// Networks
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
#include <lvgl/icons/shared.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_icon_shared.h>
|
||||
|
||||
namespace tt::app::wifimanage {
|
||||
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include <lvgl/widgets/sliderbox.h>
|
||||
#include <lvgl/fonts.h>
|
||||
#include <Tactility/lvgl/SliderBox.h>
|
||||
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
@ -131,7 +133,7 @@ static lv_obj_t* create_step_button(lv_obj_t* parent, const char* symbol, lv_eve
|
||||
return button;
|
||||
}
|
||||
|
||||
lv_obj_t* lvgl_sliderbox_create(lv_obj_t* parent, int32_t min, int32_t max, int32_t step, int32_t value) {
|
||||
lv_obj_t* sliderbox_create(lv_obj_t* parent, int32_t min, int32_t max, int32_t step, int32_t value) {
|
||||
if (max <= min) {
|
||||
max = min + 1;
|
||||
}
|
||||
@ -174,17 +176,17 @@ lv_obj_t* lvgl_sliderbox_create(lv_obj_t* parent, int32_t min, int32_t max, int3
|
||||
|
||||
sliderBox->plusButton = create_step_button(obj, LV_SYMBOL_PLUS, &on_plus_button_clicked, obj, button_size);
|
||||
|
||||
lvgl_sliderbox_set_value(obj, value, LV_ANIM_OFF);
|
||||
sliderbox_set_value(obj, value, LV_ANIM_OFF);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
int32_t lvgl_sliderbox_get_value(lv_obj_t* obj) {
|
||||
int32_t sliderbox_get_value(lv_obj_t* obj) {
|
||||
auto* sliderBox = reinterpret_cast<SliderBox*>(obj);
|
||||
return lv_slider_get_value(sliderBox->slider);
|
||||
}
|
||||
|
||||
void lvgl_sliderbox_set_value(lv_obj_t* obj, int32_t value, lv_anim_enable_t anim) {
|
||||
void sliderbox_set_value(lv_obj_t* obj, int32_t value, lv_anim_enable_t anim) {
|
||||
auto* sliderBox = reinterpret_cast<SliderBox*>(obj);
|
||||
|
||||
if (value < sliderBox->min) {
|
||||
@ -198,6 +200,8 @@ void lvgl_sliderbox_set_value(lv_obj_t* obj, int32_t value, lv_anim_enable_t ani
|
||||
update_button_states(sliderBox);
|
||||
}
|
||||
|
||||
void lvgl_sliderbox_add_value_changed_cb(lv_obj_t* obj, lv_event_cb_t callback, void* userData) {
|
||||
void sliderbox_add_value_changed_cb(lv_obj_t* obj, lv_event_cb_t callback, void* userData) {
|
||||
lv_obj_add_event_cb(obj, callback, LV_EVENT_VALUE_CHANGED, userData);
|
||||
}
|
||||
|
||||
} // namespace tt::lvgl
|
||||
@ -1,14 +1,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include <lvgl/widgets/spinner.h>
|
||||
#include <Tactility/Assets.h>
|
||||
#include <Tactility/CoreDefines.h>
|
||||
|
||||
// TODO: Don't depend on asset from a different project
|
||||
#define SPINNER_ASSET "A:/system/spinner.png"
|
||||
#include <lvgl.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
static void spinner_constructor(const lv_obj_class_t* object_class, lv_obj_t* object);
|
||||
|
||||
static const lv_obj_class_t tt_spinner_class = {
|
||||
const lv_obj_class_t tt_spinner_class = {
|
||||
.base_class = &lv_image_class,
|
||||
.constructor_cb = spinner_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
@ -23,11 +24,11 @@ static const lv_obj_class_t tt_spinner_class = {
|
||||
.theme_inheritable = 0
|
||||
};
|
||||
|
||||
lv_obj_t* lvgl_spinner_create(lv_obj_t* parent) {
|
||||
lv_obj_t* spinner_create(lv_obj_t* parent) {
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&tt_spinner_class, parent);
|
||||
lv_obj_class_init_obj(obj);
|
||||
|
||||
lv_image_set_src(obj, SPINNER_ASSET);
|
||||
lv_image_set_src(obj, TT_ASSETS_UI_SPINNER);
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -53,3 +54,5 @@ static void spinner_constructor(const lv_obj_class_t* object_class, lv_obj_t* ob
|
||||
lv_anim_set_exec_cb(&a, anim_rotation_callback);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
}
|
||||
@ -10,10 +10,10 @@
|
||||
#include <Tactility/lvgl/Style.h>
|
||||
#include <Tactility/settings/Time.h>
|
||||
|
||||
#include <lvgl/fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/log.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <memory>
|
||||
|
||||
@ -1,10 +1,259 @@
|
||||
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
#include <Tactility/app/AppManifest.h>
|
||||
|
||||
#include "tactility/drivers/pointer.h"
|
||||
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
#include <tactility/check.h>
|
||||
#include <lvgl/lvgl_fonts.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
static uint32_t getToolbarHeight(UiDensity uiDensity) {
|
||||
if (uiDensity == LVGL_UI_DENSITY_COMPACT) {
|
||||
return lvgl_get_text_font_height(FONT_SIZE_DEFAULT) * 1.4f;
|
||||
} else {
|
||||
return lvgl_get_text_font_height(FONT_SIZE_LARGE) * 2.2f;
|
||||
}
|
||||
}
|
||||
|
||||
static const _lv_font_t* getToolbarFont(UiDensity uiDensity) {
|
||||
if (uiDensity == LVGL_UI_DENSITY_COMPACT) {
|
||||
return lvgl_get_text_font(FONT_SIZE_DEFAULT);
|
||||
} else {
|
||||
return lvgl_get_text_font(FONT_SIZE_LARGE);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t getActionIconPadding(UiDensity uiDensity) {
|
||||
auto toolbar_height = getToolbarHeight(uiDensity);
|
||||
// Minimal 8 pixels total padding for selection/animation (4+4 pixels)
|
||||
return (uiDensity != LVGL_UI_DENSITY_COMPACT) ? (uint32_t)(toolbar_height * 0.2f) : 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helps with button expansion and also with vertical alignment of content,
|
||||
* as the parent flex doesn't allow for vertical alignment
|
||||
*/
|
||||
static lv_obj_t* create_action_wrapper(lv_obj_t* parent, UiDensity ui_density) {
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
lv_obj_set_size(wrapper, LV_SIZE_CONTENT, toolbar_height);
|
||||
|
||||
auto icon_padding = getActionIconPadding(ui_density);
|
||||
auto icon_padding_half = icon_padding / 2;
|
||||
|
||||
lv_obj_set_style_pad_all(wrapper, icon_padding_half, LV_STATE_DEFAULT); // For selection and touch animation
|
||||
lv_obj_set_style_bg_opa(wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(wrapper, 0, LV_STATE_DEFAULT);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_obj_t* title_label;
|
||||
lv_obj_t* close_button;
|
||||
lv_obj_t* close_button_image;
|
||||
lv_obj_t* action_container;
|
||||
uint8_t action_count;
|
||||
} Toolbar;
|
||||
|
||||
static void toolbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj);
|
||||
|
||||
static lv_obj_class_t toolbar_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = &toolbar_constructor,
|
||||
.destructor_cb = nullptr,
|
||||
.event_cb = nullptr,
|
||||
.user_data = nullptr,
|
||||
.name = nullptr,
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = 0,
|
||||
.editable = false,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE,
|
||||
.instance_size = sizeof(Toolbar),
|
||||
.theme_inheritable = false
|
||||
};
|
||||
|
||||
static void stop_app(lv_event_t* event) {
|
||||
app::stop();
|
||||
}
|
||||
|
||||
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_t* toolbar_create(lv_obj_t* parent, const std::string& title) {
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
toolbar_class.height_def = toolbar_height;
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&toolbar_class, parent);
|
||||
lv_obj_class_init_obj(obj);
|
||||
lv_obj_set_height(obj, toolbar_height);
|
||||
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_obj_set_width(obj, LV_PCT(100));
|
||||
lv_obj_set_style_pad_all(obj, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(obj, 0, LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_center(obj);
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
|
||||
auto icon_padding = getActionIconPadding(ui_density);
|
||||
|
||||
auto* close_button_wrapper = create_action_wrapper(obj, ui_density);
|
||||
|
||||
toolbar->close_button = lv_button_create(close_button_wrapper);
|
||||
if (ui_density == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_bg_opa(toolbar->close_button, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
lv_obj_set_size(toolbar->close_button, toolbar_height - icon_padding, toolbar_height - icon_padding);
|
||||
|
||||
lv_obj_set_style_pad_all(toolbar->close_button, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_align(toolbar->close_button, LV_ALIGN_CENTER, 0, 0);
|
||||
toolbar->close_button_image = lv_image_create(toolbar->close_button);
|
||||
lv_obj_align(toolbar->close_button_image, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
auto* title_wrapper = lv_obj_create(obj);
|
||||
uint32_t title_left_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? icon_padding : 2;
|
||||
uint32_t title_right_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? (icon_padding / 2) : 2;
|
||||
lv_obj_set_size(title_wrapper, LV_SIZE_CONTENT, LV_PCT(100));
|
||||
lv_obj_set_style_bg_opa(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_left(title_wrapper, title_left_padding, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_right(title_wrapper, title_right_padding, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_ver(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_flex_grow(title_wrapper, 1);
|
||||
|
||||
toolbar->title_label = lv_label_create(title_wrapper);
|
||||
lv_obj_set_style_text_font(toolbar->title_label, getToolbarFont(ui_density), LV_STATE_DEFAULT);
|
||||
lv_label_set_text(toolbar->title_label, title.c_str());
|
||||
lv_label_set_long_mode(toolbar->title_label, LV_LABEL_LONG_MODE_SCROLL);
|
||||
lv_obj_set_style_text_align(toolbar->title_label, LV_TEXT_ALIGN_LEFT, LV_STATE_DEFAULT);
|
||||
lv_obj_align(toolbar->title_label, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
lv_obj_set_width(toolbar->title_label, LV_PCT(100));
|
||||
|
||||
toolbar->action_container = lv_obj_create(obj);
|
||||
lv_obj_set_width(toolbar->action_container, LV_SIZE_CONTENT);
|
||||
lv_obj_set_flex_flow(toolbar->action_container, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_style_pad_all(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(toolbar->action_container, 0, LV_STATE_DEFAULT);
|
||||
|
||||
toolbar_set_nav_action(obj, LV_SYMBOL_CLOSE, &stop_app, nullptr);
|
||||
|
||||
// If we don't have a touch device, we assume there's some other kind of input like a keyboard, an encoder or button control
|
||||
// In that scenario we want to automatically have the close button selected so the user doesn't have to press the widget selection
|
||||
// an extra time for every screen.
|
||||
if (!device_has_active_by_type(&POINTER_TYPE)) {
|
||||
lv_group_focus_obj(toolbar->close_button);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_create(lv_obj_t* parent, const app::AppContext& app) {
|
||||
return lvgl_toolbar_create(parent, app.getManifest().appName.c_str());
|
||||
return toolbar_create(parent, app.getManifest().appName);
|
||||
}
|
||||
|
||||
void toolbar_set_title(lv_obj_t* obj, const std::string& title) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_label_set_text(toolbar->title_label, title.c_str());
|
||||
}
|
||||
|
||||
void toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_obj_add_event_cb(toolbar->close_button, callback, LV_EVENT_SHORT_CLICKED, user_data);
|
||||
lv_image_set_src(toolbar->close_button_image, icon); // e.g. LV_SYMBOL_CLOSE
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* imageOrButton, bool isImage, lv_event_cb_t callback, void* user_data) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
check(toolbar->action_count < TOOLBAR_ACTION_LIMIT, "max actions reached");
|
||||
toolbar->action_count++;
|
||||
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
|
||||
auto padding = getActionIconPadding(ui_density);
|
||||
|
||||
lv_obj_t* action_button = lv_button_create(wrapper);
|
||||
lv_obj_set_size(action_button, toolbar_height - padding, toolbar_height - padding);
|
||||
lv_obj_set_style_pad_all(action_button, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_align(action_button, LV_ALIGN_CENTER, 0, 0);
|
||||
if (ui_density == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_bg_opa(action_button, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
lv_obj_add_event_cb(action_button, callback, LV_EVENT_SHORT_CLICKED, user_data);
|
||||
lv_obj_t* button_content;
|
||||
if (isImage) {
|
||||
button_content = lv_image_create(action_button);
|
||||
lv_image_set_src(button_content, imageOrButton);
|
||||
} else {
|
||||
button_content = lv_label_create(action_button);
|
||||
lv_label_set_text(button_content, imageOrButton);
|
||||
}
|
||||
lv_obj_align(button_content, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
return action_button;
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* user_data) {
|
||||
return toolbar_add_button_action(obj, imagePath, true, callback, user_data);
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* user_data) {
|
||||
return toolbar_add_button_action(obj, text, false, callback, user_data);
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
lv_obj_set_style_pad_hor(wrapper, 4, LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_t* widget = lv_switch_create(wrapper);
|
||||
lv_obj_set_align(widget, LV_ALIGN_CENTER);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
|
||||
auto* spinner = spinner_create(wrapper);
|
||||
lv_obj_set_align(spinner, LV_ALIGN_CENTER);
|
||||
|
||||
if (lv_display_get_color_format(lv_obj_get_display(obj)) == LV_COLOR_FORMAT_L8) {
|
||||
lv_obj_set_style_image_recolor(spinner, lv_theme_get_color_secondary(obj), LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_image_recolor_opa(spinner, LV_OPA_COVER, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
return spinner;
|
||||
}
|
||||
|
||||
void toolbar_clear_actions(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
lv_obj_clean(toolbar->action_container);
|
||||
toolbar->action_count = 0;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -48,9 +48,9 @@ void addService(std::shared_ptr<const ServiceManifest> manifest, bool autoStart)
|
||||
return;
|
||||
}
|
||||
|
||||
// Intentionally never freed: removeService() only unregisters the manifest
|
||||
// from the kernel, it doesn't own this allocation. Keeps id's backing
|
||||
// string alive for cManifest.id below.
|
||||
// Intentionally never freed: services are registered once and live for the
|
||||
// process lifetime (there is no removeService()). Keeps id's backing string
|
||||
// alive for cManifest.id below.
|
||||
auto* persistentManifest = new std::shared_ptr(manifest);
|
||||
auto* cManifest = new ::ServiceManifest {
|
||||
.id = (*persistentManifest)->id.c_str(),
|
||||
@ -70,29 +70,6 @@ void addService(const ServiceManifest& manifest, bool autoStart) {
|
||||
addService(std::make_shared<const ServiceManifest>(manifest), autoStart);
|
||||
}
|
||||
|
||||
bool removeService(const std::string& id) {
|
||||
if (service_manager_get_state(id.c_str()) != SERVICE_STATE_STOPPED) {
|
||||
LOG_I(TAG, "Stopping %s before removal", id.c_str());
|
||||
if (!stopService(id)) {
|
||||
LOG_E(TAG, "Failed to stop %s before removal", id.c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_I(TAG, "Removing %s", id.c_str());
|
||||
error_t error = service_manager_remove(id.c_str());
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to remove service %s: %s", id.c_str(), error_to_string(error));
|
||||
return false;
|
||||
}
|
||||
LOG_I(TAG, "Removed %s", id.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool removeService(const ServiceManifest& manifest) {
|
||||
return removeService(manifest.id);
|
||||
}
|
||||
|
||||
const ::ServiceManifest* findManifestById(const std::string& id) {
|
||||
return service_manager_find_manifest(id.c_str());
|
||||
}
|
||||
|
||||
@ -178,21 +178,10 @@ void GuiService::redraw() {
|
||||
return;
|
||||
}
|
||||
|
||||
bool lvgl_locked = false;
|
||||
while (lvgl_is_running() && !(lvgl_locked = lvgl_try_lock(1000))) {
|
||||
while (!lvgl_try_lock(1000)) {
|
||||
LOG_W(TAG, LOG_MESSAGE_MUTEX_LOCK_FAILED_FMT, "GuiService LVGL");
|
||||
}
|
||||
|
||||
if (!lvgl_locked) {
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
if (!lvgl_is_running()) {
|
||||
lvgl_unlock();
|
||||
unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
lv_obj_clean(appRootWidget);
|
||||
|
||||
if (appToRender != nullptr) {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include <Tactility/service/ServiceManifest.h>
|
||||
#include <Tactility/service/memorychecker/MemoryCheckerService.h>
|
||||
|
||||
#include <lvgl/icons/statusbar.h>
|
||||
#include <lvgl/lvgl_icon_statusbar.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
namespace tt::service::memorychecker {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <Tactility/service/rtctime/RtcTimeService.h>
|
||||
|
||||
#include <Tactility/service/ServiceContext.h>
|
||||
#include <Tactility/service/ServiceManifest.h>
|
||||
#include <Tactility/service/ServiceRegistration.h>
|
||||
|
||||
|
||||
@ -20,9 +20,10 @@
|
||||
#include <tactility/filesystem/file_system.h>
|
||||
|
||||
#include <tactility/log.h>
|
||||
#include <tactility/module.h>
|
||||
|
||||
#include <lvgl/icons/statusbar.h>
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/lvgl_icon_statusbar.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
#include <lv_screenshot.h>
|
||||
#endif
|
||||
|
||||
#include <lvgl/icons/statusbar.h>
|
||||
#include <lvgl/lvgl_icon_statusbar.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <cctype>
|
||||
|
||||
48
TactilityC/Include/tt_lock.h
Normal file
48
TactilityC/Include/tt_lock.h
Normal file
@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** A handle that represents a lock instance. A lock could be a Mutex or similar construct */
|
||||
typedef void* LockHandle;
|
||||
|
||||
typedef enum {
|
||||
MutexTypeNormal,
|
||||
MutexTypeRecursive
|
||||
} TtMutexType;
|
||||
|
||||
/**
|
||||
* Allocate a lock for a file or folder.
|
||||
* Locking is required before reading files for filesystems that are on a shared bus (e.g. SPI SD card sharing the bus with the display)
|
||||
* @param path the path to create the lock for
|
||||
* @return the allocated lock handle
|
||||
*/
|
||||
LockHandle tt_lock_alloc_for_path(const char* path);
|
||||
|
||||
/**
|
||||
* Attempt to lock the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
* @param[in] timeout the maximum amount of ticks to wait when trying to lock
|
||||
* @return true when the lock was acquired
|
||||
*/
|
||||
bool tt_lock_acquire(LockHandle handle, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Attempt to unlock the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
*/
|
||||
void tt_lock_release(LockHandle handle);
|
||||
|
||||
/** Free the memory for this lock
|
||||
* This does not auto-release the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
*/
|
||||
void tt_lock_free(LockHandle handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
55
TactilityC/Include/tt_lvgl_keyboard.h
Normal file
55
TactilityC/Include/tt_lvgl_keyboard.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Show the on-screen keyboard.
|
||||
* @param[in] textarea the textarea to focus the input for
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_show(lv_obj_t* textarea);
|
||||
|
||||
/**
|
||||
* Hide the on-screen keyboard.
|
||||
* Has no effect when the keyboard is not visible.
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_hide();
|
||||
|
||||
/**
|
||||
* The on-screen keyboard is only shown when both of these conditions are true:
|
||||
* - there is no hardware keyboard
|
||||
* - TT_CONFIG_FORCE_ONSCREEN_KEYBOARD is set to true in tactility_config.h
|
||||
* @return if we should show a on-screen keyboard for text input inside our apps
|
||||
*/
|
||||
bool tt_lvgl_software_keyboard_is_enabled();
|
||||
|
||||
/**
|
||||
* Activate the keypad for a widget group.
|
||||
* @param group
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_activate(lv_group_t* group);
|
||||
|
||||
/**
|
||||
* Deactivate the keypad for the current widget group (if any).
|
||||
* You don't have to call this after calling _activate() because widget
|
||||
* cleanup automatically removes itself from the group it belongs to.
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_deactivate();
|
||||
|
||||
/**
|
||||
* @return true if LVGL is configured with a keypad
|
||||
*/
|
||||
bool tt_lvgl_hardware_keyboard_is_available();
|
||||
|
||||
/**
|
||||
* Set the keypad.
|
||||
* @param device the keypad device
|
||||
*/
|
||||
void tt_lvgl_hardware_keyboard_set_indev(lv_indev_t* device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
14
TactilityC/Include/tt_lvgl_spinner.h
Normal file
14
TactilityC/Include/tt_lvgl_spinner.h
Normal file
@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Create a spinner widget. */
|
||||
lv_obj_t* tt_lvgl_spinner_create(lv_obj_t* parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
72
TactilityC/Include/tt_lvgl_toolbar.h
Normal file
72
TactilityC/Include/tt_lvgl_toolbar.h
Normal file
@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include "tt_app.h"
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Create a toolbar widget that shows the app name as title */
|
||||
lv_obj_t* tt_lvgl_toolbar_create_for_app(lv_obj_t* parent, AppHandle context);
|
||||
|
||||
/** Create a toolbar widget with the provided title*/
|
||||
lv_obj_t* tt_lvgl_toolbar_create(lv_obj_t* parent, const char* title);
|
||||
|
||||
/** Sets the toolbar title */
|
||||
void tt_lvgl_toolbar_set_title(lv_obj_t* obj, const char* title);
|
||||
|
||||
/** Sets the navigation action of the toolbar (button on the top-left)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] icon the icon to set on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackEventUserData the user data that is attached to the callback event object
|
||||
*/
|
||||
void tt_lvgl_toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* callbackEventUserData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with an image to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] imagePath the path to an image file to shown on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with text to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] text the button text
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add a switch to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by lv_switch_create()
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_switch_action(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Create and add a spinner to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by Tactility's spinner_create()
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_spinner_action(lv_obj_t* obj);
|
||||
|
||||
|
||||
/**
|
||||
* Remove all actions from the toolbar
|
||||
* @param[in] obj the toolbar instance
|
||||
*/
|
||||
void tt_lvgl_toolbar_clear_actions(lv_obj_t* obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
8
TactilityC/Private/tt_lock_private.h
Normal file
8
TactilityC/Private/tt_lock_private.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <Tactility/Lock.h>
|
||||
|
||||
struct LockHolder {
|
||||
std::shared_ptr<tt::Lock> lock;
|
||||
};
|
||||
@ -5,6 +5,10 @@
|
||||
#include "tt_app_fileselection.h"
|
||||
#include "tt_app_selectiondialog.h"
|
||||
#include "tt_bundle.h"
|
||||
#include <tt_lock.h>
|
||||
#include "tt_lvgl_keyboard.h"
|
||||
#include "tt_lvgl_spinner.h"
|
||||
#include "tt_lvgl_toolbar.h"
|
||||
#include "tt_preferences.h"
|
||||
#include "tt_time.h"
|
||||
|
||||
@ -277,6 +281,10 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_user_data_child_path),
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_assets_path),
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_assets_child_path),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_alloc_for_path),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_acquire),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_release),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_free),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_free),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_opt_bool),
|
||||
@ -285,6 +293,22 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_bool),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_int32),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_string),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_show),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_hide),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_is_enabled),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_activate),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_deactivate),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_hardware_keyboard_is_available),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_hardware_keyboard_set_indev),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_create),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_create_for_app),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_set_title),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_set_nav_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_image_button_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_text_button_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_switch_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_spinner_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_clear_actions),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_free),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_opt_bool),
|
||||
@ -298,6 +322,8 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_get_code),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_is_format_24_hour),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_set_format_24_hour),
|
||||
// tt::lvgl
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_spinner_create),
|
||||
|
||||
// stdio.h
|
||||
ESP_ELFSYM_EXPORT(rename),
|
||||
|
||||
29
TactilityC/Source/tt_lock.cpp
Normal file
29
TactilityC/Source/tt_lock.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <tt_lock.h>
|
||||
#include <tt_lock_private.h>
|
||||
|
||||
#define HANDLE_AS_LOCK(handle) (static_cast<LockHolder*>(handle)->lock)
|
||||
|
||||
extern "C" {
|
||||
|
||||
LockHandle tt_lock_alloc_for_path(const char* path) {
|
||||
const auto lock = tt::file::getLock(path);
|
||||
return new LockHolder(lock);
|
||||
}
|
||||
|
||||
bool tt_lock_acquire(LockHandle handle, TickType_t timeout) {
|
||||
return HANDLE_AS_LOCK(handle)->lock(timeout);
|
||||
}
|
||||
|
||||
void tt_lock_release(LockHandle handle) {
|
||||
HANDLE_AS_LOCK(handle)->unlock();
|
||||
}
|
||||
|
||||
void tt_lock_free(LockHandle handle) {
|
||||
const auto holder = static_cast<LockHolder*>(handle);
|
||||
delete holder;
|
||||
}
|
||||
|
||||
}
|
||||
33
TactilityC/Source/tt_lvgl_keyboard.cpp
Normal file
33
TactilityC/Source/tt_lvgl_keyboard.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "Tactility/lvgl/Keyboard.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void tt_lvgl_software_keyboard_show(lv_obj_t* textarea) {
|
||||
tt::lvgl::software_keyboard_show(textarea);
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_hide() {
|
||||
tt::lvgl::software_keyboard_hide();
|
||||
}
|
||||
|
||||
bool tt_lvgl_software_keyboard_is_enabled() {
|
||||
return tt::lvgl::software_keyboard_is_enabled();
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_activate(lv_group_t* group) {
|
||||
tt::lvgl::software_keyboard_activate(group);
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_deactivate() {
|
||||
tt::lvgl::software_keyboard_deactivate();
|
||||
}
|
||||
|
||||
bool tt_lvgl_hardware_keyboard_is_available() {
|
||||
return tt::lvgl::hardware_keyboard_is_available();
|
||||
}
|
||||
|
||||
void tt_lvgl_hardware_keyboard_set_indev(lv_indev_t* device) {
|
||||
tt::lvgl::hardware_keyboard_set_indev(device);
|
||||
}
|
||||
|
||||
}
|
||||
10
TactilityC/Source/tt_lvgl_spinner.cpp
Normal file
10
TactilityC/Source/tt_lvgl_spinner.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
#include "tt_lvgl_spinner.h"
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
lv_obj_t* tt_lvgl_spinner_create(lv_obj_t* parent) {
|
||||
return tt::lvgl::spinner_create(parent);
|
||||
}
|
||||
|
||||
}
|
||||
42
TactilityC/Source/tt_lvgl_toolbar.cpp
Normal file
42
TactilityC/Source/tt_lvgl_toolbar.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "tt_lvgl_toolbar.h"
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_create(lv_obj_t* parent, const char* title) {
|
||||
return tt::lvgl::toolbar_create(parent, title);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_create_for_app(lv_obj_t* parent, AppHandle context) {
|
||||
return tt::lvgl::toolbar_create(parent, *(tt::app::AppContext*)context);
|
||||
}
|
||||
|
||||
void tt_lvgl_toolbar_set_title(lv_obj_t* obj, const char* title) {
|
||||
tt::lvgl::toolbar_set_title(obj, title);
|
||||
}
|
||||
|
||||
void tt_lvgl_toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* callbackEventUserData) {
|
||||
tt::lvgl::toolbar_set_nav_action(obj, icon, callback, callbackEventUserData);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* callbackUserData) {
|
||||
return tt::lvgl::toolbar_add_image_button_action(obj, imagePath, callback, callbackUserData);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* callbackUserData) {
|
||||
return tt::lvgl::toolbar_add_text_button_action(obj, text, callback, callbackUserData);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
return tt::lvgl::toolbar_add_switch_action(obj);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_spinner_action(lv_obj_t* obj) {
|
||||
return tt::lvgl::toolbar_add_spinner_action(obj);
|
||||
}
|
||||
|
||||
void tt_lvgl_toolbar_clear_actions(lv_obj_t* obj) {
|
||||
tt::lvgl::toolbar_clear_actions(obj);
|
||||
}
|
||||
|
||||
}
|
||||
@ -74,7 +74,6 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
|
||||
DEFINE_MODULE_SYMBOL(device_lock),
|
||||
DEFINE_MODULE_SYMBOL(device_try_lock),
|
||||
DEFINE_MODULE_SYMBOL(device_unlock),
|
||||
DEFINE_MODULE_SYMBOL(device_get_child_count),
|
||||
DEFINE_MODULE_SYMBOL(device_get_type),
|
||||
DEFINE_MODULE_SYMBOL(device_for_each),
|
||||
DEFINE_MODULE_SYMBOL(device_for_each_child),
|
||||
@ -84,14 +83,6 @@ const struct ModuleSymbol KERNEL_SYMBOLS[] = {
|
||||
DEFINE_MODULE_SYMBOL(device_find_first_active_by_type),
|
||||
DEFINE_MODULE_SYMBOL(device_find_first_by_type),
|
||||
DEFINE_MODULE_SYMBOL(device_find_first_by_compatible),
|
||||
DEFINE_MODULE_SYMBOL(device_get),
|
||||
DEFINE_MODULE_SYMBOL(device_put),
|
||||
DEFINE_MODULE_SYMBOL(device_get_by_name),
|
||||
DEFINE_MODULE_SYMBOL(device_get_first_by_type),
|
||||
DEFINE_MODULE_SYMBOL(device_get_first_active_by_type),
|
||||
DEFINE_MODULE_SYMBOL(device_has_active_by_type),
|
||||
DEFINE_MODULE_SYMBOL(device_get_first_by_compatible),
|
||||
DEFINE_MODULE_SYMBOL(device_is_constructed),
|
||||
// driver
|
||||
DEFINE_MODULE_SYMBOL(driver_construct),
|
||||
DEFINE_MODULE_SYMBOL(driver_destruct),
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
#include <tt_app.h>
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
#include <lvgl/widgets/toolbar.h>
|
||||
#include <tt_lvgl_toolbar.h>
|
||||
|
||||
#include <tactility/concurrent/dispatcher.h>
|
||||
#include <tactility/concurrent/event_group.h>
|
||||
@ -24,6 +22,8 @@
|
||||
#include <tactility/module.h>
|
||||
#include <tactility/time.h>
|
||||
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
#include <drivers/bm8563.h>
|
||||
#include <drivers/bmi270.h>
|
||||
#include <drivers/mpu6886.h>
|
||||
@ -32,7 +32,7 @@
|
||||
#include <drivers/rx8130ce.h>
|
||||
|
||||
static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
|
||||
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Title");
|
||||
lv_obj_t* toolbar = tt_lvgl_toolbar_create_for_app(parent, app);
|
||||
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
|
||||
|
||||
lv_obj_t* label = lv_label_create(parent);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user