Embedded SDK
Embedded SDK
nbgl_content.h
Go to the documentation of this file.
1 
7 #ifndef NBGL_CONTENT_H
8 #define NBGL_CONTENT_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 /*********************
15  * INCLUDES
16  *********************/
17 #include <stdint.h>
18 #include <stdbool.h>
19 
20 #include "nbgl_types.h"
21 #include "nbgl_obj.h"
22 #ifdef HAVE_PIEZO_SOUND
23 #include "os_io_seproxyhal.h"
24 #endif
25 
26 /**********************
27  * TYPEDEFS
28  **********************/
29 
34 typedef enum {
35 #ifdef HAVE_SE_TOUCH
41  NORMAL_INFO,
46 #else // HAVE_SE_TOUCH
47  REGULAR_INFO = 0,
48  BOLD_TEXT1_INFO
49 #endif // HAVE_SE_TOUCH
51 
57 typedef struct {
58  const char *text1;
59  const char *text2;
60 #ifdef HAVE_SE_TOUCH
61  const char *text3;
62 #endif // HAVE_SE_TOUCH
64  bool onTop;
66 #ifdef HAVE_SE_TOUCH
68 #endif // HAVE_SE_TOUCH
70 
75 typedef enum {
79 
90 typedef struct {
93  const nbgl_animation_t
97  const char *title;
98  const char *smallTitle;
99  const char *description;
100  const char *subText;
102  bool padding;
104 
108 typedef struct {
109  const char *text;
111  const char *longPressText;
114 #ifdef HAVE_PIEZO_SOUND
115  tune_index_e
116  tuneId;
117 #endif
119 
123 typedef struct {
124  const char *text;
126  const char *buttonText;
129 #ifdef HAVE_PIEZO_SOUND
130  tune_index_e
131  tuneId;
132 #endif
134 
139 typedef enum {
145 
150 typedef struct {
151  const char *fullValue;
152  const char *explanation;
154  const char *title;
158 
162 typedef struct {
163  const char *item;
164  const char *value;
165 #ifdef SCREEN_SIZE_WALLET
166  union {
171  };
177 #endif
179 
185 typedef nbgl_contentTagValue_t *(*nbgl_contentTagValueCallback_t)(uint8_t pairIndex);
186 
194 typedef void (*nbgl_contentActionCallback_t)(int token, uint8_t index, int page);
195 
199 typedef struct {
201  *pairs;
212  bool wrapping;
216 
220 typedef struct {
223  const char *detailsButtonText;
226 #ifdef HAVE_PIEZO_SOUND
227  tune_index_e
228  tuneId;
229 #endif
231 
236 typedef struct {
239  const char *detailsButtonText;
242 #ifdef HAVE_PIEZO_SOUND
243  tune_index_e
244  tuneId;
245 #endif
246  const char
248  const char
254 
260 typedef struct {
261  const char *text;
262  const char
266 #ifdef HAVE_PIEZO_SOUND
267  tune_index_e tuneId;
268 #endif // HAVE_PIEZO_SOUND
270 
274 typedef struct nbgl_pageSwitchesList_s {
278 
282 typedef struct {
283  const char *const *infoTypes;
284  const char *const *infoContents;
294 
300 typedef struct {
301  union {
302  const char *const *names;
303 #if defined(HAVE_LANGUAGE_PACK)
304  UX_LOC_STRINGS_INDEX *nameIds;
305 #endif // HAVE_LANGUAGE_PACK
306  };
307  bool localized;
311 #ifdef HAVE_PIEZO_SOUND
312  tune_index_e
313  tuneId;
314 #endif // HAVE_PIEZO_SOUND
316 
320 typedef struct {
321  const char *const *barTexts;
322  const uint8_t *tokens;
324 #ifdef HAVE_PIEZO_SOUND
325  tune_index_e tuneId;
326 #endif // HAVE_PIEZO_SOUND
328 
333 typedef struct {
334  const char *text;
337 #ifdef HAVE_PIEZO_SOUND
338  tune_index_e tuneId;
339 #endif // HAVE_PIEZO_SOUND
341 
345 typedef struct {
349 
354 typedef enum {
365  BARS_LIST
367 
371 typedef union {
384 
388 typedef struct {
394 
395 #ifdef __cplusplus
396 } /* extern "C" */
397 #endif
398 
399 #endif /* NBGL_CONTENT_H */
struct nbgl_pageSwitchesList_s nbgl_contentSwitchesList_t
This structure contains data to build a SWITCHES_LIST content.
nbgl_contentIllustrationType_t
possible types of illustration, for example in nbgl_contentCenter_t
Definition: nbgl_content.h:75
@ ANIM_ILLUSTRATION
animation
Definition: nbgl_content.h:77
@ ICON_ILLUSTRATION
simple icon
Definition: nbgl_content.h:76
nbgl_contentCenteredInfoStyle_t
possible styles for Centered Info Area
Definition: nbgl_content.h:34
@ LARGE_CASE_BOLD_INFO
Definition: nbgl_content.h:37
@ NORMAL_INFO
Definition: nbgl_content.h:41
@ PLUGIN_INFO
Definition: nbgl_content.h:43
@ LARGE_CASE_GRAY_INFO
Definition: nbgl_content.h:39
@ LARGE_CASE_INFO
text in BLACK and large case (INTER 32px), subText in black in Inter24px
Definition: nbgl_content.h:36
nbgl_contentTagValue_t *(* nbgl_contentTagValueCallback_t)(uint8_t pairIndex)
prototype of tag/value pair retrieval callback
Definition: nbgl_content.h:185
nbgl_contentType_t
The different types of predefined contents.
Definition: nbgl_content.h:354
@ INFO_LONG_PRESS
a centered info and a long press button
Definition: nbgl_content.h:357
@ EXTENDED_CENTER
a centered content and a possible tip-box
Definition: nbgl_content.h:356
@ CHOICES_LIST
list of choices through radio buttons
Definition: nbgl_content.h:364
@ CENTERED_INFO
a centered info
Definition: nbgl_content.h:355
@ SWITCHES_LIST
list of switches with descriptions
Definition: nbgl_content.h:362
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
Definition: nbgl_content.h:360
@ INFOS_LIST
list of infos with titles
Definition: nbgl_content.h:363
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
Definition: nbgl_content.h:361
@ TAG_VALUE_LIST
list of tag/value pairs
Definition: nbgl_content.h:359
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
Definition: nbgl_content.h:365
@ INFO_BUTTON
a centered info and a simple black button
Definition: nbgl_content.h:358
nbgl_contentValueAliasType_t
possible types of value alias
Definition: nbgl_content.h:139
@ ENS_ALIAS
alias comes from ENS
Definition: nbgl_content.h:141
@ ADDRESS_BOOK_ALIAS
alias comes from Address Book
Definition: nbgl_content.h:142
@ QR_CODE_ALIAS
alias is an address to be displayed as a QR Code
Definition: nbgl_content.h:143
@ NO_ALIAS_TYPE
Definition: nbgl_content.h:140
void(* nbgl_contentActionCallback_t)(int token, uint8_t index, int page)
prototype of function to be called when an action on a content object occurs
Definition: nbgl_content.h:194
API to draw all basic graphic objects.
common types for Graphical Library
nbgl_state_t
to represent a boolean state.
Definition: nbgl_types.h:160
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
Represents all information about an animation (succession of icons)
Definition: nbgl_types.h:382
This structure contains data to build a BARS_LIST content.
Definition: nbgl_content.h:320
const uint8_t * tokens
array of tokens, one for each bar (nbBars items)
Definition: nbgl_content.h:322
const char *const * barTexts
array of texts for each bar (nbBars items, in black/bold)
Definition: nbgl_content.h:321
uint8_t nbBars
number of elements in barTexts and tokens array
Definition: nbgl_content.h:323
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_content.h:90
uint16_t iconHug
vertical margin to apply on top and bottom of the icon
Definition: nbgl_content.h:101
const nbgl_icon_details_t * icon
the icon (can be null)
Definition: nbgl_content.h:92
const char * title
title in black large (can be null)
Definition: nbgl_content.h:97
const char * description
description in black small regular case (can be null)
Definition: nbgl_content.h:99
const char * subText
sub-text in dark gray regular small case
Definition: nbgl_content.h:100
uint16_t animOffsetY
vertical offset of animation in icon if integrated (but usually 0)
Definition: nbgl_content.h:96
bool padding
if true, apply a padding of 40px at the bottom
Definition: nbgl_content.h:102
const nbgl_animation_t * animation
the animation (can be null), used if illustrType is ANIM_ILLUSTRATION
Definition: nbgl_content.h:94
const char * smallTitle
sub-title in black small bold case (can be null)
Definition: nbgl_content.h:98
uint16_t animOffsetX
horizontal offset of animation in icon if integrated (but usually 0)
Definition: nbgl_content.h:95
nbgl_contentIllustrationType_t illustrType
Definition: nbgl_content.h:91
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_content.h:57
const char * text2
second text (can be null)
Definition: nbgl_content.h:59
const char * text1
first text (can be null)
Definition: nbgl_content.h:58
bool onTop
if set to true, align only horizontally
Definition: nbgl_content.h:64
nbgl_contentCenteredInfoStyle_t style
style to apply to this info
Definition: nbgl_content.h:65
int16_t offsetY
vertical shift to apply to this info (if >0, shift to bottom)
Definition: nbgl_content.h:67
const char * text3
third text (can be null)
Definition: nbgl_content.h:61
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
Definition: nbgl_content.h:63
This structure contains data to build a EXTENDED_CENTER content.
Definition: nbgl_content.h:345
nbgl_contentTipBox_t tipBox
if text field is NULL, no tip-box
Definition: nbgl_content.h:347
nbgl_contentCenter_t contentCenter
centered content (icon + text(s))
Definition: nbgl_content.h:346
This structure contains data to build a centered info + simple black button content.
Definition: nbgl_content.h:123
const char * buttonText
text of the long press button
Definition: nbgl_content.h:126
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
Definition: nbgl_content.h:125
const char * text
centered text in large case
Definition: nbgl_content.h:124
This structure contains data to build a INFOS_LIST content.
Definition: nbgl_content.h:282
uint8_t nbInfos
number of elements in infoTypes and infoContents array
Definition: nbgl_content.h:288
const char *const * infoContents
array of contents of infos (in black)
Definition: nbgl_content.h:284
const char *const * infoTypes
array of types of infos (in black/bold)
Definition: nbgl_content.h:283
const nbgl_contentValueExt_t * infoExtensions
Definition: nbgl_content.h:286
This structure contains data to build a centered info + long press button content.
Definition: nbgl_content.h:108
const char * longPressText
text of the long press button
Definition: nbgl_content.h:111
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
Definition: nbgl_content.h:110
const char * text
centered text in large case
Definition: nbgl_content.h:109
This structure contains a list of names to build a list of radio buttons (on the right part of screen...
Definition: nbgl_content.h:300
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_content.h:310
bool localized
if set to true, use nameIds and not names
Definition: nbgl_content.h:307
uint8_t initChoice
index of the current choice
Definition: nbgl_content.h:309
const char *const * names
array of strings giving the choices (nbChoices)
Definition: nbgl_content.h:302
uint8_t nbChoices
number of choices
Definition: nbgl_content.h:308
This structure contains info to build a switch (on the right) with a description (on the left),...
Definition: nbgl_content.h:260
const char * text
main text for the switch
Definition: nbgl_content.h:261
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_content.h:265
nbgl_state_t initState
initial state of the switch
Definition: nbgl_content.h:264
const char * subText
description under main text (NULL terminated, single line, may be null)
Definition: nbgl_content.h:263
This structure contains [item,value] pair(s) and info about a potential "details" button,...
Definition: nbgl_content.h:236
const char * confirmationText
text of the confirmation button, if NULL "It matches" is used
Definition: nbgl_content.h:247
uint8_t confirmationToken
the token used as argument of the onActionCallback
Definition: nbgl_content.h:250
const char * cancelText
the text used for cancel action, if NULL "It doesn't matches" is used
Definition: nbgl_content.h:249
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
Definition: nbgl_content.h:237
const char * detailsButtonText
this text is used for "details" button (if NULL, no button)
Definition: nbgl_content.h:239
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
Definition: nbgl_content.h:238
This structure contains a [item,value] pair and info about "details" button.
Definition: nbgl_content.h:220
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
Definition: nbgl_content.h:222
const char * detailsButtonText
this text is used for "details" button
Definition: nbgl_content.h:223
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
Definition: nbgl_content.h:221
This structure contains a list of [tag,value] pairs.
Definition: nbgl_content.h:199
nbgl_contentActionCallback_t actionCallback
called when a valueIcon is touched on a given pair
Definition: nbgl_content.h:214
const nbgl_contentTagValue_t * pairs
array of [tag,value] pairs (nbPairs items). If NULL, callback is used instead
Definition: nbgl_content.h:201
bool wrapping
if set to true, value text will be wrapped on ' ' to avoid cutting words
Definition: nbgl_content.h:212
uint8_t startIndex
index of the first pair to get with callback
Definition: nbgl_content.h:205
nbgl_contentTagValueCallback_t callback
function to call to retrieve a given pair
Definition: nbgl_content.h:202
This structure contains a [tag,value] pair.
Definition: nbgl_content.h:162
const nbgl_contentValueExt_t * extension
if not NULL, gives additional info on value field
Definition: nbgl_content.h:170
const nbgl_icon_details_t * valueIcon
Definition: nbgl_content.h:167
int8_t centeredInfo
if set to 1, the tag will be displayed as a centered info
Definition: nbgl_content.h:174
const char * value
string giving the value name
Definition: nbgl_content.h:164
const char * item
string giving the tag name
Definition: nbgl_content.h:163
This structure contains data to build a tip-box, on top of a footer, on bottom of a content center.
Definition: nbgl_content.h:333
const char * text
text of the tip-box
Definition: nbgl_content.h:334
const nbgl_icon_details_t * icon
icon of the tip-box
Definition: nbgl_content.h:335
uint8_t token
token used when tip-box is tapped
Definition: nbgl_content.h:336
This structure contains additions to a tag/value pair, to be able to build a screen to display these ...
Definition: nbgl_content.h:150
const char * fullValue
full string of the value when used as an alias
Definition: nbgl_content.h:151
nbgl_contentValueAliasType_t aliasType
type of alias
Definition: nbgl_content.h:156
const char * explanation
Definition: nbgl_content.h:152
This structure contains data to build a content.
Definition: nbgl_content.h:388
nbgl_content_u content
Definition: nbgl_content.h:390
nbgl_contentActionCallback_t contentActionCallback
callback to be called when an action on an object occurs
Definition: nbgl_content.h:392
nbgl_contentType_t type
type of page content in the content union
Definition: nbgl_content.h:389
This structure contains data to build a SWITCHES_LIST content.
Definition: nbgl_content.h:274
uint8_t nbSwitches
number of elements in switches and tokens array
Definition: nbgl_content.h:276
const nbgl_contentSwitch_t * switches
array of switches (nbSwitches items)
Definition: nbgl_content.h:275
Union of the different type of contents.
Definition: nbgl_content.h:371
nbgl_contentInfoList_t infosList
INFOS_LIST type
Definition: nbgl_content.h:380
nbgl_contentInfoLongPress_t infoLongPress
INFO_LONG_PRESS type
Definition: nbgl_content.h:374
nbgl_contentTagValueDetails_t tagValueDetails
TAG_VALUE_DETAILS type
Definition: nbgl_content.h:377
nbgl_contentTagValueConfirm_t tagValueConfirm
TAG_VALUE_CONFIRM type
Definition: nbgl_content.h:378
nbgl_contentTagValueList_t tagValueList
TAG_VALUE_LIST type
Definition: nbgl_content.h:376
nbgl_contentCenteredInfo_t centeredInfo
CENTERED_INFO type
Definition: nbgl_content.h:372
nbgl_contentBarsList_t barsList
BARS_LIST type
Definition: nbgl_content.h:382
nbgl_contentExtendedCenter_t extendedCenter
EXTENDED_CENTER type
Definition: nbgl_content.h:373
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
Definition: nbgl_content.h:379
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
Definition: nbgl_content.h:375
nbgl_contentRadioChoice_t choicesList
CHOICES_LIST type
Definition: nbgl_content.h:381
signed short int16_t
Definition: usbd_conf.h:50
unsigned short uint16_t
Definition: usbd_conf.h:54
unsigned char uint8_t
Definition: usbd_conf.h:53
signed char int8_t
Definition: usbd_conf.h:49
BOLOS_UX_LOC_STRINGS UX_LOC_STRINGS_INDEX