Migrate TactilityC and LVGL functionality (#588)
lvgl-module - Move and rename source and include files - Fix bug with missing lvgl unlock - New widgets: spinner, toolbar, sliderbox TactilityC - Removed tt_lock, tt_lvgl_\*
This commit is contained in:
committed by
GitHub
parent
cd2d9d6158
commit
b98a813f3c
@@ -1,36 +0,0 @@
|
||||
#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
|
||||
@@ -1,12 +0,0 @@
|
||||
#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,67 +2,11 @@
|
||||
|
||||
#include "../app/AppContext.h"
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <lvgl/widgets/toolbar.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
|
||||
|
||||
Reference in New Issue
Block a user