mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
to lv_cont_get_fit_width/height to lv_obj
This commit is contained in:
parent
c3156db6b9
commit
c9703af47e
@ -1517,6 +1517,29 @@ lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
|
||||
return lv_area_get_height(&obj->coords);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the width which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_fit(lv_obj_t * cont)
|
||||
{
|
||||
lv_style_t * style = lv_cont_get_style(cont);
|
||||
|
||||
return lv_obj_get_width(cont) - style->body.padding.left - style->body.padding.right;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that height reduced by the top an bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the height which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(lv_obj_t * cont)
|
||||
{
|
||||
lv_style_t * style = lv_cont_get_style(cont);
|
||||
|
||||
return lv_obj_get_width(cont) - style->body.padding.top - style->body.padding.bottom;
|
||||
}
|
||||
/**
|
||||
* Get the extended size attribute of an object
|
||||
* @param obj pointer to an object
|
||||
|
@ -649,6 +649,20 @@ lv_coord_t lv_obj_get_width(const lv_obj_t * obj);
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get that width reduced by the left and right padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the width which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_fit(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get that height reduced by the top an bottom padding.
|
||||
* @param obj pointer to an object
|
||||
* @return the height which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_fit(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get the extended size attribute of an object
|
||||
* @param obj pointer to an object
|
||||
|
@ -223,30 +223,6 @@ lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont)
|
||||
return ext->fit_bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that width reduced by the horizontal padding. Useful if a layout is used.
|
||||
* @param cont pointer to a container object
|
||||
* @return the width which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_cont_get_fit_width(lv_obj_t * cont)
|
||||
{
|
||||
lv_style_t * style = lv_cont_get_style(cont);
|
||||
|
||||
return lv_obj_get_width(cont) - style->body.padding.left - style->body.padding.right;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get that height reduced by the vertical padding. Useful if a layout is used.
|
||||
* @param cont pointer to a container object
|
||||
* @return the height which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_cont_get_fit_height(lv_obj_t * cont)
|
||||
{
|
||||
lv_style_t * style = lv_cont_get_style(cont);
|
||||
|
||||
return lv_obj_get_width(cont) - style->body.padding.top - style->body.padding.bottom;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -175,21 +175,6 @@ lv_fit_t lv_cont_get_fit_top(const lv_obj_t * cont);
|
||||
*/
|
||||
lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont);
|
||||
|
||||
|
||||
/**
|
||||
* Get that width reduced by the horizontal padding. Useful if a layout is used.
|
||||
* @param cont pointer to a container object
|
||||
* @return the width which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_cont_get_fit_width(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get that height reduced by the vertical padding. Useful if a layout is used.
|
||||
* @param cont pointer to a container object
|
||||
* @return the height which still fits into the container
|
||||
*/
|
||||
lv_coord_t lv_cont_get_fit_height(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get the style of a container
|
||||
* @param cont pointer to a container object
|
||||
|
Loading…
x
Reference in New Issue
Block a user