1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

lv_win:get_contet added instead of lv_page wrappers

This commit is contained in:
Gabor Kiss-Vamosi 2018-08-26 15:55:22 +02:00
parent f0753a82b5
commit d8d583ee57
2 changed files with 19 additions and 78 deletions

View File

@ -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.

View File

@ -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.