BigW Consortium Gitlab

Commit 350ceddf by Gabor Kiss-Vamosi

name fixes

parent 86daac14
......@@ -34,6 +34,7 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj);
static void refresh_childen_style(lv_obj_t * obj);
static void delete_children(lv_obj_t * obj);
static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode_t mode);
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
/**********************
* STATIC VARIABLES
......@@ -247,8 +248,9 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
/**
* Delete 'obj' and all of its children
* @param obj pointer to an object to delete
* @preturn LV_RES_INV beacuse the object is deleted
*/
void lv_obj_del(lv_obj_t * obj)
lv_res_t lv_obj_del(lv_obj_t * obj)
{
lv_obj_invalidate(obj);
......@@ -308,6 +310,8 @@ void lv_obj_del(lv_obj_t * obj)
if(par != NULL) {
par->signal_func(par, LV_SIGNAL_CHILD_CHG, NULL);
}
return LV_RES_INV;
}
/**
......@@ -322,41 +326,9 @@ void lv_obj_clear(lv_obj_t *obj)
lv_obj_del(child);
child = lv_obj_get_child(obj, child);
}
}
/**
* Signal function of the basic object
* @param obj pointer to an object
* @param sign signal type
* @param param parameter for the signal (depends on signal type)
* @return false: the object become invalid (e.g. deleted)
*/
bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
{
bool valid = true;
lv_style_t * style = lv_obj_get_style(obj);
switch(sign) {
case LV_SIGNAL_CHILD_CHG:
/*Return 'invalid' if the child change signal is not enabled*/
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) valid = false;
break;
case LV_SIGNAL_REFR_EXT_SIZE:
if(style->body.shadow.width > obj->ext_size) obj->ext_size = style->body.shadow.width;
break;
case LV_SIGNAL_STYLE_CHG:
lv_obj_refresh_ext_size(obj);
break;
default:
break;
}
return valid;
}
/**
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
* @param obj pointer to an object
*/
......@@ -1524,6 +1496,36 @@ static bool lv_obj_design(lv_obj_t * obj, const area_t * mask_p, lv_design_mode
}
/**
* Signal function of the basic object
* @param obj pointer to an object
* @param sign signal type
* @param param parameter for the signal (depends on signal type)
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
{
lv_res_t res = LV_RES_OK;
lv_style_t * style = lv_obj_get_style(obj);
switch(sign) {
case LV_SIGNAL_CHILD_CHG:
/*Return 'invalid' if the child change signal is not enabled*/
if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV;
break;
case LV_SIGNAL_REFR_EXT_SIZE:
if(style->body.shadow.width > obj->ext_size) obj->ext_size = style->body.shadow.width;
break;
case LV_SIGNAL_STYLE_CHG:
lv_obj_refresh_ext_size(obj);
break;
default:
break;
}
return res;
}
/**
* Reposition the children of an object. (Called recursively)
* @param obj pointer to an object which children will be repositioned
* @param x_diff x coordinate shift
......
......@@ -72,6 +72,12 @@ typedef bool (* lv_design_func_t) (struct __LV_OBJ_T * obj, const area_t * mask_
typedef enum
{
LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function*/
LV_RES_OK, /*The object is valid (no deleted) after the action*/
}lv_res_t;
typedef enum
{
/*General signals*/
LV_SIGNAL_CLEANUP,
LV_SIGNAL_CHILD_CHG,
......@@ -95,7 +101,7 @@ typedef enum
LV_SIGNAL_CONTROLL,
}lv_signal_t;
typedef bool (* lv_signal_func_t) (struct __LV_OBJ_T * obj, lv_signal_t sign, void * param);
typedef lv_res_t (* lv_signal_func_t) (struct __LV_OBJ_T * obj, lv_signal_t sign, void * param);
typedef struct __LV_OBJ_T
{
......@@ -134,12 +140,6 @@ typedef struct __LV_OBJ_T
#endif
}lv_obj_t;
typedef enum
{
LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function*/
LV_RES_OK, /*The object is valid (no deleted) after the action*/
}lv_res_t;
typedef lv_res_t (*lv_action_t) (struct __LV_OBJ_T * obj);
/*Protect some attributes (max. 8 bit)*/
......@@ -210,7 +210,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy);
* Delete 'obj' and all of its children
* @param obj pointer to an object to delete
*/
void lv_obj_del(lv_obj_t * obj);
lv_res_t lv_obj_del(lv_obj_t * obj);
/**
* Delete all children of an object
......@@ -218,14 +218,6 @@ void lv_obj_del(lv_obj_t * obj);
*/
void lv_obj_clear(lv_obj_t *obj);
/**
* Signal function of the basic object
* @param obj pointer to an object
* @param sign signal type
* @param param parameter for the signal (depends on signal type)
* @return false: the object become invalid (e.g. deleted)
*/
bool lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
/**
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
......
......@@ -45,11 +45,11 @@ 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_released;
lv_style_t lv_style_btn_pressed;
lv_style_t lv_style_btn_tgl_released;
lv_style_t lv_style_btn_tgl_pressed;
lv_style_t lv_style_btn_inactive;
lv_style_t lv_style_btn_rel;
lv_style_t lv_style_btn_pr;
lv_style_t lv_style_btn_tgl_rel;
lv_style_t lv_style_btn_tgl_pr;
lv_style_t lv_style_btn_ina;
/**********************
* MACROS
......@@ -148,53 +148,53 @@ void lv_style_init (void)
lv_style_transp_tight.body.padding.inner = 0;
/*Button released style*/
memcpy(&lv_style_btn_released, &lv_style_plain, sizeof(lv_style_t));
lv_style_btn_released.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0);
lv_style_btn_released.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d);
lv_style_btn_released.body.radius = LV_DPI / 15;
lv_style_btn_released.body.padding.hor = LV_DPI / 4;
lv_style_btn_released.body.padding.ver = LV_DPI / 6;
lv_style_btn_released.body.padding.inner = LV_DPI / 10;
lv_style_btn_released.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28);
lv_style_btn_released.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
lv_style_btn_released.body.border.opa = OPA_70;
lv_style_btn_released.text.color = COLOR_MAKE(0xff, 0xff, 0xff);
lv_style_btn_released.body.shadow.color = COLOR_GRAY;
lv_style_btn_released.body.shadow.width = 0;
memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t));
lv_style_btn_rel.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0);
lv_style_btn_rel.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d);
lv_style_btn_rel.body.radius = LV_DPI / 15;
lv_style_btn_rel.body.padding.hor = LV_DPI / 4;
lv_style_btn_rel.body.padding.ver = LV_DPI / 6;
lv_style_btn_rel.body.padding.inner = LV_DPI / 10;
lv_style_btn_rel.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28);
lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
lv_style_btn_rel.body.border.opa = OPA_70;
lv_style_btn_rel.text.color = COLOR_MAKE(0xff, 0xff, 0xff);
lv_style_btn_rel.body.shadow.color = COLOR_GRAY;
lv_style_btn_rel.body.shadow.width = 0;
/*Button pressed style*/
memcpy(&lv_style_btn_pressed, &lv_style_btn_released, sizeof(lv_style_t));
lv_style_btn_pressed.body.color_main = COLOR_MAKE(0x33, 0x62, 0x94);
lv_style_btn_pressed.body.color_gradient = COLOR_MAKE(0x10, 0x26, 0x3c);
lv_style_btn_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_pr.body.color_main = COLOR_MAKE(0x33, 0x62, 0x94);
lv_style_btn_pr.body.color_gradient = COLOR_MAKE(0x10, 0x26, 0x3c);
lv_style_btn_pr.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_pr.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_pr.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
/*Button toggle released style*/
memcpy(&lv_style_btn_tgl_released, &lv_style_btn_released, sizeof(lv_style_t));
lv_style_btn_tgl_released.body.color_main = COLOR_MAKE(0x0a, 0x11, 0x22);
lv_style_btn_tgl_released.body.color_gradient = COLOR_MAKE(0x37, 0x62, 0x90);
lv_style_btn_tgl_released.body.border.color = COLOR_MAKE(0x01, 0x07, 0x0d);
lv_style_btn_tgl_released.text.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_released.image.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_released.line.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
memcpy(&lv_style_btn_tgl_rel, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_tgl_rel.body.color_main = COLOR_MAKE(0x0a, 0x11, 0x22);
lv_style_btn_tgl_rel.body.color_gradient = COLOR_MAKE(0x37, 0x62, 0x90);
lv_style_btn_tgl_rel.body.border.color = COLOR_MAKE(0x01, 0x07, 0x0d);
lv_style_btn_tgl_rel.text.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_rel.image.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_rel.line.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
/*Button toggle pressed style*/
memcpy(&lv_style_btn_tgl_pressed, &lv_style_btn_tgl_released, sizeof(lv_style_t));
lv_style_btn_tgl_pressed.body.color_main = COLOR_MAKE(0x02, 0x14, 0x27);
lv_style_btn_tgl_pressed.body.color_gradient = COLOR_MAKE(0x2b, 0x4c, 0x70);
lv_style_btn_tgl_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
memcpy(&lv_style_btn_tgl_pr, &lv_style_btn_tgl_rel, sizeof(lv_style_t));
lv_style_btn_tgl_pr.body.color_main = COLOR_MAKE(0x02, 0x14, 0x27);
lv_style_btn_tgl_pr.body.color_gradient = COLOR_MAKE(0x2b, 0x4c, 0x70);
lv_style_btn_tgl_pr.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pr.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pr.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
/*Button inactive style*/
memcpy(&lv_style_btn_inactive, &lv_style_btn_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);
memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_ina.body.color_main = COLOR_MAKE(0xd8, 0xd8, 0xd8);
lv_style_btn_ina.body.color_gradient = COLOR_MAKE(0xd8, 0xd8, 0xd8);
lv_style_btn_ina.body.border.color = COLOR_MAKE(0x90, 0x90, 0x90);
lv_style_btn_ina.text.color = COLOR_MAKE(0x70, 0x70, 0x70);
lv_style_btn_ina.image.color = COLOR_MAKE(0x70, 0x70, 0x70);
lv_style_btn_ina.line.color = COLOR_MAKE(0x70, 0x70, 0x70);
}
......
......@@ -149,11 +149,11 @@ 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_released;
extern lv_style_t lv_style_btn_pressed;
extern lv_style_t lv_style_btn_tgl_released;
extern lv_style_t lv_style_btn_tgl_pressed;;
extern lv_style_t lv_style_btn_inactive;
extern lv_style_t lv_style_btn_rel;
extern lv_style_t lv_style_btn_pr;
extern lv_style_t lv_style_btn_tgl_rel;
extern lv_style_t lv_style_btn_tgl_pr;;
extern lv_style_t lv_style_btn_ina;
/**********************
* MACROS
......
......@@ -67,11 +67,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_REL] = &lv_style_btn_released;
ext->styles[LV_BTN_STATE_PR] = &lv_style_btn_pressed;
ext->styles[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_released;
ext->styles[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pressed;
ext->styles[LV_BTN_STATE_INA] = &lv_style_btn_inactive;
ext->styles[LV_BTN_STATE_REL] = &lv_style_btn_rel;
ext->styles[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
ext->styles[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr;
ext->styles[LV_BTN_STATE_INA] = &lv_style_btn_ina;
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->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_released;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pressed;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_released;
ext->styles_btn[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pressed;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_inactive;
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
ext->styles_btn[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_btnm);
......
......@@ -278,7 +278,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
lv_res_t res;
/* Include the ancient signal function */
res = lv_obj_signal(line, sign, param);
res = ancestor_signal(line, sign, param);
if(res != LV_RES_OK) return res;
return res;
......
......@@ -66,11 +66,11 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
dm_assert(ext);
ext->style_img = NULL;
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_released;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pressed;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_released;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_tgl_pressed;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_inactive;
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_tgl_pr;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
ext->anim_time = LV_LIST_FOCUS_TIME;
lv_obj_set_signal_func(new_list, lv_list_signal);
......@@ -311,7 +311,7 @@ uint16_t lv_list_get_anim_time(lv_obj_t *list)
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t * lv_list_get_style(lv_obj_t *list, lv_btn_style_t type)
lv_style_t * lv_list_get_style(lv_obj_t *list, lv_list_style_t type)
{
lv_list_ext_t *ext = lv_obj_get_ext_attr(list);
......
......@@ -167,7 +167,7 @@ static inline lv_page_sb_mode_t lv_list_get_sb_mode(lv_obj_t * list)
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t * lv_list_get_style(lv_obj_t *list, lv_btn_style_t type);
lv_style_t * lv_list_get_style(lv_obj_t *list, lv_list_style_t type);
/*=====================
* Other functions
......
......@@ -136,6 +136,19 @@ void lv_mbox_set_text(lv_obj_t * mbox, const char * txt)
mbox_realign(mbox);
}
/**
* Stop the action to call when button is released
* @param mbox pointer to a message box object
* @param pointer to an 'lv_btnm_action_t' action
*/
void lv_mbox_set_action(lv_obj_t * mbox, lv_btnm_action_t action)
{
lv_mbox_ext_t *ext = lv_obj_get_ext_attr(mbox);
lv_btnm_set_action(ext->btnm, action);
}
/**
* Set animation duration
* @param mbox pointer to a message box object
......@@ -159,12 +172,12 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
if(ext->anim_time != 0) {
/*Add shrinking animations*/
lv_obj_animate(mbox, LV_ANIM_GROW_H| ANIM_OUT, ext->anim_time, delay, NULL);
lv_obj_animate(mbox, LV_ANIM_GROW_V| ANIM_OUT, ext->anim_time, delay, lv_obj_del);
lv_obj_animate(mbox, LV_ANIM_GROW_V| ANIM_OUT, ext->anim_time, delay, (anim_cb_t)lv_obj_del);
/*Disable fit to let shrinking work*/
lv_cont_set_fit(mbox, false, false);
} else {
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, lv_obj_del);
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, (anim_cb_t)lv_obj_del);
}
}
......@@ -238,8 +251,7 @@ const char * lv_mbox_get_text(lv_obj_t * mbox)
*/
lv_obj_t * lv_mbox_get_from_btn(lv_obj_t * btn)
{
lv_obj_t * btnh = lv_obj_get_parent(btn);
lv_obj_t * mbox = lv_obj_get_parent(btnh);
lv_obj_t * mbox = lv_obj_get_parent(btn);
return mbox;
}
......
......@@ -103,6 +103,13 @@ void lv_mbox_set_btns(lv_obj_t * mbox, const char **btn_map, lv_btnm_action_t ac
void lv_mbox_set_text(lv_obj_t * mbox, const char * txt);
/**
* Stop the action to call when button is released
* @param mbox pointer to a message box object
* @param pointer to an 'lv_btnm_action_t' action
*/
void lv_mbox_set_action(lv_obj_t * mbox, lv_btnm_action_t action);
/**
* Set animation duration
* @param mbox pointer to a message box object
* @param time animation length in milliseconds (0: no animation)
......
......@@ -186,7 +186,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_bar_style_t type)
lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_slider_style_t type)
{
lv_slider_ext_t *ext = lv_obj_get_ext_attr(slider);
......
......@@ -179,7 +179,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_bar_style_t type);
lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_slider_style_t type);
/**********************
* MACROS
......
......@@ -148,7 +148,7 @@ void lv_sw_set_style(lv_obj_t *sw, lv_sw_style_t type, lv_style_t *style)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_sw_get_style(lv_obj_t *sw, lv_bar_style_t type)
lv_style_t * lv_sw_get_style(lv_obj_t *sw, lv_sw_style_t type)
{
lv_sw_ext_t *ext = lv_obj_get_ext_attr(sw);
......
......@@ -124,7 +124,7 @@ static inline lv_action_t lv_sw_get_action(lv_obj_t * slider)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_sw_get_style(lv_obj_t *sw, lv_bar_style_t type);
lv_style_t * lv_sw_get_style(lv_obj_t *sw, lv_sw_style_t type);
/**********************
* MACROS
......
......@@ -22,14 +22,13 @@
/**********************
* STATIC PROTOTYPES
**********************/
#if 0 /*Not used*/
static bool lv_win_design(lv_obj_t * win, const area_t * mask, lv_design_mode_t mode);
#endif
static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param);
static void lv_win_realign(lv_obj_t * win);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_func_t ancestor_signal;
/**********************
* MACROS
......@@ -39,10 +38,6 @@ static void lv_win_realign(lv_obj_t * win);
* GLOBAL FUNCTIONS
**********************/
/*-----------------
* Create function
*-----------------*/
/**
* Create a window objects
* @param par pointer to an object, it will be the parent of the new window
......@@ -54,51 +49,43 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
/*Create the ancestor object*/
lv_obj_t * new_win = lv_obj_create(par, copy);
dm_assert(new_win);
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_win);
/*Allocate the object type specific extended data*/
lv_win_ext_t * ext = lv_obj_allocate_ext_attr(new_win, sizeof(lv_win_ext_t));
dm_assert(ext);
ext->page = NULL;
ext->btnh = NULL;
ext->header = NULL;
ext->title = NULL;
ext->style_header = &lv_style_plain_color;
ext->style_cbtn_rel = &lv_style_btn_tgl_released;
ext->style_cbtn_pr = &lv_style_btn_tgl_pressed;
ext->cbtn_size = ( LV_DPI) / 2;
ext->style_btn_rel = &lv_style_btn_rel;
ext->style_btn_pr = &lv_style_btn_pr;
ext->btn_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_plain);
lv_obj_set_style(new_win, &lv_style_pretty);
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_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_transp);
lv_page_set_style(ext->page, LV_PAGE_STYLE_BG, &lv_style_transp_tight);
/*Create a holder for the header*/
ext->header = lv_cont_create(new_win, NULL);
lv_cont_set_fit(ext->header, false, true);
ext->header = lv_obj_create(new_win, NULL);
/*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_plain_color);
/*Create a title on the header*/
ext->title = lv_label_create(ext->header, NULL);
lv_label_set_text(ext->title,"My title");
/*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_transp_fit);
lv_cont_set_layout(ext->btnh, LV_CONT_LAYOUT_ROW_M);
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_HEADER, &lv_style_plain_color);
lv_obj_set_signal_func(new_win, lv_win_signal);
lv_obj_set_size(new_win, LV_HOR_RES, LV_VER_RES);
......@@ -107,21 +94,24 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
else {
lv_win_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
/*Create the objects*/
ext->header = lv_cont_create(new_win, copy_ext->header);
ext->header = lv_obj_create(new_win, copy_ext->header);
ext->title = lv_label_create(ext->header, copy_ext->title);
ext->btnh = lv_cont_create(ext->header, copy_ext->btnh);
ext->page = lv_page_create(new_win, copy_ext->page);
ext->btn_size = copy_ext->btn_size;
/*Copy the control buttons*/
lv_obj_t * child;
lv_obj_t * cbtn;
child = lv_obj_get_child(copy_ext->btnh, NULL);
child = lv_obj_get_child_back(copy_ext->header, NULL);
child = lv_obj_get_child_back(copy_ext->header, child); /*Sip the title*/
while(child != NULL) {
cbtn = lv_btn_create(ext->btnh, child);
cbtn = lv_btn_create(ext->header, child);
lv_img_create(cbtn, lv_obj_get_child(child, NULL));
child = lv_obj_get_child(copy_ext->btnh, child);
child = lv_obj_get_child_back(copy_ext->header, child);
}
lv_obj_set_signal_func(new_win, lv_win_signal);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_win);
}
......@@ -131,71 +121,10 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
return new_win;
}
/**
* Signal function of the window
* @param win pointer to a window object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return true: the object is still valid (not deleted), false: the object become invalid
*/
bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
{
bool valid;
/* Include the ancient signal function */
valid = lv_obj_signal(win, sign, param);
/* The object can be deleted so check its validity and then
* make the object specific signal handling */
if(valid != false) {
if(sign == LV_SIGNAL_CHILD_CHG) { /*Move children to the page*/
lv_obj_t * page = lv_win_get_page(win);
if(page != NULL) {
lv_obj_t * child;
child = lv_obj_get_child(win, NULL);
while(child != NULL) {
if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) {
lv_obj_t * tmp = child;
child = lv_obj_get_child(win, child); /*Get the next child before move this*/
lv_obj_set_parent(tmp, page);
} else {
child = lv_obj_get_child(win, child);
}
}
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Refresh the style of all control buttons*/
// lv_win_ext_t * ext = lv_obj_get_ext(win);
// lv_style_t * style = lv_obj_get_style(win);
// lv_obj_t * child;
// child = lv_obj_get_child(ext->ctrl_holder, NULL);
// while(child != NULL) {
// lv_obj_set_style(child, &style->ctrl_btn);
//
// /*Refresh the image style too*/
// lv_obj_set_style(lv_obj_get_child(child, NULL), &style->ctrl_img);
// child = lv_obj_get_child(ext->ctrl_holder, child);
// }
lv_win_realign(win);
}
else if(sign == LV_SIGNAL_CORD_CHG) {
/*If the size is changed refresh the window*/
if(area_get_width(param) != lv_obj_get_width(win) ||
area_get_height(param) != lv_obj_get_height(win)) {
lv_win_realign(win);
}
}
}
return valid;
}
/*=====================
* Setter functions
*====================*/
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button to the header of the window
......@@ -204,24 +133,29 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
* @param rel_action a function pointer to call when the button is released
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t rel_action)
lv_obj_t * lv_win_add_btn(lv_obj_t * win, const char * img_path, lv_action_t rel_action)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * btn = lv_btn_create(ext->btnh, NULL);
lv_btn_set_style(btn, ext->style_cbtn_rel, ext->style_cbtn_pr, NULL, NULL, NULL);
lv_obj_set_size(btn, ext->cbtn_size, ext->cbtn_size);
lv_btn_set_action(btn, LV_BTN_ACTION_RELEASE, rel_action);
lv_obj_t *btn = lv_btn_create(ext->header, NULL);
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_obj_set_size(btn, ext->btn_size, ext->btn_size);
lv_btn_set_action(btn, LV_BTN_ACTION_RELEASE, rel_action);
lv_obj_t * img = lv_img_create(btn, NULL);
lv_obj_set_click(img, false);
lv_img_set_file(img, img_path);
lv_obj_t * img = lv_img_create(btn, NULL);
lv_obj_set_click(img, false);
lv_img_set_file(img, img_path);
lv_win_realign(win);
lv_win_realign(win);
return btn;
return btn;
}
/*=====================
* Setter functions
*====================*/
/**
* A release action which can be assigned to a window control button to close it
* @param btn pointer to the released button
......@@ -229,7 +163,7 @@ lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t re
*/
lv_res_t lv_win_close_action(lv_obj_t * btn)
{
lv_obj_t * win = lv_win_get_from_cbtn(btn);
lv_obj_t * win = lv_win_get_from_btn(btn);
lv_obj_del(win);
......@@ -254,34 +188,62 @@ void lv_win_set_title(lv_obj_t * win, const char * title)
* @param win pointer to a window object
* @return control button size
*/
void lv_win_set_cbtn_size(lv_obj_t * win, cord_t size)
void lv_win_set_btn_size(lv_obj_t * win, cord_t size)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
ext->cbtn_size = size;
ext->btn_size = size;
lv_win_realign(win);
}
/**
* Set the styles of the window control buttons in a given state
* Set a style of a window
* @param win pointer to a window object
* @param rel pointer to the style in released state
* @param pr pointer to the style in pressed state
* @param type which style should be set
* @param style pointer to a style
*/
void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr)
void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
ext->style_cbtn_rel = rel;
ext->style_cbtn_pr = pr;
lv_obj_t * cbtn;
cbtn = lv_obj_get_child(ext->btnh, NULL);
while(cbtn != NULL) {
lv_btn_set_style(cbtn, ext->style_cbtn_rel, ext->style_cbtn_pr, NULL, NULL, NULL);
cbtn = lv_obj_get_child(ext->btnh, cbtn);
lv_win_ext_t *ext = lv_obj_get_ext_attr(win);
switch (type) {
case LV_WIN_STYLE_BG:
lv_obj_set_style(win, style);
lv_win_realign(win);
break;
case LV_WIN_STYLE_CONTENT:
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_HEADER:
lv_obj_set_style(ext->header, style);
lv_win_realign(win);
break;
case LV_WIN_STYLE_BTN_REL:
ext->style_btn_rel = style;
break;
case LV_WIN_STYLE_BTN_PR:
ext->style_btn_pr = style;
break;
}
/*Refresh the existing buttons*/
if(type == LV_WIN_STYLE_BTN_REL || type == LV_WIN_STYLE_BTN_PR) {
lv_obj_t *btn;
btn = lv_obj_get_child_back(ext->header, NULL);
btn = lv_obj_get_child_back(ext->header, btn); /*Skip the title*/
while(btn != NULL) {
if(type == LV_WIN_STYLE_BTN_REL) lv_btn_set_style(btn, LV_BTN_STYLE_REL, style);
else lv_btn_set_style(btn, LV_BTN_STYLE_PR, style);
btn = lv_obj_get_child_back(ext->header, btn);
}
}
}
/*=====================
* Getter functions
*====================*/
......@@ -298,36 +260,14 @@ const char * lv_win_get_title(lv_obj_t * win)
}
/**
* Get the page of a window
* @param win pointer to a window object
* @return page pointer to the page object of the window
*/
lv_obj_t * lv_win_get_page(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->page;
}
/**
* Get the s window header
* @param win pointer to a window object
* @return pointer to the window header object (lv_rect)
*/
lv_obj_t * lv_win_get_header(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->header;
}
/**
* Get the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
cord_t lv_win_get_cbtn_size(lv_obj_t * win)
cord_t lv_win_get_btn_size(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->cbtn_size;
return ext->btn_size;
}
/**
......@@ -350,7 +290,7 @@ cord_t lv_win_get_width(lv_obj_t * win)
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_cbtn(lv_obj_t * ctrl_btn)
lv_obj_t * lv_win_get_from_btn(lv_obj_t * ctrl_btn)
{
lv_obj_t * ctrl_holder = lv_obj_get_parent(ctrl_btn);
lv_obj_t * header = lv_obj_get_parent(ctrl_holder);
......@@ -359,39 +299,79 @@ lv_obj_t * lv_win_get_from_cbtn(lv_obj_t * ctrl_btn)
return win;
}
/**
* Get a style of a window
* @param win pointer to a button object
* @param type which style window be get
* @return style pointer to a style
*/
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_SCRL);
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;
}
/*To avoid warning*/
return NULL;
}
/**********************
* STATIC FUNCTIONS
**********************/
#if 0 /*Not used*/
/**
* Handle the drawing related tasks of the windows
* @param win pointer to an object
* @param mask the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return true/false, depends on 'mode'
* Signal function of the window
* @param win pointer to a window object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static bool lv_win_design(lv_obj_t * win, const area_t * mask, lv_design_mode_t mode)
static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
return false;
} else if (mode == LV_DESIGN_DRAW_MAIN) {
/*Draw the object*/
lv_res_t res;
} else if (mode == LV_DESIGN_DRAW_POST) {
/*Draw after all children is drawn*/
/* Include the ancient signal function */
res = ancestor_signal(win, sign, param);
if(res != LV_RES_OK) return res;
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
if(sign == LV_SIGNAL_CHILD_CHG) { /*Move children to the page*/
lv_obj_t * page = ext->page;
if(page != NULL) {
lv_obj_t * child;
child = lv_obj_get_child(win, NULL);
while(child != NULL) {
if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) {
lv_obj_t * tmp = child;
child = lv_obj_get_child(win, child); /*Get the next child before move this*/
lv_obj_set_parent(tmp, page);
} else {
child = lv_obj_get_child(win, child);
}
}
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_win_realign(win);
}
else if(sign == LV_SIGNAL_CORD_CHG) {
/*If the size is changed refresh the window*/
if(area_get_width(param) != lv_obj_get_width(win) ||
area_get_height(param) != lv_obj_get_height(win)) {
lv_win_realign(win);
}
}
return true;
return res;
}
#endif
/**
* Realign the building elements of a window
......@@ -399,41 +379,39 @@ static bool lv_win_design(lv_obj_t * win, const area_t * mask, lv_design_mode_t
*/
static void lv_win_realign(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
if(ext->page == NULL || ext->btnh == NULL || ext->header == NULL || ext->title == NULL) return;
lv_obj_t * cbtn;
/*Refresh the size of all control buttons*/
cbtn = lv_obj_get_child(ext->btnh, NULL);
while(cbtn != NULL) {
lv_obj_set_size(cbtn, ext->cbtn_size, ext->cbtn_size);
cbtn = lv_obj_get_child(ext->btnh, cbtn);
}
lv_style_t * btnh_style = lv_obj_get_style(ext->btnh);
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.padding.ver * 2);
lv_obj_set_width(ext->header, lv_obj_get_width(win));
/*Align the higher object first to make the correct header size first*/
if(lv_obj_get_height(ext->title) > lv_obj_get_height(ext->btnh)) {
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.hor, 0);
} else {
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.hor, 0);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
}
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_set_pos_scale(ext->header, 0, 0);
if(ext->page == NULL || ext->header == NULL || ext->title == NULL) return;
lv_style_t *header_style = lv_win_get_style(win, LV_WIN_STYLE_HEADER);
lv_obj_set_size(ext->header, lv_obj_get_width(win), ext->btn_size + 2 * header_style->body.padding.ver);
bool first_btn = true;
lv_obj_t *btn;
lv_obj_t *btn_prev;
/*Refresh the size of all control buttons*/
btn = lv_obj_get_child_back(ext->header, NULL);
btn = lv_obj_get_child_back(ext->header, btn); /*Skip the title*/
while(btn != NULL) {
lv_obj_set_size(btn, ext->btn_size, ext->btn_size);
if(first_btn) {
lv_obj_align(btn, ext->header, LV_ALIGN_IN_RIGHT_MID, - header_style->body.padding.hor, 0);
first_btn = false;
} else {
lv_obj_align(btn, btn_prev, LV_ALIGN_OUT_LEFT_MID, - header_style->body.padding.inner, 0);
}
btn_prev = btn;
btn = lv_obj_get_child_back(ext->header, btn);
}
lv_obj_t * page = lv_win_get_page(win);
lv_obj_set_size(page, lv_obj_get_width(win), lv_obj_get_height(win) - lv_obj_get_height(ext->header));
lv_obj_align(page, ext->header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
lv_style_t * style_page = lv_obj_get_style(page);
lv_obj_t * scrl = lv_page_get_scrl(page);
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.padding.hor);
lv_obj_set_pos_scale(ext->header, 0, 0);
lv_obj_set_size( ext->page, lv_obj_get_width(win), lv_obj_get_height(win) - lv_obj_get_height(ext->header));
lv_obj_align( ext->page, ext->header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
}
#endif
......@@ -57,13 +57,21 @@ typedef struct
lv_obj_t * page; /*Pointer to a page which holds the content*/
lv_obj_t * header; /*Pointer to the header container of the window*/
lv_obj_t * title; /*Pointer to the title label of the window*/
lv_obj_t * btnh; /*Pointer to the control button holder container of the window*/
lv_style_t * style_header; /*Style of the header container*/
lv_style_t * style_cbtn_rel; /*Control button releases style*/
lv_style_t * style_cbtn_pr; /*Control button pressed style*/
cord_t cbtn_size; /*Size of the control buttons (square)*/
lv_style_t * style_btn_rel; /*Control button releases style*/
lv_style_t * style_btn_pr; /*Control button pressed style*/
cord_t btn_size; /*Size of the control buttons (square)*/
}lv_win_ext_t;
typedef enum {
LV_WIN_STYLE_BG,
LV_WIN_STYLE_CONTENT,
LV_WIN_STYLE_SB,
LV_WIN_STYLE_HEADER,
LV_WIN_STYLE_BTN_REL,
LV_WIN_STYLE_BTN_PR,
}lv_win_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
......@@ -76,14 +84,10 @@ typedef struct
*/
lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy);
/**
* Signal function of the window
* @param win pointer to a window object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return true: the object is still valid (not deleted), false: the object become invalid
*/
bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param);
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button to the header of the window
......@@ -92,12 +96,15 @@ bool lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param);
* @param rel_action a function pointer to call when the button is released
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_cbtn(lv_obj_t * win, const char * img_path, lv_action_t rel_action);
lv_obj_t * lv_win_add_btn(lv_obj_t * win, const char * img_path, lv_action_t rel_action);
/*=====================
* Setter functions
*====================*/
/**
* A release action which can be assigned to a window control button to close it
* @param btn pointer to the released button
* @param indev_proc pointer to the caller input device
* @return always LV_ACTION_RES_INV because the button is deleted with the window
*/
lv_res_t lv_win_close_action(lv_obj_t * btn);
......@@ -114,15 +121,19 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
* @param win pointer to a window object
* @return control button size
*/
void lv_win_set_cbtn_size(lv_obj_t * win, cord_t size);
void lv_win_set_btn_size(lv_obj_t * win, cord_t size);
/**
* Set the styles of the window control buttons in a given state
* Set a style of a window
* @param win pointer to a window object
* @param rel pointer to the style in released state
* @param pr pointer to the style in pressed state
* @param type which style should be set
* @param style pointer to a style
*/
void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr);
void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style);
/*=====================
* Getter functions
*====================*/
/**
* Get the title of a window
......@@ -132,25 +143,11 @@ void lv_win_set_styles_cbtn(lv_obj_t * win, lv_style_t * rel, lv_style_t * pr)
const char * lv_win_get_title(lv_obj_t * win);
/**
* Get the page of a window
* @param win pointer to a window object
* @return page pointer to the page object of the window
*/
lv_obj_t * lv_win_get_page(lv_obj_t * win);
/**
* Get the s window header
* @param win pointer to a window object
* @return pointer to the window header object (lv_rect)
*/
lv_obj_t * lv_win_get_header(lv_obj_t * win);
/**
* Get the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
cord_t lv_win_get_cbtn_size(lv_obj_t * win);
cord_t lv_win_get_btn_size(lv_obj_t * win);
/**
* Get width of the content area (page scrollable) of the window
......@@ -165,7 +162,15 @@ cord_t lv_win_get_width(lv_obj_t * win);
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_cbtn(lv_obj_t * ctrl_btn);
lv_obj_t * lv_win_get_from_btn(lv_obj_t * ctrl_btn);
/**
* Get a style of a window
* @param win pointer to a button object
* @param type which style window be get
* @return style pointer to a style
*/
lv_style_t * lv_win_get_style(lv_obj_t *win, lv_win_style_t type);
/**********************
* MACROS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment