Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_layout_internal_nanos.h File Reference

Internal functions/constants of NBGL layout layer. More...

#include "nbgl_layout.h"
Include dependency graph for nbgl_layout_internal_nanos.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  nbgl_layoutInternal_s
 Structure containing all information about the current layout. More...

Macros

#define LAYOUT_OBJ_POOL_LEN   10
 Max number of complex objects with callback retrievable from pool.
#define BUTTON_MARGIN_Y   12
 Horizontal margin (sum of left and right) between the text of a button and its border.
#define NB_MAX_BUTTON_ROWS   3
 Maximum number of buttons used to display the sub text in BUTTON_INFO style.
#define NB_MAX_BUTTON_ROWS_PUBLIC   2
 Maximum number of buttons used to display the sub text in BUTTON_INFO style with nbgl_layoutAddText().
#define NB_MAX_CHAR_IN_BUTTON_ROW   20
 Maximum number of bytes (including '\0') of the text of a button in BUTTON_INFO style. A row of narrow chars is cut at this length, the rest goes in the next button.

Typedefs

typedef struct nbgl_layoutInternal_s nbgl_layoutInternal_t
 Structure containing all information about the current layout.

Functions

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

Detailed Description

Internal functions/constants of NBGL layout layer.

Definition in file nbgl_layout_internal_nanos.h.

Macro Definition Documentation

◆ BUTTON_MARGIN_Y

#define BUTTON_MARGIN_Y   12

Horizontal margin (sum of left and right) between the text of a button and its border.

Definition at line 33 of file nbgl_layout_internal_nanos.h.

◆ LAYOUT_OBJ_POOL_LEN

#define LAYOUT_OBJ_POOL_LEN   10

Max number of complex objects with callback retrievable from pool.

Definition at line 27 of file nbgl_layout_internal_nanos.h.

◆ NB_MAX_BUTTON_ROWS

#define NB_MAX_BUTTON_ROWS   3

Maximum number of buttons used to display the sub text in BUTTON_INFO style.

Definition at line 39 of file nbgl_layout_internal_nanos.h.

◆ NB_MAX_BUTTON_ROWS_PUBLIC

#define NB_MAX_BUTTON_ROWS_PUBLIC   2

Maximum number of buttons used to display the sub text in BUTTON_INFO style with nbgl_layoutAddText().

Definition at line 46 of file nbgl_layout_internal_nanos.h.

◆ NB_MAX_CHAR_IN_BUTTON_ROW

#define NB_MAX_CHAR_IN_BUTTON_ROW   20

Maximum number of bytes (including '\0') of the text of a button in BUTTON_INFO style. A row of narrow chars is cut at this length, the rest goes in the next button.

Definition at line 53 of file nbgl_layout_internal_nanos.h.

Typedef Documentation

◆ nbgl_layoutInternal_t

Structure containing all information about the current layout.

Note
It shall not be used externally

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 114 of file nbgl_layout_nanos.c.

◆ layoutAddText()

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.

Parameters
layoutthe current layout
textmain text, must be single line if subText
subTextdescription under main text (may be null)
styleif REGULAR_INFO, use regular font for text, otherwise use bold font for text
nbMaxLinesmax number of lines (or buttons in BUTTON_INFO style) for the sub text. If 0, the max displayable number is used
ellipsisif 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)
Returns
>= 0 if OK

Definition at line 392 of file nbgl_layout_nanos.c.

◆ layoutGetButtonRowLen()

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

Parameters
texttext 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
Returns
the number of bytes of text consumed by the button (always > 0 if text is not empty)

Definition at line 246 of file nbgl_layout_nanos.c.