c87200a80d
- Create `Include/` folder for all main projects - Fix some issues here and there (found while moving things) - All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <Tactility/MessageQueue.h>
|
|
#include <Tactility/Mutex.h>
|
|
#include <Tactility/PubSub.h>
|
|
#include <Tactility/service/gui/Gui.h>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <lvgl.h>
|
|
|
|
namespace tt::service::gui {
|
|
|
|
#define GUI_THREAD_FLAG_DRAW (1 << 0)
|
|
#define GUI_THREAD_FLAG_INPUT (1 << 1)
|
|
#define GUI_THREAD_FLAG_EXIT (1 << 2)
|
|
#define GUI_THREAD_FLAG_ALL (GUI_THREAD_FLAG_DRAW | GUI_THREAD_FLAG_INPUT | GUI_THREAD_FLAG_EXIT)
|
|
|
|
/** Gui structure */
|
|
struct Gui {
|
|
// Thread and lock
|
|
Thread* thread = nullptr;
|
|
Mutex mutex = Mutex(Mutex::Type::Recursive);
|
|
PubSub::SubscriptionHandle loader_pubsub_subscription = nullptr;
|
|
|
|
// Layers and Canvas
|
|
lv_obj_t* appRootWidget = nullptr;
|
|
lv_obj_t* statusbarWidget = nullptr;
|
|
|
|
// App-specific
|
|
std::shared_ptr<app::AppContext> appToRender = nullptr;
|
|
|
|
lv_obj_t* _Nullable keyboard = nullptr;
|
|
lv_group_t* keyboardGroup = nullptr;
|
|
};
|
|
|
|
/** Update GUI, request redraw */
|
|
void requestDraw();
|
|
|
|
/** Lock GUI */
|
|
void lock();
|
|
|
|
/** Unlock GUI */
|
|
void unlock();
|
|
|
|
} // namespace
|