6 #include "app_config.h"
18 #include "os_io_seproxyhal.h"
72 if ((obj->touchMask & (1 << eventType)) != 0) {
86 if (screen->touchCallback != NULL) {
111 if ((event->
x < obj->area.x0) || (event->
x >= (obj->area.x0 + obj->area.width))
112 || (event->
y < obj->area.y0) || (event->
y >= (obj->area.y0 + obj->area.height))) {
118 if (container->children != NULL) {
120 for (i = 0; i < container->nbChildren; i++) {
122 if (current != NULL) {
123 current = getTouchedObject(current, event);
124 if (current != NULL) {
132 if (obj->touchMask != 0) {
157 if ((pos->
x < obj->area.x0) || (pos->
x >= (obj->area.x0 + obj->area.width))
158 || (pos->
y < obj->area.y0) || (pos->
y >= (obj->area.y0 + obj->area.height))) {
164 for (
uint8_t i = 0; i < container->nbChildren; i++) {
166 if (current != NULL) {
167 nbgl_obj_t *child = getSwipableObjectAtPos(current, pos, detectedSwipe);
174 if (obj->touchMask & (1 << detectedSwipe)) {
203 nbgl_obj_t *first_obj = getSwipableObjectAtPos(obj, first, detectedSwipe);
205 if (first_obj == NULL) {
209 nbgl_obj_t *last_obj = getSwipableObjectAtPos(obj, last, detectedSwipe);
212 if (first_obj == last_obj) {
221 #ifndef HAVE_HW_TOUCH_SWIPE
222 #define SWIPE_THRESHOLD_X 10
223 #define SWIPE_THRESHOLD_Y 20
235 #ifdef HAVE_HW_TOUCH_SWIPE
243 return SWIPE_GESTURES[last->swipe];
261 return detected_swipe;
287 uint32_t currentTime)
312 if (foundObj == NULL) {
331 bool consumed =
false;
340 applytouchStatePosition(swipedObj, swipe);
374 applytouchStatePosition(foundObj,
TOUCHING);
383 applytouchStatePosition(foundObj,
TOUCHING);
427 if (container->children != NULL) {
429 for (i = 0; i < container->nbChildren; i++) {
431 if (current != NULL) {
433 if (current != NULL) {
441 if ((obj->touchMask != 0) && (obj->touchId ==
id)) {
#define LOG_DEBUG(__logger,...)
API to draw all basic graphic objects.
void(* nbgl_touchCallback_t)(void *obj, nbgl_touchType_t eventType)
prototype of function to be called when a touch event is received by an object
void nbgl_keyboardTouchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
function to be called when the keyboard object is touched
void nbgl_keypadTouchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
function to be called when the keypad object is touched
bool nbgl_objIsUx(nbgl_obj_t *obj)
This function returns true if the object belongs to a UxScreen.
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_obj_t * nbgl_screenGetTop(void)
Returns the screen on top layer, as a generic object.
bool nbgl_screenContainsObj(nbgl_obj_t *obj)
return true if the given obj can be found in refObj or any of its children
struct PACKED__ nbgl_screen_s nbgl_screen_t
struct to represent a screen (SCREEN type)
#define SWIPE_THRESHOLD_Y
#define SWIPE_THRESHOLD_X
bool nbgl_touchGetTouchedPosition(nbgl_obj_t *obj, nbgl_touchStatePosition_t **firstPos, nbgl_touchStatePosition_t **lastPos)
nbgl_obj_t * nbgl_touchGetObjectFromId(nbgl_obj_t *obj, uint8_t id)
parse all the children of the given object, recursively, until an object with the given touch if is f...
uint32_t nbgl_touchGetTouchDuration(nbgl_obj_t *obj)
struct nbgl_touchCtx_s nbgl_touchCtx_t
void nbgl_touchHandler(bool fromUx, nbgl_touchStatePosition_t *touchStatePosition, uint32_t currentTime)
Function to be called periodically to check touchscreen state and coordinates.
void nbgl_touchInit(bool fromUx)
Function to initialize the touch context.
#define SHORT_TOUCH_DURATION
#define LONG_TOUCH_DURATION
nbgl_touchType_t
The different types of Touchscreen events.
@ TOUCHING
corresponding to an object that is currently touched
@ CONTAINER
Empty container.
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
@ PRESSED
the finger is currently pressing the screen
@ RELEASED
the finger has been released from the screen
nbgl_touchStatePosition_t firstTouchedPosition
nbgl_obj_t * lastPressedObj
nbgl_touchStatePosition_t lastTouchedPosition
nbgl_touchState_t lastState
The low level Touchscreen event, coming from driver.
int16_t y
vertical position of the touch (or for a RELEASED the last touched point)
int16_t x
horizontal position of the touch (or for a RELEASED the last touched point)
nbgl_touchState_t state
state of the touch event, e.g PRESSED or RELEASED