mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
styles: make styles to global variables
This commit is contained in:
parent
5608bf868e
commit
919a8e81ea
@ -359,8 +359,8 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
|
||||
const lv_style_t * style, const char * fn)
|
||||
{
|
||||
if(fn == NULL) {
|
||||
lv_draw_rect(cords_p, mask_p, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_draw_label(cords_p, mask_p, lv_style_get(LV_STYLE_PLAIN), "No data", TXT_FLAG_NONE, NULL);
|
||||
lv_draw_rect(cords_p, mask_p, &lv_style_plain);
|
||||
lv_draw_label(cords_p, mask_p, &lv_style_plain, "No data", TXT_FLAG_NONE, NULL);
|
||||
} else {
|
||||
fs_file_t file;
|
||||
fs_res_t res = fs_open(&file, fn, FS_MODE_RD);
|
||||
@ -446,8 +446,8 @@ void lv_draw_img(const area_t * cords_p, const area_t * mask_p,
|
||||
fs_close(&file);
|
||||
|
||||
if(res != FS_RES_OK) {
|
||||
lv_draw_rect(cords_p, mask_p, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_draw_label(cords_p, mask_p, lv_style_get(LV_STYLE_PLAIN), "No data", TXT_FLAG_NONE, NULL);
|
||||
lv_draw_rect(cords_p, mask_p, &lv_style_plain);
|
||||
lv_draw_label(cords_p, mask_p, &lv_style_plain, "No data", TXT_FLAG_NONE, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,10 +90,10 @@ void lv_init(void)
|
||||
act_scr = def_scr;
|
||||
|
||||
top_layer = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_style(top_layer, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(top_layer, &lv_style_transp_tight);
|
||||
|
||||
sys_layer = lv_obj_create(NULL, NULL);
|
||||
lv_obj_set_style(sys_layer, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(sys_layer, &lv_style_transp_tight);
|
||||
|
||||
/*Refresh the screen*/
|
||||
lv_obj_invalidate(act_scr);
|
||||
@ -139,7 +139,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
new_obj->ext_size = 0;
|
||||
|
||||
/*Set appearance*/
|
||||
new_obj->style_p = lv_style_get(LV_STYLE_SCREEN);
|
||||
new_obj->style_p = &lv_style_scr;
|
||||
|
||||
/*Set virtual functions*/
|
||||
lv_obj_set_signal_func(new_obj, lv_obj_signal);
|
||||
@ -186,7 +186,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
|
||||
new_obj->ext_size = 0;
|
||||
|
||||
/*Set appearance*/
|
||||
new_obj->style_p = lv_style_get(LV_STYLE_PLAIN);
|
||||
new_obj->style_p = &lv_style_plain;
|
||||
|
||||
/*Set virtual functions*/
|
||||
lv_obj_set_signal_func(new_obj, lv_obj_signal);
|
||||
@ -1297,7 +1297,7 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
|
||||
}
|
||||
#endif
|
||||
|
||||
if(style_act == NULL) style_act = lv_style_get(LV_STYLE_PLAIN);
|
||||
if(style_act == NULL) style_act = &lv_style_plain;
|
||||
|
||||
return style_act;
|
||||
}
|
||||
|
@ -37,19 +37,18 @@ static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static lv_style_t lv_style_scr;
|
||||
static lv_style_t lv_style_transparent;
|
||||
static lv_style_t lv_style_transparent_tight;
|
||||
static lv_style_t lv_style_plain;
|
||||
static lv_style_t lv_style_plain_color;
|
||||
static lv_style_t lv_style_pretty;
|
||||
static lv_style_t lv_style_pretty_color;
|
||||
static lv_style_t lv_style_button_off_released;
|
||||
static lv_style_t lv_style_button_off_pressed;
|
||||
static lv_style_t lv_style_button_on_released;
|
||||
static lv_style_t lv_style_button_on_pressed;;
|
||||
static lv_style_t lv_style_button_inactive;
|
||||
lv_style_t lv_style_scr;
|
||||
lv_style_t lv_style_transp;
|
||||
lv_style_t lv_style_transp_tight;
|
||||
lv_style_t lv_style_plain;
|
||||
lv_style_t lv_style_plain_color;
|
||||
lv_style_t lv_style_pretty;
|
||||
lv_style_t lv_style_pretty_color;
|
||||
lv_style_t lv_style_btn_off_released;
|
||||
lv_style_t lv_style_btn_off_pressed;
|
||||
lv_style_t lv_style_btn_on_released;
|
||||
lv_style_t lv_style_btn_on_pressed;;
|
||||
lv_style_t lv_style_btn_inactive;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@ -131,121 +130,68 @@ void lv_style_init (void)
|
||||
lv_style_pretty_color.body.border.color = COLOR_MAKE(0x15, 0x2c, 0x42);
|
||||
|
||||
/*Transparent style*/
|
||||
memcpy(&lv_style_transparent, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_transparent.body.empty = 1;
|
||||
lv_style_transparent.glass = 1;
|
||||
lv_style_transparent.body.border.width = 0;
|
||||
memcpy(&lv_style_transp, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_transp.body.empty = 1;
|
||||
lv_style_transp.glass = 1;
|
||||
lv_style_transp.body.border.width = 0;
|
||||
|
||||
/*Transparent tight style*/
|
||||
memcpy(&lv_style_transparent_tight, &lv_style_transparent, sizeof(lv_style_t));
|
||||
lv_style_transparent_tight.body.padding.hor = 0;
|
||||
lv_style_transparent_tight.body.padding.ver = 0;
|
||||
memcpy(&lv_style_transp_tight, &lv_style_transp, sizeof(lv_style_t));
|
||||
lv_style_transp_tight.body.padding.hor = 0;
|
||||
lv_style_transp_tight.body.padding.ver = 0;
|
||||
|
||||
/*Button released style*/
|
||||
memcpy(&lv_style_button_off_released, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_button_off_released.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0);
|
||||
lv_style_button_off_released.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d);
|
||||
lv_style_button_off_released.body.radius = LV_DPI / 15;
|
||||
lv_style_button_off_released.body.padding.hor = LV_DPI / 4;
|
||||
lv_style_button_off_released.body.padding.ver = LV_DPI / 6;
|
||||
lv_style_button_off_released.body.padding.inner = LV_DPI / 10;
|
||||
lv_style_button_off_released.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28);
|
||||
lv_style_button_off_released.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_button_off_released.body.border.opa = OPA_70;
|
||||
lv_style_button_off_released.text.color = COLOR_MAKE(0xff, 0xff, 0xff);
|
||||
lv_style_button_off_released.text.align = LV_TEXT_ALIGN_MID;
|
||||
lv_style_button_off_released.body.shadow.color = COLOR_GRAY;
|
||||
lv_style_button_off_released.body.shadow.width = 0;
|
||||
memcpy(&lv_style_btn_off_released, &lv_style_plain, sizeof(lv_style_t));
|
||||
lv_style_btn_off_released.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0);
|
||||
lv_style_btn_off_released.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d);
|
||||
lv_style_btn_off_released.body.radius = LV_DPI / 15;
|
||||
lv_style_btn_off_released.body.padding.hor = LV_DPI / 4;
|
||||
lv_style_btn_off_released.body.padding.ver = LV_DPI / 6;
|
||||
lv_style_btn_off_released.body.padding.inner = LV_DPI / 10;
|
||||
lv_style_btn_off_released.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28);
|
||||
lv_style_btn_off_released.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
|
||||
lv_style_btn_off_released.body.border.opa = OPA_70;
|
||||
lv_style_btn_off_released.text.color = COLOR_MAKE(0xff, 0xff, 0xff);
|
||||
lv_style_btn_off_released.text.align = LV_TEXT_ALIGN_MID;
|
||||
lv_style_btn_off_released.body.shadow.color = COLOR_GRAY;
|
||||
lv_style_btn_off_released.body.shadow.width = 0;
|
||||
|
||||
/*Button pressed style*/
|
||||
memcpy(&lv_style_button_off_pressed, &lv_style_button_off_released, sizeof(lv_style_t));
|
||||
lv_style_button_off_pressed.body.color_main = COLOR_MAKE(0x33, 0x62, 0x94);
|
||||
lv_style_button_off_pressed.body.color_gradient = COLOR_MAKE(0x10, 0x26, 0x3c);
|
||||
lv_style_button_off_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_button_off_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_button_off_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
memcpy(&lv_style_btn_off_pressed, &lv_style_btn_off_released, sizeof(lv_style_t));
|
||||
lv_style_btn_off_pressed.body.color_main = COLOR_MAKE(0x33, 0x62, 0x94);
|
||||
lv_style_btn_off_pressed.body.color_gradient = COLOR_MAKE(0x10, 0x26, 0x3c);
|
||||
lv_style_btn_off_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_btn_off_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_btn_off_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
|
||||
/*Button toggle released style*/
|
||||
memcpy(&lv_style_button_on_released, &lv_style_button_off_released, sizeof(lv_style_t));
|
||||
lv_style_button_on_released.body.color_main = COLOR_MAKE(0x0a, 0x11, 0x22);
|
||||
lv_style_button_on_released.body.color_gradient = COLOR_MAKE(0x37, 0x62, 0x90);
|
||||
lv_style_button_on_released.body.border.color = COLOR_MAKE(0x01, 0x07, 0x0d);
|
||||
lv_style_button_on_released.text.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
lv_style_button_on_released.image.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
lv_style_button_on_released.line.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
memcpy(&lv_style_btn_on_released, &lv_style_btn_off_released, sizeof(lv_style_t));
|
||||
lv_style_btn_on_released.body.color_main = COLOR_MAKE(0x0a, 0x11, 0x22);
|
||||
lv_style_btn_on_released.body.color_gradient = COLOR_MAKE(0x37, 0x62, 0x90);
|
||||
lv_style_btn_on_released.body.border.color = COLOR_MAKE(0x01, 0x07, 0x0d);
|
||||
lv_style_btn_on_released.text.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
lv_style_btn_on_released.image.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
lv_style_btn_on_released.line.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
|
||||
|
||||
/*Button toggle pressed style*/
|
||||
memcpy(&lv_style_button_on_pressed, &lv_style_button_on_released, sizeof(lv_style_t));
|
||||
lv_style_button_on_pressed.body.color_main = COLOR_MAKE(0x02, 0x14, 0x27);
|
||||
lv_style_button_on_pressed.body.color_gradient = COLOR_MAKE(0x2b, 0x4c, 0x70);
|
||||
lv_style_button_on_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_button_on_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_button_on_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
memcpy(&lv_style_btn_on_pressed, &lv_style_btn_on_released, sizeof(lv_style_t));
|
||||
lv_style_btn_on_pressed.body.color_main = COLOR_MAKE(0x02, 0x14, 0x27);
|
||||
lv_style_btn_on_pressed.body.color_gradient = COLOR_MAKE(0x2b, 0x4c, 0x70);
|
||||
lv_style_btn_on_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_btn_on_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
lv_style_btn_on_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
|
||||
|
||||
/*Button inactive style*/
|
||||
memcpy(&lv_style_button_inactive, &lv_style_button_off_released, sizeof(lv_style_t));
|
||||
lv_style_button_inactive.body.color_main = COLOR_MAKE(0xd8, 0xd8, 0xd8);
|
||||
lv_style_button_inactive.body.color_gradient = COLOR_MAKE(0xd8, 0xd8, 0xd8);
|
||||
lv_style_button_inactive.body.border.color = COLOR_MAKE(0x90, 0x90, 0x90);
|
||||
lv_style_button_inactive.text.color = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
lv_style_button_inactive.image.color = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
lv_style_button_inactive.line.color = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
memcpy(&lv_style_btn_inactive, &lv_style_btn_off_released, sizeof(lv_style_t));
|
||||
lv_style_btn_inactive.body.color_main = COLOR_MAKE(0xd8, 0xd8, 0xd8);
|
||||
lv_style_btn_inactive.body.color_gradient = COLOR_MAKE(0xd8, 0xd8, 0xd8);
|
||||
lv_style_btn_inactive.body.border.color = COLOR_MAKE(0x90, 0x90, 0x90);
|
||||
lv_style_btn_inactive.text.color = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
lv_style_btn_inactive.image.color = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
lv_style_btn_inactive.line.color = COLOR_MAKE(0x70, 0x70, 0x70);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get style from its name
|
||||
* @param style_name an element of the 'lv_style_name_t' enum
|
||||
* @return pointer to the requested style (lv_style_def by default)
|
||||
*/
|
||||
lv_style_t * lv_style_get(lv_style_name_t style_name)
|
||||
{
|
||||
lv_style_t * style = &lv_style_plain;
|
||||
|
||||
switch(style_name) {
|
||||
case LV_STYLE_SCREEN:
|
||||
style = &lv_style_scr;
|
||||
break;
|
||||
case LV_STYLE_PLAIN:
|
||||
style = &lv_style_plain;
|
||||
break;
|
||||
case LV_STYLE_PLAIN_COLOR:
|
||||
style = &lv_style_plain_color;
|
||||
break;
|
||||
case LV_STYLE_PRETTY:
|
||||
style = &lv_style_pretty;
|
||||
break;
|
||||
case LV_STYLE_PRETTY_COLOR:
|
||||
style = &lv_style_pretty_color;
|
||||
break;
|
||||
case LV_STYLE_TRANSPARENT:
|
||||
style = &lv_style_transparent;
|
||||
break;
|
||||
case LV_STYLE_TRANSPARENT_TIGHT:
|
||||
style = &lv_style_transparent_tight;
|
||||
break;
|
||||
case LV_STYLE_BUTTON_OFF_RELEASED:
|
||||
style = &lv_style_button_off_released;
|
||||
break;
|
||||
case LV_STYLE_BUTTON_OFF_PRESSED:
|
||||
style = &lv_style_button_off_pressed;
|
||||
break;
|
||||
case LV_STYLE_BUTTON_ON_RELEASED:
|
||||
style = &lv_style_button_on_released;
|
||||
break;
|
||||
case LV_STYLE_BUTTON_ON_PRESSED:
|
||||
style = &lv_style_button_on_pressed;
|
||||
break;
|
||||
case LV_STYLE_BUTTON_INACTIVE:
|
||||
style = &lv_style_button_inactive;
|
||||
break;
|
||||
default:
|
||||
style = &lv_style_plain;
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a style to an other
|
||||
* @param dest pointer to the destination style
|
||||
|
@ -91,22 +91,6 @@ typedef struct
|
||||
}line;
|
||||
}lv_style_t;
|
||||
|
||||
typedef enum {
|
||||
LV_STYLE_SCREEN,
|
||||
LV_STYLE_TRANSPARENT,
|
||||
LV_STYLE_TRANSPARENT_TIGHT,
|
||||
LV_STYLE_PLAIN,
|
||||
LV_STYLE_PLAIN_COLOR,
|
||||
LV_STYLE_PRETTY,
|
||||
LV_STYLE_PRETTY_COLOR,
|
||||
LV_STYLE_BUTTON_OFF_RELEASED,
|
||||
LV_STYLE_BUTTON_OFF_PRESSED,
|
||||
LV_STYLE_BUTTON_ON_RELEASED,
|
||||
LV_STYLE_BUTTON_ON_PRESSED,
|
||||
LV_STYLE_BUTTON_INACTIVE,
|
||||
}lv_style_name_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
const lv_style_t * style_start; /*Pointer to the starting style*/
|
||||
const lv_style_t * style_end; /*Pointer to the destination style*/
|
||||
@ -144,14 +128,6 @@ lv_style_anim_create(&a);
|
||||
*/
|
||||
void lv_style_init (void);
|
||||
|
||||
/**
|
||||
* Get style from its name
|
||||
* @param style_name an element of the 'lv_style_name_t' enum
|
||||
* @return pointer to the requested style (lv_style_def by default)
|
||||
*/
|
||||
lv_style_t * lv_style_get(lv_style_name_t style_name);
|
||||
|
||||
|
||||
/**
|
||||
* Copy a style to an other
|
||||
* @param dest pointer to the destination style
|
||||
@ -165,6 +141,22 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src);
|
||||
*/
|
||||
void lv_style_anim_create(lv_style_anim_t * anim);
|
||||
|
||||
/*************************
|
||||
* GLOBAL VARIABLES
|
||||
*************************/
|
||||
extern lv_style_t lv_style_scr;
|
||||
extern lv_style_t lv_style_transp;
|
||||
extern lv_style_t lv_style_transp_tight;
|
||||
extern lv_style_t lv_style_plain;
|
||||
extern lv_style_t lv_style_plain_color;
|
||||
extern lv_style_t lv_style_pretty;
|
||||
extern lv_style_t lv_style_pretty_color;
|
||||
extern lv_style_t lv_style_btn_off_released;
|
||||
extern lv_style_t lv_style_btn_off_pressed;
|
||||
extern lv_style_t lv_style_btn_on_released;
|
||||
extern lv_style_t lv_style_btn_on_pressed;;
|
||||
extern lv_style_t lv_style_btn_inactive;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -64,7 +64,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->min_value = 0;
|
||||
ext->max_value = 100;
|
||||
ext->act_value = 0;
|
||||
ext->indicator_style = lv_style_get(LV_STYLE_PRETTY_COLOR);
|
||||
ext->indicator_style = &lv_style_pretty_color;
|
||||
|
||||
/* Save the ancient design function.
|
||||
* It will be used in the bar design function*/
|
||||
@ -77,7 +77,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_click(new_bar, false);
|
||||
lv_obj_set_size(new_bar, LV_DPI * 2, LV_DPI / 3);
|
||||
lv_obj_set_style(new_bar, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_bar, &lv_style_pretty);
|
||||
lv_bar_set_value(new_bar, ext->act_value);
|
||||
} else {
|
||||
lv_bar_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
|
||||
|
@ -66,11 +66,11 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->actions[LV_BTN_ACTION_LONG_PRESS] = NULL;
|
||||
ext->actions[LV_BTN_ACTION_LONG_PRESS_REPEATE] = NULL;
|
||||
|
||||
ext->styles[LV_BTN_STATE_OFF_RELEASED] = lv_style_get(LV_STYLE_BUTTON_OFF_RELEASED);
|
||||
ext->styles[LV_BTN_STATE_OFF_PRESSED] = lv_style_get(LV_STYLE_BUTTON_OFF_PRESSED);
|
||||
ext->styles[LV_BTN_STATE_ON_RELEASED] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED);
|
||||
ext->styles[LV_BTN_STATE_ON_PRESSED] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED);
|
||||
ext->styles[LV_BTN_STATE_INACTIVE] = lv_style_get(LV_STYLE_BUTTON_INACTIVE);
|
||||
ext->styles[LV_BTN_STATE_OFF_RELEASED] = &lv_style_btn_off_released;
|
||||
ext->styles[LV_BTN_STATE_OFF_PRESSED] = &lv_style_btn_off_pressed;
|
||||
ext->styles[LV_BTN_STATE_ON_RELEASED] = &lv_style_btn_on_released;
|
||||
ext->styles[LV_BTN_STATE_ON_PRESSED] = &lv_style_btn_on_pressed;
|
||||
ext->styles[LV_BTN_STATE_INACTIVE] = &lv_style_btn_inactive;
|
||||
|
||||
ext->long_press_action_executed = 0;
|
||||
ext->toggle = 0;
|
||||
|
@ -78,11 +78,11 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->action = NULL;
|
||||
ext->map_p = NULL;
|
||||
ext->toggle = 0;
|
||||
ext->button_styles[LV_BTN_STATE_OFF_RELEASED] = lv_style_get(LV_STYLE_BUTTON_OFF_RELEASED);
|
||||
ext->button_styles[LV_BTN_STATE_OFF_PRESSED] = lv_style_get(LV_STYLE_BUTTON_OFF_PRESSED);
|
||||
ext->button_styles[LV_BTN_STATE_ON_RELEASED] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED);
|
||||
ext->button_styles[LV_BTN_STATE_ON_PRESSED] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED);
|
||||
ext->button_styles[LV_BTN_STATE_INACTIVE] = lv_style_get(LV_STYLE_BUTTON_INACTIVE);
|
||||
ext->button_styles[LV_BTN_STATE_OFF_RELEASED] = &lv_style_btn_off_released;
|
||||
ext->button_styles[LV_BTN_STATE_OFF_PRESSED] = &lv_style_btn_off_pressed;
|
||||
ext->button_styles[LV_BTN_STATE_ON_RELEASED] = &lv_style_btn_on_released;
|
||||
ext->button_styles[LV_BTN_STATE_ON_PRESSED] = &lv_style_btn_on_pressed;
|
||||
ext->button_styles[LV_BTN_STATE_INACTIVE] = &lv_style_btn_inactive;
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_btnm);
|
||||
|
||||
@ -92,7 +92,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new button matrix object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_btnm, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_obj_set_style(new_btnm, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_btnm, &lv_style_pretty);
|
||||
lv_btnm_set_map(new_btnm, lv_btnm_def_map);
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
@ -69,11 +69,11 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new checkbox object*/
|
||||
if(copy == NULL) {
|
||||
ext->bullet = lv_btn_create(new_cb, NULL);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_PRESSED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_INACTIVE, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, &lv_style_transp);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, &lv_style_transp);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, &lv_style_transp);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_PRESSED, &lv_style_transp);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_INACTIVE, &lv_style_transp);
|
||||
|
||||
lv_cont_set_layout(new_cb, LV_CONT_LAYOUT_ROW_M);
|
||||
lv_cont_set_fit(new_cb, true, true);
|
||||
@ -81,10 +81,10 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
if(ancestor_bullet_design_f == NULL) ancestor_bullet_design_f = lv_obj_get_design_func(ext->bullet);
|
||||
lv_obj_set_click(ext->bullet, false);
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_PRETTY_COLOR));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_BUTTON_ON_RELEASED));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_PRESSED, lv_style_get(LV_STYLE_BUTTON_ON_PRESSED));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_RELEASED, &lv_style_pretty);
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_PRESSED, &lv_style_pretty_color);
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_RELEASED, &lv_style_btn_on_released);
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_PRESSED, &lv_style_btn_on_pressed);
|
||||
|
||||
ext->label = lv_label_create(new_cb, NULL);
|
||||
lv_obj_set_style(ext->label, NULL); /*Inherit the style of the parent*/
|
||||
|
@ -86,7 +86,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new chart background object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_chart, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_chart, &lv_style_pretty);
|
||||
lv_obj_set_size(new_chart, LV_HOR_RES / 2, LV_VER_RES / 2);
|
||||
} else {
|
||||
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
|
||||
@ -487,7 +487,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
int32_t y_tmp;
|
||||
lv_chart_dl_t * dl;
|
||||
lv_style_t lines;
|
||||
lv_style_copy(&lines, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_style_copy(&lines, &lv_style_plain);
|
||||
lines.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
lines.line.width = ext->dl_width;
|
||||
|
||||
@ -536,7 +536,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
lv_chart_dl_t * dl;
|
||||
uint8_t dl_cnt = 0;
|
||||
lv_style_t style_point;
|
||||
lv_style_copy(&style_point, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_style_copy(&style_point, &lv_style_plain);
|
||||
|
||||
style_point.body.border.width = 0;
|
||||
style_point.body.empty = 0;
|
||||
@ -588,7 +588,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t col_w = w / ((ext->dl_num + 1) * ext->pnum); /* Suppose + 1 dl as separator*/
|
||||
cord_t x_ofs = col_w / 2; /*Shift with a half col.*/
|
||||
|
||||
lv_style_copy(&rects, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_style_copy(&rects, &lv_style_plain);
|
||||
rects.body.border.width = 0;
|
||||
rects.body.empty = 0;
|
||||
rects.body.radius = 0;
|
||||
|
@ -83,7 +83,7 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new container*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_rect, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_obj_set_style(new_rect, &lv_style_plain);
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
|
@ -74,7 +74,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->selected_option_id = 0;
|
||||
ext->option_cnt = 0;
|
||||
ext->anim_time = LV_DDLIST_DEF_ANIM_TIME;
|
||||
ext->selected_style = lv_style_get(LV_STYLE_PLAIN_COLOR);
|
||||
ext->selected_style = &lv_style_plain_color;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_ddlist);
|
||||
@ -86,14 +86,14 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_t * scrl = lv_page_get_scrl(new_ddlist);
|
||||
lv_obj_set_drag(scrl, false);
|
||||
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_obj_set_style(scrl, &lv_style_transp);
|
||||
lv_cont_set_fit(scrl, true, true);
|
||||
|
||||
ext->options_label = lv_label_create(new_ddlist, NULL);
|
||||
lv_cont_set_fit(new_ddlist, true, false);
|
||||
lv_page_set_rel_action(new_ddlist, lv_ddlist_rel_action);
|
||||
lv_page_set_sb_mode(new_ddlist, LV_PAGE_SB_MODE_DRAG);
|
||||
lv_obj_set_style(new_ddlist, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_ddlist, &lv_style_pretty);
|
||||
lv_ddlist_set_options(new_ddlist, def_options);
|
||||
}
|
||||
/*Copy an existing drop down list*/
|
||||
|
@ -91,7 +91,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_lmeter_set_scale(new_gauge, LV_GAUGE_DEF_ANGLE, LV_GAUGE_DEF_SCALE_LINE_COUNT);
|
||||
lv_gauge_set_needle_num(new_gauge, 1, NULL);
|
||||
lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI);
|
||||
lv_obj_set_style(new_gauge, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_gauge, &lv_style_pretty);
|
||||
}
|
||||
/*Copy an existing gauge*/
|
||||
else {
|
||||
@ -405,7 +405,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask)
|
||||
|
||||
/*Draw the needle middle area*/
|
||||
lv_style_t style_neddle_mid;
|
||||
lv_style_copy(&style_neddle_mid, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_style_copy(&style_neddle_mid, &lv_style_plain);
|
||||
style_neddle_mid.body.color_main = style->body.border.color;
|
||||
style_neddle_mid.body.color_gradient = style->body.border.color;
|
||||
style_neddle_mid.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
@ -81,7 +81,7 @@ lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
if(par != NULL) ext->auto_size = 1;
|
||||
else ext->auto_size = 0;
|
||||
if(par != NULL) lv_obj_set_style(new_img, NULL); /*Inherit the style by default*/
|
||||
else lv_obj_set_style(new_img, lv_style_get(LV_STYLE_PLAIN)); /*Set style for screens*/
|
||||
else lv_obj_set_style(new_img, &lv_style_plain); /*Set style for screens*/
|
||||
} else {
|
||||
lv_img_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->auto_size = copy_ext->auto_size;
|
||||
|
@ -70,7 +70,7 @@ lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new led object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_led, lv_style_get(LV_STYLE_PRETTY_COLOR));
|
||||
lv_obj_set_style(new_led, &lv_style_pretty_color);
|
||||
lv_obj_set_size(new_led, LV_LED_WIDTH_DEF, LV_LED_HEIGHT_DEF);
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
@ -67,7 +67,7 @@ lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new line*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_line, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_obj_set_style(new_line, &lv_style_plain);
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
|
@ -68,11 +68,11 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
ext->sb_out = 0;
|
||||
ext->style_img = NULL;
|
||||
ext->styles_btn[LV_BTN_STATE_OFF_RELEASED] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED);
|
||||
ext->styles_btn[LV_BTN_STATE_OFF_PRESSED] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED);
|
||||
ext->styles_btn[LV_BTN_STATE_ON_RELEASED] = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED);
|
||||
ext->styles_btn[LV_BTN_STATE_OFF_PRESSED] = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED);
|
||||
ext->styles_btn[LV_BTN_STATE_INACTIVE] = lv_style_get(LV_STYLE_BUTTON_INACTIVE);
|
||||
ext->styles_btn[LV_BTN_STATE_OFF_RELEASED] = &lv_style_btn_off_released;
|
||||
ext->styles_btn[LV_BTN_STATE_OFF_PRESSED] = &lv_style_btn_off_pressed;
|
||||
ext->styles_btn[LV_BTN_STATE_ON_RELEASED] = &lv_style_btn_on_released;
|
||||
ext->styles_btn[LV_BTN_STATE_OFF_PRESSED] = &lv_style_btn_on_pressed;
|
||||
ext->styles_btn[LV_BTN_STATE_INACTIVE] = &lv_style_btn_inactive;
|
||||
|
||||
lv_obj_set_signal_func(new_list, lv_list_signal);
|
||||
|
||||
@ -80,8 +80,8 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_list, 2 * LV_DPI, 3 * LV_DPI);
|
||||
lv_cont_set_layout(ext->page.scrl, LV_LIST_LAYOUT_DEF);
|
||||
lv_obj_set_style(new_list, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(lv_page_get_scrl(new_list), lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_list, &lv_style_transp_tight);
|
||||
lv_obj_set_style(lv_page_get_scrl(new_list), &lv_style_pretty);
|
||||
lv_page_set_sb_mode(new_list, LV_PAGE_SB_MODE_AUTO);
|
||||
} else {
|
||||
lv_list_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
|
@ -69,7 +69,7 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new line meter line meter*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_lmeter, 1 * LV_DPI, 1 * LV_DPI);
|
||||
lv_obj_set_style(new_lmeter, lv_style_get(LV_STYLE_PRETTY_COLOR));
|
||||
lv_obj_set_style(new_lmeter, &lv_style_pretty_color);
|
||||
}
|
||||
/*Copy an existing line meter*/
|
||||
else {
|
||||
|
@ -65,8 +65,8 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
dm_assert(ext);
|
||||
ext->txt = NULL;
|
||||
ext->btnh = NULL;
|
||||
ext->style_btn_rel = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED);
|
||||
ext->style_btn_pr = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED);
|
||||
ext->style_btn_rel = &lv_style_btn_on_released;
|
||||
ext->style_btn_pr = &lv_style_btn_on_pressed;
|
||||
ext->anim_close_time = LV_MBOX_CLOSE_ANIM_TIME;
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
@ -80,7 +80,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->txt = lv_label_create(new_mbox, NULL);
|
||||
lv_label_set_text(ext->txt, "Text of the message box");
|
||||
|
||||
lv_obj_set_style(new_mbox, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_mbox, &lv_style_pretty);
|
||||
}
|
||||
/*Copy an existing message box*/
|
||||
else {
|
||||
@ -265,7 +265,7 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
|
||||
/*Create a button if it is not existed yet*/
|
||||
if(ext->btnh == NULL) {
|
||||
ext->btnh = lv_cont_create(mbox, NULL);
|
||||
lv_obj_set_style(ext->btnh, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_obj_set_style(ext->btnh, &lv_style_transp);
|
||||
lv_obj_set_click(ext->btnh, false);
|
||||
lv_cont_set_fit(ext->btnh, false, true);
|
||||
lv_cont_set_layout(ext->btnh, LV_CONT_LAYOUT_PRETTY);
|
||||
|
@ -70,7 +70,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->rel_action = NULL;
|
||||
ext->sbh_draw = 0;
|
||||
ext->sbv_draw = 0;
|
||||
ext->style_sb = lv_style_get(LV_STYLE_PRETTY);
|
||||
ext->style_sb = &lv_style_pretty;
|
||||
ext->sb_width = LV_DPI / 8; /*Will be modified later*/
|
||||
ext->sb_mode = LV_PAGE_SB_MODE_ON;
|
||||
|
||||
@ -78,7 +78,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new page object*/
|
||||
if(copy == NULL) {
|
||||
lv_style_t * style = lv_style_get(LV_STYLE_PRETTY_COLOR);
|
||||
lv_style_t * style = &lv_style_pretty_color;
|
||||
ext->scrl = lv_cont_create(new_page, NULL);
|
||||
if(ancestor_scrl_design_f == NULL) ancestor_scrl_design_f = lv_obj_get_design_func(ext->scrl);
|
||||
lv_obj_set_signal_func(ext->scrl, lv_page_scrl_signal);
|
||||
@ -86,7 +86,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_set_drag_throw(ext->scrl, true);
|
||||
lv_obj_set_protect(ext->scrl, LV_PROTECT_PARENT);
|
||||
lv_cont_set_fit(ext->scrl, false, true);
|
||||
lv_obj_set_style(ext->scrl, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(ext->scrl, &lv_style_pretty);
|
||||
lv_obj_set_design_func(ext->scrl, lv_scrl_design);
|
||||
|
||||
lv_page_set_sb_width(new_page, style->body.padding.hor);
|
||||
|
@ -64,7 +64,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->cb = NULL;
|
||||
ext->tmp_value = ext->bar.min_value;
|
||||
ext->style_knob = lv_style_get(LV_STYLE_PRETTY);
|
||||
ext->style_knob = &lv_style_pretty;
|
||||
ext->knob_in = 0;
|
||||
|
||||
/* Save the bar design function.
|
||||
|
@ -109,9 +109,9 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_label_set_text(ext->label, "Text area");
|
||||
lv_page_glue_obj(ext->label, true);
|
||||
lv_obj_set_click(ext->label, false);
|
||||
lv_obj_set_style(new_ta, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_style(new_ta, &lv_style_pretty);
|
||||
lv_page_set_sb_mode(new_ta, LV_PAGE_SB_MODE_AUTO);
|
||||
lv_obj_set_style(lv_page_get_scrl(new_ta), lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(lv_page_get_scrl(new_ta), &lv_style_transp_tight);
|
||||
lv_obj_set_size(new_ta, LV_TA_DEF_WIDTH, LV_TA_DEF_HEIGHT);
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
@ -88,7 +88,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new tab tab*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_tabview, LV_HOR_RES, LV_VER_RES);
|
||||
lv_obj_set_style(new_tabview, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_obj_set_style(new_tabview, &lv_style_plain);
|
||||
|
||||
ext->tabs = lv_btnm_create(new_tabview, NULL);
|
||||
lv_btnm_set_map(ext->tabs, tab_def);
|
||||
@ -106,7 +106,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_cont_set_fit(ext->content, true, false);
|
||||
lv_cont_set_layout(ext->content, LV_CONT_LAYOUT_ROW_T);
|
||||
lv_obj_set_height(ext->content, LV_VER_RES);
|
||||
lv_obj_set_style(ext->content, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(ext->content, &lv_style_transp_tight);
|
||||
lv_obj_align(ext->content, ext->tabs, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
}
|
||||
/*Copy an existing tab*/
|
||||
@ -187,8 +187,8 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
/*Create the container page*/
|
||||
lv_obj_t * h = lv_page_create(ext->content, NULL);
|
||||
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(tabview) - lv_obj_get_height(ext->tabs));
|
||||
lv_obj_set_style(h, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_obj_set_style(lv_page_get_scrl(h), lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(h, &lv_style_plain);
|
||||
lv_obj_set_style(lv_page_get_scrl(h), &lv_style_transp_tight);
|
||||
lv_obj_set_signal_func(h, tabpage_signal);
|
||||
lv_page_set_sb_mode(h, LV_PAGE_SB_MODE_AUTO);
|
||||
if(page_scrl_signal == NULL) page_scrl_signal = lv_obj_get_signal_func(lv_page_get_scrl(h));
|
||||
|
@ -62,25 +62,25 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->btnh = NULL;
|
||||
ext->header = NULL;
|
||||
ext->title = NULL;
|
||||
ext->style_header = lv_style_get(LV_STYLE_PLAIN_COLOR);
|
||||
ext->style_cbtn_rel = lv_style_get(LV_STYLE_BUTTON_ON_RELEASED);
|
||||
ext->style_cbtn_pr = lv_style_get(LV_STYLE_BUTTON_ON_PRESSED);
|
||||
ext->style_header = &lv_style_plain_color;
|
||||
ext->style_cbtn_rel = &lv_style_btn_on_released;
|
||||
ext->style_cbtn_pr = &lv_style_btn_on_pressed;
|
||||
ext->cbtn_size = ( LV_DPI) / 2;
|
||||
|
||||
/*Init the new window object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_win, LV_HOR_RES, LV_VER_RES);
|
||||
lv_obj_set_pos(new_win, 0, 0);
|
||||
lv_obj_set_style(new_win, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_obj_set_style(new_win, &lv_style_plain);
|
||||
|
||||
ext->page = lv_page_create(new_win, NULL);
|
||||
lv_obj_set_protect(ext->page, LV_PROTECT_PARENT);
|
||||
lv_obj_set_style(ext->page, lv_style_get(LV_STYLE_PLAIN));
|
||||
lv_obj_set_style(ext->page, &lv_style_plain);
|
||||
lv_page_set_sb_mode(ext->page, LV_PAGE_SB_MODE_AUTO);
|
||||
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ext->page);
|
||||
lv_cont_set_fit(scrl, false, true);
|
||||
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_obj_set_style(scrl, &lv_style_transp);
|
||||
|
||||
/*Create a holder for the header*/
|
||||
ext->header = lv_cont_create(new_win, NULL);
|
||||
@ -88,7 +88,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Move back the header because it is automatically moved to the scrollable */
|
||||
lv_obj_set_protect(ext->header, LV_PROTECT_PARENT);
|
||||
lv_obj_set_parent(ext->header, new_win);
|
||||
lv_obj_set_style(ext->header, lv_style_get(LV_STYLE_PLAIN_COLOR));
|
||||
lv_obj_set_style(ext->header, &lv_style_plain_color);
|
||||
|
||||
/*Create a title on the header*/
|
||||
ext->title = lv_label_create(ext->header, NULL);
|
||||
@ -97,7 +97,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Create a holder for the control buttons*/
|
||||
ext->btnh = lv_cont_create(ext->header, NULL);
|
||||
lv_cont_set_fit(ext->btnh, true, false);
|
||||
lv_obj_set_style(ext->btnh, lv_style_get(LV_STYLE_TRANSPARENT_TIGHT));
|
||||
lv_obj_set_style(ext->btnh, &lv_style_transp_tight);
|
||||
lv_cont_set_layout(ext->btnh, LV_CONT_LAYOUT_ROW_M);
|
||||
|
||||
lv_obj_set_signal_func(new_win, lv_win_signal);
|
||||
|
Loading…
x
Reference in New Issue
Block a user