b9a766d909
* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@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 = malloc(sizeof(GuiIconModel));
|
|
model->x = x;
|
|
model->y = y;
|
|
model->icon = icon;
|
|
|
|
// Allocate and init Element
|
|
WidgetElement* gui_icon = malloc(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;
|
|
}
|