2024-12-05 22:46:27 +01:00

29 lines
927 B
C++

#pragma once
#include "lvgl.h"
#include "app/AppContext.h"
namespace tt::lvgl {
#define TOOLBAR_HEIGHT 40
#define TOOLBAR_ACTION_LIMIT 8
#define TOOLBAR_TITLE_FONT_HEIGHT 18
typedef void(*ToolbarActionCallback)(void* _Nullable context);
typedef struct {
const char* icon;
const char* text;
ToolbarActionCallback callback;
void* _Nullable callback_context;
} ToolbarAction;
lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title);
lv_obj_t* toolbar_create(lv_obj_t* parent, const app::AppContext& app);
void toolbar_set_title(lv_obj_t* obj, const std::string& title);
void toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data);
uint8_t toolbar_add_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data);
lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj);
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj);
} // namespace