Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_content.h
Go to the documentation of this file.
1
6
7#ifndef NBGL_CONTENT_H
8#define NBGL_CONTENT_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14/*********************
15 * INCLUDES
16 *********************/
17#include <stdint.h>
18#include <stdbool.h>
19
20#include "os_io_seph_cmd.h"
21
22#include "nbgl_types.h"
23#include "ux_loc.h"
24#ifndef NBGL_USE_CASE_ONLY
25#include "nbgl_obj.h"
26#endif
27
28/**********************
29 * TYPEDEFS
30 **********************/
31
36typedef enum {
37#ifdef HAVE_SE_TOUCH
38 LARGE_CASE_INFO,
39 LARGE_CASE_BOLD_INFO,
41 LARGE_CASE_GRAY_INFO,
43 NORMAL_INFO,
45 PLUGIN_INFO
48#else // HAVE_SE_TOUCH
52#endif // HAVE_SE_TOUCH
54
60typedef struct {
61 const char *text1;
62 const char *text2;
63#ifdef HAVE_SE_TOUCH
64 const char *text3;
65#endif // HAVE_SE_TOUCH
67 bool onTop;
69#ifdef HAVE_SE_TOUCH
70 int16_t offsetY;
71#else // HAVE_SE_TOUCH
83#endif // HAVE_SE_TOUCH
85
94
119
123typedef struct {
124 const char *text;
126 const char *longPressText;
129 tune_index_e
132
136typedef struct {
137 const char *text;
139 const char *buttonText;
140 uint8_t buttonToken;
142 tune_index_e
144#ifndef HAVE_SE_TOUCH
150#endif // HAVE_SE_TOUCH
152
165
170typedef struct {
171 const char *fullValue;
172 const char *aliasSubName;
173 const char *explanation;
175 const char *title;
177 const char
179 union {
181 const struct nbgl_contentTagValueList_s
183 };
186
190typedef struct {
191 const char *item;
192 const char *value;
193 union {
200 };
201 uint8_t forcePageStart : 1;
203 uint8_t centeredInfo : 1;
204 uint8_t aliasValue : 1;
208 uint8_t nbMaxLinesForValue : 2;
215
221typedef nbgl_contentTagValue_t *(*nbgl_contentTagValueCallback_t)(uint8_t pairIndex);
222
232typedef void (*nbgl_contentActionCallback_t)(int token, uint8_t index, int page);
233
257
270
291
297typedef struct {
298 const char *text;
299 const char
302 uint8_t token;
303 tune_index_e tuneId;
305
313
329
347typedef struct {
348 union {
349 const char *const *names;
350#if defined(HAVE_LANGUAGE_PACK)
351 UX_LOC_STRINGS_INDEX *nameIds;
352#endif // HAVE_LANGUAGE_PACK
353 };
355 uint8_t nbChoices;
356 uint8_t initChoice;
357 uint8_t token;
358 tune_index_e
360#ifndef HAVE_SE_TOUCH
361 bool vertical;
369
375 const char *title;
376#endif // HAVE_SE_TOUCH
377
379
383typedef struct {
384 const char *const *barTexts;
385 const uint8_t *tokens;
386 uint8_t nbBars;
387 tune_index_e tuneId;
388#ifndef HAVE_SE_TOUCH
389 bool vertical;
392
396 const char *title;
397#endif // HAVE_SE_TOUCH
399
404typedef struct {
405 const char *text;
407 uint8_t token;
408 tune_index_e tuneId;
410
418
436
453
463
464#ifdef __cplusplus
465} /* extern "C" */
466#endif
467
468#endif /* NBGL_CONTENT_H */
struct nbgl_pageSwitchesList_s nbgl_contentSwitchesList_t
This structure contains data to build a SWITCHES_LIST content.
nbgl_contentTagValue_t *(* nbgl_contentTagValueCallback_t)(uint8_t pairIndex)
prototype of tag/value pair retrieval callback
nbgl_contentIllustrationType_t
possible types of illustration, for example in nbgl_contentCenter_t
@ ANIM_ILLUSTRATION
animation
@ ICON_ILLUSTRATION
simple icon
nbgl_contentCenteredInfoStyle_t
possible styles for Centered Info Area
@ BOLD_TEXT1_INFO
bold is used for text1 (but '\b' can switch to regular)
@ BUTTON_INFO
bold is used for text1 and text2 as a white button
@ REGULAR_INFO
both texts regular (but '\b' can switch to bold)
struct nbgl_contentTagValueList_s nbgl_contentTagValueList_t
This structure contains a list of [tag,value] pairs.
nbgl_contentType_t
The different types of predefined contents.
@ INFO_LONG_PRESS
a centered info and a long press button
@ EXTENDED_CENTER
a centered content and a possible tip-box
@ CHOICES_LIST
list of choices through radio buttons
@ CENTERED_INFO
a centered info
@ SWITCHES_LIST
list of switches with descriptions
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
@ INFOS_LIST
list of infos with titles
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
@ TAG_VALUE_LIST
list of tag/value pairs
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
@ INFO_BUTTON
a centered info and a simple black button
nbgl_contentValueAliasType_t
possible types of value alias
@ INFO_LIST_ALIAS
alias is list of infos
@ TAG_VALUE_LIST_ALIAS
@ ENS_ALIAS
alias comes from ENS
@ ADDRESS_BOOK_ALIAS
alias comes from Address Book
@ QR_CODE_ALIAS
alias is an address to be displayed as a QR Code
@ NO_ALIAS_TYPE
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
struct nbgl_contentInfoList_s nbgl_contentInfoList_t
This structure contains data to build a INFOS_LIST content.
API to draw all basic graphic objects.
common types for Graphical Library
nbgl_state_t
to represent a boolean state.
Definition nbgl_types.h:212
struct nbgl_animation_s nbgl_animation_t
Represents all information about an animation (succession of icons).
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
This structure contains data to build a BARS_LIST content.
const uint8_t * tokens
array of tokens, one for each bar (nbBars items)
const char *const * barTexts
array of texts for each bar (nbBars items, in black/bold)
const char * title
Nano only and used in the horizontal flow: per-content header text. Same semantics as nbgl_contentRad...
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when a bar is touched
uint8_t nbBars
number of elements in barTexts and tokens array
This structure contains info to build a centered (vertically and horizontally) area,...
uint16_t iconHug
vertical margin to apply on top and bottom of the icon
const nbgl_icon_details_t * icon
the icon (can be null)
const char * title
title in black large (can be null)
const char * description
description in black small regular case (can be null)
const char * subText
sub-text in dark gray regular small case
uint16_t animOffsetY
vertical offset of animation in icon if integrated (but usually 0)
bool padding
if true, apply a padding of 40px at the bottom
const nbgl_animation_t * animation
the animation (can be null), used if illustrType is ANIM_ILLUSTRATION
const char * smallTitle
sub-title in black small bold case (can be null)
uint16_t animOffsetX
horizontal offset of animation in icon if integrated (but usually 0)
nbgl_contentIllustrationType_t illustrType
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * text1
first text (can be null)
bool onTop
if set to true, align only horizontally
nbgl_contentCenteredInfoStyle_t style
style to apply to this info
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
This structure contains data to build a EXTENDED_CENTER content.
nbgl_contentTipBox_t tipBox
if text field is NULL, no tip-box
nbgl_contentCenter_t contentCenter
centered content (icon + text(s))
This structure contains data to build a centered info + simple black button content.
const char * buttonText
text of the long press button
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
const char * text
centered text in large case
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is touched
This structure contains data to build a INFOS_LIST content.
const char *const * infoContents
array of contents of infos (in black)
const char *const * infoTypes
array of types of infos (in black/bold)
const nbgl_contentValueExt_t * infoExtensions
uint8_t nbInfos
number of elements in infoTypes and infoContents array
This structure contains data to build a centered info + long press button content.
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is touched
const char * longPressText
text of the long press button
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
const char * text
centered text in large case
This structure contains a list of names to build a list of radio buttons (on the right part of screen...
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when selecting a radio button)
uint8_t token
the token that will be used as argument of the callback
bool localized
if set to true, use nameIds and not names
uint8_t initChoice
index of the current choice
const char *const * names
array of strings giving the choices (nbChoices)
const nbgl_icon_details_t * selectionIcon
uint8_t nbChoices
number of choices
const char * title
Nano only and used in the horizontal flow (i.e. vertical is false): per-content header text shown abo...
This structure contains info to build a switch (on the right) with a description (on the left),...
const char * text
main text for the switch
uint8_t token
the token that will be used as argument of the callback (unused on Nano)
nbgl_state_t initState
initial state of the switch
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const char * subText
description under main text (NULL terminated, single line, may be null)
This structure contains [item,value] pair(s) and info about a potential "details" button,...
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when details button is touched
const char * confirmationText
text of the confirmation button, if NULL "It matches" is used
uint8_t confirmationToken
the token used as argument of the onActionCallback
const char * cancelText
the text used for cancel action, if NULL "It doesn't matches" is used
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
const char * detailsButtonText
this text is used for "details" button (if NULL, no button)
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
This structure contains a [item,value] pair and info about "details" button.
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
const char * detailsButtonText
this text is used for "details" button
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when details button is touched
This structure contains a list of [tag,value] pairs.
const nbgl_contentTagValue_t * pairs
array of [tag,value] pairs (nbPairs items). If NULL, callback is used instead
nbgl_contentTagValueCallback_t callback
function to call to retrieve a given pair
bool hideEndOfLastLine
if set to true, replace 3 last chars of last line by "..."
bool wrapping
if set to true, value text will be wrapped on ' ' to avoid cutting words
nbgl_contentActionCallback_t actionCallback
called when a valueIcon is touched on a given pair
This structure contains a [tag,value] pair and possible extensions.
const nbgl_contentValueExt_t * extension
if not NULL, gives additional info on value field
const nbgl_icon_details_t * valueIcon
const char * value
string giving the value name
const char * item
string giving the tag name
uint8_t centeredInfo
if set to 1, the tag will be displayed as a centered info
This structure contains data to build a tip-box, on top of a footer, on bottom of a content center.
const char * text
text of the tip-box
const nbgl_icon_details_t * icon
icon of the tip-box
uint8_t token
token used when tip-box is tapped
tune_index_e tuneId
tune played when tip-box is tapped
This structure contains additions to a tag/value pair, to be able to build a screen to display these ...
const char * fullValue
full string of the value when used as an alias
nbgl_contentValueAliasType_t aliasType
type of alias
const struct nbgl_contentTagValueList_s * tagValuelist
if aliasType is TAG_VALUE_LIST_ALIAS
const char * backText
used as title of the popping page, if not NULL, otherwise "item" is used
const char * aliasSubName
string displayed under alias and in details view
const struct nbgl_contentInfoList_s * infolist
if aliasType is INFO_LIST_ALIAS
This structure contains data to build a content.
nbgl_content_u content
nbgl_contentActionCallback_t contentActionCallback
callback to be called when an action on an object occurs
nbgl_contentType_t type
type of page content in the content union
This structure contains data to build a SWITCHES_LIST content.
uint8_t nbSwitches
number of elements in switches and tokens array
const nbgl_contentSwitch_t * switches
array of switches (nbSwitches items)
Union of the different type of contents.
nbgl_contentInfoList_t infosList
INFOS_LIST type
nbgl_contentInfoLongPress_t infoLongPress
INFO_LONG_PRESS type
nbgl_contentTagValueDetails_t tagValueDetails
TAG_VALUE_DETAILS type
nbgl_contentTagValueConfirm_t tagValueConfirm
TAG_VALUE_CONFIRM type
nbgl_contentTagValueList_t tagValueList
TAG_VALUE_LIST type
nbgl_contentCenteredInfo_t centeredInfo
CENTERED_INFO type
nbgl_contentBarsList_t barsList
BARS_LIST type
nbgl_contentExtendedCenter_t extendedCenter
EXTENDED_CENTER type
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
nbgl_contentRadioChoice_t choicesList
CHOICES_LIST type
BOLOS_UX_LOC_STRINGS UX_LOC_STRINGS_INDEX