GUI: Elements API. More...
Go to the source code of this file.
Macros | |
| #define | ELEMENTS_MAX_LINES_NUM (7) |
| #define | ELEMENTS_BOLD_MARKER '#' |
| #define | ELEMENTS_MONO_MARKER '*' |
| #define | ELEMENTS_INVERSE_MARKER '!' |
Functions | |
| void | elements_progress_bar (Canvas *canvas, int32_t x, int32_t y, size_t width, float progress) |
| Draw progress bar. | |
| void | elements_progress_bar_with_text (Canvas *canvas, int32_t x, int32_t y, size_t width, float progress, const char *text) |
| Draw progress bar with text. | |
| void | elements_scrollbar_pos (Canvas *canvas, int32_t x, int32_t y, size_t height, size_t pos, size_t total) |
| Draw scrollbar on canvas at specific position. | |
| void | elements_scrollbar (Canvas *canvas, size_t pos, size_t total) |
| Draw scrollbar on canvas. | |
| void | elements_frame (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
| Draw rounded frame. | |
| void | elements_button_left (Canvas *canvas, const char *str) |
| Draw button in left corner. | |
| void | elements_button_right (Canvas *canvas, const char *str) |
| Draw button in right corner. | |
| void | elements_button_up (Canvas *canvas, const char *str) |
| This function draws a button in the top left corner of the canvas with icon and string. | |
| void | elements_button_down (Canvas *canvas, const char *str) |
| This function draws a button in the top right corner of the canvas with icon and string. | |
| void | elements_button_center (Canvas *canvas, const char *str) |
| Draw button in center. | |
| void | elements_multiline_text_aligned (Canvas *canvas, int32_t x, int32_t y, Align horizontal, Align vertical, const char *text) |
| Draw aligned multiline text. | |
| void | elements_multiline_text (Canvas *canvas, int32_t x, int32_t y, const char *text) |
| Draw multiline text. | |
| void | elements_multiline_text_framed (Canvas *canvas, int32_t x, int32_t y, const char *text) |
| Draw framed multiline text. | |
| void | elements_slightly_rounded_frame (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
| Draw slightly rounded frame. | |
| void | elements_slightly_rounded_box (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
| Draw slightly rounded box. | |
| void | elements_bold_rounded_frame (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
| Draw bold rounded frame. | |
| void | elements_bubble (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height) |
| Draw bubble frame for text. | |
| void | elements_bubble_str (Canvas *canvas, int32_t x, int32_t y, const char *text, Align horizontal, Align vertical) |
| Draw bubble frame for text with corner. | |
| void | elements_string_fit_width (Canvas *canvas, FuriString *string, size_t width) |
| Trim string buffer to fit width in pixels. | |
| void | elements_scrollable_text_line (Canvas *canvas, int32_t x, int32_t y, size_t width, FuriString *string, size_t scroll, bool ellipsis) |
| Draw scrollable text line. | |
| void | elements_text_box (Canvas *canvas, int32_t x, int32_t y, size_t width, size_t height, Align horizontal, Align vertical, const char *text, bool strip_to_dots) |
| Draw text box element. | |
GUI: Elements API.
Canvas helpers and UI building blocks.
| void elements_bold_rounded_frame | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| size_t | height ) |
Draw bold rounded frame.
| canvas | Canvas instance |
| x | top left corner coordinates |
| y | top left corner coordinates |
| width | width of frame |
| height | height of frame |
| void elements_bubble | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| size_t | height ) |
Draw bubble frame for text.
| canvas | Canvas instance |
| x | left x coordinates |
| y | top y coordinate |
| width | bubble width |
| height | bubble height |
| void elements_bubble_str | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| const char * | text, | ||
| Align | horizontal, | ||
| Align | vertical ) |
Draw bubble frame for text with corner.
| canvas | Canvas instance |
| x | left x coordinates |
| y | top y coordinate |
| text | text to display |
| horizontal | horizontal aligning |
| vertical | aligning |
| void elements_button_center | ( | Canvas * | canvas, |
| const char * | str ) |
Draw button in center.
| canvas | Canvas instance |
| str | button text |
| void elements_button_down | ( | Canvas * | canvas, |
| const char * | str ) |
This function draws a button in the top right corner of the canvas with icon and string.
The design and layout of the button is defined within this function.
| [in] | canvas | This is a pointer to the Canvas structure where the button will be drawn. |
| [in] | str | This is a pointer to the character string that will be drawn within the button. |
| void elements_button_left | ( | Canvas * | canvas, |
| const char * | str ) |
Draw button in left corner.
| canvas | Canvas instance |
| str | button text |
| void elements_button_right | ( | Canvas * | canvas, |
| const char * | str ) |
Draw button in right corner.
| canvas | Canvas instance |
| str | button text |
| void elements_button_up | ( | Canvas * | canvas, |
| const char * | str ) |
This function draws a button in the top left corner of the canvas with icon and string.
The design and layout of the button is defined within this function.
| [in] | canvas | This is a pointer to the Canvas structure where the button will be drawn. |
| [in] | str | This is a pointer to the character string that will be drawn within the button. |
| void elements_frame | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| size_t | height ) |
Draw rounded frame.
| canvas | Canvas instance |
| x,y | top left corner coordinates |
| width,height | frame width and height |
| void elements_multiline_text | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| const char * | text ) |
Draw multiline text.
| canvas | Canvas instance |
| x | top left corner coordinates |
| y | top left corner coordinates |
| text | string (possible multiline) |
| void elements_multiline_text_aligned | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| Align | horizontal, | ||
| Align | vertical, | ||
| const char * | text ) |
Draw aligned multiline text.
| canvas | Canvas instance |
| x,y | coordinates based on align param |
| horizontal,vertical | alignment of multiline text |
| text | string (possible multiline) |
| void elements_multiline_text_framed | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| const char * | text ) |
Draw framed multiline text.
| canvas | Canvas instance |
| x | top left corner coordinates |
| y | top left corner coordinates |
| text | string (possible multiline) |
| void elements_progress_bar | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| float | progress ) |
Draw progress bar.
| canvas | Canvas instance |
| x | progress bar position on X axis |
| y | progress bar position on Y axis |
| width | progress bar width |
| progress | progress (0.0 - 1.0) |
| void elements_progress_bar_with_text | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| float | progress, | ||
| const char * | text ) |
Draw progress bar with text.
| canvas | Canvas instance |
| x | progress bar position on X axis |
| y | progress bar position on Y axis |
| width | progress bar width |
| progress | progress (0.0 - 1.0) |
| text | text to draw |
| void elements_scrollable_text_line | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| FuriString * | string, | ||
| size_t | scroll, | ||
| bool | ellipsis ) |
Draw scrollable text line.
| canvas | The canvas | |
| [in] | x | X coordinate |
| [in] | y | Y coordinate |
| [in] | width | The width |
| string | The string | |
| [in] | scroll | The scroll counter: 0 - no scroll, any other number - scroll. Just count up, everything else will be calculated on the inside. |
| [in] | ellipsis | The ellipsis flag: true to add ellipse |
| void elements_scrollbar | ( | Canvas * | canvas, |
| size_t | pos, | ||
| size_t | total ) |
Draw scrollbar on canvas.
| canvas | Canvas instance |
| pos | current element of total elements |
| total | total elements |
| void elements_scrollbar_pos | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | height, | ||
| size_t | pos, | ||
| size_t | total ) |
Draw scrollbar on canvas at specific position.
| canvas | Canvas instance |
| x | scrollbar position on X axis |
| y | scrollbar position on Y axis |
| height | scrollbar height |
| pos | current element |
| total | total elements |
| void elements_slightly_rounded_box | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| size_t | height ) |
Draw slightly rounded box.
| canvas | Canvas instance |
| x | top left corner coordinates |
| y | top left corner coordinates |
| width | height of box |
| height | height of box |
| void elements_slightly_rounded_frame | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| size_t | height ) |
Draw slightly rounded frame.
| canvas | Canvas instance |
| x | top left corner coordinates |
| y | top left corner coordinates |
| width | width of frame |
| height | height of frame |
| void elements_string_fit_width | ( | Canvas * | canvas, |
| FuriString * | string, | ||
| size_t | width ) |
Trim string buffer to fit width in pixels.
| canvas | Canvas instance |
| string | string to trim |
| width | max width |
| void elements_text_box | ( | Canvas * | canvas, |
| int32_t | x, | ||
| int32_t | y, | ||
| size_t | width, | ||
| size_t | height, | ||
| Align | horizontal, | ||
| Align | vertical, | ||
| const char * | text, | ||
| bool | strip_to_dots ) |
Draw text box element.
| canvas | Canvas instance | |
| x | x coordinate | |
| y | y coordinate | |
| width | width to fit text | |
| height | height to fit text | |
| horizontal | Align instance | |
| vertical | Align instance | |
| [in] | text | Formatted text. The following formats are available: "\e#Bold text\e#" - bold font is used "\e*Monospaced text\e*" - monospaced font is used "\e!Inverted text\e!" - white text on black background |
| strip_to_dots | Strip text to ... if does not fit to width |