Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Macros | Functions
nbgl_layout_nanos.c File Reference
#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"
Include dependency graph for nbgl_layout_nanos.c:

Go to the source code of this file.

Macros

#define NB_MAX_LAYOUTS   3
 
#define NB_MAX_SCREEN_CHILDREN   7
 
#define BUTTON_MARGIN_Y   12
 
#define NB_MAX_CHAR_IN_LINE   20
 
#define ELLIPSIS   "..."
 
#define ELLIPSIS_SIZE   sizeof(ELLIPSIS)
 

Functions

void layoutAddObject (nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
 adds the given obj to the layout
 
nbgl_layout_tnbgl_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 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()
 

Macro Definition Documentation

◆ BUTTON_MARGIN_Y

#define BUTTON_MARGIN_Y   12

Definition at line 33 of file nbgl_layout_nanos.c.

◆ ELLIPSIS

#define ELLIPSIS   "..."

Definition at line 38 of file nbgl_layout_nanos.c.

◆ ELLIPSIS_SIZE

#define ELLIPSIS_SIZE   sizeof(ELLIPSIS)

Definition at line 39 of file nbgl_layout_nanos.c.

◆ NB_MAX_CHAR_IN_LINE

#define NB_MAX_CHAR_IN_LINE   20

Definition at line 36 of file nbgl_layout_nanos.c.

◆ NB_MAX_LAYOUTS

#define NB_MAX_LAYOUTS   3

Definition at line 28 of file nbgl_layout_nanos.c.

◆ NB_MAX_SCREEN_CHILDREN

#define NB_MAX_SCREEN_CHILDREN   7

Definition at line 31 of file nbgl_layout_nanos.c.

Function Documentation

◆ layoutAddObject()

void layoutAddObject ( nbgl_layoutInternal_t layout,
nbgl_obj_t obj 
)

adds the given obj to the layout

Parameters
layout
obj

Definition at line 119 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddButton()

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.

Parameters
layoutthe current layout
buttonInfostructure giving the description of button
Returns
>= 0 if OK

Definition at line 652 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddCenteredInfo()

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.

Parameters
layoutthe current layout
infostructure giving the description of buttons (texts, icons, layout)
Returns
>= 0 if OK

Definition at line 457 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddMenuList()

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.

Parameters
layoutthe current layout
liststructure giving the list of choices and the current selected one
Returns
>= 0 if OK

Definition at line 403 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddNavigation()

int nbgl_layoutAddNavigation ( nbgl_layout_t layout,
nbgl_layoutNavigation_t info 
)

Creates navigation arrows on side(s) of the screen.

Parameters
layoutthe current layout
infostructure giving the description of the navigation
Returns
>= 0 if OK

Definition at line 186 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddProgressBar()

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.

Parameters
layoutthe current layout
barLayoutstructure giving the description of progress bar
Returns
>= 0 if OK

Definition at line 587 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddSwitch()

int nbgl_layoutAddSwitch ( nbgl_layout_t layout,
const nbgl_layoutSwitch_t switchLayout 
)

Creates an area in main panel to display a switch.

Parameters
layoutthe current layout
switchLayoutstructure giving the description of switch
Returns
>= 0 if OK

Definition at line 683 of file nbgl_layout_nanos.c.

◆ nbgl_layoutAddText()

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.

Parameters
layoutthe current layout
textmain text, must be single line if subText
subTextdescription under main text (NULL terminated, in regular, 3 lines max, may be null)
styleif REGULAR_INFO, use regular font for text, otherwise use bold font for text
Returns
>= 0 if OK

Definition at line 225 of file nbgl_layout_nanos.c.

◆ nbgl_layoutDraw()

int nbgl_layoutDraw ( nbgl_layout_t layoutParam)

Applies given layout. The screen will be redrawn.

Parameters
layoutParamlayout to redraw
Returns
a pointer to the corresponding layout

Definition at line 760 of file nbgl_layout_nanos.c.

◆ nbgl_layoutGet()

nbgl_layout_t * nbgl_layoutGet ( const nbgl_layoutDescription_t description)

returns a layout of the given type. The layout is reset

Parameters
descriptiondescription of layout
Returns
a pointer to the corresponding layout

Definition at line 134 of file nbgl_layout_nanos.c.

◆ nbgl_layoutRelease()

int nbgl_layoutRelease ( nbgl_layout_t layoutParam)

Release the layout obtained with nbgl_layoutGet()

Parameters
layoutParamlayout to release
Returns
>= 0 if OK

Definition at line 779 of file nbgl_layout_nanos.c.