177 lines
5.0 KiB
C
177 lines
5.0 KiB
C
|
/**
|
||
|
* @file lv_indev.h
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef LV_INDEV_H
|
||
|
#define LV_INDEV_H
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
/*********************
|
||
|
* INCLUDES
|
||
|
*********************/
|
||
|
#include "lv_obj.h"
|
||
|
#include "../hal/lv_hal_indev.h"
|
||
|
#include "lv_group.h"
|
||
|
|
||
|
/*********************
|
||
|
* DEFINES
|
||
|
*********************/
|
||
|
|
||
|
/**********************
|
||
|
* TYPEDEFS
|
||
|
**********************/
|
||
|
|
||
|
/**********************
|
||
|
* GLOBAL PROTOTYPES
|
||
|
**********************/
|
||
|
|
||
|
/**
|
||
|
* Called periodically to read the input devices
|
||
|
* @param timer pointer to a timer to read
|
||
|
*/
|
||
|
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||
|
|
||
|
/**
|
||
|
* Enable or disable an input device (default enabled)
|
||
|
* @param indev pointer to an input device
|
||
|
* @param en true to enable, false to disable
|
||
|
*/
|
||
|
void lv_indev_enable(lv_indev_t * indev, bool en);
|
||
|
|
||
|
/**
|
||
|
* Get the currently processed input device. Can be used in action functions too.
|
||
|
* @return pointer to the currently processed input device or NULL if no input device processing
|
||
|
* right now
|
||
|
*/
|
||
|
lv_indev_t * lv_indev_get_act(void);
|
||
|
|
||
|
/**
|
||
|
* Get the type of an input device
|
||
|
* @param indev pointer to an input device
|
||
|
* @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`)
|
||
|
*/
|
||
|
lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Reset one or all input devices
|
||
|
* @param indev pointer to an input device to reset or NULL to reset all of them
|
||
|
* @param obj pointer to an object which triggers the reset.
|
||
|
*/
|
||
|
void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj);
|
||
|
|
||
|
/**
|
||
|
* Reset the long press state of an input device
|
||
|
* @param indev pointer to an input device
|
||
|
*/
|
||
|
void lv_indev_reset_long_press(lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON)
|
||
|
* @param indev pointer to an input device
|
||
|
* @param cur_obj pointer to an object to be used as cursor
|
||
|
*/
|
||
|
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj);
|
||
|
|
||
|
/**
|
||
|
* Set a destination group for a keypad input device (for LV_INDEV_TYPE_KEYPAD)
|
||
|
* @param indev pointer to an input device
|
||
|
* @param group point to a group
|
||
|
*/
|
||
|
void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
|
||
|
|
||
|
/**
|
||
|
* Set the an array of points for LV_INDEV_TYPE_BUTTON.
|
||
|
* These points will be assigned to the buttons to press a specific point on the screen
|
||
|
* @param indev pointer to an input device
|
||
|
* @param group point to a group
|
||
|
*/
|
||
|
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]);
|
||
|
|
||
|
/**
|
||
|
* Get the last point of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
|
||
|
* @param indev pointer to an input device
|
||
|
* @param point pointer to a point to store the result
|
||
|
*/
|
||
|
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point);
|
||
|
|
||
|
/**
|
||
|
* Get the current gesture direct
|
||
|
* @param indev pointer to an input device
|
||
|
* @return current gesture direct
|
||
|
*/
|
||
|
lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Get the last pressed key of an input device (for LV_INDEV_TYPE_KEYPAD)
|
||
|
* @param indev pointer to an input device
|
||
|
* @return the last pressed key (0 on error)
|
||
|
*/
|
||
|
uint32_t lv_indev_get_key(const lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Check the current scroll direction of an input device (for LV_INDEV_TYPE_POINTER and
|
||
|
* LV_INDEV_TYPE_BUTTON)
|
||
|
* @param indev pointer to an input device
|
||
|
* @return LV_DIR_NONE: no scrolling now
|
||
|
* LV_DIR_HOR/VER
|
||
|
*/
|
||
|
lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Get the currently scrolled object (for LV_INDEV_TYPE_POINTER and
|
||
|
* LV_INDEV_TYPE_BUTTON)
|
||
|
* @param indev pointer to an input device
|
||
|
* @return pointer to the currently scrolled object or NULL if no scrolling by this indev
|
||
|
*/
|
||
|
lv_obj_t * lv_indev_get_scroll_obj(const lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Get the movement vector of an input device (for LV_INDEV_TYPE_POINTER and
|
||
|
* LV_INDEV_TYPE_BUTTON)
|
||
|
* @param indev pointer to an input device
|
||
|
* @param point pointer to a point to store the types.pointer.vector
|
||
|
*/
|
||
|
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
|
||
|
|
||
|
/**
|
||
|
* Do nothing until the next release
|
||
|
* @param indev pointer to an input device
|
||
|
*/
|
||
|
void lv_indev_wait_release(lv_indev_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Gets a pointer to the currently active object in the currently processed input device.
|
||
|
* @return pointer to currently active object or NULL if no active object
|
||
|
*/
|
||
|
lv_obj_t * lv_indev_get_obj_act(void);
|
||
|
|
||
|
/**
|
||
|
* Get a pointer to the indev read timer to
|
||
|
* modify its parameters with `lv_timer_...` functions.
|
||
|
* @param indev pointer to an input device
|
||
|
* @return pointer to the indev read refresher timer. (NULL on error)
|
||
|
*/
|
||
|
lv_timer_t * lv_indev_get_read_timer(lv_disp_t * indev);
|
||
|
|
||
|
/**
|
||
|
* Search the most top, clickable object by a point
|
||
|
* @param obj pointer to a start object, typically the screen
|
||
|
* @param point pointer to a point for searching the most top child
|
||
|
* @return pointer to the found object or NULL if there was no suitable object
|
||
|
*/
|
||
|
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||
|
|
||
|
/**********************
|
||
|
* MACROS
|
||
|
**********************/
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
} /*extern "C"*/
|
||
|
#endif
|
||
|
|
||
|
#endif /*LV_INDEV_H*/
|