mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-17 10:22:01 +03:00
8fd411097e
* WidGet: fix name Multiline String Element * SubGhz: rename SubGhzProtocol to SubGhzParser and bring it up * SubGhz: a new way to navigate in receiver views * SubGhz: fix syntax * WedGet: add forwarding input type to wedget button callback, fix using a callback in an application * SubGhz: add assertions and status checks * SubGhz: fix syntax * [FL-1790] SubGhz: fix GateTX * SubGhz: add 434.42 MHz frequency support * SubGhz: rename type protocol, add decoder stage names * SubGhz: fix navigation through received signals when changing scenes * SubGhz: fix 2-fsk config Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
66 lines
1.5 KiB
C
Executable File
66 lines
1.5 KiB
C
Executable File
#pragma once
|
|
#include <furi.h>
|
|
#include <gui/view.h>
|
|
#include <input/input.h>
|
|
|
|
typedef enum {
|
|
GuiButtonTypeLeft,
|
|
GuiButtonTypeCenter,
|
|
GuiButtonTypeRight,
|
|
} GuiButtonType;
|
|
|
|
typedef void (*ButtonCallback)(GuiButtonType result, InputType type, 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_multiline_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); |