mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-24 21:43:06 +00:00
3f640e8f1c
* gui_widget: rework with mlib container * widget: rename gui_widget-> widget; gui_element->widget_element * gui: move widget from nfc to gui/modules * nfc: rework widget usage * nfc: return to ReadEmvAppSuccess scene after ReadEmvDataSuccess exit Co-authored-by: あく <alleteam@gmail.com>
48 lines
1.1 KiB
C
Executable file
48 lines
1.1 KiB
C
Executable file
#pragma once
|
|
#include <furi.h>
|
|
#include <gui/view.h>
|
|
|
|
typedef enum {
|
|
GuiButtonTypeLeft,
|
|
GuiButtonTypeCenter,
|
|
GuiButtonTypeRight,
|
|
} GuiButtonType;
|
|
|
|
typedef void (*ButtonCallback)(GuiButtonType result, void* context);
|
|
|
|
typedef struct WidgetElement WidgetElement;
|
|
typedef struct Widget Widget;
|
|
|
|
struct WidgetElement {
|
|
// generic draw and input callbacks
|
|
void (*draw)(Canvas* canvas, WidgetElement* element);
|
|
bool (*input)(InputEvent* event, WidgetElement* element);
|
|
|
|
// free callback
|
|
void (*free)(WidgetElement* element);
|
|
|
|
// generic model holder
|
|
void* model;
|
|
|
|
// pointer to widget that hold our element
|
|
Widget* parent;
|
|
};
|
|
|
|
/* Create string element */
|
|
WidgetElement* widget_element_string_create(
|
|
uint8_t x,
|
|
uint8_t y,
|
|
Align horizontal,
|
|
Align vertical,
|
|
Font font,
|
|
const char* text);
|
|
|
|
/* Create button element */
|
|
WidgetElement* widget_element_button_create(
|
|
GuiButtonType button_type,
|
|
const char* text,
|
|
ButtonCallback callback,
|
|
void* context);
|
|
|
|
/* Create icon element element */
|
|
WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon);
|