mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-17 10:22:01 +03:00
ecff31d228
* assets: add EMV AID table for NFC app * file-worker: add searching for value by the key * nfc: add emv parser helpers * assets: add country and currency codes * nfc: add country and currency code parsing * emv_decoder: add country and currency code support * nfc: add AID. currency and country display * nfc: rework bank_card view * nfc: add currency and country save * assets: change emv chip asset * nfc: change asset in bank card * gui: add frame element to widget * nfc: add bank card frame, add documentation * rfal: fix long APDU command emulation * nfc: fix typos * Scripts ReadMe: assets delivery command Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
#include "widget_element_i.h"
|
|
|
|
typedef struct {
|
|
uint8_t x;
|
|
uint8_t y;
|
|
const Icon* icon;
|
|
} GuiIconModel;
|
|
|
|
static void gui_icon_draw(Canvas* canvas, WidgetElement* 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(WidgetElement* gui_icon) {
|
|
furi_assert(gui_icon);
|
|
|
|
free(gui_icon->model);
|
|
free(gui_icon);
|
|
}
|
|
|
|
WidgetElement* widget_element_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
|
|
WidgetElement* gui_icon = furi_alloc(sizeof(WidgetElement));
|
|
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;
|
|
}
|