lv_page: add edge flash animation

This commit is contained in:
Gabor Kiss-Vamosi
2018-11-24 20:31:06 +01:00
parent 3785fc4887
commit dd8f1c7b38
6 changed files with 242 additions and 5 deletions

View File

@@ -65,6 +65,16 @@ typedef struct
uint8_t ver_draw :1; /*1: vertical scrollbar is visible now (Handled by the library)*/
lv_sb_mode_t mode:3; /*Scrollbar visibility from 'lv_page_sb_mode_t'*/
} sb;
struct {
uint16_t state; /*Store the current size of the edge flash effect*/
lv_style_t *style; /*Style of edge flash effect (usually homogeneous circle)*/
uint8_t enabled :1; /*1: Show a flash animation on the edge*/
uint8_t top_ip :1; /*Used internally to show that top most position is reached (flash is In Progress)*/
uint8_t bottom_ip :1; /*Used internally to show that bottom most position is reached (flash is In Progress)*/
uint8_t right_ip :1; /*Used internally to show that right most position is reached (flash is In Progress)*/
uint8_t left_ip :1; /*Used internally to show that left most position is reached (flash is In Progress)*/
}edge_flash;
uint8_t arrow_scroll :1; /*1: Enable scrolling with LV_GROUP_KEY_LEFT/RIGHT/UP/DOWN*/
uint8_t scroll_prop :1; /*1: Propagate the scrolling the the parent if the edge is reached*/
uint8_t scroll_prop_ip :1; /*1: Scroll propagation is in progress (used by the library)*/
@@ -74,6 +84,7 @@ enum {
LV_PAGE_STYLE_BG,
LV_PAGE_STYLE_SCRL,
LV_PAGE_STYLE_SB,
LV_PAGE_STYLE_EDGE_FLASH,
};
typedef uint8_t lv_page_style_t;
@@ -155,6 +166,13 @@ void lv_page_set_arrow_scroll(lv_obj_t * page, bool en);
*/
void lv_page_set_scroll_propagation(lv_obj_t * page, bool en);
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param page pointer to a Page
* @param en true or false to enable/disable end flash
*/
void lv_page_set_edge_flash(lv_obj_t * page, bool en);
/**
* Set the fit attribute of the scrollable part of a page.
* It means it can set its size automatically to involve all children.
@@ -233,6 +251,13 @@ bool lv_page_get_arrow_scroll(const lv_obj_t * page);
*/
bool lv_page_get_scroll_propagation(lv_obj_t * page);
/**
* Get the edge flash effect property.
* @param page pointer to a Page
* return true or false
*/
bool lv_page_get_edge_flash(lv_obj_t * page);
/**
* Get that width which can be set to the children to still not cause overflow (show scrollbars)
* @param page pointer to a page object