17 #include "os_helpers.h"
75 textArea->textColor =
WHITE;
76 textArea->text = PIC(text);
77 textArea->textAlignment =
CENTER;
80 textArea->obj.area.height = 12;
81 textArea->wrapping =
false;
83 textArea->obj.alignmentMarginY = 3;
90 keypad->obj.alignmentMarginY = 6;
91 keypad->obj.alignTo = NULL;
92 keypad->callback = PIC(callback);
93 keypad->enableBackspace =
false;
94 keypad->enableValidate =
false;
95 keypad->selectedKey = 0xFF;
96 keypad->shuffled = shuffled;
116 bool enableBackspace)
122 "nbgl_layoutUpdateKeypad(): enableValidate = %d, enableBackspace = %d\n",
125 if (layout == NULL) {
131 if ((keypad == NULL) || (keypad->obj.type !=
KEYPAD)) {
135 if (enableValidate && !keypad->enableValidate) {
137 keypad->selectedKey = 11;
141 keypad->selectedKey = 0xFF;
143 keypad->enableValidate = enableValidate;
144 keypad->enableBackspace = enableBackspace;
168 if (layout == NULL) {
174 container->nbChildren = nbDigits;
177 container->obj.area.width = nbDigits * C_pin_bullet_empty.width + (nbDigits - 1);
178 container->obj.area.height = C_pin_bullet_empty.height;
180 container->obj.alignmentMarginY = 24;
181 container->obj.alignTo = NULL;
189 for (
int i = 0; i < nbDigits; i++) {
191 image->buffer = &C_pin_bullet_empty;
192 image->foregroundColor =
WHITE;
195 image->obj.alignTo = (
nbgl_obj_t *) container->children[i - 1];
196 image->obj.alignmentMarginX = 1;
221 if (layout == NULL) {
228 if ((container == NULL) || (container->obj.type !=
CONTAINER)) {
231 if (nbActive > container->nbChildren) {
237 if ((image == NULL) || (image->obj.type !=
IMAGE)) {
240 image->buffer = &C_pin_bullet_empty;
243 image = (
nbgl_image_t *) container->children[nbActive - 1];
244 if ((image == NULL) || (image->obj.type !=
IMAGE)) {
249 if (image->buffer == &C_pin_bullet_filled) {
251 if (nbActive == container->nbChildren) {
256 image->buffer = &C_pin_bullet_empty;
259 image->buffer = &C_pin_bullet_filled;
Random Number Generation.
#define LOG_WARN(__logger,...)
#define LOG_DEBUG(__logger,...)
@ BAGL_FONT_OPEN_SANS_REGULAR_11px_1bpp
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
adds the given obj to the main container
int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout, uint8_t index, bool enableValidate, bool enableBackspace, bool enableDigits)
Updates an existing keypad on bottom of the screen, with the given configuration.
DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits)
Adds a placeholder for hidden digits on top of a keypad, to represent the entered digits,...
void * nbgl_layout_t
type shared externally
DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
Adds a keypad on bottom of the screen, with the associated callback.
Internal functions/constants of NBGL layout layer.
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
void nbgl_objDraw(nbgl_obj_t *obj)
This function draws or redraws the given object and its children (recursive version)
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
Gets a new container from the pool, with the given number of obj pointers.
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD type)
struct PACKED__ nbgl_image_s nbgl_image_t
struct to represent an image (IMAGE type)
int nbgl_objPoolGetArray(nbgl_obj_type_t type, uint8_t nbObjs, uint8_t layer, nbgl_obj_t **objArray)
Gets nbObjects new graphic object from the pool, with the given type, for the given layer (screen)....
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
Gets a new graphic object from the pool, with the given type. The type field of the object is set.
void(* keyboardCallback_t)(char touchedKey)
prototype of function to be called when a valid key is pressed on keyboard Backspace is equal to 0x8 ...
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.
@ NO_ALIGNMENT
used when parent container layout is used
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
@ CONTAINER
Empty container.
@ TEXT_AREA
Area to contain text line(s)
Structure containing all information about the current layout.
uint8_t nbChildren
number of children in above array
nbgl_obj_t ** children
children for main screen