|
Embedded SDK
Embedded SDK
|
Implementation of predefined pages management for Applications. More...
#include <string.h>#include "nbgl_debug.h"#include "nbgl_step_internal.h"#include "nbgl_layout_internal_nanos.h"#include "glyphs.h"#include "os_pic.h"#include "os_print.h"
Go to the source code of this file.
Classes | |
| struct | TextContext_s |
| struct | MenuListContext_s |
| struct | StepContext_s |
Macros | |
| #define | TMP_STRING_MAX_LEN 24 |
| Maximum number of layers for steps, cannot be greater than max number of layout layers. | |
| #define | NB_MAX_LAYERS 3 |
Typedefs | |
| typedef struct TextContext_s | TextContext_t |
| typedef struct MenuListContext_s | MenuListContext_t |
| typedef struct StepContext_s | StepContext_t |
Enumerations | |
| enum | StepStype_t { TEXT_STEP = 0 , CENTERED_INFO_STEP , MENU_LIST_STEP } |
Functions | |
| static void | actionCallback (nbgl_layout_t *layout, nbgl_buttonEvent_t event) |
| static void | menuListActionCallback (nbgl_layout_t *layout, nbgl_buttonEvent_t event) |
| static StepContext_t * | getFreeContext (StepStype_t type, bool modal) |
| static StepContext_t * | getContextFromLayout (nbgl_layout_t layout) |
| static bool | getStepLayout (StepContext_t *ctx, const nbgl_layoutDescription_t *layoutDescription) |
| static uint16_t | getSubTextPageLen (StepContext_t *ctx, const char *subText) |
| static uint16_t | getPageLen (StepContext_t *ctx, const char *txt) |
| static const char * | getPageAt (StepContext_t *ctx, uint16_t textPage) |
| static nbgl_layoutNavIndication_t | getNavigationInfo (nbgl_stepPosition_t pos, uint16_t nbPages, uint16_t currentPage) |
| static void | displayTextPage (StepContext_t *ctx, uint16_t textPage) |
| static void | displayMenuList (StepContext_t *ctx) |
| nbgl_step_t | nbgl_stepDrawText (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style, bool modal) |
| draws a text type step, that can be multi-pages, depending of the length of text and subText. The navigation arrows are displayed depending of the given position of this step in a flow, and depending of the page in case of multi-pages | |
| nbgl_step_t | stepDrawText (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style, bool modal, uint8_t nbMaxLinesForSubText) |
| Same as nbgl_stepDrawText(), with the possibility to truncate subText. | |
| nbgl_step_t | nbgl_stepDrawCenteredInfo (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutCenteredInfo_t *info, bool modal) |
| draw a step with a centered info (icon + text). This is always a single page step | |
| nbgl_step_t | nbgl_stepDrawMenuList (nbgl_stepMenuListCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutMenuList_t *list, bool modal) |
| draw a step page with a menu list and navigation arrows to parse it. This step must be alone | |
| uint8_t | nbgl_stepGetMenuListCurrent (nbgl_step_t step) |
| Get the index of the currently selected item in the menulist. | |
| nbgl_step_t | nbgl_stepDrawSwitch (nbgl_stepPosition_t pos, nbgl_stepButtonCallback_t onActionCallback, nbgl_screenTickerConfiguration_t *ticker, nbgl_layoutSwitch_t *switchInfo, bool modal) |
| draw a step page with a switch and navigation arrows to navigate to other pages. | |
| int | nbgl_stepRelease (nbgl_step_t step) |
| Release the step obtained with any of the nbgl_stepDrawXXX() functions. | |
Variables | |
| static StepContext_t | contexts [NB_MAX_LAYERS] |
| < array of step contexts. Index 0 is reserved for background | |
Implementation of predefined pages management for Applications.
Definition in file nbgl_step.c.
| #define NB_MAX_LAYERS 3 |
Definition at line 28 of file nbgl_step.c.
| #define TMP_STRING_MAX_LEN 24 |
Maximum number of layers for steps, cannot be greater than max number of layout layers.
Definition at line 25 of file nbgl_step.c.
| typedef struct MenuListContext_s MenuListContext_t |
definition of context for a MENU_LIST_STEP step
| typedef struct StepContext_s StepContext_t |
| typedef struct TextContext_s TextContext_t |
definition of context for a TEXT_STEP or CENTERED_INFO_STEP step
| enum StepStype_t |
type of step
| Enumerator | |
|---|---|
| TEXT_STEP | for a simple text step |
| CENTERED_INFO_STEP | for a centered info step |
| MENU_LIST_STEP | for a menu list step |
Definition at line 36 of file nbgl_step.c.
|
static |
Definition at line 381 of file nbgl_step.c.
|
static |
Definition at line 422 of file nbgl_step.c.
|
static |
Definition at line 268 of file nbgl_step.c.
|
static |
Definition at line 141 of file nbgl_step.c.
|
static |
Definition at line 110 of file nbgl_step.c.
|
static |
Definition at line 241 of file nbgl_step.c.
|
static |
Definition at line 226 of file nbgl_step.c.
|
static |
Definition at line 205 of file nbgl_step.c.
|
static |
Definition at line 163 of file nbgl_step.c.
|
static |
Definition at line 179 of file nbgl_step.c.
|
static |
Definition at line 455 of file nbgl_step.c.
| nbgl_step_t nbgl_stepDrawCenteredInfo | ( | nbgl_stepPosition_t | pos, |
| nbgl_stepButtonCallback_t | onActionCallback, | ||
| nbgl_screenTickerConfiguration_t * | ticker, | ||
| nbgl_layoutCenteredInfo_t * | info, | ||
| bool | modal ) |
draw a step with a centered info (icon + text). This is always a single page step
| pos | position of this step in the flow (first, last, single, not_first_nor_last) |
| onActionCallback | common callback for all actions on this page |
| ticker | ticker configuration, set to NULL to disable it |
| info | all information about the centered info to be displayed |
| modal | if true, means this step shall be displayed on top of existing one |
Definition at line 668 of file nbgl_step.c.
| nbgl_step_t nbgl_stepDrawMenuList | ( | nbgl_stepMenuListCallback_t | onActionCallback, |
| nbgl_screenTickerConfiguration_t * | ticker, | ||
| nbgl_layoutMenuList_t * | list, | ||
| bool | modal ) |
draw a step page with a menu list and navigation arrows to parse it. This step must be alone
| onActionCallback | common callback for all actions on this page |
| ticker | ticker configuration, set to NULL to disable it |
| list | configuration of the menu list |
| modal | if true, means this step shall be displayed on top of existing one |
Definition at line 724 of file nbgl_step.c.
| nbgl_step_t nbgl_stepDrawSwitch | ( | nbgl_stepPosition_t | pos, |
| nbgl_stepButtonCallback_t | onActionCallback, | ||
| nbgl_screenTickerConfiguration_t * | ticker, | ||
| nbgl_layoutSwitch_t * | switchInfo, | ||
| bool | modal ) |
draw a step page with a switch and navigation arrows to navigate to other pages.
| pos | position of this step in the flow (first, last, single, not_first_nor_last) |
| onActionCallback | common callback for all actions on this page |
| ticker | ticker configuration, set to NULL to disable it |
| switchInfo | all information about the switch to be displayed |
| modal | if true, means this step shall be displayed on top of existing one |
Definition at line 781 of file nbgl_step.c.
| nbgl_step_t nbgl_stepDrawText | ( | nbgl_stepPosition_t | pos, |
| nbgl_stepButtonCallback_t | onActionCallback, | ||
| nbgl_screenTickerConfiguration_t * | ticker, | ||
| const char * | text, | ||
| const char * | subText, | ||
| nbgl_contentCenteredInfoStyle_t | style, | ||
| bool | modal ) |
draws a text type step, that can be multi-pages, depending of the length of text and subText. The navigation arrows are displayed depending of the given position of this step in a flow, and depending of the page in case of multi-pages
| pos | position of this step in the flow (first, last, single, not_first_nor_last) |
| onActionCallback | common callback for all actions on this page |
| ticker | ticker configuration, set to NULL to disable it |
| text | text to display (depending of style) |
| subText | text to display under text (depending of style) |
| style | style to use for text and subText |
| modal | if true, means this step shall be displayed on top of existing one |
Definition at line 498 of file nbgl_step.c.
| uint8_t nbgl_stepGetMenuListCurrent | ( | nbgl_step_t | step | ) |
Get the index of the currently selected item in the menulist.
| step | step from which to get the current menulist choice |
Definition at line 760 of file nbgl_step.c.
| int nbgl_stepRelease | ( | nbgl_step_t | step | ) |
Release the step obtained with any of the nbgl_stepDrawXXX() functions.
| step | step to release |
Definition at line 833 of file nbgl_step.c.
| nbgl_step_t stepDrawText | ( | nbgl_stepPosition_t | pos, |
| nbgl_stepButtonCallback_t | onActionCallback, | ||
| nbgl_screenTickerConfiguration_t * | ticker, | ||
| const char * | text, | ||
| const char * | subText, | ||
| nbgl_contentCenteredInfoStyle_t | style, | ||
| bool | modal, | ||
| uint8_t | nbMaxLinesForSubText ) |
Same as nbgl_stepDrawText(), with the possibility to truncate subText.
| pos | position of this step in the flow (first, last, single, not_first_nor_last) |
| onActionCallback | common callback for all actions on this page |
| ticker | ticker configuration, set to NULL to disable it |
| text | text to display (depending of style) |
| subText | text to display under text (depending of style) |
| style | style to use for text and subText |
| modal | if true, means this step shall be displayed on top of existing one |
| nbMaxLinesForSubText | if > 0, subText is displayed in a single page, in at most this number of lines (or buttons in BUTTON_INFO style), the last one ending with "..." if it doesn't fit. Otherwise, subText is displayed in as many pages as necessary |
Definition at line 524 of file nbgl_step.c.
|
static |
< array of step contexts. Index 0 is reserved for background
Definition at line 90 of file nbgl_step.c.