1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

lv_list_add -> lv_list_add_btn, event paramter removed from lv_list/win_add_btn

This commit is contained in:
Gabor Kiss-Vamosi 2019-06-21 15:26:28 +02:00
parent ca1f21ad04
commit 4c1dbc63d2
18 changed files with 56 additions and 101 deletions

View File

@ -27,6 +27,8 @@ extern "C" {
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
/**Default value of points. Can be used to not draw a point*/
#define LV_CHART_POINT_DEF (LV_COORD_MIN) #define LV_CHART_POINT_DEF (LV_COORD_MIN)
/**Automatically calculate the tick length*/ /**Automatically calculate the tick length*/

View File

@ -676,6 +676,10 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
/*Inform the parent about the new coordinates*/ /*Inform the parent about the new coordinates*/
par->signal_cb(par, LV_SIGNAL_CHILD_CHG, cont); par->signal_cb(par, LV_SIGNAL_CHILD_CHG, cont);
if(lv_obj_get_auto_realign(cont)) {
lv_obj_realign(cont);
}
/*Tell the children the parent's size has changed*/ /*Tell the children the parent's size has changed*/
LV_LL_READ(cont->child_ll, child_i) LV_LL_READ(cont->child_ll, child_i)
{ {

View File

@ -131,7 +131,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_t * copy_img = lv_list_get_btn_img(copy_btn); lv_obj_t * copy_img = lv_list_get_btn_img(copy_btn);
if(copy_img) img_src = lv_img_get_src(copy_img); if(copy_img) img_src = lv_img_get_src(copy_img);
#endif #endif
lv_list_add(new_list, img_src, lv_list_get_btn_text(copy_btn), copy_btn->event_cb); lv_list_add_btn(new_list, img_src, lv_list_get_btn_text(copy_btn));
copy_btn = lv_list_get_next_btn(copy, copy_btn); copy_btn = lv_list_get_next_btn(copy, copy_btn);
} }
@ -171,10 +171,9 @@ void lv_list_clean(lv_obj_t * obj)
* @param list pointer to list object * @param list pointer to list object
* @param img_fn file name of an image before the text (NULL if unused) * @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 txt text of the list element (NULL if unused)
* @param event_cb specify the an event handler function. NULL if unused
* @return pointer to the new list element which can be customized (a button) * @return pointer to the new list element which can be customized (a button)
*/ */
lv_obj_t * lv_list_add(lv_obj_t * list, const void * img_src, const char * txt, lv_event_cb_t event_cb) lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt)
{ {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list); lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
ext->size++; ext->size++;
@ -192,7 +191,6 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const void * img_src, const char * txt,
lv_btn_set_style(liste, LV_BTN_STYLE_TGL_PR, ext->styles_btn[LV_BTN_STATE_TGL_PR]); lv_btn_set_style(liste, LV_BTN_STYLE_TGL_PR, ext->styles_btn[LV_BTN_STATE_TGL_PR]);
lv_btn_set_style(liste, LV_BTN_STYLE_INA, ext->styles_btn[LV_BTN_STATE_INA]); lv_btn_set_style(liste, LV_BTN_STYLE_INA, ext->styles_btn[LV_BTN_STATE_INA]);
lv_obj_set_event_cb(liste, event_cb);
lv_page_glue_obj(liste, true); lv_page_glue_obj(liste, true);
lv_btn_set_layout(liste, LV_LAYOUT_ROW_M); lv_btn_set_layout(liste, LV_LAYOUT_ROW_M);
lv_btn_set_fit2(liste, LV_FIT_FLOOD, LV_FIT_TIGHT); lv_btn_set_fit2(liste, LV_FIT_FLOOD, LV_FIT_TIGHT);

View File

@ -104,10 +104,9 @@ void lv_list_clean(lv_obj_t * obj);
* @param list pointer to list object * @param list pointer to list object
* @param img_fn file name of an image before the text (NULL if unused) * @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 txt text of the list element (NULL if unused)
* @param event_cb specify the an event handler function. NULL if unused
* @return pointer to the new list element which can be customized (a button) * @return pointer to the new list element which can be customized (a button)
*/ */
lv_obj_t * lv_list_add(lv_obj_t * list, const void * img_src, const char * txt, lv_event_cb_t event_cb); lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt);
/** /**
* Remove the index of the button in the list * Remove the index of the button in the list

View File

@ -103,7 +103,6 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
ext->edge_flash.style = &lv_style_plain_color; ext->edge_flash.style = &lv_style_plain_color;
ext->anim_time = LV_PAGE_DEF_ANIM_TIME; ext->anim_time = LV_PAGE_DEF_ANIM_TIME;
#endif #endif
ext->arrow_scroll = 0;
ext->scroll_prop = 0; ext->scroll_prop = 0;
ext->scroll_prop_ip = 0; ext->scroll_prop_ip = 0;
@ -149,7 +148,6 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal); lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal);
lv_page_set_sb_mode(new_page, copy_ext->sb.mode); lv_page_set_sb_mode(new_page, copy_ext->sb.mode);
lv_page_set_arrow_scroll(new_page, copy_ext->arrow_scroll);
lv_page_set_style(new_page, LV_PAGE_STYLE_BG, lv_page_get_style(copy, LV_PAGE_STYLE_BG)); lv_page_set_style(new_page, LV_PAGE_STYLE_BG, lv_page_get_style(copy, LV_PAGE_STYLE_BG));
lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL, lv_page_get_style(copy, LV_PAGE_STYLE_SCRL)); lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL, lv_page_get_style(copy, LV_PAGE_STYLE_SCRL));
@ -228,18 +226,6 @@ void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time)
} }
/**
* Enable/Disable scrolling with arrows if the page is in group (arrows:
* LV_KEY_LEFT/RIGHT/UP/DOWN)
* @param page pointer to a page object
* @param en true: enable scrolling with arrows
*/
void lv_page_set_arrow_scroll(lv_obj_t * page, bool en)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->arrow_scroll = en ? 1 : 0;
}
/** /**
* Enable the scroll propagation feature. If enabled then the page will move its parent if there is * Enable the scroll propagation feature. If enabled then the page will move its parent if there is
* no more space to scroll. * no more space to scroll.
@ -338,17 +324,6 @@ lv_sb_mode_t lv_page_get_sb_mode(const lv_obj_t * page)
return ext->sb.mode; return ext->sb.mode;
} }
/**
* Get the the scrolling with arrows (LV_KEY_LEFT/RIGHT/UP/DOWN) is enabled or not
* @param page pointer to a page object
* @return true: scrolling with arrows is enabled
*/
bool lv_page_get_arrow_scroll(const lv_obj_t * page)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->arrow_scroll ? true : false;
}
/** /**
* Get the scroll propagation property * Get the scroll propagation property
* @param page pointer to a Page * @param page pointer to a Page
@ -540,7 +515,7 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_
scrlable_x += page_w - obj_w; scrlable_x += page_w - obj_w;
} }
if(anim_en == LV_ANIM_ON && lv_page_get_anim_time(page) != 0) { if(anim_en == LV_ANIM_OFF || lv_page_get_anim_time(page) == 0) {
lv_obj_set_y(ext->scrl, scrlable_y); lv_obj_set_y(ext->scrl, scrlable_y);
lv_obj_set_x(ext->scrl, scrlable_x); lv_obj_set_x(ext->scrl, scrlable_x);
} else { } else {
@ -878,18 +853,18 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_CONTROL) { } else if(sign == LV_SIGNAL_CONTROL) {
uint32_t c = *((uint32_t *)param); uint32_t c = *((uint32_t *)param);
if((c == LV_KEY_DOWN) && ext->arrow_scroll) { if(c == LV_KEY_DOWN) {
lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4); lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4);
} else if((c == LV_KEY_UP) && ext->arrow_scroll) { } else if(c == LV_KEY_UP) {
lv_page_scroll_ver(page, lv_obj_get_height(page) / 4); lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
} else if((c == LV_KEY_RIGHT) && ext->arrow_scroll) { } else if(c == LV_KEY_RIGHT) {
/*If the page can't be scrolled horizontally because it's not wide enough then scroll it /*If the page can't be scrolled horizontally because it's not wide enough then scroll it
* vertically*/ * vertically*/
if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page)) if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page))
lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4); lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4);
else else
lv_page_scroll_hor(page, -lv_obj_get_width(page) / 4); lv_page_scroll_hor(page, -lv_obj_get_width(page) / 4);
} else if((c == LV_KEY_LEFT) && ext->arrow_scroll) { } else if(c == LV_KEY_LEFT) {
/*If the page can't be scrolled horizontally because it's not wide enough then scroll it /*If the page can't be scrolled horizontally because it's not wide enough then scroll it
* vertically*/ * vertically*/
if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page)) if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page))
@ -899,7 +874,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
} }
} else if(sign == LV_SIGNAL_GET_EDITABLE) { } else if(sign == LV_SIGNAL_GET_EDITABLE) {
bool * editable = (bool *)param; bool * editable = (bool *)param;
*editable = lv_page_get_arrow_scroll(page); *editable = true;
} else if(sign == LV_SIGNAL_GET_TYPE) { } else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param; lv_obj_type_t * buf = param;
uint8_t i; uint8_t i;

