Ken Van Hoeylandt 3dfc27e93e
Some checks failed
Build Firmware / cyd-2432s024c (push) Has been cancelled
Build Firmware / cyd-2432s032c (push) Has been cancelled
Build Firmware / cyd-jc2432w328c (push) Has been cancelled
Build Firmware / cyd-8048s043c (push) Has been cancelled
Build Firmware / cyd-jc8048w550c (push) Has been cancelled
Build Firmware / cyd-4848s040c (push) Has been cancelled
Build Firmware / elecrow-crowpanel-advance-28 (push) Has been cancelled
Build Firmware / elecrow-crowpanel-advance-35 (push) Has been cancelled
Build Firmware / elecrow-crowpanel-advance-50 (push) Has been cancelled
Build Firmware / elecrow-crowpanel-basic-28 (push) Has been cancelled
Build Firmware / elecrow-crowpanel-basic-35 (push) Has been cancelled
Build Firmware / elecrow-crowpanel-basic-50 (push) Has been cancelled
Build Firmware / lilygo-tdeck (push) Has been cancelled
Build Firmware / m5stack-core2 (push) Has been cancelled
Build Firmware / m5stack-cores3 (push) Has been cancelled
Build Firmware / unphone (push) Has been cancelled
Build Firmware / waveshare-s3-touch-43 (push) Has been cancelled
Build SDK / esp32 (push) Has been cancelled
Build SDK / esp32s3 (push) Has been cancelled
Build Simulator / Build-Simulator-Linux (push) Has been cancelled
Build Simulator / Build-Simulator-macOS (push) Has been cancelled
Tests / Run (push) Has been cancelled
Fixes for colours and margins in GPIO app and more (#284)
- Fixes for colours and margins in GPIO app
- Removed unused imports
2025-06-01 17:52:09 +02:00

54 lines
1.9 KiB
C++

#pragma once
#include "../app/AppContext.h"
#include <lvgl.h>
namespace tt::lvgl {
#define TOOLBAR_HEIGHT 40
#define TOOLBAR_TITLE_FONT_HEIGHT 18
#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 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] 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 lv_button instance
*/
lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* userData);
/**
* 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);
} // namespace