Tweak msgbox layout
2
main.c
|
|
@ -268,7 +268,7 @@ static void shutdown_btn_clicked_cb(lv_event_t *event) {
|
|||
LV_UNUSED(event);
|
||||
static const char *btns[] = { "Yes", "No", "" };
|
||||
lv_obj_t *mbox = lv_msgbox_create(NULL, NULL, "Shutdown device?", btns, false);
|
||||
lv_obj_set_width(mbox, 400);
|
||||
lv_obj_set_size(mbox, 400, LV_SIZE_CONTENT);
|
||||
lv_obj_add_event_cb(mbox, shutdown_mbox_value_changed_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
lv_obj_center(mbox);
|
||||
}
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
18
theme.c
|
|
@ -51,6 +51,7 @@ static struct {
|
|||
lv_style_t dropdown_list_selected;
|
||||
lv_style_t label;
|
||||
lv_style_t msgbox;
|
||||
lv_style_t msgbox_label;
|
||||
lv_style_t msgbox_btnmatrix;
|
||||
lv_style_t msgbox_background;
|
||||
lv_style_t bar;
|
||||
|
|
@ -207,9 +208,13 @@ static void init_styles(const ul_theme *theme) {
|
|||
lv_style_set_radius(&(styles.msgbox), lv_dpx(theme->msgbox.corner_radius));
|
||||
lv_style_set_pad_all(&(styles.msgbox), lv_dpx(theme->msgbox.pad));
|
||||
|
||||
reset_style(&(styles.msgbox_label));
|
||||
lv_style_set_text_align(&(styles.msgbox_label), LV_TEXT_ALIGN_CENTER);
|
||||
lv_style_set_pad_bottom(&(styles.msgbox_label), lv_dpx(theme->msgbox.gap));
|
||||
|
||||
reset_style(&(styles.msgbox_btnmatrix));
|
||||
lv_style_set_pad_top(&(styles.msgbox_btnmatrix), lv_dpx(theme->msgbox.buttons.pad));
|
||||
lv_style_set_pad_gap(&(styles.msgbox_btnmatrix), lv_dpx(theme->msgbox.buttons.gap));
|
||||
lv_style_set_min_width(&(styles.msgbox_btnmatrix), LV_PCT(100));
|
||||
|
||||
reset_style(&(styles.msgbox_background));
|
||||
lv_style_set_bg_color(&(styles.msgbox_background), lv_color_hex(theme->msgbox.dimming.color));
|
||||
|
|
@ -301,14 +306,10 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
|
|||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_label_class) && (lv_obj_check_type(lv_obj_get_parent(obj), &lv_msgbox_class) || lv_obj_check_type(lv_obj_get_parent(obj), &lv_msgbox_content_class))) {
|
||||
lv_obj_add_style(obj, &(styles.msgbox_label), 0);
|
||||
return; /* Inherit styling from message box */
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_label_class) || lv_obj_check_type(obj, &lv_spangroup_class)) {
|
||||
lv_obj_add_style(obj, &(styles.label), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_btnmatrix_class) && lv_obj_check_type(lv_obj_get_parent(obj), &lv_msgbox_class)) {
|
||||
lv_obj_add_style(obj, &(styles.msgbox_btnmatrix), 0);
|
||||
lv_obj_add_style(obj, &(styles.button), LV_PART_ITEMS);
|
||||
|
|
@ -321,6 +322,11 @@ static void apply_theme_cb(lv_theme_t *theme, lv_obj_t *obj) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_label_class) || lv_obj_check_type(obj, &lv_spangroup_class)) {
|
||||
lv_obj_add_style(obj, &(styles.label), 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_bar_class)) {
|
||||
lv_obj_add_style(obj, &(styles.bar), 0);
|
||||
lv_obj_add_style(obj, &(styles.bar_indicator), LV_PART_INDICATOR);
|
||||
|
|
|
|||
2
theme.h
|
|
@ -139,7 +139,6 @@ typedef struct {
|
|||
|
||||
/* Message box buttons theme */
|
||||
typedef struct {
|
||||
lv_coord_t pad;
|
||||
lv_coord_t gap;
|
||||
} ul_theme_msgbox_buttons;
|
||||
|
||||
|
|
@ -157,6 +156,7 @@ typedef struct {
|
|||
uint32_t border_color;
|
||||
lv_coord_t corner_radius;
|
||||
lv_coord_t pad;
|
||||
lv_coord_t gap;
|
||||
ul_theme_msgbox_buttons buttons;
|
||||
ul_theme_msgbox_dimming dimming;
|
||||
} ul_theme_msgbox;
|
||||
|
|
|
|||
12
themes.c
|
|
@ -162,9 +162,9 @@ static const ul_theme ul_themes_breezy_light = {
|
|||
.border_width = 1,
|
||||
.border_color = 0xbdc3c7,
|
||||
.corner_radius = 0,
|
||||
.pad = 10,
|
||||
.pad = 20,
|
||||
.gap = 20,
|
||||
.buttons = {
|
||||
.pad = 10,
|
||||
.gap = 5
|
||||
},
|
||||
.dimming = {
|
||||
|
|
@ -320,9 +320,9 @@ static const ul_theme ul_themes_breezy_dark = {
|
|||
.border_width = 1,
|
||||
.border_color = 0x3b4045,
|
||||
.corner_radius = 0,
|
||||
.pad = 10,
|
||||
.pad = 20,
|
||||
.gap = 20,
|
||||
.buttons = {
|
||||
.pad = 10,
|
||||
.gap = 5
|
||||
},
|
||||
.dimming = {
|
||||
|
|
@ -478,8 +478,8 @@ static const ul_theme ul_themes_pmos_light = {
|
|||
.border_color = 0x97bcc4,
|
||||
.corner_radius = 3,
|
||||
.pad = 20,
|
||||
.gap = 20,
|
||||
.buttons = {
|
||||
.pad = 20,
|
||||
.gap = 10
|
||||
},
|
||||
.dimming = {
|
||||
|
|
@ -635,8 +635,8 @@ static const ul_theme ul_themes_pmos_dark = {
|
|||
.border_color = 0x395e66,
|
||||
.corner_radius = 3,
|
||||
.pad = 20,
|
||||
.gap = 20,
|
||||
.buttons = {
|
||||
.pad = 20,
|
||||
.gap = 10
|
||||
},
|
||||
.dimming = {
|
||||
|
|
|
|||