Add a gesture event and fix an arc drawing bug (#1300)

This commit is contained in:
zlm
2020-01-16 19:24:08 -05:00
committed by Themba Dube
parent 55ed99d851
commit 400ca85c67
9 changed files with 174 additions and 10 deletions

View File

@@ -89,6 +89,7 @@ enum {
LV_EVENT_DRAG_BEGIN,
LV_EVENT_DRAG_END,
LV_EVENT_DRAG_THROW_BEGIN,
LV_EVENT_GESTURE, /**< The object has been getture*/
LV_EVENT_KEY,
LV_EVENT_FOCUSED,
LV_EVENT_DEFOCUSED,
@@ -133,6 +134,7 @@ enum {
LV_SIGNAL_DRAG_BEGIN,
LV_SIGNAL_DRAG_THROW_BEGIN,
LV_SIGNAL_DRAG_END,
LV_SIGNAL_GESTURE, /**< The object has been getture*/
/*Group related*/
LV_SIGNAL_FOCUS,
@@ -222,7 +224,8 @@ typedef struct _lv_obj_t
lv_drag_dir_t drag_dir : 3; /**< Which directions the object can be dragged in */
lv_bidi_dir_t base_dir : 2; /**< Base direction of texts related to this object */
uint8_t adv_hittest : 1; /**< 1: Use advanced hit-testing (slower) */
uint8_t reserved : 2; /**< Reserved for future use*/
uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/
uint8_t reserved : 1; /**< Reserved for future use*/
uint8_t protect; /**< Automatically happening actions can be prevented. 'OR'ed values from
`lv_protect_t`*/
lv_opa_t opa_scale; /**< Scale down the opacity by this factor. Effects all children as well*/
@@ -529,6 +532,14 @@ void lv_obj_set_drag_throw(lv_obj_t * obj, bool en);
*/
void lv_obj_set_drag_parent(lv_obj_t * obj, bool en);
/**
* Enable to use parent for gesture related operations.
* If trying to gesture the object the parent will be moved instead
* @param obj pointer to an object
* @param en true: enable the 'gesture parent' for the object
*/
void lv_obj_set_gesture_parent(lv_obj_t * obj, bool en);
/**
* Propagate the events to the parent too
* @param obj pointer to an object
@@ -536,7 +547,9 @@ void lv_obj_set_drag_parent(lv_obj_t * obj, bool en);
*/
void lv_obj_set_parent_event(lv_obj_t * obj, bool en);
void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir);
/**
* Set the opa scale enable parameter (required to set opa_scale with `lv_obj_set_opa_scale()`)
* @param obj pointer to an object
@@ -883,6 +896,12 @@ bool lv_obj_get_drag_parent(const lv_obj_t * obj);
*/
bool lv_obj_get_parent_event(const lv_obj_t * obj);
/**
* Get the gesture parent attribute of an object
* @param obj pointer to an object
* @return true: gesture parent is enabled
*/
bool lv_obj_get_gesture_parent(const lv_obj_t * obj);
lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj);