diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index 9ac9eac1c..aac73fe28 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -262,6 +262,28 @@ lv_obj_t * lv_page_get_scrl(const lv_obj_t * page) return ext->scrl; } +/** + * Get the press action of the page + * @param page pointer to a page object + * @return a function to call when the page is pressed + */ +lv_action_t lv_page_get_pr_action(lv_obj_t * page) +{ + lv_page_ext_t * ext = lv_obj_get_ext_attr(page); + return ext->pr_action; +} + +/** + * Get the release action of the page + * @param page pointer to a page object + * @return a function to call when the page is released + */ +lv_action_t lv_page_get_rel_action(lv_obj_t * page) +{ + lv_page_ext_t * ext = lv_obj_get_ext_attr(page); + return ext->rel_action; +} + /** * Set the scroll bar mode on a page * @param page pointer to a page object diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 669be36cf..98cbf21fe 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -78,7 +78,6 @@ typedef enum { * GLOBAL PROTOTYPES **********************/ - /** * Create a page objects * @param par pointer to an object, it will be the parent of the new page @@ -93,6 +92,20 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy); */ void lv_page_clean(lv_obj_t *obj); +/** + * Get the press action of the page + * @param page pointer to a page object + * @return a function to call when the page is pressed + */ +lv_action_t lv_page_get_pr_action(lv_obj_t * page); + +/** + * Get the release action of the page + * @param page pointer to a page object + * @return a function to call when the page is released + */ +lv_action_t lv_page_get_rel_action(lv_obj_t * page); + /** * Get the scrollable object of a page * @param page pointer to a page object diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 4c6490333..2aec1e739 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -192,7 +192,7 @@ void lv_ta_add_char(lv_obj_t * ta, uint32_t c) return; } - uint32_t c_uni = lv_txt_encoded_next(&c, NULL); + uint32_t c_uni = lv_txt_encoded_next((const char *)&c, NULL); if(char_is_accepted(ta, c_uni) == false) { LV_LOG_INFO("Character is no accepted by the text area (too long text or not in the accepted list)"); diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index ee1d514d3..9afb1410e 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -143,6 +143,7 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos); * @param cur_type: element of 'lv_cursor_type_t' */ void lv_ta_set_cursor_type(lv_obj_t * ta, lv_cursor_type_t cur_type); + /** * Enable/Disable password mode * @param ta pointer to a text area object @@ -163,6 +164,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en); * @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789" */ void lv_ta_set_accepted_chars(lv_obj_t * ta, const char * list); + /** * Set max length of a Text Area. * @param ta pointer to Text Area @@ -170,6 +172,16 @@ void lv_ta_set_accepted_chars(lv_obj_t * ta, const char * list); */ void lv_ta_set_max_length(lv_obj_t * ta, uint16_t num); +/** + * Set an action to call when the Text area is clicked + * @param ta pointer to a Text area + * @param action a function pointer + */ +static inline void lv_ta_set_action(lv_obj_t * ta, lv_action_t action) +{ + lv_page_set_rel_action(ta, action); +} + /** * Set the scroll bar mode of a text area * @param ta pointer to a text area object @@ -255,6 +267,16 @@ const char * lv_ta_get_accepted_chars(lv_obj_t * ta); */ uint16_t lv_ta_get_max_length(lv_obj_t * ta); +/** + * Set an action to call when the Text area is clicked + * @param ta pointer to a Text area + * @param action a function pointer + */ +static inline lv_action_t lv_ta_get_action(lv_obj_t * ta) +{ + return lv_page_get_rel_action(ta); +} + /** * Get the scroll bar mode of a text area * @param ta pointer to a text area object