View File

@ -92,7 +92,6 @@ typedef struct
uint16_t anim_time; /*Scroll animation time*/ uint16_t anim_time; /*Scroll animation time*/
#endif #endif
uint8_t arrow_scroll : 1; /*1: Enable scrolling with LV_KEY_LEFT/RIGHT/UP/DOWN*/
uint8_t scroll_prop : 1; /*1: Propagate the scrolling the the parent if the edge is reached*/ uint8_t scroll_prop : 1; /*1: Propagate the scrolling the the parent if the edge is reached*/
uint8_t scroll_prop_ip : 1; /*1: Scroll propagation is in progress (used by the library)*/ uint8_t scroll_prop_ip : 1; /*1: Scroll propagation is in progress (used by the library)*/
} lv_page_ext_t; } lv_page_ext_t;
@ -155,14 +154,6 @@ void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode);
*/ */
void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time); void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time);
/**
* Enable/Disable scrolling with arrows if the page is in group (arrows:
* LV_KEY_LEFT/RIGHT/UP/DOWN)
* @param page pointer to a page object
* @param en true: enable scrolling with arrows
*/
void lv_page_set_arrow_scroll(lv_obj_t * page, bool en);
/** /**
* Enable the scroll propagation feature. If enabled then the page will move its parent if there is * Enable the scroll propagation feature. If enabled then the page will move its parent if there is
* no more space to scroll. * no more space to scroll.
@ -264,13 +255,6 @@ void lv_page_set_style(lv_obj_t * page, lv_page_style_t type, const lv_style_t *
*/ */
lv_sb_mode_t lv_page_get_sb_mode(const lv_obj_t * page); lv_sb_mode_t lv_page_get_sb_mode(const lv_obj_t * page);
/**
* Get the the scrolling with arrows (LV_KEY_LEFT/RIGHT/UP/DOWN) is enabled or not
* @param page pointer to a page object
* @return true: scrolling with arrows is enabled
*/
bool lv_page_get_arrow_scroll(const lv_obj_t * page);
/** /**
* Get the scroll propagation property * Get the scroll propagation property
* @param page pointer to a Page * @param page pointer to a Page

View File

@ -335,12 +335,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an
const lv_style_t * style = lv_obj_get_style(ext->content); const lv_style_t * style = lv_obj_get_style(ext->content);
lv_res_t res = LV_RES_OK;
if(id >= ext->tab_cnt) id = ext->tab_cnt - 1; if(id >= ext->tab_cnt) id = ext->tab_cnt - 1;
if(id != ext->tab_cur) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id);
if(res != LV_RES_OK) return;
lv_btnm_clear_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE); lv_btnm_clear_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNM_CTRL_TGL_STATE);
ext->tab_cur = id; ext->tab_cur = id;
@ -889,7 +885,7 @@ static void tabpage_pressing_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
} }
/** /**
* Called when a tab's page or scrollable object is released or the press id lost * Called when a tab's page or scrollable object is released or the press is lost
* @param tabview pointer to the btn view object * @param tabview pointer to the btn view object
* @param tabpage pointer to the page of a btn * @param tabpage pointer to the page of a btn
*/ */
@ -925,7 +921,14 @@ static void tabpage_press_lost_handler(lv_obj_t * tabview, lv_obj_t * tabpage)
if(tab_cur < ext->tab_cnt - 1) tab_cur++; if(tab_cur < ext->tab_cnt - 1) tab_cur++;
} }
lv_tabview_set_tab_act(tabview, tab_cur, true); uint32_t id_prev = lv_tabview_get_tab_act(tabview);
lv_tabview_set_tab_act(tabview, tab_cur, LV_ANIM_ON);
uint32_t id_new = lv_tabview_get_tab_act(tabview);
lv_res_t res = LV_RES_OK;
if(id_prev != id_prev) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new);
if(res != LV_RES_OK) return;
} }
/** /**
@ -943,8 +946,17 @@ static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event)
lv_btnm_clear_btn_ctrl_all(tab_btnm, LV_BTNM_CTRL_TGL_STATE); lv_btnm_clear_btn_ctrl_all(tab_btnm, LV_BTNM_CTRL_TGL_STATE);
lv_btnm_set_btn_ctrl(tab_btnm, btn_id, LV_BTNM_CTRL_TGL_STATE); lv_btnm_set_btn_ctrl(tab_btnm, btn_id, LV_BTNM_CTRL_TGL_STATE);
lv_obj_t * tab = lv_obj_get_parent(tab_btnm); lv_obj_t * tabview = lv_obj_get_parent(tab_btnm);
lv_tabview_set_tab_act(tab, btn_id, true);
uint32_t id_prev = lv_tabview_get_tab_act(tabview);
lv_tabview_set_tab_act(tabview, btn_id, LV_ANIM_ON);
uint32_t id_new = lv_tabview_get_tab_act(tabview);
lv_res_t res = LV_RES_OK;
if(id_prev != id_prev) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new);
if(res != LV_RES_OK) return;
} }
/** /**
@ -1100,6 +1112,6 @@ static void tabview_realign(lv_obj_t * tabview)
} }
} }
lv_tabview_set_tab_act(tabview, ext->tab_cur, false); lv_tabview_set_tab_act(tabview, ext->tab_cur, LV_ANIM_OFF);
} }
#endif #endif

View File

@ -82,7 +82,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
ext->page = lv_page_create(new_win, NULL); ext->page = lv_page_create(new_win, NULL);
lv_obj_set_protect(ext->page, LV_PROTECT_PARENT); lv_obj_set_protect(ext->page, LV_PROTECT_PARENT);
lv_page_set_sb_mode(ext->page, LV_SB_MODE_AUTO); lv_page_set_sb_mode(ext->page, LV_SB_MODE_AUTO);
lv_page_set_arrow_scroll(ext->page, true); lv_page_set_style(ext->page, LV_PAGE_STYLE_BG, &lv_style_transp_fit);
/*Create a holder for the header*/ /*Create a holder for the header*/
ext->header = lv_obj_create(new_win, NULL); ext->header = lv_obj_create(new_win, NULL);
@ -94,20 +94,19 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
ext->title = lv_label_create(ext->header, NULL); ext->title = lv_label_create(ext->header, NULL);
lv_label_set_text(ext->title, "My title"); lv_label_set_text(ext->title, "My title");
/*Set the default styles*/ /*Set the default styles*/
lv_theme_t * th = lv_theme_get_current(); lv_theme_t * th = lv_theme_get_current();
if(th) { if(th) {
lv_win_set_style(new_win, LV_WIN_STYLE_BG, th->style.win.bg); lv_win_set_style(new_win, LV_WIN_STYLE_BG, th->style.win.bg);
lv_win_set_style(new_win, LV_WIN_STYLE_SB, th->style.win.sb); lv_win_set_style(new_win, LV_WIN_STYLE_SB, th->style.win.sb);
lv_win_set_style(new_win, LV_WIN_STYLE_HEADER, th->style.win.header); lv_win_set_style(new_win, LV_WIN_STYLE_HEADER, th->style.win.header);
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_BG, th->style.win.content.bg); lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT, th->style.win.content);
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_SCRL, th->style.win.content.scrl);
lv_win_set_style(new_win, LV_WIN_STYLE_BTN_REL, th->style.win.btn.rel); lv_win_set_style(new_win, LV_WIN_STYLE_BTN_REL, th->style.win.btn.rel);
lv_win_set_style(new_win, LV_WIN_STYLE_BTN_PR, th->style.win.btn.pr); lv_win_set_style(new_win, LV_WIN_STYLE_BTN_PR, th->style.win.btn.pr);
} else { } else {
lv_win_set_style(new_win, LV_WIN_STYLE_BG, &lv_style_plain); lv_win_set_style(new_win, LV_WIN_STYLE_BG, &lv_style_plain);
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_BG, &lv_style_transp_fit); lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT, &lv_style_transp);
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_SCRL, &lv_style_transp);
lv_win_set_style(new_win, LV_WIN_STYLE_HEADER, &lv_style_plain_color); lv_win_set_style(new_win, LV_WIN_STYLE_HEADER, &lv_style_plain_color);
} }
@ -164,10 +163,9 @@ void lv_win_clean(lv_obj_t * obj)
* Add control button to the header of the window * Add control button to the header of the window
* @param win pointer to a window object * @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol) * @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @param event_cb specify the an event handler function. NULL if unused
* @return pointer to the created button object * @return pointer to the created button object
*/ */
lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src, lv_event_cb_t event_cb) lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src)
{ {
lv_win_ext_t * ext = lv_obj_get_ext_attr(win); lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
@ -175,7 +173,6 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src, lv_event_cb_t ev
lv_btn_set_style(btn, LV_BTN_STYLE_REL, ext->style_btn_rel); lv_btn_set_style(btn, LV_BTN_STYLE_REL, ext->style_btn_rel);
lv_btn_set_style(btn, LV_BTN_STYLE_PR, ext->style_btn_pr); lv_btn_set_style(btn, LV_BTN_STYLE_PR, ext->style_btn_pr);
lv_obj_set_size(btn, ext->btn_size, ext->btn_size); lv_obj_set_size(btn, ext->btn_size, ext->btn_size);
lv_obj_set_event_cb(btn, event_cb);
lv_obj_t * img = lv_img_create(btn, NULL); lv_obj_t * img = lv_img_create(btn, NULL);
lv_obj_set_click(img, false); lv_obj_set_click(img, false);
@ -195,7 +192,7 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src, lv_event_cb_t ev
* @param btn pointer to the control button on teh widows header * @param btn pointer to the control button on teh widows header
* @param evet the event type * @param evet the event type
*/ */
void lv_win_close_event(lv_obj_t * btn, lv_event_t event) void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event)
{ {
if(event == LV_EVENT_RELEASED) { if(event == LV_EVENT_RELEASED) {
lv_obj_t * win = lv_win_get_from_btn(btn); lv_obj_t * win = lv_win_get_from_btn(btn);
@ -278,8 +275,7 @@ void lv_win_set_style(lv_obj_t * win, lv_win_style_t type, const lv_style_t * st
lv_obj_set_style(win, style); lv_obj_set_style(win, style);
lv_win_realign(win); lv_win_realign(win);
break; break;
case LV_WIN_STYLE_CONTENT_BG: lv_page_set_style(ext->page, LV_PAGE_STYLE_BG, style); break; case LV_WIN_STYLE_CONTENT: lv_page_set_style(ext->page, LV_PAGE_STYLE_SCRL, style); break;
case LV_WIN_STYLE_CONTENT_SCRL: lv_page_set_style(ext->page, LV_PAGE_STYLE_SCRL, style); break;
case LV_WIN_STYLE_SB: lv_page_set_style(ext->page, LV_PAGE_STYLE_SB, style); break; case LV_WIN_STYLE_SB: lv_page_set_style(ext->page, LV_PAGE_STYLE_SB, style); break;
case LV_WIN_STYLE_HEADER: case LV_WIN_STYLE_HEADER:
lv_obj_set_style(ext->header, style); lv_obj_set_style(ext->header, style);
@ -427,8 +423,7 @@ const lv_style_t * lv_win_get_style(const lv_obj_t * win, lv_win_style_t type)
switch(type) { switch(type) {
case LV_WIN_STYLE_BG: style = lv_obj_get_style(win); break; case LV_WIN_STYLE_BG: style = lv_obj_get_style(win); break;
case LV_WIN_STYLE_CONTENT_BG: style = lv_page_get_style(ext->page, LV_PAGE_STYLE_BG); break; case LV_WIN_STYLE_CONTENT: style = lv_page_get_style(ext->page, LV_PAGE_STYLE_SCRL); break;
case LV_WIN_STYLE_CONTENT_SCRL: style = lv_page_get_style(ext->page, LV_PAGE_STYLE_SCRL); break;
case LV_WIN_STYLE_SB: style = lv_page_get_style(ext->page, LV_PAGE_STYLE_SB); break; case LV_WIN_STYLE_SB: style = lv_page_get_style(ext->page, LV_PAGE_STYLE_SB); break;
case LV_WIN_STYLE_HEADER: style = lv_obj_get_style(ext->header); break; case LV_WIN_STYLE_HEADER: style = lv_obj_get_style(ext->header); break;
case LV_WIN_STYLE_BTN_REL: style = ext->style_btn_rel; break; case LV_WIN_STYLE_BTN_REL: style = ext->style_btn_rel; break;

View File

@ -68,8 +68,7 @@ typedef struct
enum { enum {
LV_WIN_STYLE_BG, LV_WIN_STYLE_BG,
LV_WIN_STYLE_CONTENT_BG, LV_WIN_STYLE_CONTENT,
LV_WIN_STYLE_CONTENT_SCRL,
LV_WIN_STYLE_SB, LV_WIN_STYLE_SB,
LV_WIN_STYLE_HEADER, LV_WIN_STYLE_HEADER,
LV_WIN_STYLE_BTN_REL, LV_WIN_STYLE_BTN_REL,
@ -103,10 +102,9 @@ void lv_win_clean(lv_obj_t * obj);
* Add control button to the header of the window * Add control button to the header of the window
* @param win pointer to a window object * @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol) * @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @param event_cb specify the an event handler function. NULL if unused
* @return pointer to the created button object * @return pointer to the created button object
*/ */
lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src, lv_event_cb_t event_cb); lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src);
/*===================== /*=====================
* Setter functions * Setter functions
@ -117,7 +115,7 @@ lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src, lv_event_cb_t ev
* @param btn pointer to the control button on teh widows header * @param btn pointer to the control button on teh widows header
* @param evet the event type * @param evet the event type
*/ */
void lv_win_close_event(lv_obj_t * btn, lv_event_t event); void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event);
/** /**
* Set the title of a window * Set the title of a window

View File

@ -311,11 +311,7 @@ typedef struct
lv_style_t * bg; lv_style_t * bg;
lv_style_t * sb; lv_style_t * sb;
lv_style_t * header; lv_style_t * header;
struct lv_style_t * content;
{
lv_style_t * bg;
lv_style_t * scrl;
} content;
struct struct
{ {
lv_style_t * rel; lv_style_t * rel;

View File

@ -823,8 +823,7 @@ static void win_init(void)
theme.style.win.bg = &bg; theme.style.win.bg = &bg;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &header; theme.style.win.header = &header;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &btn_rel; theme.style.win.btn.rel = &btn_rel;
theme.style.win.btn.pr = &btn_pr; theme.style.win.btn.pr = &btn_pr;
#endif #endif

View File

@ -340,8 +340,7 @@ static void win_init(void)
theme.style.win.bg = &plain_bordered; theme.style.win.bg = &plain_bordered;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &lv_style_plain_color; theme.style.win.header = &lv_style_plain_color;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &lv_style_btn_rel; theme.style.win.btn.rel = &lv_style_btn_rel;
theme.style.win.btn.pr = &lv_style_btn_pr; theme.style.win.btn.pr = &lv_style_btn_pr;
#endif #endif

View File

@ -788,8 +788,7 @@ static void win_init(void)
theme.style.win.bg = theme.style.panel; theme.style.win.bg = theme.style.panel;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &header; theme.style.win.header = &header;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &lv_style_transp; theme.style.win.btn.rel = &lv_style_transp;
theme.style.win.btn.pr = &pr; theme.style.win.btn.pr = &pr;
#endif #endif

View File

@ -395,8 +395,7 @@ static void win_init(void)
theme.style.win.bg = &light_frame; theme.style.win.bg = &light_frame;
theme.style.win.sb = &dark_frame; theme.style.win.sb = &dark_frame;
theme.style.win.header = &win_header; theme.style.win.header = &win_header;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &light_frame; theme.style.win.btn.rel = &light_frame;
theme.style.win.btn.pr = &dark_frame; theme.style.win.btn.pr = &dark_frame;
#endif #endif

View File

@ -792,8 +792,7 @@ static void win_init(void)
theme.style.win.bg = &bg; theme.style.win.bg = &bg;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &win_header; theme.style.win.header = &win_header;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &btn_rel; theme.style.win.btn.rel = &btn_rel;
theme.style.win.btn.pr = &btn_pr; theme.style.win.btn.pr = &btn_pr;
#endif #endif

View File

@ -714,8 +714,7 @@ static void win_init(void)
theme.style.win.bg = &win_bg; theme.style.win.bg = &win_bg;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &win_header; theme.style.win.header = &win_header;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &lv_style_transp; theme.style.win.btn.rel = &lv_style_transp;
theme.style.win.btn.pr = &win_btn_pr; theme.style.win.btn.pr = &win_btn_pr;
#endif #endif

View File

@ -335,8 +335,7 @@ static void win_init(void)
theme.style.win.bg = &def; theme.style.win.bg = &def;
theme.style.win.sb = &def; theme.style.win.sb = &def;
theme.style.win.header = &def; theme.style.win.header = &def;
theme.style.win.content.bg = &def; theme.style.win.content = &def;
theme.style.win.content.scrl = &def;
theme.style.win.btn.rel = &def; theme.style.win.btn.rel = &def;
theme.style.win.btn.pr = &def; theme.style.win.btn.pr = &def;
#endif #endif

View File

@ -763,8 +763,7 @@ static void win_init(void)
theme.style.win.bg = theme.style.panel; theme.style.win.bg = theme.style.panel;
theme.style.win.sb = &sb; theme.style.win.sb = &sb;
theme.style.win.header = &header; theme.style.win.header = &header;
theme.style.win.content.bg = &lv_style_transp; theme.style.win.content = &lv_style_transp;
theme.style.win.content.scrl = &lv_style_transp;
theme.style.win.btn.rel = &rel; theme.style.win.btn.rel = &rel;
theme.style.win.btn.pr = &pr; theme.style.win.btn.pr = &pr;
#endif #endif