flipperzero-firmware/applications/gui/modules/widget_elements/widget_element_i.h
Skorpionm f385340b2e
[FL-1758] SubGhz refactoring part 1 (#689)
* SubGhz: refactoring
* WeGet: Add support for outputting formatted lines, events center button pressed, center button released
* Variable Item: slightly changed the display of data on the screen
* SubGhz: add show errors, add show preset, refactoring
* SubGhz: refactoring transmitter
* SubGhz: removed unused modules
* SubGhz: Add FuriHalSubGhzPresetOok270Async setting menu
* SubGhz: fix annotation
* SubGhz: add support Nero Radio

Co-authored-by: あく <alleteam@gmail.com>
2021-09-10 03:29:57 +03:00

67 lines
1.5 KiB
C
Executable File

#pragma once
#include <furi.h>
#include <gui/view.h>
typedef enum {
GuiButtonTypeLeft,
GuiButtonTypeCenter,
GuiButtonTypeRight,
GuiButtonTypeCenterPress,
GuiButtonTypeCenterRelease,
} 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 multi string element */
WidgetElement* widget_element_string_multi_create(
uint8_t x,
uint8_t y,
Align horizontal,
Align vertical,
Font font,
const char* text);
/* 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 */
WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon);
/* Create frame element */
WidgetElement* widget_element_frame_create(
uint8_t x,
uint8_t y,
uint8_t width,
uint8_t height,
uint8_t radius);