1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

lv_objx: if a define is not provided by lv_conf.h define it by the object

This commit is contained in:
Gabor 2017-01-12 09:49:13 +01:00
parent 6990528bb9
commit 4fb9468664
6 changed files with 43 additions and 21 deletions

View File

@ -93,7 +93,7 @@
/*Line (dependencies: -*/
#define USE_LV_LINE 1
/*Image (dependencies: from misc: FSINT, UFS)*/
/*Image (dependencies: from misc: fsint, ufs)*/
#define USE_LV_IMG 1
#if USE_LV_IMG != 0
//#define LV_IMG_DEF_WALLPAPER img_wallpaper_var /*Comment this line to NOT use wallpaper*/
@ -133,15 +133,15 @@
/*Window (dependencies: lv_rect, lv_btn, lv_label, lv_img, lv_page)*/
#define USE_LV_WIN 1
/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/
#define USE_LV_MBOX 1
/*Message box (dependencies: lv_rect, lv_btn, lv_label)*/
#define USE_LV_MBOX 1
#if USE_LV_MBOX != 0
#define LV_MBOX_ANIM_TIME 250 /*How fast animate out the message box in auto close. 0: no animation [ms]*/
#endif
/*Gauge (dependencies: lv_rect, lv_label, lv_line, misc: trigo)*/
#define USE_LV_GAUGE 1
/*==================
* LV APP SETTINGS
* =================*/

View File

@ -20,6 +20,23 @@
/*********************
* DEFINES
*********************/
/*Test configurations*/
#ifndef LV_LABEL_SCROLL_SPEED
#define LV_LABEL_SCROLL_SPEED (25 * LV_DOWNSCALE) /*Hor, or ver. scroll speed (px/sec) in 'LV_LABEL_LONG_SCROLL' mode*/
#endif
#ifndef LV_LABEL_SCROLL_SPEED_VER
#define LV_LABEL_SCROLL_SPEED_VER (10 * LV_DOWNSCALE) /*Ver. scroll speed if hor. scroll is applied too*/
#endif
#ifndef LV_LABEL_SCROLL_PLAYBACK_PAUSE
#define LV_LABEL_SCROLL_PLAYBACK_PAUSE 500 /*Wait before the scroll turns back in ms*/
#endif
#ifndef LV_LABEL_SCROLL_REPEAT_PAUSE
#define LV_LABEL_SCROLL_REPEAT_PAUSE 500 /*Wait before the scroll begins again in ms*/
#endif
#define LV_LABEL_DOT_NUM 3
#define LV_LABEL_DOT_END_INV 0xFFFF

View File

@ -17,6 +17,10 @@
/*********************
* DEFINES
*********************/
/*Test configurations*/
#ifndef LV_MBOX_ANIM_TIME
#define LV_MBOX_ANIM_TIME 250 /*How fast animate out the message box in auto close. 0: no animation [ms]*/
#endif
/**********************
* TYPEDEFS
@ -178,17 +182,12 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
/*Hide the title and/or buttons*/
const char * title_txt = lv_label_get_text(ext->title);
if(style->hide_title != 0 || title_txt[0] == '\0') {
lv_obj_set_hidden(ext->btnh, true);
} else {
lv_obj_set_hidden(ext->btnh, false);
}
if(title_txt[0] == '\0') lv_obj_set_hidden(ext->btnh, true);
else lv_obj_set_hidden(ext->btnh, false);
if(lv_obj_get_child_num(ext->btnh) == 0) lv_obj_set_hidden(ext->btnh, true);
else lv_obj_set_hidden(ext->btnh, false);
if(style->hide_btns != 0 || lv_obj_get_child_num(ext->btnh) == 0) {
lv_obj_set_hidden(ext->btnh, true);
} else {
lv_obj_set_hidden(ext->btnh, false);
}
break;
default:
break;
@ -448,7 +447,6 @@ static void lv_mbox_realign(lv_obj_t * mbox)
btn = lv_obj_get_child(ext->btnh, btn);
}
if(style->hide_title != 0) title_w = 0;
cord_t w = MATH_MAX(title_w, txt_w);
w = MATH_MAX(w, btn_w);
lv_obj_set_width(ext->btnh, w );
@ -482,8 +480,6 @@ static void lv_mboxs_init(void)
lv_rects_get(LV_RECTS_TRANSP, &lv_mboxs_def.btnh);
lv_mboxs_def.btnh.hpad = 0;
lv_mboxs_def.btnh.vpad = 0;
lv_mboxs_def.hide_btns = 0;
lv_mboxs_def.hide_title = 0;
memcpy(&lv_mboxs_info, &lv_mboxs_def, sizeof(lv_mboxs_t));
lv_mboxs_info.bg.objs.color = COLOR_BLACK;
@ -500,8 +496,6 @@ static void lv_mboxs_init(void)
lv_mboxs_info.btn.gcolor[LV_BTN_STATE_PR] = COLOR_GRAY;
lv_mboxs_info.btn.rects.bopa = OPA_COVER;
lv_mboxs_info.btn_label.objs.color = COLOR_WHITE;
lv_mboxs_info.hide_btns = 0;
lv_mboxs_info.hide_title = 0;
memcpy(&lv_mboxs_warn, &lv_mboxs_info, sizeof(lv_mboxs_t));
lv_mboxs_warn.bg.objs.color = COLOR_MAKE(0xff, 0xb2, 0x66);

View File

@ -49,8 +49,6 @@ typedef struct
lv_rects_t btnh;
lv_btns_t btn;
lv_labels_t btn_label;
uint8_t hide_title :1;
uint8_t hide_btns :1;
}lv_mboxs_t;
/*Built-in styles of message box*/

View File

@ -19,6 +19,10 @@
/*********************
* DEFINES
*********************/
/*Test configurations*/
#ifndef LV_PAGE_ANIM_FOCUS_TIME
#define LV_PAGE_ANIM_FOCUS_TIME 300 /*List focus animation time [ms] (0: turn off the animation)*/
#endif
/**********************
* TYPEDEFS

View File

@ -17,6 +17,15 @@
/*********************
* DEFINES
*********************/
/*Test configuration*/
#ifndef LV_TA_MAX_LENGTH
#define LV_TA_MAX_LENGTH 256
#endif
#ifndef LV_TA_CUR_BLINK_TIME
#define LV_TA_CUR_BLINK_TIME 400 /*ms*/
#endif
#define LV_TA_DEF_WIDTH (120 * LV_DOWNSCALE)
#define LV_TA_DEF_HEIGHT (80 * LV_DOWNSCALE)