lv_group: click_focus improvements

This commit is contained in:
Gabor Kiss-Vamosi
2018-07-13 00:37:28 +02:00
parent 43ec140124
commit fecc974ade
6 changed files with 125 additions and 39 deletions

View File

@@ -75,6 +75,17 @@ lv_indev_t * lv_indev_get_act(void)
return indev_act;
}
/**
* 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_hal_indev_type_t lv_indev_get_type(lv_indev_t * indev)
{
if(indev == NULL) return LV_INDEV_TYPE_NONE;
return indev->driver.type;
}
/**
* Reset one or all input devices
* @param indev pointer to an input device to reset or NULL to reset all of them
@@ -162,8 +173,8 @@ void lv_indev_set_button_points(lv_indev_t * indev, lv_point_t * points)
void lv_indev_get_point(lv_indev_t * indev, lv_point_t * point)
{
if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) {
point->x = 0;
point->y = 0;
point->x = -1;
point->y = -1;
} else {
point->x = indev->proc.act_point.x;
point->y = indev->proc.act_point.y;

View File

@@ -40,6 +40,14 @@ void lv_indev_init(void);
*/
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_hal_indev_type_t lv_indev_get_type(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

View File

@@ -1479,6 +1479,20 @@ void * lv_obj_get_group(lv_obj_t * obj)
{
return obj->group_p;
}
/**
* Tell whether the ohe object is the focused object of a group or not.
* @param obj pointer to an object
* @return true: the object is focused, false: the object is not focused or not in a group
*/
bool lv_obj_is_focused(lv_obj_t * obj)
{
if(obj->group_p) {
if(lv_group_get_focused(obj->group_p) == obj) return true;
}
return false;
}
#endif
/**********************

View File

@@ -745,6 +745,15 @@ void * lv_obj_get_free_ptr(lv_obj_t * obj);
* @return the pointer to group of the object
*/
void * lv_obj_get_group(lv_obj_t * obj);
/**
* Tell whether the ohe object is the focused object of a group or not.
* @param obj pointer to an object
* @return true: the object is focused, false: the object is not focused or not in a group
*/
bool lv_obj_is_focused(lv_obj_t * obj);
#endif