From d8d583ee572aa186b0b08e62fcd832bab97a87f4 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 26 Aug 2018 15:55:22 +0200 Subject: [PATCH] lv_win:get_contet added instead of lv_page wrappers --- lv_objx/lv_win.c | 68 ++++++++---------------------------------------- lv_objx/lv_win.h | 29 ++++++--------------- 2 files changed, 19 insertions(+), 78 deletions(-) diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 484d0c22b..f7be6e33a 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -228,27 +228,6 @@ void lv_win_set_btn_size(lv_obj_t * win, lv_coord_t size) lv_win_realign(win); } -/** - * Set the layout of the window - * @param win pointer to a window object - * @param layout the layout from 'lv_layout_t' - */ -void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout) -{ - lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - lv_page_set_scrl_layout(ext->page, layout); -} - -/** - * Set the scroll bar mode of a window - * @param win pointer to a window object - * @param sb_mode the new scroll bar mode from 'lv_sb_mode_t' - */ -void lv_win_set_sb_mode(lv_obj_t * win, lv_sb_mode_t sb_mode) -{ - lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - lv_page_set_sb_mode(ext->page, sb_mode); -} /** * Set a style of a window @@ -316,6 +295,17 @@ const char * lv_win_get_title(const lv_obj_t * win) return lv_label_get_text(ext->title); } +/** +* Get the content holder object of window (`lv_page`) to allow additional customization +* @param win pointer to a window object +* @return the Page object where the window's content is +*/ +lv_obj_t * lv_win_get_content(const lv_obj_t * win) +{ + lv_win_ext_t * ext = lv_obj_get_ext_attr(win); + return ext->page; +} + /** * Get the control button size of a window * @param win pointer to a window object @@ -327,42 +317,6 @@ lv_coord_t lv_win_get_btn_size(const lv_obj_t * win) return ext->btn_size; } -/** - * Get the layout of a window - * @param win pointer to a window object - * @return the layout of the window (from 'lv_layout_t') - */ -lv_layout_t lv_win_get_layout(const lv_obj_t * win) -{ - lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - return lv_page_get_scrl_layout(ext->page); -} - -/** - * Get the scroll bar mode of a window - * @param win pointer to a window object - * @return the scroll bar mode of the window (from 'lv_sb_mode_t') - */ -lv_sb_mode_t lv_win_get_sb_mode(const lv_obj_t * win) -{ - lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - return lv_page_get_sb_mode(ext->page); -} - -/** - * Get width of the content area (page scrollable) of the window - * @param win pointer to a window object - * @return the width of the content_bg area - */ -lv_coord_t lv_win_get_width(const lv_obj_t * win) -{ - lv_win_ext_t * ext = lv_obj_get_ext_attr(win); - lv_obj_t * scrl = lv_page_get_scrl(ext->page); - lv_style_t * style_scrl = lv_obj_get_style(scrl); - - return lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor; -} - /** * Get the pointer of a widow from one of its control button. * It is useful in the action of the control buttons where only button is known. diff --git a/lv_objx/lv_win.h b/lv_objx/lv_win.h index 97f0444af..96ccd07c6 100644 --- a/lv_objx/lv_win.h +++ b/lv_objx/lv_win.h @@ -156,6 +156,7 @@ void lv_win_set_layout(lv_obj_t *win, lv_layout_t layout); */ void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style); + /*===================== * Getter functions *====================*/ @@ -167,6 +168,13 @@ void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style); */ const char * lv_win_get_title(const lv_obj_t * win); +/** +* Get the content holder object of window (`lv_page`) to allow additional customization +* @param win pointer to a window object +* @return the Page object where the window's content is +*/ +lv_obj_t * lv_win_get_content(const lv_obj_t * win); + /** * Get the control button size of a window * @param win pointer to a window object @@ -174,27 +182,6 @@ const char * lv_win_get_title(const lv_obj_t * win); */ lv_coord_t lv_win_get_btn_size(const lv_obj_t * win); -/** - * Get the layout of a window - * @param win pointer to a window object - * @return the layout of the window (from 'lv_layout_t') - */ -lv_layout_t lv_win_get_layout(const lv_obj_t *win); - -/** - * Get the scroll bar mode of a window - * @param win pointer to a window object - * @return the scroll bar mode of the window (from 'lv_sb_mode_t') - */ -lv_sb_mode_t lv_win_get_sb_mode(const lv_obj_t *win); - -/** - * Get width of the content area (page scrollable) of the window - * @param win pointer to a window object - * @return the width of the content area - */ -lv_coord_t lv_win_get_width(const lv_obj_t * win); - /** * Get the pointer of a widow from one of its control button. * It is useful in the action of the control buttons where only button is known.