mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
rename enums to be general (e.g. lv_cont_layout_t -> lv_layout_t)
This commit is contained in:
parent
7753257842
commit
a006082a47
@ -130,9 +130,9 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_group_focus_next(lv_group_t * group)
|
||||
{
|
||||
if(group->frozen != 0) return;
|
||||
if(group->frozen) return;
|
||||
|
||||
if(group->obj_focus != NULL) {
|
||||
if(group->obj_focus) {
|
||||
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
}
|
||||
@ -144,7 +144,7 @@ void lv_group_focus_next(lv_group_t * group)
|
||||
if(obj_next == NULL) obj_next = ll_get_head(&group->obj_ll);
|
||||
group->obj_focus = obj_next;
|
||||
|
||||
if(group->obj_focus != NULL){
|
||||
if(group->obj_focus){
|
||||
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
}
|
||||
@ -156,9 +156,9 @@ void lv_group_focus_next(lv_group_t * group)
|
||||
*/
|
||||
void lv_group_focus_prev(lv_group_t * group)
|
||||
{
|
||||
if(group->frozen != 0) return;
|
||||
if(group->frozen) return;
|
||||
|
||||
if(group->obj_focus != NULL) {
|
||||
if(group->obj_focus) {
|
||||
(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
lv_obj_invalidate(*group->obj_focus);
|
||||
}
|
||||
@ -248,17 +248,22 @@ lv_obj_t * lv_group_get_focused(lv_group_t * group)
|
||||
|
||||
/**
|
||||
* Default style modifier function
|
||||
* @param style pointer to a style to modify. (Typically &group->style_tmp) It will be OVERWRITTEN.
|
||||
* @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN.
|
||||
*/
|
||||
static void style_mod_def(lv_style_t * style)
|
||||
{
|
||||
/*Make the style a little bit orange*/
|
||||
style->body.border.color = COLOR_ORANGE;
|
||||
/*Make the style to be a little bit orange*/
|
||||
style->body.border.opa = OPA_COVER;
|
||||
if(style->body.border.width == 0 && style->body.empty == 0) style->body.border.width = 2 << LV_ANTIALIAS; /*Add border to not transparent styles*/
|
||||
else style->body.border.width = style->body.border.width * 2; /*Make the border thicker*/
|
||||
style->body.border.color = COLOR_ORANGE;
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.empty == 0 || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
style->body.main_color = color_mix(style->body.main_color, COLOR_ORANGE, OPA_80);
|
||||
style->body.gradient_color = color_mix(style->body.gradient_color, COLOR_ORANGE, OPA_80);
|
||||
|
||||
style->body.shadow.color = color_mix(style->body.shadow.color, COLOR_ORANGE, OPA_60);
|
||||
|
||||
}
|
||||
|
||||
#endif /*LV_OBJ_GROUP != 0*/
|
||||
|
@ -27,6 +27,8 @@ extern "C" {
|
||||
#define LV_GROUP_KEY_LEFT 20 /*0x14*/
|
||||
#define LV_GROUP_KEY_ESC 33 /*0x1B*/
|
||||
#define LV_GROUP_KEY_ENTER 10 /*0x0A, '\n'*/
|
||||
#define LV_GROUP_KEY_NEXT 9 /*0x09, '\t'*/
|
||||
#define LV_GROUP_KEY_PREV 11 /*0x0B, '*/
|
||||
|
||||
#if LV_OBJ_GROUP != 0
|
||||
/**********************
|
||||
|
@ -21,6 +21,8 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_OBJ_DEF_WIDTH (LV_DPI)
|
||||
#define LV_OBJ_DEF_HEIGHT (2 * LV_DPI / 3)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -1268,8 +1270,8 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
|
||||
if(style_act == NULL) {
|
||||
lv_obj_t * par = obj->par;
|
||||
|
||||
while(par != NULL) {
|
||||
if(par->style_p != NULL) {
|
||||
while(par) {
|
||||
if(par->style_p) {
|
||||
if(par->style_p->glass == 0) {
|
||||
style_act = par->style_p;
|
||||
break;
|
||||
@ -1279,7 +1281,7 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
#if LV_OBJ_GROUP != 0
|
||||
if(obj->group_p != NULL) {
|
||||
if(obj->group_p) {
|
||||
if(lv_group_get_focused(obj->group_p) == obj) {
|
||||
style_act = lv_group_mod_style(obj->group_p, style_act);
|
||||
}
|
||||
|
@ -47,10 +47,6 @@ extern "C" {
|
||||
#error "LV: Small Virtual Display Buffer (lv_conf.h: LV_VDB_SIZE >= (2 * LV_HOR_RES))"
|
||||
#endif
|
||||
|
||||
/*New defines*/
|
||||
#define LV_OBJ_DEF_WIDTH (80 << LV_ANTIALIAS)
|
||||
#define LV_OBJ_DEF_HEIGHT (60 << LV_ANTIALIAS)
|
||||
|
||||
#define ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/
|
||||
#define ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/
|
||||
#define ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/
|
||||
|
@ -87,7 +87,7 @@ void lv_style_init (void)
|
||||
lv_style_scr.body.shadow.width = 0;
|
||||
|
||||
lv_style_scr.text.opa = OPA_COVER;
|
||||
lv_style_scr.text.color = COLOR_MAKE(0x20, 0x20, 0x20);
|
||||
lv_style_scr.text.color = COLOR_MAKE(0x30, 0x30, 0x30);
|
||||
lv_style_scr.text.font = FONT_DEFAULT;
|
||||
lv_style_scr.text.letter_space = 1 << LV_ANTIALIAS;
|
||||
lv_style_scr.text.line_space = 2 << LV_ANTIALIAS;
|
||||
@ -125,9 +125,9 @@ void lv_style_init (void)
|
||||
|
||||
/*Pretty color style*/
|
||||
memcpy(&lv_style_pretty_color, &lv_style_pretty, sizeof(lv_style_t));
|
||||
lv_style_pretty_color.text.color = COLOR_MAKE(0xe0, 0xe0, 0xe0);
|
||||
lv_style_pretty_color.text.color = COLOR_MAKE(0xc0, 0xc0, 0xc0);
|
||||
lv_style_pretty_color.image.color = COLOR_MAKE(0xe0, 0xe0, 0xe0);
|
||||
lv_style_pretty_color.line.color = COLOR_MAKE(0xe0, 0xe0, 0xe0);
|
||||
lv_style_pretty_color.line.color = COLOR_MAKE(0xc0, 0xc0, 0xc0);
|
||||
lv_style_pretty_color.body.main_color = COLOR_MAKE(0x6b, 0x9a, 0xc7);
|
||||
lv_style_pretty_color.body.gradient_color = COLOR_MAKE(0x2b, 0x59, 0x8b);
|
||||
lv_style_pretty_color.body.border.color = COLOR_MAKE(0x15, 0x2c, 0x42);
|
||||
|
@ -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_size(new_btnm, LV_HOR_RES / 2, LV_VER_RES / 4);
|
||||
lv_btnm_set_map(new_btnm, lv_btnm_def_map);
|
||||
|
||||
/*Set the default styles*/
|
||||
|
@ -93,7 +93,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->label = lv_label_create(new_ddlist, NULL);
|
||||
lv_cont_set_fit(new_ddlist, true, false);
|
||||
lv_page_set_release_action(new_ddlist, lv_ddlist_release_action);
|
||||
lv_page_set_sb_mode(new_ddlist, LV_PAGE_SB_MODE_DRAG);
|
||||
lv_page_set_sb_mode(new_ddlist, LV_SB_MODE_DRAG);
|
||||
lv_page_set_style(new_ddlist, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
|
||||
|
||||
lv_ddlist_set_options(new_ddlist, "Option 1\nOption 2\nOption 3");
|
||||
@ -199,27 +199,19 @@ void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the fix width for the drop down list
|
||||
* If 0 then the ddlist will be auto. sized else the set width will be applied.
|
||||
* Enable or disable the horizontal fit to the content
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param w the new width (0: auto size)
|
||||
* @param fit en true: enable auto fit; false: disable auto fit
|
||||
*/
|
||||
void lv_ddlist_set_fix_width(lv_obj_t * ddlist, cord_t w)
|
||||
void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, bool fit_en)
|
||||
{
|
||||
if(w) {
|
||||
lv_cont_set_fit(ddlist, false, lv_cont_get_ver_fit(ddlist));
|
||||
lv_page_set_scrl_fit(ddlist, false, lv_page_get_scrl_fit_ver(ddlist));
|
||||
lv_obj_set_width(ddlist, w);
|
||||
lv_cont_set_fit(ddlist, fit_en, lv_cont_get_ver_fit(ddlist));
|
||||
lv_page_set_scrl_fit(ddlist, fit_en, lv_page_get_scrl_fit_ver(ddlist));
|
||||
|
||||
} else {
|
||||
lv_cont_set_fit(ddlist, true, lv_cont_get_ver_fit(ddlist));
|
||||
lv_page_set_scrl_fit(ddlist, true, lv_page_get_scrl_fit_ver(ddlist));
|
||||
}
|
||||
|
||||
lv_ddlist_refr_size(ddlist, 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the open/close animation time.
|
||||
* @param ddlist pointer to a drop down list
|
||||
@ -477,7 +469,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
char c = *((char*)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
|
||||
if(ext->sel_opt_id +1 < ext->option_cnt) {
|
||||
if(ext->sel_opt_id + 1 < ext->option_cnt) {
|
||||
ext->sel_opt_id ++;
|
||||
lv_obj_invalidate(ddlist);
|
||||
if(ext->action != NULL) {
|
||||
@ -494,7 +486,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ESC) {
|
||||
if(ext->opened != false) ext->opened = false;
|
||||
if(ext->opened == false) ext->opened = true;
|
||||
else ext->opened = true;
|
||||
|
||||
lv_ddlist_refr_size(ddlist, true);
|
||||
}
|
||||
|
@ -102,19 +102,18 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t action);
|
||||
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h);
|
||||
|
||||
/**
|
||||
* Set the fix width for the drop down list
|
||||
* If 0 then the ddlist will be auto. sized else the set width will be applied.
|
||||
* Enable or disable the horizontal fit to the content
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param w the new width (0: auto size)
|
||||
* @param fit en true: enable auto fit; false: disable auto fit
|
||||
*/
|
||||
void lv_ddlist_set_fix_width(lv_obj_t * ddlist, cord_t w);
|
||||
void lv_ddlist_set_hor_fit(lv_obj_t * ddlist, bool fit_en);
|
||||
|
||||
/**
|
||||
* Set the scroll bar mode of a drop down list
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
static inline void lv_ddlist_set_sb_mode(lv_obj_t * ddlist, lv_page_sb_mode_t mode)
|
||||
static inline void lv_ddlist_set_sb_mode(lv_obj_t * ddlist, lv_sb_mode_t mode)
|
||||
{
|
||||
lv_page_set_sb_mode(ddlist, mode);
|
||||
}
|
||||
@ -179,7 +178,7 @@ cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
static inline lv_page_sb_mode_t lv_ddlist_get_sb_mode(lv_obj_t * ddlist)
|
||||
static inline lv_sb_mode_t lv_ddlist_get_sb_mode(lv_obj_t * ddlist)
|
||||
{
|
||||
return lv_page_get_sb_mode(ddlist);
|
||||
}
|
||||
|
@ -253,8 +253,12 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
|
||||
lv_style_t * style = lv_obj_get_style(gauge);
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
/* Store the real pointer because of 'lv_group'
|
||||
* If the object is in focus 'lv_obj_get_style()' will give a pointer to tmp style
|
||||
* and to the real object style. It is important because of style change tricks below*/
|
||||
lv_style_t *style_ori_p = gauge->style_p;
|
||||
lv_style_t *style = lv_obj_get_style(gauge);
|
||||
lv_gauge_ext_t *ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
lv_gauge_draw_scale(gauge, mask);
|
||||
|
||||
@ -276,8 +280,7 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
|
||||
|
||||
ext->lmeter.line_cnt = line_cnt_tmp; /*Restore the parameters*/
|
||||
ext->lmeter.cur_value = value_tmp;
|
||||
gauge->style_p = style;
|
||||
|
||||
gauge->style_p = style_ori_p; /*Restore the ORIGINAL style pointer*/
|
||||
|
||||
lv_gauge_draw_needle(gauge, mask);
|
||||
|
||||
|
@ -89,7 +89,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
ext->ta = NULL;
|
||||
ext->mode = LV_KB_MODE_TEXT;
|
||||
ext->cur_mng = 0;
|
||||
ext->cursor_mng = 0;
|
||||
ext->close_action = NULL;
|
||||
ext->ok_action = NULL;
|
||||
|
||||
@ -121,7 +121,7 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_kb_ext_t * copy_ext = lv_obj_get_ext_attr(copy);ext->ta = NULL;
|
||||
ext->ta = copy_ext->ta;
|
||||
ext->mode = copy_ext->mode;
|
||||
ext->cur_mng = copy_ext->cur_mng;
|
||||
ext->cursor_mng = copy_ext->cursor_mng;
|
||||
ext->close_action = copy_ext->close_action;
|
||||
ext->ok_action = copy_ext->ok_action;
|
||||
|
||||
@ -144,10 +144,19 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
void lv_kb_set_ta(lv_obj_t * kb, lv_obj_t * ta)
|
||||
{
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
lv_cursor_type_t cur_type;
|
||||
|
||||
if(ext->ta && ext->cursor_mng) {
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type | LV_CURSOR_HIDDEN);
|
||||
}
|
||||
|
||||
if(ext->ta != NULL && ext->cur_mng != 0) lv_ta_set_cursor_show(ext->ta, false);
|
||||
ext->ta = ta;
|
||||
if(ext->cur_mng != 0) lv_ta_set_cursor_show(ext->ta, true);
|
||||
|
||||
if(ext->cursor_mng) {
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,9 +181,13 @@ void lv_kb_set_mode(lv_obj_t * kb, lv_kb_mode_t mode)
|
||||
void lv_kb_set_cursor_manage(lv_obj_t * kb, bool en)
|
||||
{
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
ext->cur_mng = en == false? 0 : 1;
|
||||
ext->cursor_mng = en == false? 0 : 1;
|
||||
|
||||
if(ext->ta != NULL) lv_ta_set_cursor_show(ext->ta, true);
|
||||
if(ext->ta) {
|
||||
lv_cursor_type_t cur_type;
|
||||
cur_type = lv_ta_get_cursor_type(ext->ta);
|
||||
lv_ta_set_cursor_type(ext->ta, cur_type & (~LV_CURSOR_HIDDEN));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -264,7 +277,7 @@ lv_kb_mode_t lv_kb_get_mode(lv_obj_t * kb)
|
||||
bool lv_kb_get_cursor_manage(lv_obj_t * kb, bool en)
|
||||
{
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
return ext->cur_mng == 0 ? false : true;
|
||||
return ext->cursor_mng == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +39,7 @@ typedef struct {
|
||||
/*New data for this type */
|
||||
lv_obj_t *ta; /*Pointer to the assigned text area*/
|
||||
lv_kb_mode_t mode; /*Key map type*/
|
||||
uint8_t cur_mng :1; /*1: automatically show/hide cursor when a text area is assigned or left*/
|
||||
uint8_t cursor_mng :1; /*1: automatically show/hide cursor when a text area is assigned or left*/
|
||||
lv_action_t ok_action; /*Called when the "Ok" button is clicked*/
|
||||
lv_action_t close_action; /*Called when the "Hide" button is clicked*/
|
||||
}lv_kb_ext_t;
|
||||
|
@ -179,6 +179,11 @@ static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t
|
||||
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
|
||||
lv_style_t * style = lv_obj_get_style(led);
|
||||
|
||||
/* Store the real pointer because of 'lv_group'
|
||||
* If the object is in focus 'lv_obj_get_style()' will give a pointer to tmp style
|
||||
* and to the real object style. It is important because of style change tricks below*/
|
||||
lv_style_t *style_ori_p = led->style_p;
|
||||
|
||||
/*Create a temporal style*/
|
||||
lv_style_t leds_tmp;
|
||||
memcpy(&leds_tmp, style, sizeof(leds_tmp));
|
||||
@ -194,7 +199,7 @@ static bool lv_led_design(lv_obj_t * led, const area_t * mask, lv_design_mode_t
|
||||
|
||||
led->style_p = &leds_tmp;
|
||||
ancestor_design_f(led, mask, mode);
|
||||
led->style_p = style;
|
||||
led->style_p = style_ori_p; /*Restore the ORIGINAL style pointer*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ 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_page_set_scrl_layout(new_list, LV_LIST_LAYOUT_DEF);
|
||||
lv_list_set_sb_mode(new_list, LV_PAGE_SB_MODE_DRAG);
|
||||
lv_list_set_sb_mode(new_list, LV_SB_MODE_DRAG);
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_theme_t *th = lv_theme_get_current();
|
||||
|
@ -106,7 +106,7 @@ void lv_list_set_anim_time(lv_obj_t *list, uint16_t anim_time);
|
||||
* @param list pointer to a list object
|
||||
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
static inline void lv_list_set_sb_mode(lv_obj_t * list, lv_page_sb_mode_t mode)
|
||||
static inline void lv_list_set_sb_mode(lv_obj_t * list, lv_sb_mode_t mode)
|
||||
{
|
||||
lv_page_set_sb_mode(list, mode);
|
||||
}
|
||||
@ -156,7 +156,7 @@ uint16_t lv_list_get_anim_time(lv_obj_t *list);
|
||||
* @param list pointer to a list object
|
||||
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
static inline lv_page_sb_mode_t lv_list_get_sb_mode(lv_obj_t * list)
|
||||
static inline lv_sb_mode_t lv_list_get_sb_mode(lv_obj_t * list)
|
||||
{
|
||||
return lv_page_get_sb_mode(list);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->sb.hor_draw = 0;
|
||||
ext->sb.ver_draw = 0;
|
||||
ext->sb.style = &lv_style_pretty;
|
||||
ext->sb.mode = LV_PAGE_SB_MODE_AUTO;
|
||||
ext->sb.mode = LV_SB_MODE_AUTO;
|
||||
|
||||
/*Init the new page object*/
|
||||
if(copy == NULL) {
|
||||
@ -161,7 +161,7 @@ void lv_page_set_press_action(lv_obj_t * page, lv_action_t pr_action)
|
||||
* @param page pointer to a page object
|
||||
* @param sb.mode the new mode from 'lv_page_sb.mode_t' enum
|
||||
*/
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_page_sb_mode_t sb_mode)
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode)
|
||||
{
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
ext->sb.mode = sb_mode;
|
||||
@ -220,7 +220,7 @@ lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
|
||||
* @param page pointer to a page object
|
||||
* @return the mode from 'lv_page_sb.mode_t' enum
|
||||
*/
|
||||
lv_page_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page)
|
||||
lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page)
|
||||
{
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
return ext->sb.mode;
|
||||
@ -580,7 +580,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
|
||||
}
|
||||
else if(sign == LV_SIGNAL_DRAG_END) {
|
||||
/*Hide scrollbars if required*/
|
||||
if(page_ext->sb.mode == LV_PAGE_SB_MODE_DRAG) {
|
||||
if(page_ext->sb.mode == LV_SB_MODE_DRAG) {
|
||||
area_t sb_area_tmp;
|
||||
if(page_ext->sb.hor_draw) {
|
||||
area_cpy(&sb_area_tmp, &page_ext->sb.hor_area);
|
||||
@ -644,9 +644,9 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
cord_t sb_hor_pad = MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.hor);
|
||||
cord_t sb_ver_pad = MATH_MAX(ext->sb.style->body.padding.inner, style->body.padding.ver);
|
||||
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_OFF) return;
|
||||
if(ext->sb.mode == LV_SB_MODE_OFF) return;
|
||||
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_ON) {
|
||||
if(ext->sb.mode == LV_SB_MODE_ON) {
|
||||
ext->sb.hor_draw = 1;
|
||||
ext->sb.ver_draw = 1;
|
||||
}
|
||||
@ -671,7 +671,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
}
|
||||
|
||||
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_DRAG && lv_indev_is_dragging(lv_indev_get_act()) == false) {
|
||||
if(ext->sb.mode == LV_SB_MODE_DRAG && lv_indev_is_dragging(lv_indev_get_act()) == false) {
|
||||
ext->sb.hor_draw = 0;
|
||||
ext->sb.ver_draw = 0;
|
||||
return;
|
||||
@ -682,7 +682,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
if(scrl_w <= obj_w - 2 * hpad) { /*Full sized scroll bar*/
|
||||
area_set_width(&ext->sb.hor_area, obj_w - 2 * sb_hor_pad);
|
||||
area_set_pos(&ext->sb.hor_area, sb_hor_pad, obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.ver);
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_AUTO || ext->sb.mode == LV_PAGE_SB_MODE_DRAG) ext->sb.hor_draw = 0;
|
||||
if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.hor_draw = 0;
|
||||
} else {
|
||||
size_tmp = (obj_w * (obj_w - (2 * sb_hor_pad))) / (scrl_w + 2 * hpad);
|
||||
if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
|
||||
@ -693,14 +693,14 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
(scrl_w + 2 * hpad - obj_w ),
|
||||
obj_h - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.ver);
|
||||
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_AUTO || ext->sb.mode == LV_PAGE_SB_MODE_DRAG) ext->sb.hor_draw = 1;
|
||||
if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.hor_draw = 1;
|
||||
}
|
||||
|
||||
/*Vertical scrollbar*/
|
||||
if(scrl_h <= obj_h - 2 * vpad) { /*Full sized scroll bar*/
|
||||
area_set_height(&ext->sb.ver_area, obj_h - 2 * sb_ver_pad);
|
||||
area_set_pos(&ext->sb.ver_area, obj_w - ext->sb.style->body.padding.inner - ext->sb.style->body.padding.hor, sb_ver_pad);
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_AUTO || ext->sb.mode == LV_PAGE_SB_MODE_DRAG) ext->sb.ver_draw = 0;
|
||||
if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.ver_draw = 0;
|
||||
} else {
|
||||
size_tmp = (obj_h * (obj_h - (2 * sb_ver_pad))) / (scrl_h + 2 * vpad);
|
||||
if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
|
||||
@ -711,7 +711,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
(-(lv_obj_get_y(scrl) - vpad) * (obj_h - size_tmp - 2 * sb_ver_pad)) /
|
||||
(scrl_h + 2 * vpad - obj_h ));
|
||||
|
||||
if(ext->sb.mode == LV_PAGE_SB_MODE_AUTO || ext->sb.mode == LV_PAGE_SB_MODE_DRAG) ext->sb.ver_draw = 1;
|
||||
if(ext->sb.mode == LV_SB_MODE_AUTO || ext->sb.mode == LV_SB_MODE_DRAG) ext->sb.ver_draw = 1;
|
||||
}
|
||||
|
||||
/*Invalidate the new scrollbar areas*/
|
||||
|
@ -35,11 +35,11 @@ extern "C" {
|
||||
/*Scrollbar modes: shows when should the scrollbars be visible*/
|
||||
typedef enum
|
||||
{
|
||||
LV_PAGE_SB_MODE_OFF, /*Never show scrollbars*/
|
||||
LV_PAGE_SB_MODE_ON, /*Always show scrollbars*/
|
||||
LV_PAGE_SB_MODE_DRAG, /*Show scrollbars when page is being dragged*/
|
||||
LV_PAGE_SB_MODE_AUTO, /*Show scrollbars when the scrollable container is large enough to be scrolled*/
|
||||
}lv_page_sb_mode_t;
|
||||
LV_SB_MODE_OFF, /*Never show scrollbars*/
|
||||
LV_SB_MODE_ON, /*Always show scrollbars*/
|
||||
LV_SB_MODE_DRAG, /*Show scrollbars when page is being dragged*/
|
||||
LV_SB_MODE_AUTO, /*Show scrollbars when the scrollable container is large enough to be scrolled*/
|
||||
}lv_sb_mode_t;
|
||||
|
||||
/*Data of page*/
|
||||
typedef struct
|
||||
@ -109,7 +109,7 @@ void lv_page_set_press_action(lv_obj_t * page, lv_action_t pr_action);
|
||||
* @param page pointer to a page object
|
||||
* @param sb.mode the new mode from 'lv_page_sb.mode_t' enum
|
||||
*/
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_page_sb_mode_t sb_mode);
|
||||
void lv_page_set_sb_mode(lv_obj_t * page, lv_sb_mode_t sb_mode);
|
||||
|
||||
/**
|
||||
* Set the fit attribute of the scrollable part of a page.
|
||||
@ -172,7 +172,7 @@ void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style);
|
||||
* @param page pointer to a page object
|
||||
* @return the mode from 'lv_page_sb.mode_t' enum
|
||||
*/
|
||||
lv_page_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page);
|
||||
lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page);
|
||||
|
||||
/**
|
||||
* Get width of the scrollable part of a page
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "lv_roller.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_obj/lv_group.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
/*********************
|
||||
@ -243,10 +244,12 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
{
|
||||
lv_res_t res;
|
||||
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(roller, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
|
||||
/*Don't let the drop down list to handle the control signals. It works differently*/
|
||||
if(sign != LV_SIGNAL_CONTROLL && sign != LV_SIGNAL_FOCUS && sign != LV_SIGNAL_DEFOCUS) {
|
||||
/* Include the ancient signal function */
|
||||
res = ancestor_signal(roller, sign, param);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
@ -268,6 +271,25 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt_id);
|
||||
refr_position(roller, false);
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_CONTROLL) {
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
char c = *((char*)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
|
||||
if(ext->ddlist.sel_opt_id +1 < ext->ddlist.option_cnt) {
|
||||
|
||||
lv_roller_set_selected(roller, ext->ddlist.sel_opt_id + 1, true);
|
||||
if(ext->ddlist.action != NULL) {
|
||||
ext->ddlist.action(roller);
|
||||
}
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
|
||||
if(ext->ddlist.sel_opt_id > 0) {
|
||||
lv_roller_set_selected(roller, ext->ddlist.sel_opt_id - 1, true);
|
||||
if(ext->ddlist.action != NULL) {
|
||||
ext->ddlist.action(roller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -71,15 +71,15 @@ static inline void lv_roller_set_options(lv_obj_t * roller, const char * options
|
||||
*/
|
||||
void lv_roller_set_selected(lv_obj_t *roller, uint16_t sel_opt, bool anim_en);
|
||||
|
||||
|
||||
/**
|
||||
* Set the fix width for the roller
|
||||
* If 0 then the roller will be auto. sized else the set width will be applied.
|
||||
* @param roller pointer to a drop down list
|
||||
* @param w the new width (0: auto size)
|
||||
* Enable or disable the horizontal fit to the content
|
||||
* @param roller pointer to a roller
|
||||
* @param fit en true: enable auto fit; false: disable auto fit
|
||||
*/
|
||||
static inline void lv_roller_set_fix_width(lv_obj_t * roller, cord_t w)
|
||||
static inline void lv_roller_set_hor_fit(lv_obj_t * roller, bool fit_en)
|
||||
{
|
||||
lv_ddlist_set_fix_width(roller, w);
|
||||
lv_ddlist_set_hor_fit(roller, fit_en);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,8 +18,9 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_SLIDER_SIZE_MIN (2 << LV_ANTIALIAS) /*hpad and vpad cannot make the bar or indicator smaller then this [px]*/
|
||||
#define LV_SLIDER_SIZE_MIN (4 << LV_ANTIALIAS) /*hpad and vpad cannot make the bar or indicator smaller then this [px]*/
|
||||
#define LV_SLIDER_NOT_PRESSED INT16_MIN
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
@ -108,7 +108,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_label_set_text(ext->label, "Text area");
|
||||
lv_obj_set_click(ext->label, false);
|
||||
lv_obj_set_size(new_ta, LV_TA_DEF_WIDTH, LV_TA_DEF_HEIGHT);
|
||||
lv_ta_set_sb_mode(new_ta, LV_PAGE_SB_MODE_DRAG);
|
||||
lv_ta_set_sb_mode(new_ta, LV_SB_MODE_DRAG);
|
||||
lv_page_set_style(new_ta, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
|
||||
|
||||
/*Set the default styles*/
|
||||
@ -739,6 +739,7 @@ static bool lv_ta_scrollable_design(lv_obj_t * scrl, const area_t * mask, lv_des
|
||||
lv_ta_ext_t * ta_ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_t * label_style = lv_obj_get_style(ta_ext->label);
|
||||
if(ta_ext->cursor.type == LV_CURSOR_NONE ||
|
||||
(ta_ext->cursor.type & LV_CURSOR_HIDDEN) ||
|
||||
ta_ext->cursor.state == 0 ||
|
||||
label_style->body.opa == OPA_TRANSP)
|
||||
{
|
||||
@ -913,15 +914,11 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
}
|
||||
else if (sign == LV_SIGNAL_CONTROLL) {
|
||||
char c = *((char*)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT) {
|
||||
lv_ta_cursor_right(ta);
|
||||
} else if(c == LV_GROUP_KEY_LEFT) {
|
||||
lv_ta_cursor_left(ta);
|
||||
} else if(c == LV_GROUP_KEY_UP) {
|
||||
lv_ta_cursor_up(ta);
|
||||
} else if(c == LV_GROUP_KEY_DOWN) {
|
||||
lv_ta_cursor_down(ta);
|
||||
}
|
||||
if(c == LV_GROUP_KEY_RIGHT) lv_ta_cursor_right(ta);
|
||||
else if(c == LV_GROUP_KEY_LEFT) lv_ta_cursor_left(ta);
|
||||
else if(c == LV_GROUP_KEY_UP) lv_ta_cursor_up(ta);
|
||||
else if(c == LV_GROUP_KEY_DOWN) lv_ta_cursor_down(ta);
|
||||
else lv_ta_add_char(ta, c);
|
||||
}
|
||||
|
||||
return res;
|
||||
@ -964,7 +961,10 @@ static void cursor_blink_anim(lv_obj_t * ta, uint8_t show)
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
if(show != ext->cursor.state) {
|
||||
ext->cursor.state = show == 0 ? 0 : 1;
|
||||
if(ext->cursor.show != 0) lv_obj_invalidate(ta);
|
||||
if(ext->cursor.type != LV_CURSOR_NONE &&
|
||||
(ext->cursor.type & LV_CURSOR_HIDDEN) == 0) {
|
||||
lv_obj_invalidate(ta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ typedef enum {
|
||||
LV_CURSOR_BLOCK,
|
||||
LV_CURSOR_OUTLINE,
|
||||
LV_CURSOR_UNDERLINE,
|
||||
LV_CURSOR_HIDDEN = 0x10, /*Or it to any value to hide the cursor temporally*/
|
||||
}lv_cursor_type_t;
|
||||
|
||||
/*Data of text area*/
|
||||
@ -153,7 +154,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en);
|
||||
* @param ta pointer to a text area object
|
||||
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
static inline void lv_ta_set_sb_mode(lv_obj_t * ta, lv_page_sb_mode_t mode)
|
||||
static inline void lv_ta_set_sb_mode(lv_obj_t * ta, lv_sb_mode_t mode)
|
||||
{
|
||||
lv_page_set_sb_mode(ta, mode);
|
||||
}
|
||||
@ -224,7 +225,7 @@ bool lv_ta_get_one_line(lv_obj_t * ta);
|
||||
* @param ta pointer to a text area object
|
||||
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
|
||||
*/
|
||||
static inline lv_page_sb_mode_t lv_ta_get_sb_mode(lv_obj_t * ta)
|
||||
static inline lv_sb_mode_t lv_ta_get_sb_mode(lv_obj_t * ta)
|
||||
{
|
||||
return lv_page_get_sb_mode(ta);
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
|
||||
lv_page_set_style(h, LV_PAGE_STYLE_BG, &lv_style_transp);
|
||||
lv_page_set_style(h, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
|
||||
lv_page_set_sb_mode(h, LV_PAGE_SB_MODE_AUTO);
|
||||
lv_page_set_sb_mode(h, LV_SB_MODE_AUTO);
|
||||
|
||||
if(page_signal == NULL) page_signal = lv_obj_get_signal_func(h);
|
||||
if(page_scrl_signal == NULL) page_scrl_signal = lv_obj_get_signal_func(lv_page_get_scrl(h));
|
||||
@ -474,7 +474,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
|
||||
dm_free(ext->tab_name_ptr);
|
||||
ext->tab_name_ptr = NULL;
|
||||
} else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
}
|
||||
else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
if(ext->content != NULL &&
|
||||
(lv_obj_get_width(tabview) != area_get_width(param) ||
|
||||
lv_obj_get_height(tabview) != area_get_height(param)))
|
||||
@ -482,6 +483,11 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
|
||||
tabview_realign(tabview);
|
||||
}
|
||||
}
|
||||
else if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_CONTROLL) {
|
||||
if(ext->btns) {
|
||||
ext->btns->signal_func(ext->btns, sign, param);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -71,8 +71,7 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
ext->page = lv_page_create(new_win, NULL);
|
||||
lv_obj_set_protect(ext->page, LV_PROTECT_PARENT);
|
||||
lv_page_set_sb_mode(ext->page, LV_PAGE_SB_MODE_AUTO);
|
||||
lv_page_set_style(ext->page, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight);
|
||||
lv_page_set_sb_mode(ext->page, LV_SB_MODE_AUTO);
|
||||
|
||||
/*Create a holder for the header*/
|
||||
ext->header = lv_obj_create(new_win, NULL);
|
||||
@ -91,13 +90,15 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_BG, th->win.bg);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_SB, th->win.sb);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_HEADER, th->win.header);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT, th->win.content);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_BG, th->win.content.bg);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_SCRL, th->win.content.scrl);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_BTN_REL, th->win.btn.rel);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_BTN_PR, th->win.btn.pr);
|
||||
|
||||
} else {
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_BG, &lv_style_pretty);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT, &lv_style_transp);
|
||||
lv_win_set_style(new_win, LV_WIN_STYLE_CONTENT_BG, &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);
|
||||
|
||||
}
|
||||
@ -202,7 +203,7 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
|
||||
/**
|
||||
* Set the control button size of a window
|
||||
* @param win pointer to a window object
|
||||
* @return control button size
|
||||
* @param size control button size
|
||||
*/
|
||||
void lv_win_set_btn_size(lv_obj_t * win, cord_t size)
|
||||
{
|
||||
@ -212,6 +213,28 @@ void lv_win_set_btn_size(lv_obj_t * win, cord_t size)
|
||||
lv_win_realign(win);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the layout of the window
|
||||
* @param win pointer to a window object
|
||||
* @param layout the layout from 'lv_layout_t'
|
||||
*/
|
||||
void lv_win_set_layout(lv_obj_t *win, lv_layout_t layout)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
lv_page_set_scrl_layout(ext->page, layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the scroll bar mode of a window
|
||||
* @param win pointer to a window object
|
||||
* @param sb_mode the new scroll bar mode from 'lv_sb_mode_t'
|
||||
*/
|
||||
void lv_win_set_sb_mode(lv_obj_t *win, lv_sb_mode_t sb_mode)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
lv_page_set_sb_mode(ext->page, sb_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a style of a window
|
||||
* @param win pointer to a window object
|
||||
@ -227,9 +250,12 @@ void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style)
|
||||
lv_obj_set_style(win, style);
|
||||
lv_win_realign(win);
|
||||
break;
|
||||
case LV_WIN_STYLE_CONTENT:
|
||||
case LV_WIN_STYLE_CONTENT_BG:
|
||||
lv_page_set_style(ext->page, LV_PAGE_STYLE_BG, 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;
|
||||
@ -286,10 +312,32 @@ cord_t lv_win_get_btn_size(lv_obj_t * win)
|
||||
return ext->btn_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the layout of a window
|
||||
* @param win pointer to a window object
|
||||
* @return the layout of the window (from 'lv_layout_t')
|
||||
*/
|
||||
lv_layout_t lv_win_get_layout(lv_obj_t *win)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
return lv_page_get_scrl_layout(ext->page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scroll bar mode of a window
|
||||
* @param win pointer to a window object
|
||||
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
|
||||
*/
|
||||
lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t *win)
|
||||
{
|
||||
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
|
||||
return lv_page_get_sb_mode(ext->page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get width of the content area (page scrollable) of the window
|
||||
* @param win pointer to a window object
|
||||
* @return the width of the content area
|
||||
* @return the width of the content_bg area
|
||||
*/
|
||||
cord_t lv_win_get_width(lv_obj_t * win)
|
||||
{
|
||||
@ -325,12 +373,13 @@ lv_style_t * lv_win_get_style(lv_obj_t *win, lv_win_style_t type)
|
||||
lv_win_ext_t *ext = lv_obj_get_ext_attr(win);
|
||||
|
||||
switch (type) {
|
||||
case LV_WIN_STYLE_BG: return lv_obj_get_style(win);
|
||||
case LV_WIN_STYLE_SB: return lv_page_get_style(ext->page, LV_PAGE_STYLE_SB);
|
||||
case LV_WIN_STYLE_CONTENT: return lv_page_get_style(ext->page, LV_PAGE_STYLE_BG);
|
||||
case LV_WIN_STYLE_HEADER: return lv_obj_get_style(ext->header);
|
||||
case LV_WIN_STYLE_BTN_REL: return ext->style_btn_rel;
|
||||
case LV_WIN_STYLE_BTN_PR: return ext->style_btn_pr;
|
||||
case LV_WIN_STYLE_BG: return lv_obj_get_style(win);
|
||||
case LV_WIN_STYLE_CONTENT_BG: return lv_page_get_style(ext->page, LV_PAGE_STYLE_BG);
|
||||
case LV_WIN_STYLE_CONTENT_SCRL: return lv_page_get_style(ext->page, LV_PAGE_STYLE_SCRL);
|
||||
case LV_WIN_STYLE_SB: return lv_page_get_style(ext->page, LV_PAGE_STYLE_SB);
|
||||
case LV_WIN_STYLE_HEADER: return lv_obj_get_style(ext->header);
|
||||
case LV_WIN_STYLE_BTN_REL: return ext->style_btn_rel;
|
||||
case LV_WIN_STYLE_BTN_PR: return ext->style_btn_pr;
|
||||
default: return NULL;
|
||||
}
|
||||
|
||||
@ -338,6 +387,22 @@ lv_style_t * lv_win_get_style(lv_obj_t *win, lv_win_style_t type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Focus on an object. It ensures that the object will be visible in the window.
|
||||
* @param win pointer to a window object
|
||||
* @param obj pointer to an object to focus (must be in the window)
|
||||
* @param anim_time scroll animation time in milliseconds (0: no animation)
|
||||
*/
|
||||
void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, uint16_t anim_time)
|
||||
{
|
||||
lv_win_ext_t *ext = lv_obj_get_ext_attr(win);
|
||||
lv_page_focus(ext->page, obj, anim_time);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -65,7 +65,8 @@ typedef struct
|
||||
|
||||
typedef enum {
|
||||
LV_WIN_STYLE_BG,
|
||||
LV_WIN_STYLE_CONTENT,
|
||||
LV_WIN_STYLE_CONTENT_BG,
|
||||
LV_WIN_STYLE_CONTENT_SCRL,
|
||||
LV_WIN_STYLE_SB,
|
||||
LV_WIN_STYLE_HEADER,
|
||||
LV_WIN_STYLE_BTN_REL,
|
||||
@ -123,6 +124,27 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
|
||||
*/
|
||||
void lv_win_set_btn_size(lv_obj_t * win, cord_t size);
|
||||
|
||||
/**
|
||||
* Set the control button size of a window
|
||||
* @param win pointer to a window object
|
||||
* @param size control button size
|
||||
*/
|
||||
void lv_win_set_btn_size(lv_obj_t * win, cord_t size);
|
||||
|
||||
/**
|
||||
* Set the scroll bar mode of a window
|
||||
* @param win pointer to a window object
|
||||
* @param sb_mode the new scroll bar mode from 'lv_sb_mode_t'
|
||||
*/
|
||||
void lv_win_set_sb_mode(lv_obj_t *win, lv_sb_mode_t sb_mode);
|
||||
|
||||
/**
|
||||
* Set the layout of the window
|
||||
* @param win pointer to a window object
|
||||
* @param layout the layout from 'lv_layout_t'
|
||||
*/
|
||||
void lv_win_set_layout(lv_obj_t *win, lv_layout_t layout);
|
||||
|
||||
/**
|
||||
* Set a style of a window
|
||||
* @param win pointer to a window object
|
||||
@ -149,6 +171,20 @@ const char * lv_win_get_title(lv_obj_t * win);
|
||||
*/
|
||||
cord_t lv_win_get_btn_size(lv_obj_t * win);
|
||||
|
||||
/**
|
||||
* Get the layout of a window
|
||||
* @param win pointer to a window object
|
||||
* @return the layout of the window (from 'lv_layout_t')
|
||||
*/
|
||||
lv_layout_t lv_win_get_layout(lv_obj_t *win);
|
||||
|
||||
/**
|
||||
* Get the scroll bar mode of a window
|
||||
* @param win pointer to a window object
|
||||
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
|
||||
*/
|
||||
lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t *win);
|
||||
|
||||
/**
|
||||
* Get width of the content area (page scrollable) of the window
|
||||
* @param win pointer to a window object
|
||||
@ -172,6 +208,18 @@ lv_obj_t * lv_win_get_from_btn(lv_obj_t * ctrl_btn);
|
||||
*/
|
||||
lv_style_t * lv_win_get_style(lv_obj_t *win, lv_win_style_t type);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Focus on an object. It ensures that the object will be visible in the window.
|
||||
* @param win pointer to a window object
|
||||
* @param obj pointer to an object to focus (must be in the window)
|
||||
* @param anim_time scroll animation time in milliseconds (0: no animation)
|
||||
*/
|
||||
void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, uint16_t anim_time);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user