styles: make styles to global variables

This commit is contained in:
Gabor Kiss-Vamosi
2017-10-30 17:31:48 +01:00
parent 5608bf868e
commit 919a8e81ea
23 changed files with 149 additions and 211 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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*/

View File

@@ -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*/

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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*/

View File

@@ -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;

View File

@@ -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;

View File

@@ -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*/

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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);

View File

@@ -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);

View File

@@ -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.

View File

@@ -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*/

View File

@@ -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));

View File

@@ -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);