api(align) save align in style and handle x/y according to it
This commit is contained in:
@@ -905,6 +905,7 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
lv_obj_t * child = lv_obj_get_child(obj, i);
|
||||
|
||||
lv_obj_refr_size(child);
|
||||
lv_obj_refr_pos(child);
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_layout(obj, LV_PART_MAIN)) {
|
||||
@@ -912,8 +913,11 @@ static void lv_obj_event_cb(lv_obj_t * obj, lv_event_t e)
|
||||
}
|
||||
}
|
||||
else if(e == LV_EVENT_CHILD_CHANGED) {
|
||||
// lv_obj_mark_layout_as_dirty(obj);
|
||||
if(lv_obj_get_style_layout(obj, LV_PART_MAIN)) {
|
||||
lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_MAIN);
|
||||
lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_MAIN);
|
||||
lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN);
|
||||
uint16_t layout = lv_obj_get_style_layout(obj, LV_PART_MAIN);
|
||||
if(layout || align || w == LV_SIZE_CONTENT || h == LV_SIZE_CONTENT) {
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
|
||||
lv_obj_set_x(obj, x);
|
||||
lv_obj_set_y(obj, y);
|
||||
|
||||
}
|
||||
|
||||
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
|
||||
@@ -163,8 +162,6 @@ void lv_obj_refr_size(lv_obj_t * obj)
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/*Calculate the required auto sizes*/
|
||||
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the srollbars*/
|
||||
bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0);
|
||||
@@ -291,7 +288,13 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb)
|
||||
return layout_cnt; /*No -1 to skip 0th index*/
|
||||
}
|
||||
|
||||
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
void lv_obj_align(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
lv_obj_set_style_align(obj, LV_PART_MAIN, LV_STATE_DEFAULT, align);
|
||||
lv_obj_set_pos(obj, x_ofs, y_ofs);
|
||||
}
|
||||
|
||||
void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@@ -310,40 +313,40 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
||||
x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
case LV_ALIGN_IN_TOP_LEFT:
|
||||
case LV_ALIGN_TOP_LEFT:
|
||||
x = 0;
|
||||
y = 0;
|
||||
break;
|
||||
case LV_ALIGN_IN_TOP_MID:
|
||||
case LV_ALIGN_TOP_MID:
|
||||
x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = 0;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_TOP_RIGHT:
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj);
|
||||
y = 0;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_BOTTOM_LEFT:
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
x = 0;
|
||||
y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
case LV_ALIGN_IN_BOTTOM_MID:
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
x = lv_obj_get_width_fit(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_BOTTOM_RIGHT:
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height_fit(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_LEFT_MID:
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
x = 0;
|
||||
y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_RIGHT_MID:
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
x = lv_obj_get_width_fit(base) - lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height_fit(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
@@ -411,8 +414,9 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
||||
|
||||
x += x_ofs + base->coords.x1 - parent->coords.x1 + lv_obj_get_scroll_left(parent);
|
||||
y += y_ofs + base->coords.y1 - parent->coords.y1 + lv_obj_get_scroll_top(parent);
|
||||
|
||||
lv_obj_set_style_align(obj, LV_PART_MAIN, LV_STATE_DEFAULT, LV_ALIGN_TOP_LEFT);
|
||||
lv_obj_set_pos(obj, x, y);
|
||||
|
||||
}
|
||||
|
||||
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords)
|
||||
@@ -570,9 +574,58 @@ bool lv_obj_handle_self_size_chg(struct _lv_obj_t * obj)
|
||||
|
||||
void lv_obj_refr_pos(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN);
|
||||
lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN);
|
||||
lv_obj_move_to(obj, x, y);
|
||||
if(parent == NULL) {
|
||||
lv_obj_move_to(obj, x, y);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_align_t align = lv_obj_get_style_align(obj, LV_PART_MAIN);
|
||||
if(align == LV_ALIGN_TOP_LEFT) {
|
||||
lv_obj_move_to(obj, x, y);
|
||||
}
|
||||
else {
|
||||
lv_coord_t pw = lv_obj_get_width_fit(parent);
|
||||
lv_coord_t ph = lv_obj_get_height_fit(parent);
|
||||
lv_coord_t w = lv_obj_get_width(obj);
|
||||
lv_coord_t h = lv_obj_get_height(obj);
|
||||
|
||||
switch(align) {
|
||||
case LV_ALIGN_TOP_MID:
|
||||
x += pw / 2 - w / 2;
|
||||
break;
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
x += pw - w;
|
||||
break;
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
x += pw / 2 - w / 2;
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
x += pw - w;
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
x += pw - w;
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
case LV_ALIGN_CENTER:
|
||||
x += pw / 2 - w / 2;
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lv_obj_move_to(obj, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
|
||||
@@ -137,6 +137,15 @@ void lv_obj_update_layout(struct _lv_obj_t * obj);
|
||||
*/
|
||||
uint32_t lv_layout_register(lv_layout_update_cb_t cb);
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
* @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used.
|
||||
* @param x_ofs x coordinate offset after alignment
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
*/
|
||||
void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
|
||||
/**
|
||||
* Align an object to an other object.
|
||||
* @param obj pointer to an object to align
|
||||
@@ -146,7 +155,7 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb);
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
* @note if the position or size of `base` changes `obj` needs to be aligned manually again
|
||||
*/
|
||||
void lv_obj_align(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
|
||||
/**
|
||||
* Align an object to the center on its parent.
|
||||
@@ -155,7 +164,7 @@ void lv_obj_align(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_alig
|
||||
*/
|
||||
static inline void lv_obj_center(struct _lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -136,9 +136,15 @@ static inline lv_coord_t lv_obj_get_style_y(const struct _lv_obj_t * obj, uint32
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline uint16_t lv_obj_get_style_layout(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT);
|
||||
return (lv_align_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_align(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ALIGN);
|
||||
return (lv_coord_t)v.num;
|
||||
}
|
||||
|
||||
@@ -668,7 +674,8 @@ static inline void lv_obj_set_style_y(struct _lv_obj_t * obj, uint32_t part, uin
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, part, state, LV_STYLE_Y, v);
|
||||
}
|
||||
static inline void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_coord_t value)
|
||||
|
||||
static inline void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_align_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
@@ -676,6 +683,13 @@ static inline void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint32_t part
|
||||
lv_obj_set_local_style_prop(obj, part, state, LV_STYLE_LAYOUT, v);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_align(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_coord_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, part, state, LV_STYLE_ALIGN, v);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_color_t value)
|
||||
{
|
||||
|
||||
@@ -269,11 +269,11 @@ static void style_init(void)
|
||||
lv_style_set_pad_column(&styles->btn, LV_DPX(5));
|
||||
lv_style_set_pad_row(&styles->btn, LV_DPX(5));
|
||||
#if LV_USE_FLEX
|
||||
lv_style_set_layout(&styles->btn, LV_LAYOUT_FLEX);
|
||||
lv_style_set_flex_flow(&styles->btn, LV_FLEX_FLOW_ROW);
|
||||
lv_style_set_flex_main_place(&styles->btn, LV_FLEX_PLACE_CENTER);
|
||||
lv_style_set_flex_cross_place(&styles->btn, LV_FLEX_PLACE_CENTER);
|
||||
lv_style_set_flex_track_place(&styles->btn, LV_FLEX_PLACE_CENTER);
|
||||
// lv_style_set_layout(&styles->btn, LV_LAYOUT_FLEX);
|
||||
// lv_style_set_flex_flow(&styles->btn, LV_FLEX_FLOW_ROW);
|
||||
// lv_style_set_flex_main_place(&styles->btn, LV_FLEX_PLACE_CENTER);
|
||||
// lv_style_set_flex_cross_place(&styles->btn, LV_FLEX_PLACE_CENTER);
|
||||
// lv_style_set_flex_track_place(&styles->btn, LV_FLEX_PLACE_CENTER);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ lv_obj_t * lv_calendar_header_arrow_create(lv_obj_t * parent, lv_obj_t * calenda
|
||||
lv_obj_add_event_cb(mo_next, month_event_cb, calendar);
|
||||
lv_obj_clear_flag(mo_next, LV_OBJ_FLAG_CLICK_FOCUSABLE);
|
||||
|
||||
lv_obj_align(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
lv_obj_align_to(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ lv_obj_t * lv_calendar_header_dropdown_create(lv_obj_t * parent, lv_obj_t * cale
|
||||
lv_obj_add_event_cb(month_dd, month_event_cb, calendar);
|
||||
lv_obj_set_flex_grow(month_dd, 1);
|
||||
|
||||
lv_obj_align(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
lv_obj_align_to(header, calendar, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ static void lv_keyboard_constructor(lv_obj_t * obj)
|
||||
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
lv_obj_set_size(obj, lv_obj_get_width_fit(parent), lv_obj_get_height_fit(parent) / 2);
|
||||
lv_obj_align(obj, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_align(obj, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_add_event_cb(obj, lv_keyboard_def_event_cb, NULL);
|
||||
lv_obj_set_base_dir(obj, LV_BIDI_DIR_LTR);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ lv_obj_t * lv_msgbox_create(const char * title, const char * txt, const char * b
|
||||
lv_label_set_text(label, LV_SYMBOL_CLOSE);
|
||||
lv_coord_t close_btn_size = LV_MAX(lv_obj_get_width(label), lv_obj_get_height(label)) + LV_DPX(10);
|
||||
lv_obj_set_size(close_btn, close_btn_size, close_btn_size);
|
||||
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
|
||||
}
|
||||
|
||||
label = lv_label_create(mbox);
|
||||
|
||||
@@ -61,7 +61,7 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * icon, lv_coord_t btn_w, l
|
||||
|
||||
lv_obj_t * img = lv_img_create(btn);
|
||||
lv_img_set_src(img, icon);
|
||||
lv_obj_align(img, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_obj_align(img, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
||||
@@ -280,40 +280,40 @@ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align
|
||||
res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_TOP_LEFT:
|
||||
case LV_ALIGN_TOP_LEFT:
|
||||
res->x = 0;
|
||||
res->y = 0;
|
||||
break;
|
||||
case LV_ALIGN_IN_TOP_MID:
|
||||
case LV_ALIGN_TOP_MID:
|
||||
res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2;
|
||||
res->y = 0;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_TOP_RIGHT:
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
res->x = lv_area_get_width(base) - lv_area_get_width(to_align);
|
||||
res->y = 0;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_BOTTOM_LEFT:
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
res->x = 0;
|
||||
res->y = lv_area_get_height(base) - lv_area_get_height(to_align);
|
||||
break;
|
||||
case LV_ALIGN_IN_BOTTOM_MID:
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2;
|
||||
res->y = lv_area_get_height(base) - lv_area_get_height(to_align);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_BOTTOM_RIGHT:
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
res->x = lv_area_get_width(base) - lv_area_get_width(to_align);
|
||||
res->y = lv_area_get_height(base) - lv_area_get_height(to_align);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_LEFT_MID:
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
res->x = 0;
|
||||
res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_IN_RIGHT_MID:
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
res->x = lv_area_get_width(base) - lv_area_get_width(to_align);
|
||||
res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2;
|
||||
break;
|
||||
|
||||
@@ -59,15 +59,16 @@ typedef struct {
|
||||
|
||||
/** Alignments*/
|
||||
enum {
|
||||
LV_ALIGN_CENTER = 0,
|
||||
LV_ALIGN_IN_TOP_LEFT,
|
||||
LV_ALIGN_IN_TOP_MID,
|
||||
LV_ALIGN_IN_TOP_RIGHT,
|
||||
LV_ALIGN_IN_BOTTOM_LEFT,
|
||||
LV_ALIGN_IN_BOTTOM_MID,
|
||||
LV_ALIGN_IN_BOTTOM_RIGHT,
|
||||
LV_ALIGN_IN_LEFT_MID,
|
||||
LV_ALIGN_IN_RIGHT_MID,
|
||||
LV_ALIGN_TOP_LEFT = 0,
|
||||
LV_ALIGN_TOP_MID,
|
||||
LV_ALIGN_TOP_RIGHT,
|
||||
LV_ALIGN_BOTTOM_LEFT,
|
||||
LV_ALIGN_BOTTOM_MID,
|
||||
LV_ALIGN_BOTTOM_RIGHT,
|
||||
LV_ALIGN_LEFT_MID,
|
||||
LV_ALIGN_RIGHT_MID,
|
||||
LV_ALIGN_CENTER,
|
||||
|
||||
LV_ALIGN_OUT_TOP_LEFT,
|
||||
LV_ALIGN_OUT_TOP_MID,
|
||||
LV_ALIGN_OUT_TOP_RIGHT,
|
||||
|
||||
@@ -139,6 +139,7 @@ typedef enum {
|
||||
LV_STYLE_X = 24 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_Y = 25 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_LAYOUT = 26 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
LV_STYLE_ALIGN = 27 | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
|
||||
/*Group 2*/
|
||||
LV_STYLE_BG_COLOR = 32,
|
||||
@@ -211,9 +212,6 @@ typedef enum {
|
||||
LV_STYLE_TEXT_DECOR = 92 | LV_STYLE_PROP_INHERIT,
|
||||
LV_STYLE_TEXT_ALIGN = 93 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_LAYOUT_REFR,
|
||||
|
||||
/*Group 6*/
|
||||
LV_STYLE_CONTENT_TEXT = 96 | LV_STYLE_PROP_EXT_DRAW,
|
||||
|
||||
_LV_STYLE_LAST_BUILT_IN_PROP = 111,
|
||||
|
||||
LV_STYLE_PROP_ALL = 0xFFFF
|
||||
|
||||
@@ -183,8 +183,7 @@ static inline void lv_style_set_y(lv_style_t * style, lv_coord_t value)
|
||||
lv_style_set_prop(style, LV_STYLE_Y, v);
|
||||
}
|
||||
|
||||
|
||||
static inline void lv_style_set_layout(lv_style_t * style, lv_coord_t value)
|
||||
static inline void lv_style_set_layout(lv_style_t * style, uint16_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
@@ -192,6 +191,14 @@ static inline void lv_style_set_layout(lv_style_t * style, lv_coord_t value)
|
||||
lv_style_set_prop(style, LV_STYLE_LAYOUT, v);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_align(lv_style_t * style, lv_align_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_ALIGN, v);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_bg_color(lv_style_t * style, lv_color_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
||||
@@ -486,10 +486,10 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj)
|
||||
|
||||
position_to_selected(dropdown_obj);
|
||||
|
||||
if(dir == LV_DIR_BOTTOM) lv_obj_align(dropdown->list, dropdown_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
else if(dir == LV_DIR_TOP) lv_obj_align(dropdown->list, dropdown_obj, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
else if(dir == LV_DIR_LEFT) lv_obj_align(dropdown->list, dropdown_obj, LV_ALIGN_OUT_LEFT_TOP, 0, 0);
|
||||
else if(dir == LV_DIR_RIGHT) lv_obj_align(dropdown->list, dropdown_obj, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
|
||||
if(dir == LV_DIR_BOTTOM) lv_obj_align_to(dropdown->list, dropdown_obj, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
else if(dir == LV_DIR_TOP) lv_obj_align_to(dropdown->list, dropdown_obj, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
else if(dir == LV_DIR_LEFT) lv_obj_align_to(dropdown->list, dropdown_obj, LV_ALIGN_OUT_LEFT_TOP, 0, 0);
|
||||
else if(dir == LV_DIR_RIGHT) lv_obj_align_to(dropdown->list, dropdown_obj, LV_ALIGN_OUT_RIGHT_TOP, 0, 0);
|
||||
|
||||
|
||||
if(dropdown->dir == LV_DIR_LEFT || dropdown->dir == LV_DIR_RIGHT) {
|
||||
|
||||
Reference in New Issue
Block a user