mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-17 10:22:01 +03:00
49af516ec7
* nfc: remove mifare read debug view and scene * nfc: change mifare ultralight data structure * mifare_ultralight: add more commands * nfc: add emulate mifare ul scene * nfc: rework data structures, remove debug scenes and views * nfc: add read emv scenes * nfc: mifare emulation wip * nfc cli: increase detecting time * nfc: save nfc files with new format * nfc: store Mifare Ultralight * nfc: start loading mifare ultralight * nfc: add delete scenes * nfc: add edit UID and name * nfc: finish parsing uid and mifare ul data * nfc: delete success fix * gui_widget: introduce GuiWidget * gui_widget: add string element * gui_widget: add button element * gui_widget: move free elements into gui_widget * nfc: rework info scene with GuiWidget * nfc: rework device info scene * nfc: rework delete scene gui * nfc: add compatible script support * nfc: rework emv reading scenes * nfc: rework bank card save * nfc: add bank card custom view * gui_widget: add icon element * nfc: add icon to bank card * nfc: start worker after switching view Co-authored-by: あく <alleteam@gmail.com>
52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
#include "gui_element_i.h"
|
|
#include "gui_element_icon.h"
|
|
#include "gui_widget.h"
|
|
|
|
#include <m-string.h>
|
|
|
|
typedef struct {
|
|
uint8_t x;
|
|
uint8_t y;
|
|
const Icon* icon;
|
|
} GuiIconModel;
|
|
|
|
static void gui_icon_draw(Canvas* canvas, GuiElement* element) {
|
|
furi_assert(canvas);
|
|
furi_assert(element);
|
|
GuiIconModel* model = element->model;
|
|
|
|
if(model->icon) {
|
|
canvas_draw_icon(canvas, model->x, model->y, model->icon);
|
|
}
|
|
}
|
|
|
|
static void gui_icon_free(GuiElement* gui_icon) {
|
|
furi_assert(gui_icon);
|
|
|
|
if(gui_icon->parent != NULL) {
|
|
// TODO deattach element
|
|
}
|
|
free(gui_icon->model);
|
|
free(gui_icon);
|
|
}
|
|
|
|
GuiElement* gui_icon_create(uint8_t x, uint8_t y, const Icon* icon) {
|
|
furi_assert(icon);
|
|
|
|
// Allocate and init model
|
|
GuiIconModel* model = furi_alloc(sizeof(GuiIconModel));
|
|
model->x = x;
|
|
model->y = y;
|
|
model->icon = icon;
|
|
|
|
// Allocate and init Element
|
|
GuiElement* gui_icon = furi_alloc(sizeof(GuiElement));
|
|
gui_icon->parent = NULL;
|
|
gui_icon->input = NULL;
|
|
gui_icon->draw = gui_icon_draw;
|
|
gui_icon->free = gui_icon_free;
|
|
gui_icon->model = model;
|
|
|
|
return gui_icon;
|
|
}
|