minor API updates
This commit is contained in:
@@ -71,9 +71,9 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an object from its group
|
* Remove an object from its group
|
||||||
* @param obj pointer to an objectto remove
|
* @param obj pointer to an object to remove
|
||||||
*/
|
*/
|
||||||
void lv_group_rem_obj(lv_obj_t * obj)
|
void lv_group_remove_obj(lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
lv_group_t * g = obj->group_p;
|
lv_group_t * g = obj->group_p;
|
||||||
if(g == NULL) return;
|
if(g == NULL) return;
|
||||||
@@ -92,7 +92,6 @@ void lv_group_rem_obj(lv_obj_t * obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focus on an object (defocus the current)
|
* Focus on an object (defocus the current)
|
||||||
* @param obj pointer to an object to focus on
|
* @param obj pointer to an object to focus on
|
||||||
@@ -193,7 +192,7 @@ void lv_group_focus_freeze(lv_group_t * group, bool en)
|
|||||||
* @param group pointer to a group
|
* @param group pointer to a group
|
||||||
* @param c a character (use LV_GROUP_KEY_.. to navigate)
|
* @param c a character (use LV_GROUP_KEY_.. to navigate)
|
||||||
*/
|
*/
|
||||||
void lv_group_send(lv_group_t * group, uint32_t c)
|
void lv_group_send_data(lv_group_t * group, uint32_t c)
|
||||||
{
|
{
|
||||||
lv_obj_t * act = lv_group_get_focused(group);
|
lv_obj_t * act = lv_group_get_focused(group);
|
||||||
if(act == NULL) return;
|
if(act == NULL) return;
|
||||||
@@ -259,11 +258,11 @@ static void style_mod_def(lv_style_t * style)
|
|||||||
/*If not empty or has border then emphasis the border*/
|
/*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;
|
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.main_color = color_mix(style->body.main_color, COLOR_ORANGE, OPA_70);
|
||||||
style->body.gradient_color = color_mix(style->body.gradient_color, COLOR_ORANGE, OPA_80);
|
style->body.gradient_color = color_mix(style->body.gradient_color, COLOR_ORANGE, OPA_70);
|
||||||
|
|
||||||
style->body.shadow.color = color_mix(style->body.shadow.color, COLOR_ORANGE, OPA_60);
|
style->body.shadow.color = color_mix(style->body.shadow.color, COLOR_ORANGE, OPA_60);
|
||||||
|
|
||||||
|
style->text.color = color_mix(style->text.color, COLOR_ORANGE, OPA_70);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /*LV_OBJ_GROUP != 0*/
|
#endif /*LV_OBJ_GROUP != 0*/
|
||||||
|
|||||||
@@ -46,15 +46,79 @@ typedef struct _lv_group_t
|
|||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new object group
|
||||||
|
* @return pointer to the new object group
|
||||||
|
*/
|
||||||
lv_group_t * lv_group_create(void);
|
lv_group_t * lv_group_create(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an object to a group
|
||||||
|
* @param group pointer to a group
|
||||||
|
* @param obj pointer to an object to add
|
||||||
|
*/
|
||||||
void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj);
|
void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj);
|
||||||
void lv_group_rem_obj(lv_obj_t * obj);
|
|
||||||
|
/**
|
||||||
|
* Remove an object from its group
|
||||||
|
* @param obj pointer to an object to remove
|
||||||
|
*/
|
||||||
|
void lv_group_remove_obj(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focus on an object (defocus the current)
|
||||||
|
* @param obj pointer to an object to focus on
|
||||||
|
*/
|
||||||
void lv_group_focus_obj(lv_obj_t * obj);
|
void lv_group_focus_obj(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focus the next object in a group (defocus the current)
|
||||||
|
* @param group pointer to a group
|
||||||
|
*/
|
||||||
void lv_group_focus_next(lv_group_t * group);
|
void lv_group_focus_next(lv_group_t * group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Focus the previous object in a group (defocus the current)
|
||||||
|
* @param group pointer to a group
|
||||||
|
*/
|
||||||
void lv_group_focus_prev(lv_group_t * group);
|
void lv_group_focus_prev(lv_group_t * group);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do not let to change the focus from the current object
|
||||||
|
* @param group pointer to a group
|
||||||
|
* @param en true: freeze, false: release freezing (normal mode)
|
||||||
|
*/
|
||||||
void lv_group_focus_freeze(lv_group_t * group, bool en);
|
void lv_group_focus_freeze(lv_group_t * group, bool en);
|
||||||
void lv_group_send(lv_group_t * group, uint32_t c);
|
|
||||||
|
/**
|
||||||
|
* Send a control character to the focuses object of a group
|
||||||
|
* @param group pointer to a group
|
||||||
|
* @param c a character (use LV_GROUP_KEY_.. to navigate)
|
||||||
|
*/
|
||||||
|
void lv_group_send_data(lv_group_t * group, uint32_t c);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a function for a group which will modify the object's style if it is in focus
|
||||||
|
* @param group pointer to a group
|
||||||
|
* @param style_cb the style modifier function pointer
|
||||||
|
*/
|
||||||
|
void lv_group_set_style_mod_cb(lv_group_t * group, void (*style_cb)(lv_style_t * style));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify a style with the set 'style_mod' function. The input style remains unchanged.
|
||||||
|
* @param group pointer to group
|
||||||
|
* @param style pointer to a style to modify
|
||||||
|
* @return a copy of the input style but modified with the 'style_mod' function
|
||||||
|
*/
|
||||||
lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style);
|
lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the focused object or NULL if there isn't one
|
||||||
|
* @param group pointer to a group
|
||||||
|
* @return pointer to the focused object
|
||||||
|
*/
|
||||||
lv_obj_t * lv_group_get_focused(lv_group_t * group);
|
lv_obj_t * lv_group_get_focused(lv_group_t * group);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ static void indev_proc_task(void * param)
|
|||||||
lv_group_focus_prev(i->group);
|
lv_group_focus_prev(i->group);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lv_group_send(i->group, data.key);
|
lv_group_send_data(i->group, data.key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void refresh_childen_position(lv_obj_t * obj, cord_t x_diff, cord_t y_diff);
|
static void refresh_childen_position(lv_obj_t * obj, cord_t x_diff, cord_t y_diff);
|
||||||
static void lv_style_refr_core(void * style_p, lv_obj_t * obj);
|
static void lv_obj_report_style_mod_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);
|
||||||
@@ -468,17 +468,6 @@ void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y)
|
|||||||
lv_obj_invalidate(obj);
|
lv_obj_invalidate(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set relative the position of an object (relative to the parent).
|
|
||||||
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object
|
|
||||||
* @param x new distance from the left side of the parent.
|
|
||||||
* @param y new distance from the top of the parent.
|
|
||||||
*/
|
|
||||||
void lv_obj_set_pos_scale(lv_obj_t * obj, cord_t x, cord_t y)
|
|
||||||
{
|
|
||||||
lv_obj_set_pos(obj, x << LV_ANTIALIAS, y << LV_ANTIALIAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the x coordinate of a object
|
* Set the x coordinate of a object
|
||||||
@@ -490,16 +479,6 @@ void lv_obj_set_x(lv_obj_t * obj, cord_t x)
|
|||||||
lv_obj_set_pos(obj, x, lv_obj_get_y(obj));
|
lv_obj_set_pos(obj, x, lv_obj_get_y(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the x coordinate of a object.
|
|
||||||
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object
|
|
||||||
* @param x new distance from the left side from the parent.
|
|
||||||
*/
|
|
||||||
void lv_obj_set_x_scale(lv_obj_t * obj, cord_t x)
|
|
||||||
{
|
|
||||||
lv_obj_set_pos(obj, x << LV_ANTIALIAS, lv_obj_get_y(obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the y coordinate of a object
|
* Set the y coordinate of a object
|
||||||
@@ -511,17 +490,6 @@ void lv_obj_set_y(lv_obj_t * obj, cord_t y)
|
|||||||
lv_obj_set_pos(obj, lv_obj_get_x(obj), y);
|
lv_obj_set_pos(obj, lv_obj_get_x(obj), y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the y coordinate of a object.
|
|
||||||
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object
|
|
||||||
* @param y new distance from the top of the parent.
|
|
||||||
*/
|
|
||||||
void lv_obj_set_y_scale(lv_obj_t * obj, cord_t y)
|
|
||||||
{
|
|
||||||
lv_obj_set_pos(obj, lv_obj_get_x(obj), y << LV_ANTIALIAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size of an object
|
* Set the size of an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -561,18 +529,6 @@ void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h)
|
|||||||
lv_obj_invalidate(obj);
|
lv_obj_invalidate(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the size of an object.
|
|
||||||
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object
|
|
||||||
* @param w new width
|
|
||||||
* @param h new height
|
|
||||||
*/
|
|
||||||
void lv_obj_set_size_scale(lv_obj_t * obj, cord_t w, cord_t h)
|
|
||||||
{
|
|
||||||
lv_obj_set_size(obj, w << LV_ANTIALIAS, h << LV_ANTIALIAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width of an object
|
* Set the width of an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -583,17 +539,6 @@ void lv_obj_set_width(lv_obj_t * obj, cord_t w)
|
|||||||
lv_obj_set_size(obj, w, lv_obj_get_height(obj));
|
lv_obj_set_size(obj, w, lv_obj_get_height(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the width of an object.
|
|
||||||
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object
|
|
||||||
* @param w new width
|
|
||||||
*/
|
|
||||||
void lv_obj_set_width_scale(lv_obj_t * obj, cord_t w)
|
|
||||||
{
|
|
||||||
lv_obj_set_size(obj, w << LV_ANTIALIAS, lv_obj_get_height(obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the height of an object
|
* Set the height of an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -604,17 +549,6 @@ void lv_obj_set_height(lv_obj_t * obj, cord_t h)
|
|||||||
lv_obj_set_size(obj, lv_obj_get_width(obj), h);
|
lv_obj_set_size(obj, lv_obj_get_width(obj), h);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the height of an object.
|
|
||||||
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object
|
|
||||||
* @param h new height
|
|
||||||
*/
|
|
||||||
void lv_obj_set_height_scale(lv_obj_t * obj, cord_t h)
|
|
||||||
{
|
|
||||||
lv_obj_set_size(obj, lv_obj_get_width(obj), h << LV_ANTIALIAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Align an object to an other object.
|
* Align an object to an other object.
|
||||||
* @param obj pointer to an object to align
|
* @param obj pointer to an object to align
|
||||||
@@ -752,21 +686,6 @@ void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod
|
|||||||
lv_obj_set_pos(obj, new_x, new_y);
|
lv_obj_set_pos(obj, new_x, new_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Align an object to an other object.
|
|
||||||
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
|
||||||
* @param obj pointer to an object to align
|
|
||||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
|
||||||
* @param align type of alignment (see 'lv_align_t' enum)
|
|
||||||
* @param x_mod x coordinate shift after alignment
|
|
||||||
* @param y_mod y coordinate shift after alignment
|
|
||||||
*/
|
|
||||||
void lv_obj_align_scale(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod)
|
|
||||||
{
|
|
||||||
lv_obj_align(obj, base, align, x_mod << LV_ANTIALIAS, y_mod << LV_ANTIALIAS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------
|
/*---------------------
|
||||||
* Appearance set
|
* Appearance set
|
||||||
*--------------------*/
|
*--------------------*/
|
||||||
@@ -800,22 +719,19 @@ void lv_obj_refresh_style(lv_obj_t * obj)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*TODO move this function out of here*/
|
|
||||||
/**
|
/**
|
||||||
* Notify all object if a style is modified
|
* Notify all object if a style is modified
|
||||||
* @param style pointer to a style. Only the objects with this style will be notified
|
* @param style pointer to a style. Only the objects with this style will be notified
|
||||||
* (NULL to notify all objects)
|
* (NULL to notify all objects)
|
||||||
*/
|
*/
|
||||||
void lv_style_refr_objs(void * style)
|
void lv_obj_report_style_mod(void * style)
|
||||||
{
|
{
|
||||||
lv_obj_t * i;
|
lv_obj_t * i;
|
||||||
LL_READ(scr_ll, i) {
|
LL_READ(scr_ll, i) {
|
||||||
lv_style_refr_core(style, i);
|
lv_obj_report_style_mod_core(style, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*-----------------
|
/*-----------------
|
||||||
* Attribute set
|
* Attribute set
|
||||||
*----------------*/
|
*----------------*/
|
||||||
@@ -1116,7 +1032,6 @@ lv_obj_t * lv_obj_get_screen(lv_obj_t * obj)
|
|||||||
return act_p;
|
return act_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*---------------------
|
/*---------------------
|
||||||
* Parent/children get
|
* Parent/children get
|
||||||
*--------------------*/
|
*--------------------*/
|
||||||
@@ -1398,7 +1313,6 @@ lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj)
|
|||||||
return obj->design_func;
|
return obj->design_func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------
|
/*------------------
|
||||||
* Other get
|
* Other get
|
||||||
*-----------------*/
|
*-----------------*/
|
||||||
@@ -1546,13 +1460,12 @@ static void refresh_childen_position(lv_obj_t * obj, cord_t x_diff, cord_t y_dif
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*TODO move this function out of here*/
|
|
||||||
/**
|
/**
|
||||||
* Refresh the style of all children of an object. (Called recursively)
|
* Refresh the style of all children of an object. (Called recursively)
|
||||||
* @param style_p refresh objects only with this style. (ignore is if NULL)
|
* @param style_p refresh objects only with this style. (ignore is if NULL)
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
*/
|
*/
|
||||||
static void lv_style_refr_core(void * style_p, lv_obj_t * obj)
|
static void lv_obj_report_style_mod_core(void * style_p, lv_obj_t * obj)
|
||||||
{
|
{
|
||||||
lv_obj_t * i;
|
lv_obj_t * i;
|
||||||
LL_READ(obj->child_ll, i) {
|
LL_READ(obj->child_ll, i) {
|
||||||
@@ -1561,7 +1474,7 @@ static void lv_style_refr_core(void * style_p, lv_obj_t * obj)
|
|||||||
lv_obj_refresh_style(i);
|
lv_obj_refresh_style(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_style_refr_core(style_p, i);
|
lv_obj_report_style_mod_core(style_p, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1611,7 +1524,7 @@ static void delete_children(lv_obj_t * obj)
|
|||||||
|
|
||||||
/*Delete from the group*/
|
/*Delete from the group*/
|
||||||
#if LV_OBJ_GROUP != 0
|
#if LV_OBJ_GROUP != 0
|
||||||
if(obj->group_p != NULL) lv_group_rem_obj(obj);
|
if(obj->group_p != NULL) lv_group_remove_obj(obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*Remove the object from parent's children list*/
|
/*Remove the object from parent's children list*/
|
||||||
|
|||||||
168
lv_obj/lv_obj.h
168
lv_obj/lv_obj.h
@@ -193,6 +193,10 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
void lv_init(void);
|
void lv_init(void);
|
||||||
|
|
||||||
|
/*--------------------
|
||||||
|
* Create and delete
|
||||||
|
*-------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a basic object
|
* Create a basic object
|
||||||
* @param parent pointer to a parent object.
|
* @param parent pointer to a parent object.
|
||||||
@@ -205,6 +209,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
|
||||||
|
* @preturn LV_RES_INV beacuse the object is deleted
|
||||||
*/
|
*/
|
||||||
lv_res_t lv_obj_del(lv_obj_t * obj);
|
lv_res_t lv_obj_del(lv_obj_t * obj);
|
||||||
|
|
||||||
@@ -214,19 +219,31 @@ lv_res_t lv_obj_del(lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_clear(lv_obj_t *obj);
|
void lv_obj_clear(lv_obj_t *obj);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
void lv_obj_invalidate(lv_obj_t * obj);
|
void lv_obj_invalidate(lv_obj_t * obj);
|
||||||
|
|
||||||
|
|
||||||
|
/*=====================
|
||||||
|
* Setter functions
|
||||||
|
*====================*/
|
||||||
|
|
||||||
|
/*--------------
|
||||||
|
* Screen set
|
||||||
|
*--------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a new screen
|
* Load a new screen
|
||||||
* @param scr pointer to a screen
|
* @param scr pointer to a screen
|
||||||
*/
|
*/
|
||||||
void lv_scr_load(lv_obj_t * scr);
|
void lv_scr_load(lv_obj_t * scr);
|
||||||
|
|
||||||
|
/*--------------------
|
||||||
|
* Parent/children set
|
||||||
|
*--------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new parent for an object. Its relative position will be the same.
|
* Set a new parent for an object. Its relative position will be the same.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -234,6 +251,10 @@ void lv_scr_load(lv_obj_t * scr);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
|
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
|
||||||
|
|
||||||
|
/*--------------------
|
||||||
|
* Coordinate set
|
||||||
|
* ------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set relative the position of an object (relative to the parent)
|
* Set relative the position of an object (relative to the parent)
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -244,12 +265,15 @@ void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set relative the position of an object (relative to the parent).
|
* Set relative the position of an object (relative to the parent).
|
||||||
* The coordinates will be upscaled with LV_DOWNSCALE.
|
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param x new distance from the left side of the parent. (will be multiplied with LV_DOWNSCALE)
|
* @param x new distance from the left side of the parent.
|
||||||
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
|
* @param y new distance from the top of the parent.
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_pos_scale(lv_obj_t * obj, cord_t x, cord_t y);
|
static inline void lv_obj_set_pos_scale(lv_obj_t * obj, cord_t x, cord_t y)
|
||||||
|
{
|
||||||
|
lv_obj_set_pos(obj, x << LV_ANTIALIAS, y << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the x coordinate of a object
|
* Set the x coordinate of a object
|
||||||
@@ -260,11 +284,14 @@ void lv_obj_set_x(lv_obj_t * obj, cord_t x);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the x coordinate of a object.
|
* Set the x coordinate of a object.
|
||||||
* The coordinate will be upscaled with LV_DOWNSCALE.
|
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param x new distance from the left side from the parent. (will be multiplied with LV_DOWNSCALE)
|
* @param x new distance from the left side from the parent.
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_x_scale(lv_obj_t * obj, cord_t x);
|
static inline void lv_obj_set_x_scale(lv_obj_t * obj, cord_t x)
|
||||||
|
{
|
||||||
|
lv_obj_set_x(obj, x << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the y coordinate of a object
|
* Set the y coordinate of a object
|
||||||
@@ -275,11 +302,14 @@ void lv_obj_set_y(lv_obj_t * obj, cord_t y);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the y coordinate of a object.
|
* Set the y coordinate of a object.
|
||||||
* The coordinate will be upscaled with LV_DOWNSCALE.
|
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param y new distance from the top of the parent. (will be multiplied with LV_DOWNSCALE)
|
* @param y new distance from the top of the parent.
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_y_scale(lv_obj_t * obj, cord_t y);
|
static inline void lv_obj_set_y_scale(lv_obj_t * obj, cord_t y)
|
||||||
|
{
|
||||||
|
lv_obj_set_y(obj, y << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size of an object
|
* Set the size of an object
|
||||||
@@ -290,12 +320,16 @@ void lv_obj_set_y_scale(lv_obj_t * obj, cord_t y);
|
|||||||
void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h);
|
void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the size of an object. The coordinates will be upscaled with LV_DOWNSCALE.
|
* Set the size of an object.
|
||||||
|
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param w new width (will be multiplied with LV_DOWNSCALE)
|
* @param w new width
|
||||||
* @param h new height (will be multiplied with LV_DOWNSCALE)
|
* @param h new height
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_size_scale(lv_obj_t * obj, cord_t w, cord_t h);
|
static inline void lv_obj_set_size_scale(lv_obj_t * obj, cord_t w, cord_t h)
|
||||||
|
{
|
||||||
|
lv_obj_set_size(obj, w << LV_ANTIALIAS, h << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width of an object
|
* Set the width of an object
|
||||||
@@ -305,11 +339,15 @@ void lv_obj_set_size_scale(lv_obj_t * obj, cord_t w, cord_t h);
|
|||||||
void lv_obj_set_width(lv_obj_t * obj, cord_t w);
|
void lv_obj_set_width(lv_obj_t * obj, cord_t w);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the width of an object. The width will be upscaled with LV_DOWNSCALE
|
* Set the width of an object.
|
||||||
|
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param w new width (will be multiplied with LV_DOWNSCALE)
|
* @param w new width
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_width_scale(lv_obj_t * obj, cord_t w);
|
static inline void lv_obj_set_width_scale(lv_obj_t * obj, cord_t w)
|
||||||
|
{
|
||||||
|
lv_obj_set_width(obj, w << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the height of an object
|
* Set the height of an object
|
||||||
@@ -319,11 +357,15 @@ void lv_obj_set_width_scale(lv_obj_t * obj, cord_t w);
|
|||||||
void lv_obj_set_height(lv_obj_t * obj, cord_t h);
|
void lv_obj_set_height(lv_obj_t * obj, cord_t h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the height of an object. The height will be upscaled with LV_DOWNSCALE
|
* Set the height of an object.
|
||||||
|
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param h new height (will be multiplied with LV_DOWNSCALE)
|
* @param h new height
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_height_scale(lv_obj_t * obj, cord_t h);
|
static inline void lv_obj_set_height_scale(lv_obj_t * obj, cord_t h)
|
||||||
|
{
|
||||||
|
lv_obj_set_height(obj, h << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Align an object to an other object.
|
* Align an object to an other object.
|
||||||
@@ -336,21 +378,22 @@ void lv_obj_set_height_scale(lv_obj_t * obj, cord_t h);
|
|||||||
void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod);
|
void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Align an object to an other object. The coordinates will be upscaled with LV_DOWNSCALE.
|
* Align an object to an other object.
|
||||||
|
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
|
||||||
* @param obj pointer to an object to align
|
* @param obj pointer to an object to align
|
||||||
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
|
||||||
* @param align type of alignment (see 'lv_align_t' enum)
|
* @param align type of alignment (see 'lv_align_t' enum)
|
||||||
* @param x_mod x coordinate shift after alignment (will be multiplied with LV_DOWNSCALE)
|
* @param x_mod x coordinate shift after alignment
|
||||||
* @param y_mod y coordinate shift after alignment (will be multiplied with LV_DOWNSCALE)
|
* @param y_mod y coordinate shift after alignment
|
||||||
*/
|
*/
|
||||||
void lv_obj_align_scale(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod);
|
static inline void lv_obj_align_scale(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod)
|
||||||
|
{
|
||||||
|
lv_obj_align(obj, base, align, x_mod << LV_ANTIALIAS, y_mod << LV_ANTIALIAS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/*---------------------
|
||||||
* Set the extended size of an object
|
* Appearance set
|
||||||
* @param obj pointer to an object
|
*--------------------*/
|
||||||
* @param ext_size the extended size
|
|
||||||
*/
|
|
||||||
void lv_obj_set_ext_size(lv_obj_t * obj, cord_t ext_size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a new style for an object
|
* Set a new style for an object
|
||||||
@@ -370,7 +413,11 @@ void lv_obj_refresh_style(lv_obj_t * obj);
|
|||||||
* @param style pointer to a style. Only the objects with this style will be notified
|
* @param style pointer to a style. Only the objects with this style will be notified
|
||||||
* (NULL to notify all objects)
|
* (NULL to notify all objects)
|
||||||
*/
|
*/
|
||||||
void lv_style_refr_objs(void * style);
|
void lv_obj_report_style_mod(void * style);
|
||||||
|
|
||||||
|
/*-----------------
|
||||||
|
* Attribute set
|
||||||
|
*----------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide an object. It won't be visible and clickable.
|
* Hide an object. It won't be visible and clickable.
|
||||||
@@ -445,6 +492,10 @@ void lv_obj_set_signal_func(lv_obj_t * obj, lv_signal_func_t fp);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp);
|
void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp);
|
||||||
|
|
||||||
|
/*----------------
|
||||||
|
* Other set
|
||||||
|
*--------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a new ext. data for an object
|
* Allocate a new ext. data for an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -466,7 +517,7 @@ void lv_obj_refresh_ext_size(lv_obj_t * obj);
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param free_num the new free number
|
* @param free_num the new free number
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_free_num(lv_obj_t * obj, LV_OBJ_FREE_NUM_TYPE free_number);
|
void lv_obj_set_free_num(lv_obj_t * obj, LV_OBJ_FREE_NUM_TYPE free_num);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_OBJ_FREE_PTR != 0
|
#if LV_OBJ_FREE_PTR != 0
|
||||||
@@ -476,7 +527,7 @@ void lv_obj_set_free_num(lv_obj_t * obj, LV_OBJ_FREE_NUM_TYPE free_number);
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param free_p the new free pinter
|
* @param free_p the new free pinter
|
||||||
*/
|
*/
|
||||||
void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_pointer);
|
void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -489,11 +540,25 @@ void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_pointer);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay, void (*cb) (lv_obj_t *));
|
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay, void (*cb) (lv_obj_t *));
|
||||||
|
|
||||||
|
/*=======================
|
||||||
|
* Getter functions
|
||||||
|
*======================*/
|
||||||
|
|
||||||
|
/*------------------
|
||||||
|
* Screen get
|
||||||
|
*-----------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return with the actual screen
|
* Return with a pointer to the active screen
|
||||||
* @return pointer to to the actual screen object
|
* @return pointer to the active screen object (loaded by 'lv_scr_load()')
|
||||||
*/
|
*/
|
||||||
lv_obj_t * lv_scr_act(void);lv_obj_t * lv_layer_top(void);
|
lv_obj_t * lv_scr_act(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return with the top layer. (Same on every screen and it is above the normal screen layer)
|
||||||
|
* @return pointer to the top layer object (transparent screen sized lv_obj)
|
||||||
|
*/
|
||||||
|
lv_obj_t * lv_layer_top(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return with the system layer. (Same on every screen and it is above the all other layers)
|
* Return with the system layer. (Same on every screen and it is above the all other layers)
|
||||||
@@ -509,6 +574,10 @@ lv_obj_t * lv_layer_sys(void);
|
|||||||
*/
|
*/
|
||||||
lv_obj_t * lv_obj_get_screen(lv_obj_t * obj);
|
lv_obj_t * lv_obj_get_screen(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/*---------------------
|
||||||
|
* Parent/children get
|
||||||
|
*--------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns with the parent of an object
|
* Returns with the parent of an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -517,7 +586,7 @@ lv_obj_t * lv_obj_get_screen(lv_obj_t * obj);
|
|||||||
lv_obj_t * lv_obj_get_parent(lv_obj_t * obj);
|
lv_obj_t * lv_obj_get_parent(lv_obj_t * obj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through the children of an object
|
* Iterate through the children of an object (start from the "youngest, lastly created")
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param child NULL at first call to get the next children
|
* @param child NULL at first call to get the next children
|
||||||
* and the previous return value later
|
* and the previous return value later
|
||||||
@@ -526,7 +595,7 @@ lv_obj_t * lv_obj_get_parent(lv_obj_t * obj);
|
|||||||
lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child);
|
lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through the children of an object (start from the "oldest")
|
* Iterate through the children of an object (start from the "oldest", firstly created)
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @param child NULL at first call to get the next children
|
* @param child NULL at first call to get the next children
|
||||||
* and the previous return value later
|
* and the previous return value later
|
||||||
@@ -541,6 +610,10 @@ lv_obj_t * lv_obj_get_child_back(lv_obj_t * obj, lv_obj_t * child);
|
|||||||
*/
|
*/
|
||||||
uint16_t lv_obj_count_children(lv_obj_t * obj);
|
uint16_t lv_obj_count_children(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/*---------------------
|
||||||
|
* Coordinate get
|
||||||
|
*--------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the coordinates of an object to an area
|
* Copy the coordinates of an object to an area
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -583,6 +656,10 @@ cord_t lv_obj_get_height(lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
cord_t lv_obj_get_ext_size(lv_obj_t * obj);
|
cord_t lv_obj_get_ext_size(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/*-----------------
|
||||||
|
* Appearance get
|
||||||
|
*---------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the style pointer of an object (if NULL get style of the parent)
|
* Get the style pointer of an object (if NULL get style of the parent)
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -590,6 +667,10 @@ cord_t lv_obj_get_ext_size(lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
lv_style_t * lv_obj_get_style(lv_obj_t * obj);
|
lv_style_t * lv_obj_get_style(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/*-----------------
|
||||||
|
* Attribute get
|
||||||
|
*----------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the hidden attribute of an object
|
* Get the hidden attribute of an object
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
@@ -661,11 +742,15 @@ lv_signal_func_t lv_obj_get_signal_func(lv_obj_t * obj);
|
|||||||
*/
|
*/
|
||||||
lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj);
|
lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj);
|
||||||
|
|
||||||
|
/*------------------
|
||||||
|
* Other get
|
||||||
|
*-----------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ext pointer
|
* Get the ext pointer
|
||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the ext pointer but not the dynamic version
|
* @return the ext pointer but not the dynamic version
|
||||||
* Use it as ext->data1, and NOT da(ext_attr)->data1
|
* Use it as ext->data1, and NOT da(ext)->data1
|
||||||
*/
|
*/
|
||||||
void * lv_obj_get_ext_attr(lv_obj_t * obj);
|
void * lv_obj_get_ext_attr(lv_obj_t * obj);
|
||||||
|
|
||||||
@@ -684,7 +769,7 @@ LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj);
|
|||||||
* @param obj pointer to an object
|
* @param obj pointer to an object
|
||||||
* @return the free pointer
|
* @return the free pointer
|
||||||
*/
|
*/
|
||||||
void * lv_obj_get_free_p(lv_obj_t * obj);
|
void * lv_obj_get_free_ptr(lv_obj_t * obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LV_OBJ_GROUP != 0
|
#if LV_OBJ_GROUP != 0
|
||||||
@@ -696,6 +781,7 @@ void * lv_obj_get_free_p(lv_obj_t * obj);
|
|||||||
void * lv_obj_get_group(lv_obj_t * obj);
|
void * lv_obj_get_group(lv_obj_t * obj);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
**********************/
|
**********************/
|
||||||
|
|||||||
@@ -208,6 +208,8 @@ void lv_style_copy(lv_style_t * dest, const lv_style_t * src)
|
|||||||
memcpy(dest, src, sizeof(lv_style_t));
|
memcpy(dest, src, sizeof(lv_style_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an animation from a pre-configured 'lv_style_anim_t' variable
|
* Create an animation from a pre-configured 'lv_style_anim_t' variable
|
||||||
* @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied)
|
* @param anim pointer to a pre-configured 'lv_style_anim_t' variable (will be copied)
|
||||||
@@ -287,8 +289,7 @@ static void lv_style_aimator(lv_style_anim_dsc_t * dsc, int32_t val)
|
|||||||
act->body.shadow.type = end->body.shadow.type;
|
act->body.shadow.type = end->body.shadow.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_style_refr_objs(dsc->style_anim);
|
lv_obj_report_style_mod(dsc->style_anim);
|
||||||
|
|
||||||
|
|
||||||
if(val == LV_STYLE_ANIM_RES) {
|
if(val == LV_STYLE_ANIM_RES) {
|
||||||
dm_free(dsc);
|
dm_free(dsc);
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ extern "C" {
|
|||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
#define LV_RADIUS_CIRCLE (CORD_MAX) /*A very big radius to always draw as circle*/
|
#define LV_RADIUS_CIRCLE (CORD_MAX) /*A very big radius to always draw as circle*/
|
||||||
|
#define LV_AA LV_ANTIALIAS /*Just a shorter form of LV_ANTIALIAS*/
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
|
||||||
/*Border types (Use 'OR'ed values)*/
|
/*Border types (Use 'OR'ed values)*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "../lv_obj/lv_group.h"
|
#include "../lv_obj/lv_group.h"
|
||||||
#include "../lv_obj/lv_indev.h"
|
#include "../lv_obj/lv_indev.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
|
#include "misc/gfx/fonts/symbol_def.h"
|
||||||
#include "misc/gfx/anim.h"
|
#include "misc/gfx/anim.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -408,12 +409,15 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m
|
|||||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||||
ancestor_design(ddlist, mask, mode);
|
ancestor_design(ddlist, mask, mode);
|
||||||
|
|
||||||
/*If the list is opened draw a rectangle under the selected item*/
|
|
||||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||||
|
|
||||||
|
/*If the list is opened draw a rectangle under the selected item*/
|
||||||
if(ext->opened != 0) {
|
if(ext->opened != 0) {
|
||||||
lv_style_t *style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
|
lv_style_t *style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_BG);
|
||||||
const font_t * font = style->text.font;
|
const font_t * font = style->text.font;
|
||||||
cord_t font_h = font_get_height_scale(font);
|
cord_t font_h = font_get_height_scale(font);
|
||||||
|
|
||||||
|
/*Draw the selected*/
|
||||||
area_t rect_area;
|
area_t rect_area;
|
||||||
rect_area.y1 = ext->label->coords.y1;
|
rect_area.y1 = ext->label->coords.y1;
|
||||||
rect_area.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
|
rect_area.y1 += ext->sel_opt_id * (font_h + style->text.line_space);
|
||||||
|
|||||||
@@ -22,10 +22,6 @@
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
#ifndef LV_GAUGE_MAX_NEEDLE
|
|
||||||
#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
|
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
|
||||||
#define LV_GAUGE_DEF_LABEL_COUNT 6
|
#define LV_GAUGE_DEF_LABEL_COUNT 6
|
||||||
#define LV_GAUGE_DEF_LINE_COUNT 21 /*Should be: ((label_cnt - 1) * internal_lines) + 1*/
|
#define LV_GAUGE_DEF_LINE_COUNT 21 /*Should be: ((label_cnt - 1) * internal_lines) + 1*/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "lv_lmeter.h"
|
#include "lv_lmeter.h"
|
||||||
#include "../lv_draw/lv_draw.h"
|
#include "../lv_draw/lv_draw.h"
|
||||||
#include "../lv_themes/lv_theme.h"
|
#include "../lv_themes/lv_theme.h"
|
||||||
|
#include "../lv_obj/lv_group.h"
|
||||||
#include "misc/math/trigo.h"
|
#include "misc/math/trigo.h"
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
@@ -240,6 +241,14 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
|
|||||||
lv_style_t style_tmp;
|
lv_style_t style_tmp;
|
||||||
memcpy(&style_tmp, style, sizeof(lv_style_t));
|
memcpy(&style_tmp, style, sizeof(lv_style_t));
|
||||||
|
|
||||||
|
|
||||||
|
#if LV_OBJ_GROUP
|
||||||
|
lv_group_t *g = lv_obj_get_group(lmeter);
|
||||||
|
if(lv_group_get_focused(g) == lmeter) {
|
||||||
|
style_tmp.line.width += 1 << LV_ANTIALIAS;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cord_t r_out = lv_obj_get_width(lmeter) / 2;
|
cord_t r_out = lv_obj_get_width(lmeter) / 2;
|
||||||
cord_t r_in = r_out - style->body.padding.hor;
|
cord_t r_in = r_out - style->body.padding.hor;
|
||||||
cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1;
|
cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1;
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
|
|||||||
ext->title = lv_label_create(ext->header, NULL);
|
ext->title = lv_label_create(ext->header, NULL);
|
||||||
lv_label_set_text(ext->title,"My title");
|
lv_label_set_text(ext->title,"My title");
|
||||||
|
|
||||||
|
|
||||||
/*Set the default styles*/
|
/*Set the default styles*/
|
||||||
lv_theme_t *th = lv_theme_get_current();
|
lv_theme_t *th = lv_theme_get_current();
|
||||||
if(th) {
|
if(th) {
|
||||||
|
|||||||
Reference in New Issue
Block a user