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); ...@@ -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 refresh_childen_style(lv_obj_t * obj);
static void delete_children(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 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 * STATIC VARIABLES
...@@ -247,8 +248,9 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) ...@@ -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 * Delete 'obj' and all of its children
* @param obj pointer to an object to delete * @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); lv_obj_invalidate(obj);
...@@ -308,6 +310,8 @@ void lv_obj_del(lv_obj_t * obj) ...@@ -308,6 +310,8 @@ void lv_obj_del(lv_obj_t * obj)
if(par != NULL) { if(par != NULL) {
par->signal_func(par, LV_SIGNAL_CHILD_CHG, 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) ...@@ -322,41 +326,9 @@ void lv_obj_clear(lv_obj_t *obj)
lv_obj_del(child); lv_obj_del(child);
child = lv_obj_get_child(obj, 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' * Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
* @param obj pointer to an object * @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 ...@@ -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) * Reposition the children of an object. (Called recursively)
* @param obj pointer to an object which children will be repositioned * @param obj pointer to an object which children will be repositioned
* @param x_diff x coordinate shift * @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_ ...@@ -72,6 +72,12 @@ typedef bool (* lv_design_func_t) (struct __LV_OBJ_T * obj, const area_t * mask_
typedef enum 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*/ /*General signals*/
LV_SIGNAL_CLEANUP, LV_SIGNAL_CLEANUP,
LV_SIGNAL_CHILD_CHG, LV_SIGNAL_CHILD_CHG,
...@@ -95,7 +101,7 @@ typedef enum ...@@ -95,7 +101,7 @@ typedef enum
LV_SIGNAL_CONTROLL, LV_SIGNAL_CONTROLL,
}lv_signal_t; }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 typedef struct __LV_OBJ_T
{ {
...@@ -134,12 +140,6 @@ typedef struct __LV_OBJ_T ...@@ -134,12 +140,6 @@ typedef struct __LV_OBJ_T
#endif #endif
}lv_obj_t; }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); typedef lv_res_t (*lv_action_t) (struct __LV_OBJ_T * obj);
/*Protect some attributes (max. 8 bit)*/ /*Protect some attributes (max. 8 bit)*/
...@@ -210,7 +210,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy); ...@@ -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 * Delete 'obj' and all of its children
* @param obj pointer to an object to delete * @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 * Delete all children of an object
...@@ -218,14 +218,6 @@ void lv_obj_del(lv_obj_t * obj); ...@@ -218,14 +218,6 @@ void lv_obj_del(lv_obj_t * obj);
*/ */
void lv_obj_clear(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' * 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; ...@@ -45,11 +45,11 @@ lv_style_t lv_style_plain;
lv_style_t lv_style_plain_color; lv_style_t lv_style_plain_color;
lv_style_t lv_style_pretty; lv_style_t lv_style_pretty;
lv_style_t lv_style_pretty_color; lv_style_t lv_style_pretty_color;
lv_style_t lv_style_btn_released; lv_style_t lv_style_btn_rel;
lv_style_t lv_style_btn_pressed; lv_style_t lv_style_btn_pr;
lv_style_t lv_style_btn_tgl_released; lv_style_t lv_style_btn_tgl_rel;
lv_style_t lv_style_btn_tgl_pressed; lv_style_t lv_style_btn_tgl_pr;
lv_style_t lv_style_btn_inactive; lv_style_t lv_style_btn_ina;
/********************** /**********************
* MACROS * MACROS
...@@ -148,53 +148,53 @@ void lv_style_init (void) ...@@ -148,53 +148,53 @@ void lv_style_init (void)
lv_style_transp_tight.body.padding.inner = 0; lv_style_transp_tight.body.padding.inner = 0;
/*Button released style*/ /*Button released style*/
memcpy(&lv_style_btn_released, &lv_style_plain, sizeof(lv_style_t)); memcpy(&lv_style_btn_rel, &lv_style_plain, sizeof(lv_style_t));
lv_style_btn_released.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0); lv_style_btn_rel.body.color_main = COLOR_MAKE(0x76, 0xa2, 0xd0);
lv_style_btn_released.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d); lv_style_btn_rel.body.color_gradient = COLOR_MAKE(0x19, 0x3a, 0x5d);
lv_style_btn_released.body.radius = LV_DPI / 15; lv_style_btn_rel.body.radius = LV_DPI / 15;
lv_style_btn_released.body.padding.hor = LV_DPI / 4; lv_style_btn_rel.body.padding.hor = LV_DPI / 4;
lv_style_btn_released.body.padding.ver = LV_DPI / 6; lv_style_btn_rel.body.padding.ver = LV_DPI / 6;
lv_style_btn_released.body.padding.inner = LV_DPI / 10; lv_style_btn_rel.body.padding.inner = LV_DPI / 10;
lv_style_btn_released.body.border.color = COLOR_MAKE(0x0b, 0x19, 0x28); lv_style_btn_rel.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_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1;
lv_style_btn_released.body.border.opa = OPA_70; lv_style_btn_rel.body.border.opa = OPA_70;
lv_style_btn_released.text.color = COLOR_MAKE(0xff, 0xff, 0xff); lv_style_btn_rel.text.color = COLOR_MAKE(0xff, 0xff, 0xff);
lv_style_btn_released.body.shadow.color = COLOR_GRAY; lv_style_btn_rel.body.shadow.color = COLOR_GRAY;
lv_style_btn_released.body.shadow.width = 0; lv_style_btn_rel.body.shadow.width = 0;
/*Button pressed style*/ /*Button pressed style*/
memcpy(&lv_style_btn_pressed, &lv_style_btn_released, sizeof(lv_style_t)); memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_pressed.body.color_main = COLOR_MAKE(0x33, 0x62, 0x94); lv_style_btn_pr.body.color_main = COLOR_MAKE(0x33, 0x62, 0x94);
lv_style_btn_pressed.body.color_gradient = COLOR_MAKE(0x10, 0x26, 0x3c); lv_style_btn_pr.body.color_gradient = COLOR_MAKE(0x10, 0x26, 0x3c);
lv_style_btn_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_pr.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_pr.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_pr.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
/*Button toggle released style*/ /*Button toggle released style*/
memcpy(&lv_style_btn_tgl_released, &lv_style_btn_released, sizeof(lv_style_t)); memcpy(&lv_style_btn_tgl_rel, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_tgl_released.body.color_main = COLOR_MAKE(0x0a, 0x11, 0x22); lv_style_btn_tgl_rel.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_rel.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_rel.body.border.color = COLOR_MAKE(0x01, 0x07, 0x0d);
lv_style_btn_tgl_released.text.color = COLOR_MAKE(0xc8, 0xdd, 0xf4); lv_style_btn_tgl_rel.text.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_released.image.color = COLOR_MAKE(0xc8, 0xdd, 0xf4); lv_style_btn_tgl_rel.image.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
lv_style_btn_tgl_released.line.color = COLOR_MAKE(0xc8, 0xdd, 0xf4); lv_style_btn_tgl_rel.line.color = COLOR_MAKE(0xc8, 0xdd, 0xf4);
/*Button toggle pressed style*/ /*Button toggle pressed style*/
memcpy(&lv_style_btn_tgl_pressed, &lv_style_btn_tgl_released, sizeof(lv_style_t)); memcpy(&lv_style_btn_tgl_pr, &lv_style_btn_tgl_rel, sizeof(lv_style_t));
lv_style_btn_tgl_pressed.body.color_main = COLOR_MAKE(0x02, 0x14, 0x27); lv_style_btn_tgl_pr.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_pr.body.color_gradient = COLOR_MAKE(0x2b, 0x4c, 0x70);
lv_style_btn_tgl_pressed.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_tgl_pr.text.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pressed.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_tgl_pr.image.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
lv_style_btn_tgl_pressed.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6); lv_style_btn_tgl_pr.line.color = COLOR_MAKE(0xa4, 0xb5, 0xc6);
/*Button inactive style*/ /*Button inactive style*/
memcpy(&lv_style_btn_inactive, &lv_style_btn_released, sizeof(lv_style_t)); memcpy(&lv_style_btn_ina, &lv_style_btn_rel, sizeof(lv_style_t));
lv_style_btn_inactive.body.color_main = COLOR_MAKE(0xd8, 0xd8, 0xd8); lv_style_btn_ina.body.color_main = COLOR_MAKE(0xd8, 0xd8, 0xd8);
lv_style_btn_inactive.body.color_gradient = COLOR_MAKE(0xd8, 0xd8, 0xd8); lv_style_btn_ina.body.color_gradient = COLOR_MAKE(0xd8, 0xd8, 0xd8);
lv_style_btn_inactive.body.border.color = COLOR_MAKE(0x90, 0x90, 0x90); lv_style_btn_ina.body.border.color = COLOR_MAKE(0x90, 0x90, 0x90);
lv_style_btn_inactive.text.color = COLOR_MAKE(0x70, 0x70, 0x70); lv_style_btn_ina.text.color = COLOR_MAKE(0x70, 0x70, 0x70);
lv_style_btn_inactive.image.color = COLOR_MAKE(0x70, 0x70, 0x70); lv_style_btn_ina.image.color = COLOR_MAKE(0x70, 0x70, 0x70);
lv_style_btn_inactive.line.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; ...@@ -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_plain_color;
extern lv_style_t lv_style_pretty; extern lv_style_t lv_style_pretty;
extern lv_style_t lv_style_pretty_color; extern lv_style_t lv_style_pretty_color;
extern lv_style_t lv_style_btn_released; extern lv_style_t lv_style_btn_rel;
extern lv_style_t lv_style_btn_pressed; extern lv_style_t lv_style_btn_pr;
extern lv_style_t lv_style_btn_tgl_released; extern lv_style_t lv_style_btn_tgl_rel;
extern lv_style_t lv_style_btn_tgl_pressed;; extern lv_style_t lv_style_btn_tgl_pr;;
extern lv_style_t lv_style_btn_inactive; extern lv_style_t lv_style_btn_ina;
/********************** /**********************
* MACROS * MACROS
......
...@@ -67,11 +67,11 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -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] = NULL;
ext->actions[LV_BTN_ACTION_LONG_PRESS_REPEATE] = 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_REL] = &lv_style_btn_rel;
ext->styles[LV_BTN_STATE_PR] = &lv_style_btn_pressed; ext->styles[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_released; ext->styles[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
ext->styles[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pressed; ext->styles[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr;
ext->styles[LV_BTN_STATE_INA] = &lv_style_btn_inactive; ext->styles[LV_BTN_STATE_INA] = &lv_style_btn_ina;
ext->long_press_action_executed = 0; ext->long_press_action_executed = 0;
ext->toggle = 0; ext->toggle = 0;
......
...@@ -78,11 +78,11 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -78,11 +78,11 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
ext->action = NULL; ext->action = NULL;
ext->map_p = NULL; ext->map_p = NULL;
ext->toggle = 0; ext->toggle = 0;
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_released; ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pressed; ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_released; 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_pressed; ext->styles_btn[LV_BTN_STATE_TGL_PR] = &lv_style_btn_tgl_pr;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_inactive; 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); 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) ...@@ -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; lv_res_t res;
/* Include the ancient signal function */ /* 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; if(res != LV_RES_OK) return res;
return res; return res;
......
...@@ -66,11 +66,11 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy) ...@@ -66,11 +66,11 @@ lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
dm_assert(ext); dm_assert(ext);
ext->style_img = NULL; ext->style_img = NULL;
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_released; ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pressed; ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_released; ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_tgl_pressed; ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_tgl_pr;
ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_inactive; ext->styles_btn[LV_BTN_STATE_INA] = &lv_style_btn_ina;
ext->anim_time = LV_LIST_FOCUS_TIME; ext->anim_time = LV_LIST_FOCUS_TIME;
lv_obj_set_signal_func(new_list, lv_list_signal); 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) ...@@ -311,7 +311,7 @@ uint16_t lv_list_get_anim_time(lv_obj_t *list)
* @param type which style should be get * @param type which style should be get
* @return style pointer to a style * @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); 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) ...@@ -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 * @param type which style should be get
* @return style pointer to a style * @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 * Other functions
......
...@@ -136,6 +136,19 @@ void lv_mbox_set_text(lv_obj_t * mbox, const char * txt) ...@@ -136,6 +136,19 @@ void lv_mbox_set_text(lv_obj_t * mbox, const char * txt)
mbox_realign(mbox); 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 * Set animation duration
* @param mbox pointer to a message box object * @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) ...@@ -159,12 +172,12 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
if(ext->anim_time != 0) { if(ext->anim_time != 0) {
/*Add shrinking animations*/ /*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_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*/ /*Disable fit to let shrinking work*/
lv_cont_set_fit(mbox, false, false); lv_cont_set_fit(mbox, false, false);
} else { } 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) ...@@ -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 * 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(btn);
lv_obj_t * mbox = lv_obj_get_parent(btnh);
return mbox; return mbox;
} }
......
...@@ -103,6 +103,13 @@ void lv_mbox_set_btns(lv_obj_t * mbox, const char **btn_map, lv_btnm_action_t ac ...@@ -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); 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 * Set animation duration
* @param mbox pointer to a message box object * @param mbox pointer to a message box object
* @param time animation length in milliseconds (0: no animation) * @param time animation length in milliseconds (0: no animation)
......
...@@ -186,7 +186,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider) ...@@ -186,7 +186,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider)
* @param type which style should be get * @param type which style should be get
* @return style pointer to a style * @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); 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); ...@@ -179,7 +179,7 @@ bool lv_slider_get_knob_in(lv_obj_t * slider);
* @param type which style should be get * @param type which style should be get
* @return style pointer to a style * @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 * MACROS
......
...@@ -148,7 +148,7 @@ void lv_sw_set_style(lv_obj_t *sw, lv_sw_style_t type, lv_style_t *style) ...@@ -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 * @param type which style should be get
* @return style pointer to a style * @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); 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) ...@@ -124,7 +124,7 @@ static inline lv_action_t lv_sw_get_action(lv_obj_t * slider)
* @param type which style should be get * @param type which style should be get
* @return style pointer to a style * @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 * MACROS
......
...@@ -57,13 +57,21 @@ typedef struct ...@@ -57,13 +57,21 @@ typedef struct
lv_obj_t * page; /*Pointer to a page which holds the content*/ 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 * header; /*Pointer to the header container of the window*/
lv_obj_t * title; /*Pointer to the title label 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_header; /*Style of the header container*/
lv_style_t * style_cbtn_rel; /*Control button releases style*/ lv_style_t * style_btn_rel; /*Control button releases style*/
lv_style_t * style_cbtn_pr; /*Control button pressed style*/ lv_style_t * style_btn_pr; /*Control button pressed style*/
cord_t cbtn_size; /*Size of the control buttons (square)*/ cord_t btn_size; /*Size of the control buttons (square)*/
}lv_win_ext_t; }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 * GLOBAL PROTOTYPES
**********************/ **********************/
...@@ -76,14 +84,10 @@ typedef struct ...@@ -76,14 +84,10 @@ typedef struct
*/ */
lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy); 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 * Add/remove functions
* @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 control button to the header of the window * 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); ...@@ -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 * @param rel_action a function pointer to call when the button is released
* @return pointer to the created button object * @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 * A release action which can be assigned to a window control button to close it
* @param btn pointer to the released button * @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 * @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); 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); ...@@ -114,15 +121,19 @@ void lv_win_set_title(lv_obj_t * win, const char * title);
* @param win pointer to a window object * @param win pointer to a window object
* @return control button size * @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 win pointer to a window object
* @param rel pointer to the style in released state * @param type which style should be set
* @param pr pointer to the style in pressed state * @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 * 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) ...@@ -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); 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 * Get the control button size of a window
* @param win pointer to a window object * @param win pointer to a window object
* @return control button size * @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 * 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); ...@@ -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 * @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn' * @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 * 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