TactilityC and Toolbar improvements (#355)

This commit is contained in:
Ken Van Hoeylandt
2025-10-02 23:40:40 +02:00
committed by GitHub
parent b214a3358e
commit 00347cbd29
8 changed files with 83 additions and 26 deletions
+21 -9
View File
@@ -14,7 +14,7 @@ lv_obj_t* tt_lvgl_toolbar_create_for_app(lv_obj_t* parent, AppHandle context);
lv_obj_t* tt_lvgl_toolbar_create(lv_obj_t* parent, const char* title);
/** Sets the toolbar title */
void toolbar_set_title(lv_obj_t* obj, const char* 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
@@ -22,31 +22,43 @@ void toolbar_set_title(lv_obj_t* obj, const char* title);
* @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* callbackEventUserData);
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 to the toolbar (aligned to the right of the toolbar)
* 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] icon the icon for the action
* @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] callbackEventUserData the user data that is attached to the callback event object
* @return an instance created by lv_button_create()
* @param[in] callbackUserData the user data that is passed to the callback
* @return an lv_button instance
*/
lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* 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);
/**
* 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* toolbar_add_switch_action(lv_obj_t* obj);
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* toolbar_add_spinner_action(lv_obj_t* obj);
lv_obj_t* tt_lvgl_toolbar_add_spinner_action(lv_obj_t* obj);
#ifdef __cplusplus
}
+17
View File
@@ -36,6 +36,7 @@
#include <ctype.h>
#include <esp_log.h>
#include <cassert>
#include <esp_random.h>
#include <getopt.h>
#include <time.h>
#include <setjmp.h>
@@ -56,6 +57,9 @@ const esp_elfsym main_symbols[] {
ESP_ELFSYM_EXPORT(rand),
ESP_ELFSYM_EXPORT(srand),
ESP_ELFSYM_EXPORT(rand_r),
// esp random
ESP_ELFSYM_EXPORT(esp_random),
ESP_ELFSYM_EXPORT(esp_fill_random),
// unistd.h
ESP_ELFSYM_EXPORT(usleep),
ESP_ELFSYM_EXPORT(sleep),
@@ -233,6 +237,12 @@ const esp_elfsym main_symbols[] {
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_message_queue_alloc),
ESP_ELFSYM_EXPORT(tt_message_queue_free),
ESP_ELFSYM_EXPORT(tt_message_queue_put),
@@ -488,6 +498,13 @@ const esp_elfsym main_symbols[] {
ESP_ELFSYM_EXPORT(lv_spinbox_set_cursor_pos),
ESP_ELFSYM_EXPORT(lv_spinbox_step_next),
ESP_ELFSYM_EXPORT(lv_spinbox_step_prev),
// lv_indev
ESP_ELFSYM_EXPORT(lv_indev_get_type),
ESP_ELFSYM_EXPORT(lv_indev_get_point),
ESP_ELFSYM_EXPORT(lv_indev_get_display),
ESP_ELFSYM_EXPORT(lv_indev_get_key),
ESP_ELFSYM_EXPORT(lv_indev_get_gesture_dir),
ESP_ELFSYM_EXPORT(lv_indev_get_state),
// delimiter
ESP_ELFSYM_END
};
+10 -6
View File
@@ -11,23 +11,27 @@ 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 toolbar_set_title(lv_obj_t* obj, const char* title) {
void tt_lvgl_toolbar_set_title(lv_obj_t* obj, const char* title) {
tt::lvgl::toolbar_set_title(obj, title);
}
void toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* callbackEventUserData) {
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* toolbar_add_button_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* callbackEventUserData) {
return tt::lvgl::toolbar_add_button_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* toolbar_add_switch_action(lv_obj_t* obj) {
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* toolbar_add_spinner_action(lv_obj_t* obj) {
lv_obj_t* tt_lvgl_toolbar_add_spinner_action(lv_obj_t* obj) {
return tt::lvgl::toolbar_add_spinner_action(obj);
}