C++ refactoring (#91)

This commit is contained in:
Ken Van Hoeylandt
2024-11-26 17:51:05 +01:00
committed by GitHub
parent d06137ba76
commit ca5d4b8226
159 changed files with 904 additions and 1086 deletions
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include "MessageQueue.h"
#include "Mutex.h"
#include "Pubsub.h"
#include "service/gui/Gui.h"
#include "service/gui/ViewPort.h"
#include "service/gui/ViewPort_i.h"
#include <cstdio>
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;
Mutex* mutex;
PubSubSubscription* loader_pubsub_subscription;
// Layers and Canvas
lv_obj_t* lvgl_parent;
// App-specific
ViewPort* app_view_port;
lv_obj_t* _Nullable keyboard;
lv_group_t* keyboard_group;
};
/** Update GUI, request redraw */
void request_draw();
/** Lock GUI */
void lock();
/** Unlock GUI */
void unlock();
} // namespace
@@ -0,0 +1,23 @@
#pragma once
#include "service/gui/ViewPort.h"
namespace tt::service::gui {
/** Process draw call. Calls on_show callback.
* To be used by GUI, called on redraw.
*
* @param view_port ViewPort instance
* @param canvas canvas to draw at
*/
void view_port_show(ViewPort* view_port, lv_obj_t* parent);
/**
* Process draw clearing call. Calls on_hdie callback.
* To be used by GUI, called on redraw.
*
* @param view_port
*/
void view_port_hide(ViewPort* view_port);
} // namespace