GUI: abolish API injection into instances. (#265)
* GUI: abolish API injection into instances. Update usage by 3rd party apps. * GUI: update documentation. Cleanup api usage. Adjust status bar item spacing.
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "gui_i.h"
|
||||
#include "widget.h"
|
||||
|
||||
struct Widget {
|
||||
Gui* gui;
|
||||
bool is_enabled;
|
||||
|
||||
uint8_t width;
|
||||
uint8_t height;
|
||||
|
||||
WidgetDrawCallback draw_callback;
|
||||
void* draw_callback_context;
|
||||
|
||||
WidgetInputCallback input_callback;
|
||||
void* input_callback_context;
|
||||
};
|
||||
|
||||
/*
|
||||
* Set GUI referenec.
|
||||
* Set GUI reference.
|
||||
* To be used by GUI, called upon widget tree insert
|
||||
* @param gui - gui instance pointer.
|
||||
*/
|
||||
void widget_gui_set(Widget* widget, Gui* gui);
|
||||
|
||||
/*
|
||||
* Process draw call. Calls draw callback.
|
||||
* @param canvas_api - canvas to draw at.
|
||||
* To be used by GUI, called on tree redraw.
|
||||
* @param canvas - canvas to draw at.
|
||||
*/
|
||||
void widget_draw(Widget* widget, CanvasApi* canvas_api);
|
||||
void widget_draw(Widget* widget, Canvas* canvas);
|
||||
|
||||
/*
|
||||
* Process input. Calls input callback.
|
||||
* Process input. Calls input callbac
|
||||
* To be used by GUI, called on input dispatch.
|
||||
* @param event - pointer to input event.
|
||||
*/
|
||||
void widget_input(Widget* widget, InputEvent* event);
|
||||
|
||||
Reference in New Issue
Block a user