[FL-1906] Documentation: add Doxyfile, prepare sources for doxygen. (#741)

* Documentation: add Doxyfile, prepare sources for doxygen.

* Update ReadMe and remove obsolete CLA

* Add contribution guide

* Contributing: update text

* Correct spelling
This commit is contained in:
あく
2021-10-03 13:36:05 +03:00
committed by GitHub
parent 1208a5077f
commit 89a6c09a7a
66 changed files with 4846 additions and 1224 deletions

View File

@@ -1,4 +1,10 @@
/**
* @file button_menu.h
* GUI: ButtonMenu view module API
*/
#pragma once
#include <stdint.h>
#include <gui/view.h>
@@ -6,40 +12,48 @@
extern "C" {
#endif
/* ButtonMenu anonymous structure */
/** ButtonMenu anonymous structure */
typedef struct ButtonMenu ButtonMenu;
/** ButtonMenuItem anonymous structure */
typedef struct ButtonMenuItem ButtonMenuItem;
/* Callback for any button menu actions */
/** Callback for any button menu actions */
typedef void (*ButtonMenuItemCallback)(void* context, int32_t index, InputType type);
/* Type of button. Difference in drawing buttons. */
/** Type of button. Difference in drawing buttons. */
typedef enum {
ButtonMenuItemTypeCommon,
ButtonMenuItemTypeControl,
} ButtonMenuItemType;
/**
* @brief Get button menu view
* @param button_menu - ButtonMenu instance
* @return View instance that can be used for embedding
/** Get button menu view
*
* @param button_menu ButtonMenu instance
*
* @return View instance that can be used for embedding
*/
View* button_menu_get_view(ButtonMenu* button_menu);
/**
* @brief Clean button menu
* @param button_menu - ButtonMenu instance
/** Clean button menu
*
* @param button_menu ButtonMenu instance
*/
void button_menu_clean(ButtonMenu* button_menu);
/**
* @brief Add item to button menu instance
* @param button_menu - ButtonMenu instance
* @param label - text inside new button
* @param index - value to distinct between buttons inside ButtonMenuItemCallback
* @param type - type of button to create. Differ by button drawing.
* Control buttons have no frames, and have more squared borders.
* @return pointer to just-created item
/** Add item to button menu instance
*
* @param button_menu ButtonMenu instance
* @param label text inside new button
* @param index value to distinct between buttons inside
* ButtonMenuItemCallback
* @param callback The callback
* @param type type of button to create. Differ by button
* drawing. Control buttons have no frames, and
* have more squared borders.
* @param callback_context The callback context
*
* @return pointer to just-created item
*/
ButtonMenuItem* button_menu_add_item(
ButtonMenu* button_menu,
@@ -49,29 +63,29 @@ ButtonMenuItem* button_menu_add_item(
ButtonMenuItemType type,
void* callback_context);
/**
* @brief Allocate and initialize new instance of ButtonMenu model
* @return just-created ButtonMenu model
/** Allocate and initialize new instance of ButtonMenu model
*
* @return just-created ButtonMenu model
*/
ButtonMenu* button_menu_alloc(void);
/**
* @brief Free ButtonMenu element
* @param button_menu - ButtonMenu instance
/** Free ButtonMenu element
*
* @param button_menu ButtonMenu instance
*/
void button_menu_free(ButtonMenu* button_menu);
/**
* @brief Set ButtonMenu header on top of canvas
* @param button_menu - ButtonMenu instance
* @param header - header on the top of button menu
/** Set ButtonMenu header on top of canvas
*
* @param button_menu ButtonMenu instance
* @param header header on the top of button menu
*/
void button_menu_set_header(ButtonMenu* button_menu, const char* header);
/**
* @brief Set selected item
* @param button_menu - ButtonMenu instance
* @param index - index of ButtonMenu to be selected
/** Set selected item
*
* @param button_menu ButtonMenu instance
* @param index index of ButtonMenu to be selected
*/
void button_menu_set_selected_item(ButtonMenu* button_menu, uint32_t index);

View File

@@ -1,4 +1,10 @@
/**
* @file button_panel.h
* GUI: ButtonPanel view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
@@ -10,37 +16,39 @@ typedef struct ButtonPanel ButtonPanel;
/** Callback type to call for handling selecting button_panel items */
typedef void (*ButtonItemCallback)(void* context, uint32_t index);
/** Callback type for additional drawings above main button_panel screen */
typedef void (*ButtonPanelDrawCallback)(Canvas* canvas, void* _model);
/** Callback type to intercept input events of button_panel */
typedef bool (*ButtonPanelInputCallback)(InputEvent* event, void* context);
/** Allocate new button_panel module.
*
* @return just-created module
* @return ButtonPanel instance
*/
ButtonPanel* button_panel_alloc(void);
/** Free button_panel module.
*
* @param button_panel - module to free
* @param button_panel ButtonPanel instance
*/
void button_panel_free(ButtonPanel* button_panel);
/** Free items from button_panel module. Preallocated matrix stays unchanged.
*
* @param button_panel - module to clean
* @param button_panel ButtonPanel instance
*/
void button_panel_clean(ButtonPanel* button_panel);
/** Reserve space for adding items.
*
* One does not simply use button_panel_add_item() without this function.
* It should be allocated space for it first.
* One does not simply use button_panel_add_item() without this function. It
* should be allocated space for it first.
*
* @param button_panel - module to modify
* @param reserve_x - number of columns in button_panel
* @param reserve_y - number of rows in button_panel
* @param button_panel ButtonPanel instance
* @param reserve_x number of columns in button_panel
* @param reserve_y number of rows in button_panel
*/
void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t reserve_y);
@@ -48,20 +56,20 @@ void button_panel_reserve(ButtonPanel* button_panel, size_t reserve_x, size_t re
*
* Have to set element in bounds of allocated size by X and by Y.
*
* @param button_panel - module
* @param index - value to pass to callback
* @param matrix_place_x - coordinates by x-axis on virtual grid, it
* is only used for naviagation
* @param matrix_place_y - coordinates by y-axis on virtual grid, it
* is only used for naviagation
* @param x - x-coordinate to draw icon on
* @param y - y-coordinate to draw icon on
* @param icon_name - name of the icon to draw
* @param icon_name_selected - name of the icon to draw when current
* element is selected
* @param callback - function to call when specific element is selected
* (pressed Ok on selected item)
* @param callback_context - context to pass to callback
* @param button_panel ButtonPanel instance
* @param index value to pass to callback
* @param matrix_place_x coordinates by x-axis on virtual grid, it
* is only used for naviagation
* @param matrix_place_y coordinates by y-axis on virtual grid, it
* is only used for naviagation
* @param x x-coordinate to draw icon on
* @param y y-coordinate to draw icon on
* @param icon_name name of the icon to draw
* @param icon_name_selected name of the icon to draw when current
* element is selected
* @param callback function to call when specific element is
* selected (pressed Ok on selected item)
* @param callback_context context to pass to callback
*/
void button_panel_add_item(
ButtonPanel* button_panel,
@@ -77,17 +85,19 @@ void button_panel_add_item(
/** Get button_panel view.
*
* @param button_panel - module to get view from
* @return acquired view
* @param button_panel ButtonPanel instance
*
* @return acquired view
*/
View* button_panel_get_view(ButtonPanel* button_panel);
/** Add label to button_panel module.
*
* @param x - x-coordinate to place label
* @param y - y-coordinate to place label
* @param font - font to write label with
* @param label_str - string label to write
* @param button_panel ButtonPanel instance
* @param x x-coordinate to place label
* @param y y-coordinate to place label
* @param font font to write label with
* @param label_str string label to write
*/
void button_panel_add_label(
ButtonPanel* button_panel,
@@ -101,9 +111,9 @@ void button_panel_add_label(
*
* Used to add popup drawings after main draw callback is done.
*
* @param button_panel - module to modify
* @param callback - callback function to set for draw event
* @param context - context to pass to callback
* @param button_panel ButtonPanel instance
* @param callback callback function to set for draw event
* @param context context to pass to callback
*/
void button_panel_set_popup_draw_callback(
ButtonPanel* button_panel,
@@ -112,12 +122,12 @@ void button_panel_set_popup_draw_callback(
/** Set popup input callback for button_panel module.
*
* Used to add popup input callback. It will intercept all input
* events for current view.
* Used to add popup input callback. It will intercept all input events for
* current view.
*
* @param button_panel - module to modify
* @param callback - function to overwrite main input callbacks
* @param context - context to pass to callback
* @param button_panel ButtonPanel instance
* @param callback function to overwrite main input callbacks
* @param context context to pass to callback
*/
void button_panel_set_popup_input_callback(
ButtonPanel* button_panel,

View File

@@ -1,59 +1,53 @@
/**
* @file byte_input.h
* GUI: ByteInput keyboard view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Byte input anonymous structure
*
*/
/** Byte input anonymous structure */
typedef struct ByteInput ByteInput;
/**
* @brief callback that is executed on save button press
*
*/
/** callback that is executed on save button press */
typedef void (*ByteInputCallback)(void* context);
/**
* @brief callback that is executed when byte buffer is changed
*
*/
/** callback that is executed when byte buffer is changed */
typedef void (*ByteChangedCallback)(void* context);
/**
* @brief Allocate and initialize byte input. This byte input is used to enter bytes.
*
* @return ByteInput instance pointer
/** Allocate and initialize byte input. This byte input is used to enter bytes.
*
* @return ByteInput instance pointer
*/
ByteInput* byte_input_alloc();
/**
* @brief Deinitialize and free byte input
*
* @param byte_input Byte input instance
/** Deinitialize and free byte input
*
* @param byte_input Byte input instance
*/
void byte_input_free(ByteInput* byte_input);
/**
* @brief Get byte input view
*
* @param byte_input byte input instance
* @return View instance that can be used for embedding
/** Get byte input view
*
* @param byte_input byte input instance
*
* @return View instance that can be used for embedding
*/
View* byte_input_get_view(ByteInput* byte_input);
/**
* @brief Set byte input result callback
*
* @param byte_input byte input instance
* @param input_callback input callback fn
* @param changed_callback changed callback fn
* @param callback_context callback context
* @param bytes buffer to use
* @param bytes_count buffer length
/** Set byte input result callback
*
* @param byte_input byte input instance
* @param input_callback input callback fn
* @param changed_callback changed callback fn
* @param callback_context callback context
* @param bytes buffer to use
* @param bytes_count buffer length
*/
void byte_input_set_result_callback(
ByteInput* byte_input,
@@ -63,11 +57,10 @@ void byte_input_set_result_callback(
uint8_t* bytes,
uint8_t bytes_count);
/**
* @brief Set byte input header text
*
* @param byte_input byte input instance
* @param text text to be shown
/** Set byte input header text
*
* @param byte_input byte input instance
* @param text text to be shown
*/
void byte_input_set_header_text(ByteInput* byte_input, const char* text);

View File

@@ -1,77 +1,95 @@
/**
* @file dialog.h
* GUI: Dialog view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dialog anonymous structure */
/** Dialog anonymous structure */
typedef struct Dialog Dialog;
/* Dialog result */
/** Dialog result */
typedef enum {
DialogResultLeft,
DialogResultRight,
DialogResultBack,
} DialogResult;
/* Dialog result callback type
* @warning comes from GUI thread
/** Dialog result callback type
* @warning comes from GUI thread
*/
typedef void (*DialogResultCallback)(DialogResult result, void* context);
/* Allocate and initialize dialog
/** Allocate and initialize dialog
*
* This dialog used to ask simple questions like Yes/
*
* @return Dialog instance
*/
Dialog* dialog_alloc();
/* Deinitialize and free dialog
* @param dialog - Dialog instance
/** Deinitialize and free dialog
*
* @param dialog Dialog instance
*/
void dialog_free(Dialog* dialog);
/* Get dialog view
* @param dialog - Dialog instance
* @return View instance that can be used for embedding
/** Get dialog view
*
* @param dialog Dialog instance
*
* @return View instance that can be used for embedding
*/
View* dialog_get_view(Dialog* dialog);
/* Set dialog result callback
* @param dialog - Dialog instance
* @param callback - result callback function
/** Set dialog result callback
*
* @param dialog Dialog instance
* @param callback result callback function
*/
void dialog_set_result_callback(Dialog* dialog, DialogResultCallback callback);
/* Set dialog context
* @param dialog - Dialog instance
* @param context - context pointer, will be passed to result callback
/** Set dialog context
*
* @param dialog Dialog instance
* @param context context pointer, will be passed to result callback
*/
void dialog_set_context(Dialog* dialog, void* context);
/* Set dialog header text
* @param dialog - Dialog instance
* @param text - text to be shown
/** Set dialog header text
*
* @param dialog Dialog instance
* @param text text to be shown
*/
void dialog_set_header_text(Dialog* dialog, const char* text);
/* Set dialog text
* @param dialog - Dialog instance
* @param text - text to be shown
/** Set dialog text
*
* @param dialog Dialog instance
* @param text text to be shown
*/
void dialog_set_text(Dialog* dialog, const char* text);
/* Set left button text
* @param dialog - Dialog instance
* @param text - text to be shown
/** Set left button text
*
* @param dialog Dialog instance
* @param text text to be shown
*/
void dialog_set_left_button_text(Dialog* dialog, const char* text);
/* Set right button text
* @param dialog - Dialog instance
* @param text - text to be shown
/** Set right button text
*
* @param dialog Dialog instance
* @param text text to be shown
*/
void dialog_set_right_button_text(Dialog* dialog, const char* text);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,4 +1,10 @@
/**
* @file dialog_ex.h
* GUI: DialogEx view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
@@ -21,40 +27,51 @@ typedef enum {
typedef void (*DialogExResultCallback)(DialogExResult result, void* context);
/** Allocate and initialize dialog
*
* This dialog used to ask simple questions
* @return DialogEx instance
*
* @return DialogEx instance
*/
DialogEx* dialog_ex_alloc();
/** Deinitialize and free dialog
* @param dialog - DialogEx instance
*
* @param dialog_ex DialogEx instance
*/
void dialog_ex_free(DialogEx* dialog_ex);
/** Get dialog view
* @param dialog - DialogEx instance
* @return View instance that can be used for embedding
*
* @param dialog_ex DialogEx instance
*
* @return View instance that can be used for embedding
*/
View* dialog_ex_get_view(DialogEx* dialog_ex);
/** Set dialog result callback
* @param dialog_ex - DialogEx instance
* @param callback - result callback function
*
* @param dialog_ex DialogEx instance
* @param callback result callback function
*/
void dialog_ex_set_result_callback(DialogEx* dialog_ex, DialogExResultCallback callback);
/** Set dialog context
* @param dialog_ex - DialogEx instance
* @param context - context pointer, will be passed to result callback
*
* @param dialog_ex DialogEx instance
* @param context context pointer, will be passed to result callback
*/
void dialog_ex_set_context(DialogEx* dialog_ex, void* context);
/** Set dialog header text
*
* If text is null, dialog header will not be rendered
* @param dialog - DialogEx instance
* @param text - text to be shown, can be multiline
* @param x, y - text position
* @param horizontal, vertical - text aligment
*
* @param dialog_ex DialogEx instance
* @param text text to be shown, can be multiline
* @param x x position
* @param y y position
* @param horizontal horizontal text aligment
* @param vertical vertical text aligment
*/
void dialog_ex_set_header(
DialogEx* dialog_ex,
@@ -65,11 +82,15 @@ void dialog_ex_set_header(
Align vertical);
/** Set dialog text
*
* If text is null, dialog text will not be rendered
* @param dialog - DialogEx instance
* @param text - text to be shown, can be multiline
* @param x, y - text position
* @param horizontal, vertical - text aligment
*
* @param dialog_ex DialogEx instance
* @param text text to be shown, can be multiline
* @param x x position
* @param y y position
* @param horizontal horizontal text aligment
* @param vertical vertical text aligment
*/
void dialog_ex_set_text(
DialogEx* dialog_ex,
@@ -80,36 +101,47 @@ void dialog_ex_set_text(
Align vertical);
/** Set dialog icon
*
* If x or y is negative, dialog icon will not be rendered
* @param dialog - DialogEx instance
* @param x, y - icon position
* @param name - icon to be shown
*
* @param dialog_ex DialogEx instance
* @param x x position
* @param y y position
* @param icon The icon
* @param name icon to be shown
*/
void dialog_ex_set_icon(DialogEx* dialog_ex, uint8_t x, uint8_t y, const Icon* icon);
/** Set left button text
*
* If text is null, left button will not be rendered and processed
* @param dialog - DialogEx instance
* @param text - text to be shown
*
* @param dialog_ex DialogEx instance
* @param text text to be shown
*/
void dialog_ex_set_left_button_text(DialogEx* dialog_ex, const char* text);
/** Set center button text
*
* If text is null, center button will not be rendered and processed
* @param dialog - DialogEx instance
* @param text - text to be shown
*
* @param dialog_ex DialogEx instance
* @param text text to be shown
*/
void dialog_ex_set_center_button_text(DialogEx* dialog_ex, const char* text);
/** Set right button text
*
* If text is null, right button will not be rendered and processed
* @param dialog - DialogEx instance
* @param text - text to be shown
*
* @param dialog_ex DialogEx instance
* @param text text to be shown
*/
void dialog_ex_set_right_button_text(DialogEx* dialog_ex, const char* text);
/** Clean dialog
* @param dialog_ex DialogEx instance
*
* @param dialog_ex DialogEx instance
*/
void dialog_ex_clean(DialogEx* dialog_ex);

View File

@@ -1,26 +1,38 @@
/**
* @file empty_screen.h
* GUI: EmptyScreen view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Empty screen anonymous structure */
/** Empty screen anonymous structure */
typedef struct EmptyScreen EmptyScreen;
/* Allocate and initialize empty screen
/** Allocate and initialize empty screen
*
* This empty screen used to ask simple questions like Yes/
*
* @return EmptyScreen instance
*/
EmptyScreen* empty_screen_alloc();
/* Deinitialize and free empty screen
* @param empty_screen - Empty screen instance
/** Deinitialize and free empty screen
*
* @param empty_screen Empty screen instance
*/
void empty_screen_free(EmptyScreen* empty_screen);
/* Get empty screen view
* @param empty_screen - Empty screen instance
* @return View instance that can be used for embedding
/** Get empty screen view
*
* @param empty_screen Empty screen instance
*
* @return View instance that can be used for embedding
*/
View* empty_screen_get_view(EmptyScreen* empty_screen);

View File

@@ -1,4 +1,10 @@
/**
* @file file_select.h
* GUI: FileSelect view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus

View File

@@ -1,4 +1,10 @@
/**
* @file menu.h
* GUI: Menu view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
@@ -7,31 +13,38 @@ extern "C" {
/** Menu anonymous structure */
typedef struct Menu Menu;
/** Menu Item Callback */
typedef void (*MenuItemCallback)(void* context, uint32_t index);
/** Menu allocation and initialization
* @return Menu instance
*
* @return Menu instance
*/
Menu* menu_alloc();
/** Free menu
* @param menu - Menu instance
*
* @param menu Menu instance
*/
void menu_free(Menu* menu);
/** Get Menu view
* @param menu - Menu instance
* @return View instance
*
* @param menu Menu instance
*
* @return View instance
*/
View* menu_get_view(Menu* menu);
/** Add item to menu
* @param menu - Menu instance
* @param label - menu item string label
* @param icon - IconAnimation instance
* @param index - menu item index
* @param callback - MenuItemCallback instance
* @param context - pointer to context
*
* @param menu Menu instance
* @param label menu item string label
* @param icon IconAnimation instance
* @param index menu item index
* @param callback MenuItemCallback instance
* @param context pointer to context
*/
void menu_add_item(
Menu* menu,
@@ -42,14 +55,16 @@ void menu_add_item(
void* context);
/** Clean menu
* Note: this function does not free menu instance
* @param menu - Menu instance
* @note this function does not free menu instance
*
* @param menu Menu instance
*/
void menu_clean(Menu* menu);
/** Set current menu item
* @param submenu
* @param index
*
* @param menu Menu instance
* @param index The index
*/
void menu_set_selected_item(Menu* menu, uint32_t index);

View File

@@ -1,52 +1,70 @@
/**
* @file popup.h
* GUI: Popup view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Popup anonymous structure */
/** Popup anonymous structure */
typedef struct Popup Popup;
/* Popup result callback type
* @warning comes from GUI thread
/** Popup result callback type
* @warning comes from GUI thread
*/
typedef void (*PopupCallback)(void* context);
/* Allocate and initialize popup
/** Allocate and initialize popup
*
* This popup used to ask simple questions like Yes/
*
* @return Popup instance
*/
Popup* popup_alloc();
/* Deinitialize and free popup
* @param popup - Popup instance
/** Deinitialize and free popup
*
* @param popup Popup instance
*/
void popup_free(Popup* popup);
/* Get popup view
* @param popup - Popup instance
* @return View instance that can be used for embedding
/** Get popup view
*
* @param popup Popup instance
*
* @return View instance that can be used for embedding
*/
View* popup_get_view(Popup* popup);
/* Set popup header text
* @param popup - Popup instance
* @param text - text to be shown
/** Set popup header text
*
* @param popup Popup instance
* @param callback PopupCallback
*/
void popup_set_callback(Popup* popup, PopupCallback callback);
/* Set popup context
* @param popup - Popup instance
* @param context - context pointer, will be passed to result callback
/** Set popup context
*
* @param popup Popup instance
* @param context context pointer, will be passed to result callback
*/
void popup_set_context(Popup* popup, void* context);
/* Set popup header text
/** Set popup header text
*
* If text is null, popup header will not be rendered
* @param popup - Popup instance
* @param text - text to be shown, can be multiline
* @param x, y - text position
* @param horizontal, vertical - text aligment
*
* @param popup Popup instance
* @param text text to be shown, can be multiline
* @param x x position
* @param y y position
* @param horizontal horizontal alignment
* @param vertical vertical aligment
*/
void popup_set_header(
Popup* popup,
@@ -56,12 +74,16 @@ void popup_set_header(
Align horizontal,
Align vertical);
/* Set popup text
/** Set popup text
*
* If text is null, popup text will not be rendered
* @param popup - Popup instance
* @param text - text to be shown, can be multiline
* @param x, y - text position
* @param horizontal, vertical - text aligment
*
* @param popup Popup instance
* @param text text to be shown, can be multiline
* @param x x position
* @param y y position
* @param horizontal horizontal alignment
* @param vertical vertical aligment
*/
void popup_set_text(
Popup* popup,
@@ -71,30 +93,36 @@ void popup_set_text(
Align horizontal,
Align vertical);
/* Set popup icon
/** Set popup icon
*
* If icon position is negative, popup icon will not be rendered
* @param popup - Popup instance
* @param x, y - icon position
* @param name - icon to be shown
*
* @param popup Popup instance
* @param x x position
* @param y y position
* @param icon pointer to Icon data
*/
void popup_set_icon(Popup* popup, uint8_t x, uint8_t y, const Icon* icon);
/* Set popup timeout
* @param popup - Popup instance
* @param timeout_in_ms - popup timeout value in milliseconds
/** Set popup timeout
*
* @param popup Popup instance
* @param timeout_in_ms popup timeout value in milliseconds
*/
void popup_set_timeout(Popup* popup, uint32_t timeout_in_ms);
/* Enable popup timeout
* @param popup - Popup instance
/** Enable popup timeout
*
* @param popup Popup instance
*/
void popup_enable_timeout(Popup* popup);
/* Disable popup timeout
* @param popup - Popup instance
/** Disable popup timeout
*
* @param popup Popup instance
*/
void popup_disable_timeout(Popup* popup);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,40 +1,50 @@
/**
* @file submenu.h
* GUI: SubMenu view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Submenu anonymous structure */
/** Submenu anonymous structure */
typedef struct Submenu Submenu;
typedef void (*SubmenuItemCallback)(void* context, uint32_t index);
/**
* @brief Allocate and initialize submenu
/** Allocate and initialize submenu
*
* This submenu is used to select one option
*
* @return Submenu instance
*/
Submenu* submenu_alloc();
/**
* @brief Deinitialize and free submenu
* @param submenu - Submenu instance
/** Deinitialize and free submenu
*
* @param submenu Submenu instance
*/
void submenu_free(Submenu* submenu);
/**
* @brief Get submenu view
* @param submenu - Submenu instance
* @return View instance that can be used for embedding
/** Get submenu view
*
* @param submenu Submenu instance
*
* @return View instance that can be used for embedding
*/
View* submenu_get_view(Submenu* submenu);
/**
* @brief Add item to submenu
* @param submenu - Submenu instance
* @param label - menu item label
* @param index - menu item index, used for callback, may be the same with other items
* @param callback - menu item callback
* @param callback_context - menu item callback context
/** Add item to submenu
*
* @param submenu Submenu instance
* @param label menu item label
* @param index menu item index, used for callback, may be
* the same with other items
* @param callback menu item callback
* @param callback_context menu item callback context
*/
void submenu_add_item(
Submenu* submenu,
@@ -43,23 +53,23 @@ void submenu_add_item(
SubmenuItemCallback callback,
void* callback_context);
/**
* @brief Remove all items from submenu
* @param submenu - Submenu instance
/** Remove all items from submenu
*
* @param submenu Submenu instance
*/
void submenu_clean(Submenu* submenu);
/**
* @brief Set submenu item selector
* @param submenu
* @param index
/** Set submenu item selector
*
* @param submenu Submenu instance
* @param index The index
*/
void submenu_set_selected_item(Submenu* submenu, uint32_t index);
/**
* @brief Set optional header for submenu
* @param submenu - submenu entity
* @param header - header to set
/** Set optional header for submenu
*
* @param submenu Submenu instance
* @param header header to set
*/
void submenu_set_header(Submenu* submenu, const char* header);

View File

@@ -1,11 +1,17 @@
/**
* @file text_box.h
* GUI: TextBox view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/* TextBox anonymous structure */
/** TextBox anonymous structure */
typedef struct TextBox TextBox;
typedef void (*TextBoxExitCallback)(void* context);
@@ -15,46 +21,56 @@ typedef enum {
} TextBoxFont;
/** Allocate and initialize text_box
*
* @return TextBox instance
*/
TextBox* text_box_alloc();
/** Deinitialize and free text_box
* @param text_box text_box instance
*
* @param text_box text_box instance
*/
void text_box_free(TextBox* text_box);
/** Get text_box view
* @param text_box TextBox instance
* @return View instance that can be used for embedding
*
* @param text_box TextBox instance
*
* @return View instance that can be used for embedding
*/
View* text_box_get_view(TextBox* text_box);
/** Clean text_box
* @param text_box TextBox instance
*
* @param text_box TextBox instance
*/
void text_box_clean(TextBox* text_box);
/** Set text for text_box
* @param text_box TextBox instance
* @param text text to set
*
* @param text_box TextBox instance
* @param text text to set
*/
void text_box_set_text(TextBox* text_box, const char* text);
/** Set TextBox font
* @param text_box TextBox instance
* @param font TextBoxFont instance
*
* @param text_box TextBox instance
* @param font TextBoxFont instance
*/
void text_box_set_font(TextBox* text_box, TextBoxFont font);
/** Set text_box context
* @param text_box TextBox instance
* @param context context pointer
*
* @param text_box TextBox instance
* @param context context pointer
*/
void text_box_set_context(TextBox* text_box, void* context);
/** Set exit callback
* @param text_box TextBox instance
* @param callback TextBoxExitCallback callback pointer
*
* @param text_box TextBox instance
* @param callback TextBoxExitCallback callback pointer
*/
void text_box_set_exit_callback(TextBox* text_box, TextBoxExitCallback callback);

View File

@@ -1,44 +1,59 @@
/**
* @file text_input.h
* GUI: TextInput keybord view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Text input anonymous structure */
/** Text input anonymous structure */
typedef struct TextInput TextInput;
typedef void (*TextInputCallback)(void* context);
/** Allocate and initialize text input
/** Allocate and initialize text input
*
* This text input is used to enter string
* @return TextInput instance
*
* @return TextInput instance
*/
TextInput* text_input_alloc();
/** Deinitialize and free text input
* @param text_input - TextInput instance
*
* @param text_input TextInput instance
*/
void text_input_free(TextInput* text_input);
/** Clean text input view
* Note: this function does not free memory
* @param text_input - Text input instance
/** Clean text input view Note: this function does not free memory
*
* @param text_input Text input instance
*/
void text_input_clean(TextInput* text_input);
/** Get text input view
* @param text_input - TextInput instance
* @return View instance that can be used for embedding
*
* @param text_input TextInput instance
*
* @return View instance that can be used for embedding
*/
View* text_input_get_view(TextInput* text_input);
/** Set text input result callback
* @param text_input - TextInput instance
* @param callback - callback fn
* @param callback_context - callback context
* @param text_buffer - pointer to YOUR text buffer, that we going to modify
* @param text_buffer_size - YOUR text buffer size in bytes. Max string length will be text_buffer_size - 1.
* @param clear_default_text - clear text from text_buffer on first OK event
*
* @param text_input TextInput instance
* @param callback callback fn
* @param callback_context callback context
* @param text_buffer pointer to YOUR text buffer, that we going
* to modify
* @param text_buffer_size YOUR text buffer size in bytes. Max string
* length will be text_buffer_size-1.
* @param clear_default_text clear text from text_buffer on first OK
* event
*/
void text_input_set_result_callback(
TextInput* text_input,
@@ -49,8 +64,9 @@ void text_input_set_result_callback(
bool clear_default_text);
/** Set text input header text
* @param text_input - TextInput instance
* @param text - text to be shown
*
* @param text_input TextInput instance
* @param text text to be shown
*/
void text_input_set_header_text(TextInput* text_input, const char* text);

View File

@@ -1,4 +1,10 @@
/**
* @file variable-item-list.h
* GUI: VariableItemList view module API
*/
#pragma once
#include <gui/view.h>
#ifdef __cplusplus
@@ -11,29 +17,40 @@ typedef void (*VariableItemChangeCallback)(VariableItem* item);
typedef void (*VariableItemListEnterCallback)(void* context, uint32_t index);
/** Allocate and initialize VariableItemList
* @return VariableItemList*
*
* @return VariableItemList*
*/
VariableItemList* variable_item_list_alloc();
/** Deinitialize and free VariableItemList
* @param variable_item_list VariableItemList instance
*
* @param variable_item_list VariableItemList instance
*/
void variable_item_list_free(VariableItemList* variable_item_list);
/** Clear all elements from list
* @param variable_item_list VariableItemList instance
*
* @param variable_item_list VariableItemList instance
*/
void variable_item_list_clean(VariableItemList* variable_item_list);
/** Get VariableItemList View instance
*
* @param variable_item_list VariableItemList instance
*
* @return View instance
*/
View* variable_item_list_get_view(VariableItemList* variable_item_list);
/** Add item to VariableItemList
* @param variable_item_list VariableItemList instance
* @param label item name
* @param values_count item values count
* @param change_callback called on value change in gui
* @param context item context
* @return VariableItem* item instance
*
* @param variable_item_list VariableItemList instance
* @param label item name
* @param values_count item values count
* @param change_callback called on value change in gui
* @param context item context
*
* @return VariableItem* item instance
*/
VariableItem* variable_item_list_add(
VariableItemList* variable_item_list,
@@ -43,9 +60,10 @@ VariableItem* variable_item_list_add(
void* context);
/** Set enter callback
* @param variable_item_list VariableItemList instance
* @param calback VariableItemListEnterCallback instance
* @param context pointer to context
*
* @param variable_item_list VariableItemList instance
* @param callback VariableItemListEnterCallback instance
* @param context pointer to context
*/
void variable_item_list_set_enter_callback(
VariableItemList* variable_item_list,
@@ -53,29 +71,35 @@ void variable_item_list_set_enter_callback(
void* context);
/** Set item current selected index
* @param item VariableItem* instance
* @param current_value_index
*
* @param item VariableItem* instance
* @param current_value_index The current value index
*/
void variable_item_set_current_value_index(VariableItem* item, uint8_t current_value_index);
/** Set item current selected text
* @param item VariableItem* instance
* @param current_value_text
*
* @param item VariableItem* instance
* @param current_value_text The current value text
*/
void variable_item_set_current_value_text(VariableItem* item, const char* current_value_text);
/** Get item current selected index
* @param item VariableItem* instance
* @return uint8_t current selected index
*
* @param item VariableItem* instance
*
* @return uint8_t current selected index
*/
uint8_t variable_item_get_current_value_index(VariableItem* item);
/** Get item context
* @param item VariableItem* instance
* @return void* item context
*
* @param item VariableItem* instance
*
* @return void* item context
*/
void* variable_item_get_context(VariableItem* item);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,38 +1,51 @@
/**
* @file widget.h
* GUI: Widget view module API
*/
#pragma once
#include "widget_elements/widget_element_i.h"
typedef struct Widget Widget;
typedef struct WidgetElement WidgetElement;
/** Allocate Widget that holds Widget Elements
* @return Widget instance
*
* @return Widget instance
*/
Widget* widget_alloc();
/** Free Widget
* @note this function free allocated Widget Elements
* @param widget Widget instance
* @note this function free allocated Widget Elements
*
* @param widget Widget instance
*/
void widget_free(Widget* widget);
/** Clear Widget
* @param widget Widget instance
*
* @param widget Widget instance
*/
void widget_clear(Widget* widget);
/** Get Widget view
* @param widget Widget instance
* @return View instance
*
* @param widget Widget instance
*
* @return View instance
*/
View* widget_get_view(Widget* widget);
/** Add Multi String Element
* @param widget Widget instance
* @param x - x coordinate
* @param y - y coordinate
* @param horizontal - Align instance
* @param vertical - Align instance
* @param font Font instance
*
* @param widget Widget instance
* @param x x coordinate
* @param y y coordinate
* @param horizontal Align instance
* @param vertical Align instance
* @param font Font instance
* @param[in] text The text
*/
void widget_add_string_multiline_element(
Widget* widget,
@@ -44,12 +57,14 @@ void widget_add_string_multiline_element(
const char* text);
/** Add String Element
* @param widget Widget instance
* @param x - x coordinate
* @param y - y coordinate
* @param horizontal - Align instance
* @param vertical - Align instance
* @param font Font instance
*
* @param widget Widget instance
* @param x x coordinate
* @param y y coordinate
* @param horizontal Align instance
* @param vertical Align instance
* @param font Font instance
* @param[in] text The text
*/
void widget_add_string_element(
Widget* widget,
@@ -61,11 +76,12 @@ void widget_add_string_element(
const char* text);
/** Add Button Element
* @param widget Widget instance
* @param button_type GuiButtonType instance
* @param text text on allocated button
* @param callback ButtonCallback instance
* @param context pointer to context
*
* @param widget Widget instance
* @param button_type GuiButtonType instance
* @param text text on allocated button
* @param callback ButtonCallback instance
* @param context pointer to context
*/
void widget_add_button_element(
Widget* widget,
@@ -75,20 +91,22 @@ void widget_add_button_element(
void* context);
/** Add Icon Element
* @param widget Widget instance
* @param x top left x coordinate
* @param y top left y coordinate
* @param icon Icon instance
*
* @param widget Widget instance
* @param x top left x coordinate
* @param y top left y coordinate
* @param icon Icon instance
*/
void widget_add_icon_element(Widget* widget, uint8_t x, uint8_t y, const Icon* icon);
/** Add Frame Element
* @param widget Widget instance
* @param x top left x coordinate
* @param y top left y coordinate
* @param width frame width
* @param height frame height
* @param radius frame radius
*
* @param widget Widget instance
* @param x top left x coordinate
* @param y top left y coordinate
* @param width frame width
* @param height frame height
* @param radius frame radius
*/
void widget_add_frame_element(
Widget* widget,

View File

@@ -1,3 +1,8 @@
/**
* @file widget_element_i.h
* GUI: internal Widget Element API
*/
#pragma once
#include <furi.h>
#include <gui/view.h>
@@ -29,7 +34,7 @@ struct WidgetElement {
Widget* parent;
};
/* Create multi string element */
/** Create multi string element */
WidgetElement* widget_element_string_multiline_create(
uint8_t x,
uint8_t y,
@@ -38,7 +43,7 @@ WidgetElement* widget_element_string_multiline_create(
Font font,
const char* text);
/* Create string element */
/** Create string element */
WidgetElement* widget_element_string_create(
uint8_t x,
uint8_t y,
@@ -47,20 +52,20 @@ WidgetElement* widget_element_string_create(
Font font,
const char* text);
/* Create button element */
/** Create button element */
WidgetElement* widget_element_button_create(
GuiButtonType button_type,
const char* text,
ButtonCallback callback,
void* context);
/* Create icon element */
/** Create icon element */
WidgetElement* widget_element_icon_create(uint8_t x, uint8_t y, const Icon* icon);
/* Create frame element */
/** Create frame element */
WidgetElement* widget_element_frame_create(
uint8_t x,
uint8_t y,
uint8_t width,
uint8_t height,
uint8_t radius);
uint8_t radius);