mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-26 11:07:34 +08:00
@@ -538,6 +538,17 @@ lv_coord_t lv_obj_get_y2(const lv_obj_t * obj)
|
||||
return lv_obj_get_y(obj) + lv_obj_get_height(obj);
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_x_aligned(const lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_x(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_y_aligned(const lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_y(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
|
||||
lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
+31
-5
@@ -35,24 +35,36 @@ typedef struct {
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Set the relative the position of an object (relative to the parent's top left corner)
|
||||
* Set the the position of an object relative to the set alignment.
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side of the parent plus the parent's left padding
|
||||
* @param y new distance from the top side of the parent plus the parent's right padding
|
||||
* @param x new x coordinate
|
||||
* @param y new y coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the x coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param x new distance from the left side from the parent plus the parent's left padding
|
||||
* @param x new x coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x);
|
||||
|
||||
/**
|
||||
* Set the y coordinate of a object
|
||||
* @param obj pointer to an object
|
||||
* @param y new distance from the top of the parent plus the parent's top padding
|
||||
* @param y new y coordinate
|
||||
* @note With default alignment it's the distance from the top left corner
|
||||
* @note E.g. LV_ALIGN_CENTER alignment it's the offset from the center of the parent
|
||||
* @note The position is interpreted on the content area of the parent
|
||||
* @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)`
|
||||
*/
|
||||
void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
|
||||
|
||||
@@ -245,6 +257,20 @@ lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the actually set x coordinate of object, i.e. the offset form the set alignment
|
||||
* @param obj pointer to an object
|
||||
* @return the set x coordinate
|
||||
*/
|
||||
lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the actually set y coordinate of object, i.e. the offset form the set alignment
|
||||
* @param obj pointer to an object
|
||||
* @return the set y coordinate
|
||||
*/
|
||||
lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the width of an object
|
||||
* @param obj pointer to an object
|
||||
|
||||
@@ -230,15 +230,6 @@ static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t val
|
||||
|
||||
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt);
|
||||
|
||||
static inline lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_x(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_y(obj, LV_PART_MAIN);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
Reference in New Issue
Block a user