Embedded SDK
Embedded SDK
nbgl_layout_internal.h
Go to the documentation of this file.
1 
7 #ifndef NBGL_LAYOUT_INTERNAL_H
8 #define NBGL_LAYOUT_INTERNAL_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include "nbgl_layout.h"
15 
16 /*********************
17  * INCLUDES
18  *********************/
19 
20 /*********************
21  * DEFINES
22  *********************/
23 // internal margin, between sub-items
24 #define INTERNAL_MARGIN 8
25 
26 #define SMALL_BUTTON_HEIGHT 64
27 
32 #define LAYOUT_OBJ_POOL_LEN 16
33 
34 #define KEYBOARD_FOOTER_TYPE 99
35 #define KEYPAD_FOOTER_TYPE 98
36 
37 /**********************
38  * TYPEDEFS
39  **********************/
40 typedef struct {
42  uint8_t token; // user token, attached to callback
43  uint8_t index; // index within the token
44  tune_index_e tuneId; // if not @ref NBGL_NO_TUNE, a tune will be played
45 } layoutObj_t;
46 
47 typedef enum {
50  SWIPE_USAGE_SUGGESTIONS, // for suggestion buttons
53 
54 // used by screen (top level)
55 enum {
56  HEADER_INDEX = 0, // For header container
63 };
64 
70 typedef struct nbgl_layoutInternal_s {
71  bool modal;
78 
90  nbgl_layoutTouchCallback_t callback; // user callback for all controls
91  // This is the pool of callback objects, potentially used by this layout
93  // number of callback objects used by the whole layout in callbackObjPool
95 
99 
100 /**********************
101  * GLOBAL PROTOTYPES
102  **********************/
106  nbgl_obj_t *obj,
107  uint8_t token,
108  tune_index_e tuneId);
109 void layoutNavigationPopulate(nbgl_container_t *navContainer,
110  const nbgl_layoutNavigationBar_t *navConfig,
111  uint8_t layer);
113  nbgl_touchType_t eventType,
114  uint8_t nbPages,
115  uint8_t *activePage);
116 
117 /**********************
118  * MACROS
119  **********************/
120 
121 #ifdef __cplusplus
122 } /* extern "C" */
123 #endif
124 
125 #endif /* NBGL_LAYOUT_INTERNAL_H */
API of the Advanced BOLOS Graphical Library, for predefined layouts.
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
Definition: nbgl_layout.h:104
nbgl_layoutUpFooterType_t
The different types of area on top of footer.
Definition: nbgl_layout.h:526
nbgl_layoutHeaderType_t
The different types of extended header.
Definition: nbgl_layout.h:416
nbgl_layoutFooterType_t
The different types of extended footer.
Definition: nbgl_layout.h:474
nbgl_swipe_usage_t
@ NB_SWIPE_USAGE
@ SWIPE_USAGE_CUSTOM
@ SWIPE_USAGE_SUGGESTIONS
@ SWIPE_USAGE_NAVIGATION
bool keyboardSwipeCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
@ UP_FOOTER_INDEX
@ FOOTER_INDEX
@ HEADER_INDEX
@ TOP_RIGHT_BUTTON_INDEX
@ MAIN_CONTAINER_INDEX
@ LEFT_BORDER_INDEX
@ NB_MAX_SCREEN_CHILDREN
void layoutNavigationPopulate(nbgl_container_t *navContainer, const nbgl_layoutNavigationBar_t *navConfig, uint8_t layer)
This function creates a full navigation bar "object", with buttons and returns it as a container.
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
adds the given obj to the main container
Definition: nbgl_layout.c:519
layoutObj_t * layoutAddCallbackObj(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj, uint8_t token, tune_index_e tuneId)
Definition: nbgl_layout.c:492
#define LAYOUT_OBJ_POOL_LEN
Max number of complex objects with callback retrievable from pool.
bool layoutNavigationCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType, uint8_t nbPages, uint8_t *activePage)
function to be called when any of the controls in navigation bar is touched
struct nbgl_layoutInternal_s nbgl_layoutInternal_t
Structure containing all information about the current layout.
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
nbgl_touchType_t
The different types of Touchscreen events.
Definition: nbgl_types.h:220
nbgl_obj_t * obj
tune_index_e tuneId
Structure containing all information about the current layout.
nbgl_container_t * footerContainer
container used to store footer (buttons, nav....)
uint8_t activePage
index of active page for navigation bar
nbgl_swipe_usage_t swipeUsage
nbgl_layoutTouchCallback_t callback
nbgl_container_t * container
nbgl_container_t * headerContainer
container used to store header (progress, back, empty space...)
nbgl_layoutFooterType_t footerType
type of footer
bool modal
if true, means the screen is a modal
uint8_t nbChildren
number of children in above array
nbgl_layoutHeaderType_t headerType
type of header
nbgl_container_t * upFooterContainer
uint8_t nbPages
number of pages for navigation bar
nbgl_layoutUpFooterType_t upFooterType
type of up-footer
layoutObj_t callbackObjPool[LAYOUT_OBJ_POOL_LEN]
nbgl_text_area_t * tapText
nbgl_obj_t ** children
children for main screen
This structure contains info to build a navigation bar at the bottom of the screen.
Definition: nbgl_layout.h:118
unsigned char uint8_t
Definition: usbd_conf.h:53