Loading...
Searching...
No Matches
widget.h File Reference

GUI: Widget view module API. More...

#include <gui/view.h>
#include "widget_elements/widget_element.h"

Go to the source code of this file.

Typedefs

typedef struct Widget Widget
 
typedef struct WidgetElement WidgetElement
 

Functions

Widgetwidget_alloc (void)
 Allocate Widget that holds Widget Elements.
 
void widget_free (Widget *widget)
 Free Widget.
 
void widget_reset (Widget *widget)
 Reset Widget.
 
Viewwidget_get_view (Widget *widget)
 Get Widget view.
 
void widget_add_string_multiline_element (Widget *widget, uint8_t x, uint8_t y, Align horizontal, Align vertical, Font font, const char *text)
 Add Multi String Element.
 
void widget_add_string_element (Widget *widget, uint8_t x, uint8_t y, Align horizontal, Align vertical, Font font, const char *text)
 Add String Element.
 
void widget_add_text_box_element (Widget *widget, uint8_t x, uint8_t y, uint8_t width, uint8_t height, Align horizontal, Align vertical, const char *text, bool strip_to_dots)
 Add Text Box Element.
 
void widget_add_text_scroll_element (Widget *widget, uint8_t x, uint8_t y, uint8_t width, uint8_t height, const char *text)
 Add Text Scroll Element.
 
void widget_add_button_element (Widget *widget, GuiButtonType button_type, const char *text, ButtonCallback callback, void *context)
 Add Button Element.
 
void widget_add_icon_element (Widget *widget, uint8_t x, uint8_t y, const Icon *icon)
 Add Icon Element.
 
void widget_add_frame_element (Widget *widget, uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint8_t radius)
 Add Frame Element.
 

Detailed Description

GUI: Widget view module API.

Function Documentation

◆ widget_add_button_element()

void widget_add_button_element ( Widget * widget,
GuiButtonType button_type,
const char * text,
ButtonCallback callback,
void * context )

Add Button Element.

Parameters
widgetWidget instance
button_typeGuiButtonType instance
texttext on allocated button
callbackButtonCallback instance
contextpointer to context

◆ widget_add_frame_element()

void widget_add_frame_element ( Widget * widget,
uint8_t x,
uint8_t y,
uint8_t width,
uint8_t height,
uint8_t radius )

Add Frame Element.

Parameters
widgetWidget instance
xtop left x coordinate
ytop left y coordinate
widthframe width
heightframe height
radiusframe radius

◆ widget_add_icon_element()

void widget_add_icon_element ( Widget * widget,
uint8_t x,
uint8_t y,
const Icon * icon )

Add Icon Element.

Parameters
widgetWidget instance
xtop left x coordinate
ytop left y coordinate
iconIcon instance

◆ widget_add_string_element()

void widget_add_string_element ( Widget * widget,
uint8_t x,
uint8_t y,
Align horizontal,
Align vertical,
Font font,
const char * text )

Add String Element.

Parameters
widgetWidget instance
xx coordinate
yy coordinate
horizontalAlign instance
verticalAlign instance
fontFont instance
[in]textThe text

◆ widget_add_string_multiline_element()

void widget_add_string_multiline_element ( Widget * widget,
uint8_t x,
uint8_t y,
Align horizontal,
Align vertical,
Font font,
const char * text )

Add Multi String Element.

Parameters
widgetWidget instance
xx coordinate
yy coordinate
horizontalAlign instance
verticalAlign instance
fontFont instance
[in]textThe text

◆ widget_add_text_box_element()

void widget_add_text_box_element ( Widget * widget,
uint8_t x,
uint8_t y,
uint8_t width,
uint8_t height,
Align horizontal,
Align vertical,
const char * text,
bool strip_to_dots )

Add Text Box Element.

Parameters
widgetWidget instance
xx coordinate
yy coordinate
widthwidth to fit text
heightheight to fit text
horizontalAlign instance
verticalAlign instance
[in]textFormatted text. The following formats are available: "\e#Bold text\e#" - bold font is used "\e*Monospaced text\e*" - monospaced font is used "\e!Inversed text\e!" - white text on black background
strip_to_dotsStrip text to ... if does not fit to width

◆ widget_add_text_scroll_element()

void widget_add_text_scroll_element ( Widget * widget,
uint8_t x,
uint8_t y,
uint8_t width,
uint8_t height,
const char * text )

Add Text Scroll Element.

Parameters
widgetWidget instance
xx coordinate
yy coordinate
widthwidth to fit text
heightheight to fit text
[in]textFormatted text. Default format: align left, Secondary font. The following formats are available: "\e#Bold text" - sets bold font before until next '
' symbol "\e*Monospaced text\e*" - sets monospaced font before until next '
' symbol "\ecCenter-aligned text" - sets center horizontal align until the next '
' symbol "\erRight-aligned text" - sets right horizontal align until the next '
' symbol

◆ widget_alloc()

Widget * widget_alloc ( void )

Allocate Widget that holds Widget Elements.

Returns
Widget instance

◆ widget_free()

void widget_free ( Widget * widget)

Free Widget.

Note
this function free allocated Widget Elements
Parameters
widgetWidget instance

◆ widget_get_view()

View * widget_get_view ( Widget * widget)

Get Widget view.

Parameters
widgetWidget instance
Returns
View instance

◆ widget_reset()

void widget_reset ( Widget * widget)

Reset Widget.

Parameters
widgetWidget instance