|
Embedded SDK
Embedded SDK
|
#include <string.h>#include <stdlib.h>#include "nbgl_debug.h"#include "nbgl_front.h"#include "nbgl_layout_internal_nanos.h"#include "nbgl_obj.h"#include "nbgl_draw.h"#include "nbgl_screen.h"#include "nbgl_touch.h"#include "glyphs.h"#include "os_pic.h"#include "os_helpers.h"#include "lcx_rng.h"
Go to the source code of this file.
Macros | |
| #define | NB_MAX_LAYOUTS 3 |
| #define | NB_MAX_SCREEN_CHILDREN 7 |
| #define | ELLIPSIS "..." |
| #define | ELLIPSIS_SIZE sizeof(ELLIPSIS) |
Functions | |
| static void | buttonCallback (nbgl_screen_t *screen, nbgl_buttonEvent_t buttonEvent) |
| void | layoutAddObject (nbgl_layoutInternal_t *layout, nbgl_obj_t *obj) |
| adds the given obj to the layout | |
| static void | getButtonTextLen (const char *text, uint16_t maxWidth, uint16_t maxLen, uint16_t *len, uint16_t *width) |
| computes the part of the given text fitting in the given width and in the given number of bytes, in the font of the buttons in BUTTON_INFO style | |
| static void | addTextWithEllipsis (nbgl_layoutInternal_t *layoutInt, nbgl_container_t *container, nbgl_text_area_t *textArea, uint8_t nbLines, uint16_t areaHeight) |
| displays the given number of lines of the text of the given text area, the last line ending with an ellipsis. The text is not copied: the first lines are displayed by the given text area, the last line and the ellipsis by 2 other text areas, aligned under it | |
| uint16_t | layoutGetButtonRowLen (const char *text, uint16_t *len, uint16_t *width) |
| computes the part of the given text displayed in a single button in BUTTON_INFO style. Used both to draw the buttons and to split the text in pages, so that they always match | |
| nbgl_layout_t * | nbgl_layoutGet (const nbgl_layoutDescription_t *description) |
| returns a layout of the given type. The layout is reset | |
| int | nbgl_layoutAddNavigation (nbgl_layout_t *layout, nbgl_layoutNavigation_t *info) |
| Creates navigation arrows on side(s) of the screen. | |
| int | nbgl_layoutAddText (nbgl_layout_t *layout, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style) |
| Creates an area with given text and sub text, using the given style. | |
| int | layoutAddText (nbgl_layout_t *layout, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style, uint8_t nbMaxLines, bool ellipsis) |
| Same as nbgl_layoutAddText(), with the choice of the max number of lines (or buttons in BUTTON_INFO style) of the sub text, and of the behavior when the sub text doesn't fit in them. | |
| int | nbgl_layoutAddMenuList (nbgl_layout_t *layout, nbgl_layoutMenuList_t *list) |
| Creates a menu list (only for nanos) with the given parameters. The navigation (and selection) must be handled by the caller. | |
| int | nbgl_layoutAddCenteredInfo (nbgl_layout_t *layout, const nbgl_layoutCenteredInfo_t *info) |
| Creates an area on the center of the main panel, with a possible icon/image, a possible text in black under it, and a possible text in gray under it. | |
| int | nbgl_layoutAddProgressBar (nbgl_layout_t *layout, const nbgl_layoutProgressBar_t *barLayout) |
| Creates an area in main panel to display a progress bar, with a title text and a description under the progress. | |
| int | nbgl_layoutAddButton (nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo) |
| Creates an area in main panel to display a button, with the given style. | |
| int | nbgl_layoutAddSwitch (nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout) |
| Creates an area in main panel to display a switch. | |
| int | nbgl_layoutDraw (nbgl_layout_t *layoutParam) |
| Applies given layout. The screen will be redrawn. | |
| int | nbgl_layoutRelease (nbgl_layout_t *layoutParam) |
| Release the layout obtained with nbgl_layoutGet(). | |
Variables | |
| static nbgl_layoutInternal_t | gLayout [NB_MAX_LAYOUTS] = {0} |
| array of layouts, if used by modal | |
| #define ELLIPSIS "..." |
Definition at line 33 of file nbgl_layout_nanos.c.
| #define ELLIPSIS_SIZE sizeof(ELLIPSIS) |
Definition at line 34 of file nbgl_layout_nanos.c.
| #define NB_MAX_LAYOUTS 3 |
Definition at line 28 of file nbgl_layout_nanos.c.
| #define NB_MAX_SCREEN_CHILDREN 7 |
Definition at line 31 of file nbgl_layout_nanos.c.
|
static |
displays the given number of lines of the text of the given text area, the last line ending with an ellipsis. The text is not copied: the first lines are displayed by the given text area, the last line and the ellipsis by 2 other text areas, aligned under it
| layoutInt | the current layout |
| container | container of the text areas |
| textArea | text area of the sub text, already set at index 1 of container |
| nbLines | number of lines of the sub text |
| areaHeight | height of the area in which the lines are vertically centered |
Definition at line 166 of file nbgl_layout_nanos.c.
|
static |
Definition at line 58 of file nbgl_layout_nanos.c.
|
static |
computes the part of the given text fitting in the given width and in the given number of bytes, in the font of the buttons in BUTTON_INFO style
| text | text to display, starting at the beginning of the button |
| maxWidth | max width in pixels of the text |
| maxLen | max number of bytes of the text |
| len | [out] number of bytes of text fitting |
| width | [out] width in pixels of these bytes |
Definition at line 135 of file nbgl_layout_nanos.c.
| void layoutAddObject | ( | nbgl_layoutInternal_t * | layout, |
| nbgl_obj_t * | obj ) |
adds the given obj to the layout
| layout | |
| obj |
Definition at line 114 of file nbgl_layout_nanos.c.
| int layoutAddText | ( | nbgl_layout_t * | layout, |
| const char * | text, | ||
| const char * | subText, | ||
| nbgl_contentCenteredInfoStyle_t | style, | ||
| uint8_t | nbMaxLines, | ||
| bool | ellipsis ) |
Same as nbgl_layoutAddText(), with the choice of the max number of lines (or buttons in BUTTON_INFO style) of the sub text, and of the behavior when the sub text doesn't fit in them.
| layout | the current layout |
| text | main text, must be single line if subText |
| subText | description under main text (may be null) |
| style | if REGULAR_INFO, use regular font for text, otherwise use bold font for text |
| nbMaxLines | max number of lines (or buttons in BUTTON_INFO style) for the sub text. If 0, the max displayable number is used |
| ellipsis | if true, the last line (or button) ends with an ellipsis if the sub text doesn't fit, otherwise the remaining text is simply not displayed (it is displayed by the caller in another page) |
Definition at line 392 of file nbgl_layout_nanos.c.
| uint16_t layoutGetButtonRowLen | ( | const char * | text, |
| uint16_t * | len, | ||
| uint16_t * | width ) |
computes the part of the given text displayed in a single button in BUTTON_INFO style. Used both to draw the buttons and to split the text in pages, so that they always match
| text | text to display, starting at the beginning of the button |
| len | [out] number of bytes of text displayed in the button |
| width | [out] width in pixels of these bytes |
Definition at line 246 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddButton | ( | nbgl_layout_t * | layout, |
| const nbgl_layoutButton_t * | buttonInfo ) |
Creates an area in main panel to display a button, with the given style.
| layout | the current layout |
| buttonInfo | structure giving the description of button |
Definition at line 874 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddCenteredInfo | ( | nbgl_layout_t * | layout, |
| const nbgl_layoutCenteredInfo_t * | info ) |
Creates an area on the center of the main panel, with a possible icon/image, a possible text in black under it, and a possible text in gray under it.
| layout | the current layout |
| info | structure giving the description of buttons (texts, icons, layout) |
Definition at line 646 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddMenuList | ( | nbgl_layout_t * | layout, |
| nbgl_layoutMenuList_t * | list ) |
Creates a menu list (only for nanos) with the given parameters. The navigation (and selection) must be handled by the caller.
| layout | the current layout |
| list | structure giving the list of choices and the current selected one |
Definition at line 592 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddNavigation | ( | nbgl_layout_t * | layout, |
| nbgl_layoutNavigation_t * | info ) |
Creates navigation arrows on side(s) of the screen.
| layout | the current layout |
| info | structure giving the description of the navigation |
Definition at line 323 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddProgressBar | ( | nbgl_layout_t * | layout, |
| const nbgl_layoutProgressBar_t * | barLayout ) |
Creates an area in main panel to display a progress bar, with a title text and a description under the progress.
| layout | the current layout |
| barLayout | structure giving the description of progress bar |
Definition at line 809 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddSwitch | ( | nbgl_layout_t * | layout, |
| const nbgl_layoutSwitch_t * | switchLayout ) |
Creates an area in main panel to display a switch.
| layout | the current layout |
| switchLayout | structure giving the description of switch |
Definition at line 905 of file nbgl_layout_nanos.c.
| int nbgl_layoutAddText | ( | nbgl_layout_t * | layout, |
| const char * | text, | ||
| const char * | subText, | ||
| nbgl_contentCenteredInfoStyle_t | style ) |
Creates an area with given text and sub text, using the given style.
| layout | the current layout |
| text | main text, must be single line if subText |
| subText | description under main text (NULL terminated, in regular, 3 lines max, or 2 buttons max in BUTTON_INFO style, may be null) |
| style | if REGULAR_INFO, use regular font for text, otherwise use bold font for text |
Definition at line 362 of file nbgl_layout_nanos.c.
| int nbgl_layoutDraw | ( | nbgl_layout_t * | layoutParam | ) |
Applies given layout. The screen will be redrawn.
| layoutParam | layout to redraw |
Definition at line 985 of file nbgl_layout_nanos.c.
| nbgl_layout_t * nbgl_layoutGet | ( | const nbgl_layoutDescription_t * | description | ) |
returns a layout of the given type. The layout is reset
| description | description of layout |
Definition at line 271 of file nbgl_layout_nanos.c.
| int nbgl_layoutRelease | ( | nbgl_layout_t * | layoutParam | ) |
Release the layout obtained with nbgl_layoutGet().
| layoutParam | layout to release |
Definition at line 1005 of file nbgl_layout_nanos.c.
|
static |
array of layouts, if used by modal
Definition at line 52 of file nbgl_layout_nanos.c.