mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
list ready + objs.transp added
This commit is contained in:
parent
fd4f9cdf11
commit
0257a82990
@ -35,8 +35,9 @@ lv_obj_t* def_scr_dp = NULL;
|
||||
lv_obj_t* act_scr_dp = NULL;
|
||||
ll_dsc_t scr_ll;
|
||||
|
||||
lv_objs_t lv_objs_def = {.color = COLOR_MAKE(0x20, 0x30, 0x40)};
|
||||
lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR};
|
||||
lv_objs_t lv_objs_def = {.color = COLOR_MAKE(0xa0, 0xc0, 0xe0), .transp = 0};
|
||||
lv_objs_t lv_objs_scr = {.color = LV_OBJ_DEF_SCR_COLOR, .transp = 0};
|
||||
lv_objs_t lv_objs_transp = {.transp = 1};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -306,7 +307,7 @@ bool lv_obj_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param)
|
||||
switch(sign) {
|
||||
case LV_SIGNAL_CHILD_CHG:
|
||||
/*Return 'invalid' if the child change signal is not enabled*/
|
||||
// if(obj_dp->child_chg_off != 0) valid = false;
|
||||
if(obj_dp->child_chg_off != 0) valid = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -332,6 +333,8 @@ lv_objs_t * lv_objs_get(lv_objs_builtin_t style, lv_objs_t * copy_p)
|
||||
case LV_OBJS_SCR:
|
||||
style_p = &lv_objs_scr;
|
||||
break;
|
||||
case LV_OBJS_TRANSP:
|
||||
style_p = &lv_objs_transp;
|
||||
break;
|
||||
default:
|
||||
style_p = NULL;
|
||||
@ -829,6 +832,9 @@ void lv_obj_set_hidden(lv_obj_t* obj_dp, bool hidden_en)
|
||||
{
|
||||
obj_dp->hidden = hidden_en == false ? 0 : 1;
|
||||
|
||||
lv_obj_t * par_dp = lv_obj_get_parent(obj_dp);
|
||||
par_dp->signal_f(par_dp, LV_SIGNAL_CHILD_CHG, obj_dp);
|
||||
|
||||
lv_obj_inv(obj_dp);
|
||||
}
|
||||
|
||||
|
@ -134,12 +134,14 @@ typedef enum
|
||||
typedef struct
|
||||
{
|
||||
color_t color;
|
||||
uint8_t transp :1;
|
||||
}lv_objs_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_OBJS_DEF,
|
||||
LV_OBJS_SCR,
|
||||
LV_OBJS_TRANSP,
|
||||
}lv_objs_builtin_t;
|
||||
|
||||
/**********************
|
||||
|
@ -316,6 +316,7 @@ static lv_obj_t* lv_refr_get_top_obj(const area_t * area_p, lv_obj_t* obj_dp)
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
if(obj_dp->opa == OPA_COVER &&
|
||||
obj_dp->hidden == 0 &&
|
||||
LV_SA(obj_dp, lv_objs_t)->transp == 0 &&
|
||||
obj_dp->design_f(obj_dp, area_p, LV_DESIGN_COVER_CHK) != false)
|
||||
{
|
||||
LL_READ(obj_dp->child_ll, i) {
|
||||
@ -397,7 +398,7 @@ static void lv_refr_obj(lv_obj_t* obj_dp, const area_t * mask_ori_p)
|
||||
if(union_ok != false) {
|
||||
|
||||
/* Redraw the object */
|
||||
if(obj_dp->opa != OPA_TRANSP) {
|
||||
if(obj_dp->opa != OPA_TRANSP && LV_SA(obj_dp, lv_objs_t)->transp == 0) {
|
||||
obj_dp->design_f(obj_dp, &mask_parent, LV_DESIGN_DRAW);
|
||||
}
|
||||
|
||||
|
@ -66,6 +66,7 @@ static lv_btns_t lv_btns_def =
|
||||
};
|
||||
static lv_btns_t lv_btns_transp =
|
||||
{
|
||||
.rects.objs.transp = 1,
|
||||
.rects.bwidth = 0,
|
||||
.rects.empty = 1,
|
||||
.rects.hpad = 10 * LV_STYLE_MULT,
|
||||
|
@ -11,8 +11,7 @@
|
||||
|
||||
#include "lv_list.h"
|
||||
#include "lv_rect.h"
|
||||
#include "lv_label.h"
|
||||
#include "lv_img.h"
|
||||
#include "misc/math/math_base.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -36,7 +35,7 @@ static lv_lists_t lv_lists_def =
|
||||
/*Page style*/
|
||||
.pages.bg_rects.objs.color = COLOR_MAKE(0x20, 0x50, 0x80), .pages.bg_rects.gcolor = COLOR_SILVER, .pages.bg_rects.bcolor = COLOR_GRAY,
|
||||
.pages.bg_rects.bopa = 50, .pages.bg_rects.bwidth = 0 * LV_STYLE_MULT, .pages.bg_rects.round = 2 * LV_STYLE_MULT,
|
||||
.pages.bg_rects.empty = 0,
|
||||
.pages.bg_rects.empty = 1,
|
||||
.pages.bg_rects.vpad = 10 * LV_STYLE_MULT,
|
||||
.pages.bg_rects.hpad = 10 * LV_STYLE_MULT,
|
||||
.pages.bg_rects.opad = 5 * LV_STYLE_MULT,
|
||||
@ -47,15 +46,21 @@ static lv_lists_t lv_lists_def =
|
||||
|
||||
/*List element style*/
|
||||
.liste_btns.mcolor[LV_BTN_STATE_REL] = COLOR_MAKE(0xa0, 0xa0, 0xa0), .liste_btns.gcolor[LV_BTN_STATE_REL] = COLOR_WHITE, .liste_btns.bcolor[LV_BTN_STATE_REL] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0x60, 0x80, 0xa0), .liste_btns.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0xd0, 0xd0, 0xd0), .liste_btns.bcolor[LV_BTN_STATE_PR] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x80,0x00,0x00), .liste_btns.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x20, 0x20, 0x20), .liste_btns.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0xf0, 0x26, 0x26), .liste_btns.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x40, 0x40, 0x40), .liste_btns.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0xa0, 0xa0, 0xa0), .liste_btns.gcolor[LV_BTN_STATE_PR] = COLOR_MAKE(0xa0, 0xc0, 0xe0), .liste_btns.bcolor[LV_BTN_STATE_PR] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0x60,0x80,0xa0), .liste_btns.gcolor[LV_BTN_STATE_TGL_REL] = COLOR_MAKE(0xc0, 0xd0, 0xf0), .liste_btns.bcolor[LV_BTN_STATE_TGL_REL] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x60, 0x80, 0xa0), .liste_btns.gcolor[LV_BTN_STATE_TGL_PR] = COLOR_MAKE(0x80, 0xa0, 0xc0), .liste_btns.bcolor[LV_BTN_STATE_TGL_PR] = COLOR_WHITE,
|
||||
.liste_btns.mcolor[LV_BTN_STATE_INA] = COLOR_SILVER, .liste_btns.gcolor[LV_BTN_STATE_INA] = COLOR_GRAY, .liste_btns.bcolor[LV_BTN_STATE_INA] = COLOR_WHITE,
|
||||
.liste_btns.rects.bwidth = 2 * LV_STYLE_MULT, .liste_btns.rects.bopa = 50,
|
||||
.liste_btns.rects.empty = 0, .liste_btns.rects.round = 4 * LV_STYLE_MULT,
|
||||
.liste_btns.rects.hpad = 10 * LV_STYLE_MULT,
|
||||
.liste_btns.rects.vpad = 10 * LV_STYLE_MULT,
|
||||
.liste_btns.rects.opad = 5 * LV_STYLE_MULT,
|
||||
.liste_btns.rects.opad = 20 * LV_STYLE_MULT,
|
||||
|
||||
.liste_labels.objs.color = COLOR_MAKE(0x20,0x20,0x20), .liste_labels.font = LV_FONT_DEFAULT,
|
||||
.liste_labels.letter_space = 2 * LV_STYLE_MULT, .liste_labels.line_space = 2 * LV_STYLE_MULT,
|
||||
.liste_labels.mid = 0,
|
||||
|
||||
.liste_imgs.recolor_opa = OPA_COVER,
|
||||
|
||||
.liste_layout = LV_RECT_LAYOUT_ROW_M
|
||||
};
|
||||
@ -81,12 +86,17 @@ static lv_lists_t lv_lists_def =
|
||||
lv_obj_t* lv_list_create(lv_obj_t* par_dp, lv_obj_t * copy_dp)
|
||||
{
|
||||
/*Create the ancestor basic object*/
|
||||
lv_obj_t * new_obj_dp = lv_page_create(par_dp, NULL);
|
||||
lv_obj_t * new_obj_dp = lv_page_create(par_dp, copy_dp);
|
||||
dm_assert(new_obj_dp);
|
||||
lv_list_ext_t * ext_p= lv_obj_alloc_ext(new_obj_dp, sizeof(lv_list_ext_t));
|
||||
|
||||
/*Init the new list object*/
|
||||
lv_obj_set_style(new_obj_dp, &lv_lists_def);
|
||||
lv_rect_set_layout(new_obj_dp, LV_LIST_LAYOUT_DEF);
|
||||
if(copy_dp == NULL) {
|
||||
ext_p->fit = LV_LIST_FIT_LONGEST;
|
||||
lv_obj_set_signal_f(new_obj_dp, lv_list_signal);
|
||||
lv_obj_set_style(new_obj_dp, &lv_lists_def);
|
||||
lv_rect_set_layout(new_obj_dp, LV_LIST_LAYOUT_DEF);
|
||||
}
|
||||
|
||||
return new_obj_dp;
|
||||
}
|
||||
@ -102,7 +112,7 @@ bool lv_list_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param)
|
||||
bool valid;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
valid = lv_list_signal(obj_dp, sign, param);
|
||||
valid = lv_page_signal(obj_dp, sign, param);
|
||||
|
||||
/* The object can be deleted so check its validity and then
|
||||
* make the object specific signal handling */
|
||||
@ -116,30 +126,73 @@ bool lv_list_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param)
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
void lv_list_add(lv_obj_t * obj_dp, const char * img_fn, const char * txt, void (*release) (lv_obj_t *))
|
||||
/**
|
||||
* Add a list element to the list
|
||||
* @param obj_dp pointer to list object
|
||||
* @param img_fn file name of an image before the text (NULL if unused)
|
||||
* @param txt text of the list element (NULL if unused)
|
||||
* @param rel_action pointer to release action function (like with lv_btn)
|
||||
* @return pointer to the new list element which can be customized (a button)
|
||||
*/
|
||||
lv_obj_t * lv_list_add(lv_obj_t * obj_dp, const char * img_fn, const char * txt, bool (*rel_action)(lv_obj_t*, lv_dispi_t *))
|
||||
{
|
||||
lv_lists_t * lists = lv_obj_get_style(obj_dp);
|
||||
lv_lists_t * lists_p = lv_obj_get_style(obj_dp);
|
||||
lv_list_ext_t * ext_p = lv_obj_get_ext(obj_dp);
|
||||
|
||||
/*Create a list element with the image an the text*/
|
||||
lv_obj_t * liste;
|
||||
liste = lv_btn_create(obj_dp, NULL);
|
||||
lv_obj_set_style(liste, &lists->liste_btns);
|
||||
//lv_btn_set_rel_action(liste, release);
|
||||
lv_obj_set_style(liste, &lists_p->liste_btns);
|
||||
lv_btn_set_rel_action(liste, rel_action);
|
||||
lv_page_glue_obj(liste, true);
|
||||
lv_rect_set_layout(liste, lv_lists_def.liste_layout);
|
||||
lv_rect_set_fit(liste, false, true);
|
||||
|
||||
|
||||
cord_t w = lv_obj_get_width(lv_obj_get_parent(obj_dp));
|
||||
w -= lists->pages.bg_rects.hpad * 2;
|
||||
lv_obj_set_width(liste, w);
|
||||
lv_rect_set_fit(liste, true, true); /*hor. fit might be disabled later*/
|
||||
|
||||
if(img_fn != NULL) {
|
||||
lv_obj_t * img = lv_img_create(liste, NULL);
|
||||
lv_img_set_file(img, img_fn);
|
||||
lv_obj_set_style(img, &lists_p->liste_imgs);
|
||||
lv_obj_set_click(img, false);
|
||||
}
|
||||
|
||||
lv_obj_t * label = lv_label_create(liste, NULL);
|
||||
lv_label_set_text(label, txt);
|
||||
if(txt != NULL) {
|
||||
lv_obj_t * label = lv_label_create(liste, NULL);
|
||||
lv_label_set_text(label, txt);
|
||||
lv_obj_set_style(label,&lists_p->liste_labels);
|
||||
lv_obj_set_click(label, false);
|
||||
}
|
||||
|
||||
/*Make the adjustment*/
|
||||
if(ext_p->fit == LV_LIST_FIT_HOLDER) {
|
||||
/*Now the width will be adjusted*/
|
||||
lv_rect_set_fit(liste, false, true);
|
||||
cord_t w = lv_obj_get_width(lv_obj_get_parent(obj_dp));
|
||||
w -= lists_p->pages.bg_rects.hpad * 2;
|
||||
lv_obj_set_width(liste, w);
|
||||
} else if(ext_p->fit == LV_LIST_FIT_LONGEST) {
|
||||
/*Now the width will be adjusted*/
|
||||
lv_rect_set_fit(liste, false, true);
|
||||
|
||||
lv_obj_t * e;
|
||||
cord_t w = 0;
|
||||
/*Get the longest list element*/
|
||||
e = lv_obj_get_child(obj_dp, NULL);
|
||||
while(e != NULL) {
|
||||
w = max(w, lv_obj_get_width(e));
|
||||
e = lv_obj_get_child(obj_dp, e);
|
||||
}
|
||||
|
||||
/*Set all list element to the longest width*/
|
||||
e = lv_obj_get_child(obj_dp, NULL);
|
||||
while(e != NULL) {
|
||||
if(lv_obj_get_width(e) != w) {
|
||||
lv_obj_set_width(e, w);
|
||||
}
|
||||
e = lv_obj_get_child(obj_dp, e);
|
||||
}
|
||||
}
|
||||
|
||||
return liste;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,20 +220,86 @@ lv_lists_t * lv_lists_get(lv_lists_builtin_t style, lv_lists_t * copy_p)
|
||||
|
||||
return style_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the list elements up by one
|
||||
* @param obj_dp pointer a to list object
|
||||
*/
|
||||
void lv_list_up(lv_obj_t * obj_dp)
|
||||
{
|
||||
/*Search the first list element which 'y' coordinate is below the parent
|
||||
* and position the list to show this element on the bottom*/
|
||||
lv_obj_t * h = lv_obj_get_parent(obj_dp);
|
||||
lv_obj_t * e;
|
||||
lv_obj_t * e_prev = NULL;
|
||||
e = lv_obj_get_child(obj_dp, NULL);
|
||||
while(e != NULL) {
|
||||
if(e->cords.y2 <= h->cords.y2) {
|
||||
if(e_prev != NULL)
|
||||
lv_obj_set_y(obj_dp, lv_obj_get_height(h) -
|
||||
(lv_obj_get_y(e_prev) + lv_obj_get_height(e_prev)));
|
||||
break;
|
||||
}
|
||||
e_prev = e;
|
||||
e = lv_obj_get_child(obj_dp, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the list elements down by one
|
||||
* @param obj_dp pointer to a list object
|
||||
*/
|
||||
void lv_list_down(lv_obj_t * obj_dp)
|
||||
{
|
||||
/*Search the first list element which 'y' coordinate is above the parent
|
||||
* and position the list to show this element on the top*/
|
||||
lv_obj_t * h = lv_obj_get_parent(obj_dp);
|
||||
lv_obj_t * e;
|
||||
e = lv_obj_get_child(obj_dp, NULL);
|
||||
while(e != NULL) {
|
||||
if(e->cords.y1 < h->cords.y1) {
|
||||
lv_obj_set_y(obj_dp, -lv_obj_get_y(e));
|
||||
break;
|
||||
}
|
||||
e = lv_obj_get_child(obj_dp, e);
|
||||
}
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Setter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Set the list element fitting of a list
|
||||
* @param obj_dp pointer to a list object
|
||||
* @param fit type of fitting (from lv_list_fit_t)
|
||||
*/
|
||||
void lv_list_set_fit(lv_obj_t * obj_dp, lv_list_fit_t fit)
|
||||
{
|
||||
lv_list_ext_t * ext_p = lv_obj_get_ext(obj_dp);
|
||||
|
||||
ext_p->fit = fit;
|
||||
}
|
||||
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the fit type of a list
|
||||
* @param obj_dp pointer to list object
|
||||
* @return the fit (from lv_list_fit_t)
|
||||
*/
|
||||
lv_list_fit_t lv_list_get_fit(lv_obj_t * obj_dp)
|
||||
{
|
||||
return LV_EA(obj_dp, lv_list_ext_t)->fit;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Handle the drawing related tasks of the lists
|
||||
* @param obj_dp pointer to an object
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "../lv_obj/lv_obj.h"
|
||||
#include "lv_page.h"
|
||||
#include "lv_btn.h"
|
||||
#include "lv_label.h"
|
||||
#include "lv_img.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -29,23 +31,31 @@ typedef struct
|
||||
{
|
||||
lv_pages_t pages; /*Ancestor page style*/
|
||||
lv_btns_t liste_btns;
|
||||
lv_labels_t liste_labels;
|
||||
lv_imgs_t liste_imgs;
|
||||
lv_rect_layout_t liste_layout;
|
||||
}lv_lists_t;
|
||||
|
||||
|
||||
/*Built-in styles of LISTATE*/
|
||||
typedef enum
|
||||
{
|
||||
LV_LISTS_DEF,
|
||||
}lv_lists_builtin_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LV_LIST_FIT_OFF = 0,
|
||||
LV_LIST_FIT_HOLDER,
|
||||
LV_LIST_FIT_CONTENT,
|
||||
LV_LIST_FIT_LONGEST,
|
||||
}lv_list_fit_t;
|
||||
|
||||
|
||||
/*Data of LIST*/
|
||||
typedef struct
|
||||
{
|
||||
lv_page_ext_t page_ext;
|
||||
uint8_t fit_size :1; /*Automatically set the adjust size of list elements to longest element */
|
||||
uint8_t sel_en :1; /*Enable selecting list elements by toggling them */
|
||||
uint8_t sel_one :1; /*Enable to select only one list element*/
|
||||
uint8_t fit; /*Width adjustment of list elements (from lv_list_adjsut_t)*/
|
||||
}lv_list_ext_t;
|
||||
|
||||
|
||||
@ -54,9 +64,14 @@ typedef struct
|
||||
**********************/
|
||||
lv_obj_t* lv_list_create(lv_obj_t* par_dp, lv_obj_t * copy_dp);
|
||||
bool lv_list_signal(lv_obj_t* obj_dp, lv_signal_t sign, void * param);
|
||||
void lv_list_add(lv_obj_t * obj_dp, const char * img_fn, const char * txt, void (*release) (lv_obj_t *));
|
||||
lv_obj_t * lv_list_add(lv_obj_t * obj_dp, const char * img_fn, const char * txt, bool (*rel_action)(lv_obj_t*, lv_dispi_t *));
|
||||
lv_lists_t * lv_lists_get(lv_lists_builtin_t style, lv_lists_t * copy_p);
|
||||
|
||||
void lv_list_down(lv_obj_t * obj_dp);
|
||||
void lv_list_up(lv_obj_t * obj_dp);
|
||||
void lv_list_set_fit(lv_obj_t * obj_dp, lv_list_fit_t fit);
|
||||
lv_list_fit_t lv_list_get_fit(lv_obj_t * obj_dp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -91,7 +91,9 @@ static lv_pages_t lv_pages_paper =
|
||||
|
||||
static lv_pages_t lv_pages_transp =
|
||||
{
|
||||
.bg_rects.objs.transp = 1,
|
||||
.bg_rects.empty = 1,
|
||||
.bg_rects.bwidth = 0,
|
||||
.bg_rects.hpad = 10 * LV_STYLE_MULT,
|
||||
.bg_rects.vpad = 10 * LV_STYLE_MULT,
|
||||
.bg_rects.vpad = 10 * LV_STYLE_MULT,
|
||||
@ -274,14 +276,11 @@ bool lv_page_signal(lv_obj_t* obj_dp, lv_signal_t sign, void* param)
|
||||
break;
|
||||
|
||||
case LV_SIGNAL_STYLE_CHG:
|
||||
lv_obj_set_style(page_ext_p->sbh_dp, &pages_p->sb_rects);
|
||||
lv_obj_set_style(page_ext_p->sbv_dp, &pages_p->sb_rects);
|
||||
lv_obj_set_width(page_ext_p->sbv_dp, pages_p->sb_width);
|
||||
lv_obj_set_height(page_ext_p->sbh_dp, pages_p->sb_width);
|
||||
|
||||
/* Set the styles only if they are different else infinite loop
|
||||
* will be created from lv_obj_set_style*/
|
||||
if(lv_obj_get_style(page_ext_p->sbh_dp) != &pages_p->sb_rects) {
|
||||
lv_obj_set_style(page_ext_p->sbh_dp, &pages_p->sb_rects);
|
||||
lv_obj_set_style(page_ext_p->sbv_dp, &pages_p->sb_rects);
|
||||
lv_obj_set_style(obj_dp, &pages_p->bg_rects);
|
||||
}
|
||||
if(pages_p->sb_mode == LV_PAGE_SB_MODE_ON) {
|
||||
lv_obj_set_opa(page_ext_p->sbv_dp, (pages_p->sb_opa * OPA_COVER) / 100);
|
||||
lv_obj_set_opa(page_ext_p->sbh_dp, (pages_p->sb_opa * OPA_COVER) / 100);
|
||||
|
@ -50,7 +50,7 @@ static lv_rects_t lv_rects_def =
|
||||
.hpad = 10 * LV_STYLE_MULT, .vpad = 10 * LV_STYLE_MULT, .opad = 10 * LV_STYLE_MULT };
|
||||
|
||||
static lv_rects_t lv_rects_transp =
|
||||
{ .bwidth = 0, .empty = 1,
|
||||
{ .objs.transp = 1, .bwidth = 0, .empty = 1,
|
||||
.hpad = 10 * LV_STYLE_MULT, .vpad = 10 * LV_STYLE_MULT, .opad = 10 * LV_STYLE_MULT};
|
||||
|
||||
static lv_rects_t lv_rects_border =
|
||||
@ -345,6 +345,8 @@ static void lv_rect_layout_col(lv_obj_t * obj_dp)
|
||||
/* Align the children */
|
||||
cord_t last_cord = rects_p->vpad;
|
||||
LL_READ_BACK(obj_dp->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false) continue;
|
||||
|
||||
lv_obj_align(child, obj_dp, align, hpad_corr , last_cord);
|
||||
last_cord += lv_obj_get_height(child) + rects_p->opad;
|
||||
}
|
||||
@ -392,6 +394,8 @@ static void lv_rect_layout_row(lv_obj_t * obj_dp)
|
||||
/* Align the children */
|
||||
cord_t last_cord = rects_p->hpad;
|
||||
LL_READ_BACK(obj_dp->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false) continue;
|
||||
|
||||
lv_obj_align(child, obj_dp, align, last_cord, vpad_corr);
|
||||
last_cord += lv_obj_get_width(child) + rects_p->opad;
|
||||
}
|
||||
@ -423,6 +427,8 @@ static void lv_rect_layout_center(lv_obj_t * obj_dp)
|
||||
/* Align the children */
|
||||
cord_t last_cord = - (h_tot / 2);
|
||||
LL_READ_BACK(obj_dp->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false) continue;
|
||||
|
||||
lv_obj_align(child, obj_dp, LV_ALIGN_CENTER, 0, last_cord + lv_obj_get_height(child) / 2);
|
||||
last_cord += lv_obj_get_height(child) + rects_p->opad;
|
||||
}
|
||||
@ -457,6 +463,7 @@ void lv_rect_refr_autofit(lv_obj_t * obj_dp)
|
||||
rect_cords.y2 = LV_CORD_MIN;
|
||||
|
||||
LL_READ(obj_dp->child_ll, i) {
|
||||
if(lv_obj_get_hidden(i) != false) continue;
|
||||
rect_cords.x1 = min(rect_cords.x1, i->cords.x1);
|
||||
rect_cords.y1 = min(rect_cords.y1, i->cords.y1);
|
||||
rect_cords.x2 = max(rect_cords.x2, i->cords.x2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user