mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
feat(obj): add lv_obj_get_height/width_visible
This commit is contained in:
parent
acd07ff83c
commit
d93056cd43
@ -404,6 +404,34 @@ void lv_obj_get_coords_fit(const lv_obj_t * obj, lv_area_t * area)
|
||||
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_height_visible(const lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_update_layout(lv_obj_get_screen(obj));
|
||||
|
||||
lv_coord_t h = LV_COORD_MAX;
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
while(parent) {
|
||||
h = LV_MIN(lv_obj_get_height_fit(parent), h);
|
||||
parent = lv_obj_get_parent(parent);
|
||||
}
|
||||
|
||||
return h == LV_COORD_MAX ? LV_DPI_DEF : h;
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_width_visible(const lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_update_layout(lv_obj_get_screen(obj));
|
||||
|
||||
lv_coord_t w = LV_COORD_MAX;
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
while(parent) {
|
||||
w = LV_MIN(lv_obj_get_width_fit(parent), w);
|
||||
parent = lv_obj_get_parent(parent);
|
||||
}
|
||||
|
||||
return w == LV_COORD_MAX ? LV_DPI_DEF : w;
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_self_width(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_point_t p = {0, LV_COORD_MIN};
|
||||
|
@ -223,6 +223,24 @@ lv_coord_t lv_obj_get_height_fit(const struct _lv_obj_t * obj);
|
||||
*/
|
||||
void lv_obj_get_coords_fit(const struct _lv_obj_t * obj, lv_area_t * area);
|
||||
|
||||
/**
|
||||
* Get the height which is visible on the the given object without causing overflow.
|
||||
* If there are smaller grand parents than their height will be considered.
|
||||
* Useful on nested scrollable objects to get a height that fills the entire visible height.
|
||||
* @param obj pointer to an object
|
||||
* @return the visible height
|
||||
*/
|
||||
lv_coord_t lv_obj_get_height_visible(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the widht which is visible on the the given object without causing overflow.
|
||||
* If there are smaller grand parents than their width will be considered.
|
||||
* Useful on nested scrollable objects to get a width that fills the entire visible width.
|
||||
* @param obj pointer to an object
|
||||
* @return the visible width
|
||||
*/
|
||||
lv_coord_t lv_obj_get_width_visible(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table.
|
||||
* @param obj pointer to an objects
|
||||
|
Loading…
x
Reference in New Issue
Block a user