2021-10-03 10:36:05 +00:00
|
|
|
/**
|
|
|
|
* @file widget_element_i.h
|
|
|
|
* GUI: internal Widget Element API
|
|
|
|
*/
|
|
|
|
|
2021-07-23 13:09:34 +00:00
|
|
|
#pragma once
|
|
|
|
#include <furi.h>
|
|
|
|
#include <gui/view.h>
|
2021-09-15 15:24:19 +00:00
|
|
|
#include <input/input.h>
|
2022-09-14 16:11:38 +00:00
|
|
|
#include "widget_element.h"
|
2021-07-23 13:09:34 +00:00
|
|
|
|
2022-09-14 16:11:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2021-07-23 13:09:34 +00:00
|
|
|
|
|
|
|
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;
|
2022-08-17 15:08:13 +00:00
|
|
|
FuriMutex* model_mutex;
|
2021-07-23 13:09:34 +00:00
|
|
|
|
|
|
|
// pointer to widget that hold our element
|
|
|
|
Widget* parent;
|
|
|
|
};
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Create multi string element */
|
2021-09-15 15:24:19 +00:00
|
|
|
WidgetElement* widget_element_string_multiline_create(
|
2021-09-10 00:29:57 +00:00
|
|
|
uint8_t x,
|
|
|
|
uint8_t y,
|
|
|
|
Align horizontal,
|
|
|
|
Align vertical,
|
|
|
|
Font font,
|
|
|
|
const char* text);
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Create string element */
|
2021-07-23 13:09:34 +00:00
|
|
|
WidgetElement* widget_element_string_create(
|
|
|
|
uint8_t x,
|
|
|
|
uint8_t y,
|
|
|
|
Align horizontal,
|
|
|
|
Align vertical,
|
|
|
|
Font font,
|
|
|
|
const char* text);
|
|
|
|
|
2021-10-27 18:55:03 +00:00
|
|
|
/** Create text box element */
|
|
|
|
WidgetElement* widget_element_text_box_create(
|
|
|
|
uint8_t x,
|
|
|
|
uint8_t y,
|
|
|
|
uint8_t width,
|
|
|
|
uint8_t height,
|
|
|
|
Align horizontal,
|
|
|
|
Align vertical,
|
2022-04-19 19:23:50 +00:00
|
|
|
const char* text,
|
|
|
|
bool strip_to_dots);
|
2021-10-27 18:55:03 +00:00
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Create button element */
|
2021-07-23 13:09:34 +00:00
|
|
|
WidgetElement* widget_element_button_create(
|
|
|
|
GuiButtonType button_type,
|
|
|
|
const char* text,
|
|
|
|
ButtonCallback callback,
|
|
|
|
void* context);
|
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Create icon element */
|
2021-07-23 13:09:34 +00:00
|
|
|
WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon);
|
2021-08-20 19:56:43 +00:00
|
|
|
|
2021-10-03 10:36:05 +00:00
|
|
|
/** Create frame element */
|
2021-08-20 19:56:43 +00:00
|
|
|
WidgetElement* widget_element_frame_create(
|
|
|
|
uint8_t x,
|
|
|
|
uint8_t y,
|
|
|
|
uint8_t width,
|
|
|
|
uint8_t height,
|
2021-10-03 10:36:05 +00:00
|
|
|
uint8_t radius);
|
2022-08-17 15:08:13 +00:00
|
|
|
|
|
|
|
WidgetElement* widget_element_text_scroll_create(
|
|
|
|
uint8_t x,
|
|
|
|
uint8_t y,
|
|
|
|
uint8_t width,
|
|
|
|
uint8_t height,
|
|
|
|
const char* text);
|
2022-09-14 16:11:38 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|