add 'const' attribute to pointer where possible

This commit is contained in:
Gabor Kiss-Vamosi
2018-07-30 06:52:29 +02:00
parent a005d832cb
commit 769c7b28ff
63 changed files with 454 additions and 433 deletions

View File

@@ -348,7 +348,7 @@ lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style)
* @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(const lv_group_t * group)
{
if(!group) return NULL;
if(group->obj_focus == NULL) return NULL;
@@ -361,7 +361,7 @@ lv_obj_t * lv_group_get_focused(lv_group_t * group)
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_cb(lv_group_t * group)
lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group)
{
if(!group) return false;
return group->style_mod ;
@@ -372,7 +372,7 @@ lv_group_style_mod_func_t lv_group_get_style_mod_cb(lv_group_t * group)
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(lv_group_t * group)
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
{
if(!group) return false;
return group->style_mod_edit;
@@ -383,7 +383,7 @@ lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(lv_group_t * group)
* @param group pointer to a group
* @return the call back function or NULL if not set
*/
lv_group_focus_cb_t lv_group_get_focus_cb(lv_group_t * group)
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group)
{
if(!group) return false;
return group->focus_cb;
@@ -394,7 +394,7 @@ lv_group_focus_cb_t lv_group_get_focus_cb(lv_group_t * group)
* @param group pointer to group
* @return true editing is enabled
*/
bool lv_group_get_edit_enable(lv_group_t * group, bool en)
bool lv_group_get_edit_enable(const lv_group_t * group, bool en)
{
return group->edit_mode_en ? true : false;
}
@@ -404,7 +404,7 @@ bool lv_group_get_edit_enable(lv_group_t * group, bool en)
* @param group pointer to group
* @return true: edit mode; false: navigate mode
*/
bool lv_group_get_editing(lv_group_t * group)
bool lv_group_get_editing(const lv_group_t * group)
{
if(!group) return false;
return group->editing ? true : false;
@@ -415,7 +415,7 @@ bool lv_group_get_editing(lv_group_t * group)
* @param group pointer to group
* @return true: `click_focus` is enabled; false: disabled
*/
bool lv_group_get_click_focus(lv_group_t * group)
bool lv_group_get_click_focus(const lv_group_t * group)
{
if(!group) return false;
return group->click_focus ? true : false;

View File

@@ -180,49 +180,49 @@ lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style);
* @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(const lv_group_t * group);
/**
* Get a the style modifier function of a group
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_cb(lv_group_t * group);
lv_group_style_mod_func_t lv_group_get_style_mod_cb(const lv_group_t * group);
/**
* Get a the style modifier function of a group in edit mode
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(lv_group_t * group);
lv_group_style_mod_func_t lv_group_get_style_mod_edit_cb(const lv_group_t * group);
/**
* Get the focus callback function of a group
* @param group pointer to a group
* @return the call back function or NULL if not set
*/
lv_group_focus_cb_t lv_group_get_focus_cb(lv_group_t * group);
lv_group_focus_cb_t lv_group_get_focus_cb(const lv_group_t * group);
/**
* Get the edit mode is enabled or not.
* @param group pointer to group
* @return true editing is enabled
*/
bool lv_group_get_edit_enable(lv_group_t * group, bool en);
bool lv_group_get_edit_enable(const lv_group_t * group, bool en);
/**
* Get the current mode (edit or navigate).
* @param group pointer to group
* @return true: edit mode; false: navigate mode
*/
bool lv_group_get_editing(lv_group_t * group);
bool lv_group_get_editing(const lv_group_t * group);
/**
* Get the `click_focus` attribute.
* @param group pointer to group
* @return true: `click_focus` is enabled; false: disabled
*/
bool lv_group_get_click_focus(lv_group_t * group);
bool lv_group_get_click_focus(const lv_group_t * group);
/**********************

View File

@@ -80,7 +80,7 @@ lv_indev_t * lv_indev_get_act(void)
* @param indev pointer to an input device
* @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`)
*/
lv_hal_indev_type_t lv_indev_get_type(lv_indev_t * indev)
lv_hal_indev_type_t lv_indev_get_type(const lv_indev_t * indev)
{
if(indev == NULL) return LV_INDEV_TYPE_NONE;
@@ -170,7 +170,7 @@ void lv_indev_set_button_points(lv_indev_t * indev, lv_point_t * points)
* @param indev pointer to an input device
* @param point pointer to a point to store the result
*/
void lv_indev_get_point(lv_indev_t * indev, lv_point_t * point)
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point)
{
if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) {
point->x = -1;
@@ -186,7 +186,7 @@ void lv_indev_get_point(lv_indev_t * indev, lv_point_t * point)
* @param indev pointer to an input device
* @return true: drag is in progress
*/
bool lv_indev_is_dragging(lv_indev_t * indev)
bool lv_indev_is_dragging(const lv_indev_t * indev)
{
if(indev == NULL) return false;
if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) return false;
@@ -198,7 +198,7 @@ bool lv_indev_is_dragging(lv_indev_t * indev)
* @param indev pointer to an input device
* @param point pointer to a point to store the vector
*/
void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point)
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point)
{
if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) {
point->x = 0;
@@ -214,7 +214,7 @@ void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point)
* @param indev pointer to an input device (NULL to get the overall smallest inactivity)
* @return Elapsed ticks (milliseconds) since last press
*/
uint32_t lv_indev_get_inactive_time(lv_indev_t * indev)
uint32_t lv_indev_get_inactive_time(const lv_indev_t * indev)
{
uint32_t t;

View File

@@ -46,7 +46,7 @@ lv_indev_t * lv_indev_get_act(void);
* @param indev pointer to an input device
* @return the type of the input device from `lv_hal_indev_type_t` (`LV_INDEV_TYPE_...`)
*/
lv_hal_indev_type_t lv_indev_get_type(lv_indev_t * indev);
lv_hal_indev_type_t lv_indev_get_type(const lv_indev_t * indev);
/**
* Reset one or all input devices
@@ -96,27 +96,27 @@ void lv_indev_set_button_points(lv_indev_t *indev, lv_point_t *points);
* @param indev pointer to an input device
* @param point pointer to a point to store the result
*/
void lv_indev_get_point(lv_indev_t * indev, lv_point_t * point);
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point);
/**
* Check if there is dragging with an input device or not (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device
* @return true: drag is in progress
*/
bool lv_indev_is_dragging(lv_indev_t * indev);
bool lv_indev_is_dragging(const lv_indev_t * indev);
/**
* Get the vector of dragging of an input device (for LV_INDEV_TYPE_POINTER and LV_INDEV_TYPE_BUTTON)
* @param indev pointer to an input device
* @param point pointer to a point to store the vector
*/
void lv_indev_get_vect(lv_indev_t * indev, lv_point_t * point);
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
/**
* Get elapsed time since last press
* @param indev pointer to an input device (NULL to get the overall smallest inactivity)
* @return Elapsed ticks (milliseconds) since last press
*/
uint32_t lv_indev_get_inactive_time(lv_indev_t * indev);
uint32_t lv_indev_get_inactive_time(const lv_indev_t * indev);
/**
* Do nothing until the next release

View File

@@ -119,7 +119,7 @@ void lv_init(void)
* @param copy pointer to a base object, if not NULL then the new object will be copied from it
* @return pointer to the new object
*/
lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
lv_obj_t * lv_obj_create(lv_obj_t * parent,const lv_obj_t * copy)
{
lv_obj_t * new_obj = NULL;
@@ -366,7 +366,7 @@ void lv_obj_clean(lv_obj_t * obj)
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
* @param obj pointer to an object
*/
void lv_obj_invalidate(lv_obj_t * obj)
void lv_obj_invalidate(const lv_obj_t * obj)
{
if(lv_obj_get_hidden(obj)) return;
@@ -1081,17 +1081,17 @@ lv_obj_t * lv_layer_sys(void)
* @param obj pointer to an object
* @return pointer to a screen
*/
lv_obj_t * lv_obj_get_screen(lv_obj_t * obj)
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj)
{
lv_obj_t * par = obj;
lv_obj_t * act_p;
const lv_obj_t * par = obj;
const lv_obj_t * act_p;
do {
act_p = par;
par = lv_obj_get_parent(act_p);
} while(par != NULL);
return act_p;
return (lv_obj_t *)act_p;
}
/*---------------------
@@ -1103,7 +1103,7 @@ lv_obj_t * lv_obj_get_screen(lv_obj_t * obj)
* @param obj pointer to an object
* @return pointer to the parent of 'obj'
*/
lv_obj_t * lv_obj_get_parent(lv_obj_t * obj)
lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj)
{
return obj->par;
}
@@ -1115,7 +1115,7 @@ lv_obj_t * lv_obj_get_parent(lv_obj_t * obj)
* and the previous return value later
* @return the child after 'act_child' or NULL if no more child
*/
lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child)
lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child)
{
if(child == NULL) {
return lv_ll_get_head(&obj->child_ll);
@@ -1133,7 +1133,7 @@ lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child)
* and the previous return value later
* @return the child after 'act_child' or NULL if no more child
*/
lv_obj_t * lv_obj_get_child_back(lv_obj_t * obj, lv_obj_t * child)
lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child)
{
if(child == NULL) {
return lv_ll_get_tail(&obj->child_ll);
@@ -1149,7 +1149,7 @@ lv_obj_t * lv_obj_get_child_back(lv_obj_t * obj, lv_obj_t * child)
* @param obj pointer to an object
* @return children number of 'obj'
*/
uint16_t lv_obj_count_children(lv_obj_t * obj)
uint16_t lv_obj_count_children(const lv_obj_t * obj)
{
lv_obj_t * i;
uint16_t cnt = 0;
@@ -1168,7 +1168,7 @@ uint16_t lv_obj_count_children(lv_obj_t * obj)
* @param obj pointer to an object
* @param cords_p pointer to an area to store the coordinates
*/
void lv_obj_get_coords(lv_obj_t * obj, lv_area_t * cords_p)
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p)
{
lv_area_copy(cords_p, &obj->coords);
}
@@ -1179,7 +1179,7 @@ void lv_obj_get_coords(lv_obj_t * obj, lv_area_t * cords_p)
* @param obj pointer to an object
* @return distance of 'obj' from the left side of its parent
*/
lv_coord_t lv_obj_get_x(lv_obj_t * obj)
lv_coord_t lv_obj_get_x(const lv_obj_t * obj)
{
lv_coord_t rel_x;
lv_obj_t * parent = lv_obj_get_parent(obj);
@@ -1193,7 +1193,7 @@ lv_coord_t lv_obj_get_x(lv_obj_t * obj)
* @param obj pointer to an object
* @return distance of 'obj' from the top of its parent
*/
lv_coord_t lv_obj_get_y(lv_obj_t * obj)
lv_coord_t lv_obj_get_y(const lv_obj_t * obj)
{
lv_coord_t rel_y;
lv_obj_t * parent = lv_obj_get_parent(obj);
@@ -1207,7 +1207,7 @@ lv_coord_t lv_obj_get_y(lv_obj_t * obj)
* @param obj pointer to an object
* @return the width
*/
lv_coord_t lv_obj_get_width(lv_obj_t * obj)
lv_coord_t lv_obj_get_width(const lv_obj_t * obj)
{
return lv_area_get_width(&obj->coords);
}
@@ -1217,7 +1217,7 @@ lv_coord_t lv_obj_get_width(lv_obj_t * obj)
* @param obj pointer to an object
* @return the height
*/
lv_coord_t lv_obj_get_height(lv_obj_t * obj)
lv_coord_t lv_obj_get_height(const lv_obj_t * obj)
{
return lv_area_get_height(&obj->coords);
}
@@ -1227,7 +1227,7 @@ lv_coord_t lv_obj_get_height(lv_obj_t * obj)
* @param obj pointer to an object
* @return the extended size attribute
*/
lv_coord_t lv_obj_get_ext_size(lv_obj_t * obj)
lv_coord_t lv_obj_get_ext_size(const lv_obj_t * obj)
{
return obj->ext_size;
}
@@ -1241,7 +1241,7 @@ lv_coord_t lv_obj_get_ext_size(lv_obj_t * obj)
* @param obj pointer to an object
* @return pointer to a style
*/
lv_style_t * lv_obj_get_style(lv_obj_t * obj)
lv_style_t * lv_obj_get_style(const lv_obj_t * obj)
{
lv_style_t * style_act = obj->style_p;
if(style_act == NULL) {
@@ -1289,7 +1289,7 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: the object is hidden
*/
bool lv_obj_get_hidden(lv_obj_t * obj)
bool lv_obj_get_hidden(const lv_obj_t * obj)
{
return obj->hidden == 0 ? false : true;
}
@@ -1299,7 +1299,7 @@ bool lv_obj_get_hidden(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: the object is clickable
*/
bool lv_obj_get_click(lv_obj_t * obj)
bool lv_obj_get_click(const lv_obj_t * obj)
{
return obj->click == 0 ? false : true;
}
@@ -1309,7 +1309,7 @@ bool lv_obj_get_click(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: the auto top feture is enabled
*/
bool lv_obj_get_top(lv_obj_t * obj)
bool lv_obj_get_top(const lv_obj_t * obj)
{
return obj->top == 0 ? false : true;
}
@@ -1319,7 +1319,7 @@ bool lv_obj_get_top(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: the object is dragable
*/
bool lv_obj_get_drag(lv_obj_t * obj)
bool lv_obj_get_drag(const lv_obj_t * obj)
{
return obj->drag == 0 ? false : true;
}
@@ -1329,7 +1329,7 @@ bool lv_obj_get_drag(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: drag throw is enabled
*/
bool lv_obj_get_drag_throw(lv_obj_t * obj)
bool lv_obj_get_drag_throw(const lv_obj_t * obj)
{
return obj->drag_throw == 0 ? false : true;
}
@@ -1339,7 +1339,7 @@ bool lv_obj_get_drag_throw(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: drag parent is enabled
*/
bool lv_obj_get_drag_parent(lv_obj_t * obj)
bool lv_obj_get_drag_parent(const lv_obj_t * obj)
{
return obj->drag_parent == 0 ? false : true;
}
@@ -1349,7 +1349,7 @@ bool lv_obj_get_drag_parent(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: opa scaling is enabled for this object and all children false: no opa scaling
*/
lv_opa_t lv_obj_get_opa_scale_enable(lv_obj_t * obj)
lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj)
{
return obj->opa_scale_en == 0 ? false : true;
}
@@ -1359,9 +1359,9 @@ lv_opa_t lv_obj_get_opa_scale_enable(lv_obj_t * obj)
* @param obj pointer to an object
* @return opa scale [0..255]
*/
lv_opa_t lv_obj_get_opa_scale(lv_obj_t * obj)
lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj)
{
lv_obj_t * parent = obj;
const lv_obj_t * parent = obj;
while(parent) {
if(parent->opa_scale_en) return parent->opa_scale;
@@ -1376,7 +1376,7 @@ lv_opa_t lv_obj_get_opa_scale(lv_obj_t * obj)
* @param obj pointer to an object
* @return protect field ('OR'ed values of lv_obj_prot_t)
*/
uint8_t lv_obj_get_protect(lv_obj_t * obj)
uint8_t lv_obj_get_protect(const lv_obj_t * obj)
{
return obj->protect ;
}
@@ -1387,7 +1387,7 @@ uint8_t lv_obj_get_protect(lv_obj_t * obj)
* @param prot protect bits to test ('OR'ed values of lv_obj_prot_t)
* @return false: none of the given bits are set, true: at least one bit is set
*/
bool lv_obj_is_protected(lv_obj_t * obj, uint8_t prot)
bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot)
{
return (obj->protect & prot) == 0 ? false : true ;
}
@@ -1397,7 +1397,7 @@ bool lv_obj_is_protected(lv_obj_t * obj, uint8_t prot)
* @param obj pointer to an object
* @return the signal function
*/
lv_signal_func_t lv_obj_get_signal_func(lv_obj_t * obj)
lv_signal_func_t lv_obj_get_signal_func(const lv_obj_t * obj)
{
return obj->signal_func;
}
@@ -1407,7 +1407,7 @@ lv_signal_func_t lv_obj_get_signal_func(lv_obj_t * obj)
* @param obj pointer to an object
* @return the design function
*/
lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj)
lv_design_func_t lv_obj_get_design_func(const lv_obj_t * obj)
{
return obj->design_func;
}
@@ -1422,7 +1422,7 @@ lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj)
* @return the ext pointer but not the dynamic version
* 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(const lv_obj_t * obj)
{
return obj->ext_attr;
}
@@ -1461,7 +1461,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf)
* @param obj pointer to an object
* @return the free number
*/
LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj)
LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(const lv_obj_t * obj)
{
return obj->free_num;
}
@@ -1473,7 +1473,7 @@ LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj)
* @param obj pointer to an object
* @return the free pointer
*/
void * lv_obj_get_free_ptr(lv_obj_t * obj)
void * lv_obj_get_free_ptr(const lv_obj_t * obj)
{
return obj->free_ptr;
}
@@ -1486,7 +1486,7 @@ void * lv_obj_get_free_ptr(lv_obj_t * obj)
* @param obj pointer to an object
* @return the pointer to group of the object
*/
void * lv_obj_get_group(lv_obj_t * obj)
void * lv_obj_get_group(const lv_obj_t * obj)
{
return obj->group_p;
}
@@ -1496,7 +1496,7 @@ void * lv_obj_get_group(lv_obj_t * obj)
* @param obj pointer to an object
* @return true: the object is focused, false: the object is not focused or not in a group
*/
bool lv_obj_is_focused(lv_obj_t * obj)
bool lv_obj_is_focused(const lv_obj_t * obj)
{
if(obj->group_p) {
if(lv_group_get_focused(obj->group_p) == obj) return true;

View File

@@ -222,7 +222,7 @@ void lv_init(void);
* @param copy pointer to a base object, if not NULL then the new object will be copied from it
* @return pointer to the new object
*/
lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy);
lv_obj_t * lv_obj_create(lv_obj_t * parent,const lv_obj_t * copy);
/**
* Delete 'obj' and all of its children
@@ -241,7 +241,7 @@ void lv_obj_clean(lv_obj_t *obj);
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
* @param obj pointer to an object
*/
void lv_obj_invalidate(lv_obj_t * obj);
void lv_obj_invalidate(const lv_obj_t * obj);
/*=====================
* Setter functions
@@ -532,7 +532,7 @@ lv_obj_t * lv_layer_sys(void);
* @param obj pointer to an object
* @return pointer to a screen
*/
lv_obj_t * lv_obj_get_screen(lv_obj_t * obj);
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
/*---------------------
* Parent/children get
@@ -543,7 +543,7 @@ lv_obj_t * lv_obj_get_screen(lv_obj_t * obj);
* @param obj pointer to an object
* @return pointer to the parent of 'obj'
*/
lv_obj_t * lv_obj_get_parent(lv_obj_t * obj);
lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj);
/**
* Iterate through the children of an object (start from the "youngest, lastly created")
@@ -552,7 +552,7 @@ lv_obj_t * lv_obj_get_parent(lv_obj_t * obj);
* and the previous return value later
* @return the child after 'act_child' or NULL if no more child
*/
lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child);
lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child);
/**
* Iterate through the children of an object (start from the "oldest", firstly created)
@@ -561,14 +561,14 @@ lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child);
* and the previous return value later
* @return the child after 'act_child' or NULL if no more child
*/
lv_obj_t * lv_obj_get_child_back(lv_obj_t * obj, lv_obj_t * child);
lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child);
/**
* Count the children of an object (only children directly on 'obj')
* @param obj pointer to an object
* @return children number of 'obj'
*/
uint16_t lv_obj_count_children(lv_obj_t * obj);
uint16_t lv_obj_count_children(const lv_obj_t * obj);
/*---------------------
* Coordinate get
@@ -579,42 +579,42 @@ uint16_t lv_obj_count_children(lv_obj_t * obj);
* @param obj pointer to an object
* @param cords_p pointer to an area to store the coordinates
*/
void lv_obj_get_coords(lv_obj_t * obj, lv_area_t * cords_p);
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
/**
* Get the x coordinate of object
* @param obj pointer to an object
* @return distance of 'obj' from the left side of its parent
*/
lv_coord_t lv_obj_get_x(lv_obj_t * obj);
lv_coord_t lv_obj_get_x(const lv_obj_t * obj);
/**
* Get the y coordinate of object
* @param obj pointer to an object
* @return distance of 'obj' from the top of its parent
*/
lv_coord_t lv_obj_get_y(lv_obj_t * obj);
lv_coord_t lv_obj_get_y(const lv_obj_t * obj);
/**
* Get the width of an object
* @param obj pointer to an object
* @return the width
*/
lv_coord_t lv_obj_get_width(lv_obj_t * obj);
lv_coord_t lv_obj_get_width(const lv_obj_t * obj);
/**
* Get the height of an object
* @param obj pointer to an object
* @return the height
*/
lv_coord_t lv_obj_get_height(lv_obj_t * obj);
lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
/**
* Get the extended size attribute of an object
* @param obj pointer to an object
* @return the extended size attribute
*/
lv_coord_t lv_obj_get_ext_size(lv_obj_t * obj);
lv_coord_t lv_obj_get_ext_size(const lv_obj_t * obj);
/*-----------------
* Appearance get
@@ -625,7 +625,7 @@ lv_coord_t lv_obj_get_ext_size(lv_obj_t * obj);
* @param obj pointer to an object
* @return pointer to a style
*/
lv_style_t * lv_obj_get_style(lv_obj_t * obj);
lv_style_t * lv_obj_get_style(const lv_obj_t * obj);
/*-----------------
* Attribute get
@@ -636,56 +636,56 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj);
* @param obj pointer to an object
* @return true: the object is hidden
*/
bool lv_obj_get_hidden(lv_obj_t * obj);
bool lv_obj_get_hidden(const lv_obj_t * obj);
/**
* Get the click enable attribute of an object
* @param obj pointer to an object
* @return true: the object is clickable
*/
bool lv_obj_get_click(lv_obj_t * obj);
bool lv_obj_get_click(const lv_obj_t * obj);
/**
* Get the top enable attribute of an object
* @param obj pointer to an object
* @return true: the auto top feture is enabled
*/
bool lv_obj_get_top(lv_obj_t * obj);
bool lv_obj_get_top(const lv_obj_t * obj);
/**
* Get the drag enable attribute of an object
* @param obj pointer to an object
* @return true: the object is dragable
*/
bool lv_obj_get_drag(lv_obj_t * obj);
bool lv_obj_get_drag(const lv_obj_t * obj);
/**
* Get the drag thow enable attribute of an object
* @param obj pointer to an object
* @return true: drag throw is enabled
*/
bool lv_obj_get_drag_throw(lv_obj_t * obj);
bool lv_obj_get_drag_throw(const lv_obj_t * obj);
/**
* Get the drag parent attribute of an object
* @param obj pointer to an object
* @return true: drag parent is enabled
*/
bool lv_obj_get_drag_parent(lv_obj_t * obj);
bool lv_obj_get_drag_parent(const lv_obj_t * obj);
/**
* Get the opa scale parameter of an object
* @param obj pointer to an object
* @return opa scale [0..255]
*/
lv_opa_t lv_obj_get_opa_scale(lv_obj_t * obj);
lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj);
/**
* Get the protect field of an object
* @param obj pointer to an object
* @return protect field ('OR'ed values of lv_obj_prot_t)
*/
uint8_t lv_obj_get_protect(lv_obj_t * obj);
uint8_t lv_obj_get_protect(const lv_obj_t * obj);
/**
* Check at least one bit of a given protect bitfield is set
@@ -693,21 +693,21 @@ uint8_t lv_obj_get_protect(lv_obj_t * obj);
* @param prot protect bits to test ('OR'ed values of lv_obj_prot_t)
* @return false: none of the given bits are set, true: at least one bit is set
*/
bool lv_obj_is_protected(lv_obj_t * obj, uint8_t prot);
bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot);
/**
* Get the signal function of an object
* @param obj pointer to an object
* @return the signal function
*/
lv_signal_func_t lv_obj_get_signal_func(lv_obj_t * obj);
lv_signal_func_t lv_obj_get_signal_func(const lv_obj_t * obj);
/**
* Get the design function of an object
* @param obj pointer to an object
* @return the design function
*/
lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj);
lv_design_func_t lv_obj_get_design_func(const lv_obj_t * obj);
/*------------------
* Other get
@@ -719,7 +719,7 @@ lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj);
* @return the ext pointer but not the dynamic version
* 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(const lv_obj_t * obj);
/**
* Get object's and its ancestors type. Put their name in `type_buf` starting with the current type.
@@ -735,7 +735,7 @@ void lv_obj_get_type(lv_obj_t * obj, lv_obj_type_t * buf);
* @param obj pointer to an object
* @return the free number
*/
LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj);
LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(const lv_obj_t * obj);
#endif
#if LV_OBJ_FREE_PTR != 0
@@ -744,7 +744,7 @@ LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj);
* @param obj pointer to an object
* @return the free pointer
*/
void * lv_obj_get_free_ptr(lv_obj_t * obj);
void * lv_obj_get_free_ptr(const lv_obj_t * obj);
#endif
#if USE_LV_GROUP
@@ -753,7 +753,7 @@ void * lv_obj_get_free_ptr(lv_obj_t * obj);
* @param obj pointer to an object
* @return the pointer to group of the object
*/
void * lv_obj_get_group(lv_obj_t * obj);
void * lv_obj_get_group(const lv_obj_t * obj);
/**
@@ -761,7 +761,7 @@ void * lv_obj_get_group(lv_obj_t * obj);
* @param obj pointer to an object
* @return true: the object is focused, false: the object is not focused or not in a group
*/
bool lv_obj_is_focused(lv_obj_t * obj);
bool lv_obj_is_focused(const lv_obj_t * obj);
#endif

View File

@@ -29,15 +29,20 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma
static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
#if USE_LV_SHADOW && LV_VDB_SIZE
static void lv_draw_shadow(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_shadow_full(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_shadow_bottom(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, lv_opa_t opa_scale);
static void lv_draw_shadow_full_straight(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style, const lv_opa_t * map);
#endif
static uint16_t lv_draw_cont_radius_corr(uint16_t r, lv_coord_t w, lv_coord_t h);
#if LV_ANTIALIAS
static lv_opa_t antialias_get_opa_circ(lv_coord_t seg, lv_coord_t px_id, lv_opa_t opa);
#endif
/**********************
* STATIC VARIABLES
**********************/
@@ -1391,13 +1396,15 @@ static uint16_t lv_draw_cont_radius_corr(uint16_t r, lv_coord_t w, lv_coord_t h)
return r;
}
#if LV_ANTIALIAS
/**
* Approximate the opacity for anti-aliasing.
* Used the first segment of a circle which is the longest and have the most non-linearity (cos)
* @param seg
* @param px_id
* @param line_opa
* @return
* @param seg length of the line segment
* @param px_id index of pixel on the line segment
* @param line_opa opacity of the lien (it will be the max opacity)
* @return the desired opacity of the pixel
*/
static lv_opa_t antialias_get_opa_circ(lv_coord_t seg, lv_coord_t px_id, lv_opa_t opa)
{
@@ -1413,3 +1420,5 @@ static lv_opa_t antialias_get_opa_circ(lv_coord_t seg, lv_coord_t px_id, lv_opa_
}
}
#endif

View File

@@ -231,7 +231,7 @@ void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node)
* @param ll_p pointer to linked list
* @return pointer to the head of 'll_p'
*/
void * lv_ll_get_head(lv_ll_t * ll_p)
void * lv_ll_get_head(const lv_ll_t * ll_p)
{
void * head = NULL;
@@ -247,7 +247,7 @@ void * lv_ll_get_head(lv_ll_t * ll_p)
* @param ll_p pointer to linked list
* @return pointer to the head of 'll_p'
*/
void * lv_ll_get_tail(lv_ll_t * ll_p)
void * lv_ll_get_tail(const lv_ll_t * ll_p)
{
void * tail = NULL;
@@ -264,12 +264,12 @@ void * lv_ll_get_tail(lv_ll_t * ll_p)
* @param n_act pointer a node
* @return pointer to the next node
*/
void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act)
void * lv_ll_get_next(const lv_ll_t * ll_p,const void * n_act)
{
void * next = NULL;
if(ll_p != NULL) {
lv_ll_node_t * n_act_d = n_act;
const lv_ll_node_t * n_act_d = n_act;
memcpy(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
}
@@ -282,12 +282,12 @@ void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act)
* @param n_act pointer a node
* @return pointer to the previous node
*/
void * lv_ll_get_prev(lv_ll_t * ll_p, void * n_act)
void * lv_ll_get_prev(const lv_ll_t * ll_p,const void * n_act)
{
void * prev = NULL;
if(ll_p != NULL) {
lv_ll_node_t * n_act_d = n_act;
const lv_ll_node_t * n_act_d = n_act;
memcpy(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
}

View File

@@ -97,14 +97,14 @@ void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node);
* @param ll_p pointer to linked list
* @return pointer to the head of 'll_p'
*/
void * lv_ll_get_head(lv_ll_t * ll_p);
void * lv_ll_get_head(const lv_ll_t * ll_p);
/**
* Return with tail node of the linked list
* @param ll_p pointer to linked list
* @return pointer to the head of 'll_p'
*/
void * lv_ll_get_tail(lv_ll_t * ll_p);
void * lv_ll_get_tail(const lv_ll_t * ll_p);
/**
* Return with the pointer of the next node after 'n_act'
@@ -112,7 +112,7 @@ void * lv_ll_get_tail(lv_ll_t * ll_p);
* @param n_act pointer a node
* @return pointer to the next node
*/
void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act);
void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act);
/**
* Return with the pointer of the previous node after 'n_act'
@@ -120,7 +120,7 @@ void * lv_ll_get_next(lv_ll_t * ll_p, void * n_act);
* @param n_act pointer a node
* @return pointer to the previous node
*/
void * lv_ll_get_prev(lv_ll_t * ll_p, void * n_act);
void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act);
/**
* Move a nodw before an other node in the same linked list

View File

@@ -48,7 +48,7 @@ static lv_design_func_t ancestor_design;
* @param copy pointer to a arc object, if not NULL then the new object will be copied from it
* @return pointer to the created arc
*/
lv_obj_t * lv_arc_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("arc create started");
@@ -174,7 +174,7 @@ uint16_t lv_arc_get_angle_end(lv_obj_t * arc)
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_arc_get_style(lv_obj_t * arc, lv_arc_style_t type)
lv_style_t * lv_arc_get_style(const lv_obj_t * arc, lv_arc_style_t type)
{
switch(type) {

View File

@@ -55,7 +55,7 @@ typedef enum {
* @param copy pointer to a arc object, if not NULL then the new object will be copied from it
* @return pointer to the created arc
*/
lv_obj_t * lv_arc_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
@@ -106,7 +106,7 @@ uint16_t lv_arc_get_angle_end(lv_obj_t * arc);
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_arc_get_style(lv_obj_t * arc, lv_arc_style_t type);
lv_style_t * lv_arc_get_style(const lv_obj_t * arc, lv_arc_style_t type);
/*=====================
* Other functions

View File

@@ -50,7 +50,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
* @return pointer to the created bar
*/
lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("lv_bar create started");
@@ -214,7 +214,7 @@ void lv_bar_set_style(lv_obj_t * bar, lv_bar_style_t type, lv_style_t * style)
* @param bar pointer to a bar object
* @return the value of the bar
*/
int16_t lv_bar_get_value(lv_obj_t * bar)
int16_t lv_bar_get_value(const lv_obj_t * bar)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->cur_value;
@@ -225,7 +225,7 @@ int16_t lv_bar_get_value(lv_obj_t * bar)
* @param bar pointer to a bar object
* @return the minimum value of the bar
*/
int16_t lv_bar_get_min_value(lv_obj_t * bar)
int16_t lv_bar_get_min_value(const lv_obj_t * bar)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->min_value;
@@ -236,7 +236,7 @@ int16_t lv_bar_get_min_value(lv_obj_t * bar)
* @param bar pointer to a bar object
* @return the maximum value of the bar
*/
int16_t lv_bar_get_max_value(lv_obj_t * bar)
int16_t lv_bar_get_max_value(const lv_obj_t * bar)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->max_value;
@@ -248,7 +248,7 @@ int16_t lv_bar_get_max_value(lv_obj_t * bar)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_bar_get_style(lv_obj_t * bar, lv_bar_style_t type)
lv_style_t * lv_bar_get_style(const lv_obj_t * bar, lv_bar_style_t type)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);

View File

@@ -60,7 +60,7 @@ typedef enum {
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
* @return pointer to the created bar
*/
lv_obj_t * lv_bar_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -107,21 +107,21 @@ void lv_bar_set_style(lv_obj_t *bar, lv_bar_style_t type, lv_style_t *style);
* @param bar pointer to a bar object
* @return the value of the bar
*/
int16_t lv_bar_get_value(lv_obj_t * bar);
int16_t lv_bar_get_value(const lv_obj_t * bar);
/**
* Get the minimum value of a bar
* @param bar pointer to a bar object
* @return the minimum value of the bar
*/
int16_t lv_bar_get_min_value(lv_obj_t * bar);
int16_t lv_bar_get_min_value(const lv_obj_t * bar);
/**
* Get the maximum value of a bar
* @param bar pointer to a bar object
* @return the maximum value of the bar
*/
int16_t lv_bar_get_max_value(lv_obj_t * bar);
int16_t lv_bar_get_max_value(const lv_obj_t * bar);
/**
@@ -130,7 +130,7 @@ int16_t lv_bar_get_max_value(lv_obj_t * bar);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_bar_get_style(lv_obj_t *bar, lv_bar_style_t type);
lv_style_t * lv_bar_get_style(const lv_obj_t *bar, lv_bar_style_t type);
/**********************
* MACROS

View File

@@ -65,7 +65,7 @@ static lv_point_t ink_point;
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("button create started");
@@ -284,7 +284,7 @@ void lv_btn_set_style(lv_obj_t * btn, lv_btn_style_t type, lv_style_t * style)
* @param btn pointer to a button object
* @return the state of the button (from lv_btn_state_t enum)
*/
lv_btn_state_t lv_btn_get_state(lv_obj_t * btn)
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
{
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
return ext->state;
@@ -295,7 +295,7 @@ lv_btn_state_t lv_btn_get_state(lv_obj_t * btn)
* @param btn pointer to a button object
* @return ture: toggle enabled, false: disabled
*/
bool lv_btn_get_toggle(lv_obj_t * btn)
bool lv_btn_get_toggle(const lv_obj_t * btn)
{
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
@@ -307,7 +307,7 @@ bool lv_btn_get_toggle(lv_obj_t * btn)
* @param btn pointer to a button object
* @return pointer to the release action function
*/
lv_action_t lv_btn_get_action(lv_obj_t * btn, lv_btn_action_t type)
lv_action_t lv_btn_get_action(const lv_obj_t * btn, lv_btn_action_t type)
{
if(type >= LV_BTN_ACTION_NUM) return NULL;
@@ -320,7 +320,7 @@ lv_action_t lv_btn_get_action(lv_obj_t * btn, lv_btn_action_t type)
* @param btn pointer to a button object
* @return the time of the ink animation
*/
uint16_t lv_btn_get_ink_fill_time(lv_obj_t * btn, uint16_t time)
uint16_t lv_btn_get_ink_fill_time(const lv_obj_t * btn, uint16_t time)
{
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
return ext->ink_fill_time;
@@ -332,7 +332,7 @@ uint16_t lv_btn_get_ink_fill_time(lv_obj_t * btn, uint16_t time)
* @param btn pointer to a button object
* @return the time of the ink animation
*/
uint16_t lv_btn_get_ink_wait_time(lv_obj_t * btn, uint16_t time)
uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn, uint16_t time)
{
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
return ext->ink_wait_time;
@@ -344,7 +344,7 @@ uint16_t lv_btn_get_ink_wait_time(lv_obj_t * btn, uint16_t time)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_style_t type)
lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type)
{
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);

View File

@@ -90,7 +90,7 @@ typedef enum {
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_btn_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -178,28 +178,28 @@ void lv_btn_set_style(lv_obj_t * btn, lv_btn_style_t type, lv_style_t *style);
* @param btn pointer to a button object
* @return the state of the button (from lv_btn_state_t enum)
*/
lv_btn_state_t lv_btn_get_state(lv_obj_t * btn);
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn);
/**
* Get the toggle enable attribute of the button
* @param btn pointer to a button object
* @return ture: toggle enabled, false: disabled
*/
bool lv_btn_get_toggle(lv_obj_t * btn);
bool lv_btn_get_toggle(const lv_obj_t * btn);
/**
* Get the release action of a button
* @param btn pointer to a button object
* @return pointer to the release action function
*/
lv_action_t lv_btn_get_action(lv_obj_t * btn, lv_btn_action_t type);
lv_action_t lv_btn_get_action(const lv_obj_t * btn, lv_btn_action_t type);
/**
* Get the layout of a button
* @param btn pointer to button object
* @return the layout from 'lv_cont_layout_t'
*/
static inline lv_layout_t lv_btn_get_layout(lv_obj_t * btn)
static inline lv_layout_t lv_btn_get_layout(const lv_obj_t * btn)
{
return lv_cont_get_layout(btn);
}
@@ -209,7 +209,7 @@ static inline lv_layout_t lv_btn_get_layout(lv_obj_t * btn)
* @param btn pointer to a button object
* @return true: horizontal fit is enabled; false: disabled
*/
static inline bool lv_btn_get_hor_fit(lv_obj_t * btn)
static inline bool lv_btn_get_hor_fit(const lv_obj_t * btn)
{
return lv_cont_get_hor_fit(btn);
}
@@ -219,7 +219,7 @@ static inline bool lv_btn_get_hor_fit(lv_obj_t * btn)
* @param btn pointer to a button object
* @return true: vertical fit is enabled; false: disabled
*/
static inline bool lv_btn_get_ver_fit(lv_obj_t * btn)
static inline bool lv_btn_get_ver_fit(const lv_obj_t * btn)
{
return lv_cont_get_ver_fit(btn);
}
@@ -228,14 +228,14 @@ static inline bool lv_btn_get_ver_fit(lv_obj_t * btn)
* @param btn pointer to a button object
* @return the time of the ink animation
*/
uint16_t lv_btn_get_ink_fill_time(lv_obj_t * btn, uint16_t time);
uint16_t lv_btn_get_ink_fill_time(const lv_obj_t * btn, uint16_t time);
/**
* Get the wait time before the ink disappears
* @param btn pointer to a button object
* @return the time of the ink animation
*/
uint16_t lv_btn_get_ink_wait_time(lv_obj_t * btn, uint16_t time);
uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn, uint16_t time);
/**
* Get style of a button.
@@ -243,7 +243,7 @@ uint16_t lv_btn_get_ink_wait_time(lv_obj_t * btn, uint16_t time);
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_btn_get_style(lv_obj_t * btn, lv_btn_style_t type);
lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type);
/**********************
* MACROS

View File

@@ -62,7 +62,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a button matrix object, if not NULL then the new object will be copied from it
* @return pointer to the created button matrix
*/
lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("button matrix create started");
@@ -324,7 +324,7 @@ void lv_btnm_set_style(lv_obj_t * btnm, lv_btnm_style_t type, lv_style_t * style
* @param btnm pointer to a button matrix object
* @return the current map
*/
const char ** lv_btnm_get_map(lv_obj_t * btnm)
const char ** lv_btnm_get_map(const lv_obj_t * btnm)
{
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->map_p;
@@ -335,7 +335,7 @@ const char ** lv_btnm_get_map(lv_obj_t * btnm)
* @param btnm: pointer to button matrix object
* @return pointer to the callback function
*/
lv_btnm_action_t lv_btnm_get_action(lv_obj_t * btnm)
lv_btnm_action_t lv_btnm_get_action(const lv_obj_t * btnm)
{
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->action;
@@ -346,7 +346,7 @@ lv_btnm_action_t lv_btnm_get_action(lv_obj_t * btnm)
* @param btnm pointer to button matrix object
* @return index of the currently toggled button (0: if unset)
*/
uint16_t lv_btnm_get_toggled(lv_obj_t * btnm)
uint16_t lv_btnm_get_toggled(const lv_obj_t * btnm)
{
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
@@ -360,7 +360,7 @@ uint16_t lv_btnm_get_toggled(lv_obj_t * btnm)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_btnm_get_style(lv_obj_t * btnm, lv_btnm_style_t type)
lv_style_t * lv_btnm_get_style(const lv_obj_t * btnm, lv_btnm_style_t type)
{
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);

View File

@@ -81,7 +81,7 @@ typedef enum {
* @param copy pointer to a button matrix object, if not NULL then the new object will be copied from it
* @return pointer to the created button matrix
*/
lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -135,14 +135,14 @@ void lv_btnm_set_style(lv_obj_t *btnm, lv_btnm_style_t type, lv_style_t *style);
* @param btnm pointer to a button matrix object
* @return the current map
*/
const char ** lv_btnm_get_map(lv_obj_t * btnm);
const char ** lv_btnm_get_map(const lv_obj_t * btnm);
/**
* Get a the callback function of the buttons on a button matrix
* @param btnm: pointer to button matrix object
* @return pointer to the callback function
*/
lv_btnm_action_t lv_btnm_get_action(lv_obj_t * btnm);
lv_btnm_action_t lv_btnm_get_action(const lv_obj_t * btnm);
/**
@@ -150,7 +150,7 @@ lv_btnm_action_t lv_btnm_get_action(lv_obj_t * btnm);
* @param btnm pointer to button matrix object
* @return index of the currently toggled button (0: if unset)
*/
uint16_t lv_btnm_get_toggled(lv_obj_t * btnm);
uint16_t lv_btnm_get_toggled(const lv_obj_t * btnm);
/**
* Get a style of a button matrix
@@ -158,7 +158,7 @@ uint16_t lv_btnm_get_toggled(lv_obj_t * btnm);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_btnm_get_style(lv_obj_t *btnm, lv_btnm_style_t type);
lv_style_t * lv_btnm_get_style(const lv_obj_t *btnm, lv_btnm_style_t type);
/**********************
* MACROS

View File

@@ -68,7 +68,7 @@ static const char * month_name[12] = {"January", "February", "March", "Ap
* @param copy pointer to a calendar object, if not NULL then the new object will be copied from it
* @return pointer to the created calendar
*/
lv_obj_t * lv_calendar_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("calendar create started");
@@ -281,7 +281,7 @@ void lv_calendar_set_style(lv_obj_t * calendar, lv_calendar_style_t type, lv_sty
* @param calendar pointer to a calendar object
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
*/
lv_calendar_date_t * lv_calendar_get_today_date(lv_obj_t * calendar)
lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return &ext->today;
@@ -292,7 +292,7 @@ lv_calendar_date_t * lv_calendar_get_today_date(lv_obj_t * calendar)
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
*/
lv_calendar_date_t * lv_calendar_get_showed_date(lv_obj_t * calendar)
lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return &ext->showed_date;
@@ -303,7 +303,7 @@ lv_calendar_date_t * lv_calendar_get_showed_date(lv_obj_t * calendar)
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` array containing the dates.
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(lv_obj_t * calendar)
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->highlighted_dates;
@@ -314,7 +314,7 @@ lv_calendar_date_t * lv_calendar_get_highlighted_dates(lv_obj_t * calendar)
* @param calendar pointer to a calendar object
* @return number of highlighted days
*/
uint16_t lv_calendar_get_highlighted_dates_num(lv_obj_t * calendar)
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->highlighted_dates_num;
@@ -325,7 +325,7 @@ uint16_t lv_calendar_get_highlighted_dates_num(lv_obj_t * calendar)
* @param calendar pointer to a calendar object
* @return pointer to the array of day names
*/
const char ** lv_calendar_get_day_names(lv_obj_t * calendar, const char ** day_names)
const char ** lv_calendar_get_day_names(const lv_obj_t * calendar, const char ** day_names)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->day_names;
@@ -336,7 +336,7 @@ const char ** lv_calendar_get_day_names(lv_obj_t * calendar, const char ** day_n
* @param calendar pointer to a calendar object
* @return pointer to the array of month names
*/
const char ** lv_calendar_get_month_names(lv_obj_t * calendar, const char ** day_names)
const char ** lv_calendar_get_month_names(const lv_obj_t * calendar, const char ** day_names)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->month_names;
@@ -348,7 +348,7 @@ const char ** lv_calendar_get_month_names(lv_obj_t * calendar, const char ** day
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_calendar_get_style(lv_obj_t * calendar, lv_calendar_style_t type)
lv_style_t * lv_calendar_get_style(const lv_obj_t * calendar, lv_calendar_style_t type)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);

View File

@@ -82,7 +82,7 @@ typedef enum {
* @param copy pointer to a calendar object, if not NULL then the new object will be copied from it
* @return pointer to the created calendar
*/
lv_obj_t * lv_calendar_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
@@ -149,28 +149,28 @@ void lv_calendar_set_style(lv_obj_t * calendar, lv_calendar_style_t type, lv_sty
* @param calendar pointer to a calendar object
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
*/
lv_calendar_date_t * lv_calendar_get_today_date(lv_obj_t * calendar);
lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar);
/**
* Get the currently showed
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
*/
lv_calendar_date_t * lv_calendar_get_showed_date(lv_obj_t * calendar);
lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar);
/**
* Get the the highlighted dates
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` array containing the dates.
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(lv_obj_t * calendar);
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar);
/**
* Get the number of the highlighted dates
* @param calendar pointer to a calendar object
* @return number of highlighted days
*/
uint16_t lv_calendar_get_highlighted_dates_num(lv_obj_t * calendar);
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar);
/**
@@ -178,14 +178,14 @@ uint16_t lv_calendar_get_highlighted_dates_num(lv_obj_t * calendar);
* @param calendar pointer to a calendar object
* @return pointer to the array of day names
*/
const char ** lv_calendar_get_day_names(lv_obj_t * calendar, const char ** day_names);
const char ** lv_calendar_get_day_names(const lv_obj_t * calendar, const char ** day_names);
/**
* Get the name of the month
* @param calendar pointer to a calendar object
* @return pointer to the array of month names
*/
const char ** lv_calendar_get_month_names(lv_obj_t * calendar, const char ** day_names);
const char ** lv_calendar_get_month_names(const lv_obj_t * calendar, const char ** day_names);
/**
* Get style of a calendar.
@@ -193,7 +193,7 @@ const char ** lv_calendar_get_month_names(lv_obj_t * calendar, const char ** day
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_calendar_get_style(lv_obj_t * calendar, lv_calendar_style_t type);
lv_style_t * lv_calendar_get_style(const lv_obj_t * calendar, lv_calendar_style_t type);
/*=====================
* Other functions

View File

@@ -48,7 +48,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a check box object, if not NULL then the new object will be copied from it
* @return pointer to the created check box
*/
lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("check box create started");
@@ -176,7 +176,7 @@ void lv_cb_set_style(lv_obj_t * cb, lv_cb_style_t type, lv_style_t * style)
* @param cb pointer to check box object
* @return pointer to the text of the check box
*/
const char * lv_cb_get_text(lv_obj_t * cb)
const char * lv_cb_get_text(const lv_obj_t * cb)
{
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
return lv_label_get_text(ext->label);
@@ -189,7 +189,7 @@ const char * lv_cb_get_text(lv_obj_t * cb)
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_cb_get_style(lv_obj_t * cb, lv_cb_style_t type)
lv_style_t * lv_cb_get_style(const lv_obj_t * cb, lv_cb_style_t type)
{
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);

View File

@@ -70,7 +70,7 @@ typedef enum {
* @param copy pointer to a check box object, if not NULL then the new object will be copied from it
* @return pointer to the created check box
*/
lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -129,14 +129,14 @@ void lv_cb_set_style(lv_obj_t * cb, lv_cb_style_t type, lv_style_t *style);
* @param cb pointer to check box object
* @return pointer to the text of the check box
*/
const char * lv_cb_get_text(lv_obj_t * cb);
const char * lv_cb_get_text(const lv_obj_t * cb);
/**
* Get the current state of the check box
* @param cb pointer to a check box object
* @return true: checked; false: not checked
*/
static inline bool lv_cb_is_checked(lv_obj_t * cb)
static inline bool lv_cb_is_checked(const lv_obj_t * cb)
{
return lv_btn_get_state(cb) == LV_BTN_STATE_REL ? false : true;
}
@@ -146,7 +146,7 @@ static inline bool lv_cb_is_checked(lv_obj_t * cb)
* @param cb pointer to a button object
* @return pointer to the action function
*/
static inline lv_action_t lv_cb_get_action(lv_obj_t * cb)
static inline lv_action_t lv_cb_get_action(const lv_obj_t * cb)
{
return lv_btn_get_action(cb, LV_BTN_ACTION_CLICK);
}
@@ -158,7 +158,7 @@ static inline lv_action_t lv_cb_get_action(lv_obj_t * cb)
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_cb_get_style(lv_obj_t * cb, lv_cb_style_t type);
lv_style_t * lv_cb_get_style(const lv_obj_t * cb, lv_cb_style_t type);
/**********************
* MACROS

View File

@@ -55,7 +55,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a chart background object, if not NULL then the new object will be copied from it
* @return pointer to the created chart background
*/
lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
{
@@ -349,7 +349,7 @@ void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
* @param chart pointer to chart object
* @return type of the chart (from 'lv_chart_t' enum)
*/
lv_chart_type_t lv_chart_get_type(lv_obj_t * chart)
lv_chart_type_t lv_chart_get_type(const lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->type;
@@ -360,7 +360,7 @@ lv_chart_type_t lv_chart_get_type(lv_obj_t * chart)
* @param chart pointer to chart object
* @return point number on each data line
*/
uint16_t lv_chart_get_point_cnt(lv_obj_t * chart)
uint16_t lv_chart_get_point_cnt(const lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->point_cnt;
@@ -371,7 +371,7 @@ uint16_t lv_chart_get_point_cnt(lv_obj_t * chart)
* @param chart pointer to chart object
* @return the opacity of the data series
*/
lv_opa_t lv_chart_get_series_opa(lv_obj_t * chart)
lv_opa_t lv_chart_get_series_opa(const lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->series.opa;
@@ -382,7 +382,7 @@ lv_opa_t lv_chart_get_series_opa(lv_obj_t * chart)
* @param chart pointer to chart object
* @return the width the data series (lines or points)
*/
lv_coord_t lv_chart_get_series_width(lv_obj_t * chart)
lv_coord_t lv_chart_get_series_width(const lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->series.width;
@@ -393,7 +393,7 @@ lv_coord_t lv_chart_get_series_width(lv_obj_t * chart)
* @param chart pointer to chart object
* @return dark effect level (LV_OPA_TRANSP to turn off)
*/
lv_opa_t lv_chart_get_series_darking(lv_obj_t * chart)
lv_opa_t lv_chart_get_series_darking(const lv_obj_t * chart)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->series.dark;

View File

@@ -76,7 +76,7 @@ typedef enum
* @param copy pointer to a chart background object, if not NULL then the new object will be copied from it
* @return pointer to the created chart background
*/
lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
@@ -188,42 +188,42 @@ static inline void lv_chart_set_style(lv_obj_t *chart, lv_style_t *style)
* @param chart pointer to chart object
* @return type of the chart (from 'lv_chart_t' enum)
*/
lv_chart_type_t lv_chart_get_type(lv_obj_t * chart);
lv_chart_type_t lv_chart_get_type(const lv_obj_t * chart);
/**
* Get the data point number per data line on chart
* @param chart pointer to chart object
* @return point number on each data line
*/
uint16_t lv_chart_get_point_cnt(lv_obj_t * chart);
uint16_t lv_chart_get_point_cnt(const lv_obj_t * chart);
/**
* Get the opacity of the data series
* @param chart pointer to chart object
* @return the opacity of the data series
*/
lv_opa_t lv_chart_get_series_opa(lv_obj_t * chart);
lv_opa_t lv_chart_get_series_opa(const lv_obj_t * chart);
/**
* Get the data series width
* @param chart pointer to chart object
* @return the width the data series (lines or points)
*/
lv_coord_t lv_chart_get_series_width(lv_obj_t * chart);
lv_coord_t lv_chart_get_series_width(const lv_obj_t * chart);
/**
* Get the dark effect level on the bottom of the points or columns
* @param chart pointer to chart object
* @return dark effect level (LV_OPA_TRANSP to turn off)
*/
lv_opa_t lv_chart_get_series_darking(lv_obj_t * chart);
lv_opa_t lv_chart_get_series_darking(const lv_obj_t * chart);
/**
* Get the style of an chart object
* @param chart pointer to an chart object
* @return pointer to the chart's style
*/
static inline lv_style_t* lv_chart_get_style(lv_obj_t *chart)
static inline lv_style_t* lv_chart_get_style(const lv_obj_t *chart)
{
return lv_obj_get_style(chart);
}

View File

@@ -60,7 +60,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
* @return pointer to the created container
*/
lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
{
@@ -163,7 +163,7 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
* @param cont pointer to container object
* @return the layout from 'lv_cont_layout_t'
*/
lv_layout_t lv_cont_get_layout(lv_obj_t * cont)
lv_layout_t lv_cont_get_layout(const lv_obj_t * cont)
{
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
return ext->layout;
@@ -174,7 +174,7 @@ lv_layout_t lv_cont_get_layout(lv_obj_t * cont)
* @param cont pointer to a container object
* @return true: horizontal fit is enabled; false: disabled
*/
bool lv_cont_get_hor_fit(lv_obj_t * cont)
bool lv_cont_get_hor_fit(const lv_obj_t * cont)
{
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
return ext->hor_fit == 0 ? false : true;
@@ -185,7 +185,7 @@ bool lv_cont_get_hor_fit(lv_obj_t * cont)
* @param cont pointer to a container object
* @return true: vertical fit is enabled; false: disabled
*/
bool lv_cont_get_ver_fit(lv_obj_t * cont)
bool lv_cont_get_ver_fit(const lv_obj_t * cont)
{
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
return ext->ver_fit == 0 ? false : true;

View File

@@ -65,7 +65,7 @@ typedef struct
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
* @return pointer to the created container
*/
lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -107,28 +107,28 @@ static inline void lv_cont_set_style(lv_obj_t *cont, lv_style_t * style)
* @param cont pointer to container object
* @return the layout from 'lv_cont_layout_t'
*/
lv_layout_t lv_cont_get_layout(lv_obj_t * cont);
lv_layout_t lv_cont_get_layout(const lv_obj_t * cont);
/**
* Get horizontal fit enable attribute of a container
* @param cont pointer to a container object
* @return true: horizontal fit is enabled; false: disabled
*/
bool lv_cont_get_hor_fit(lv_obj_t * cont);
bool lv_cont_get_hor_fit(const lv_obj_t * cont);
/**
* Get vertical fit enable attribute of a container
* @param cont pointer to a container object
* @return true: vertical fit is enabled; false: disabled
*/
bool lv_cont_get_ver_fit(lv_obj_t * cont);
bool lv_cont_get_ver_fit(const lv_obj_t * cont);
/**
* Get the style of a container
* @param cont pointer to a container object
* @return pointer to the container's style
*/
static inline lv_style_t * lv_cont_get_style(lv_obj_t *cont)
static inline lv_style_t * lv_cont_get_style(const lv_obj_t *cont)
{
return lv_obj_get_style(cont);
}

View File

@@ -64,7 +64,7 @@ static lv_design_func_t ancestor_design;
* @param copy pointer to a drop down list object, if not NULL then the new object will be copied from it
* @return pointer to the created drop down list
*/
lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("drop down list create started");
@@ -280,7 +280,7 @@ void lv_ddlist_set_style(lv_obj_t * ddlist, lv_ddlist_style_t type, lv_style_t *
* @param ddlist pointer to drop down list object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_ddlist_get_options(lv_obj_t * ddlist)
const char * lv_ddlist_get_options(const lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
return lv_label_get_text(ext->label);
@@ -291,7 +291,7 @@ const char * lv_ddlist_get_options(lv_obj_t * ddlist)
* @param ddlist pointer to drop down list object
* @return id of the selected option (0 ... number of option - 1);
*/
uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist)
uint16_t lv_ddlist_get_selected(const lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
@@ -303,7 +303,7 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist)
* @param ddlist pointer to ddlist object
* @param buf pointer to an array to store the string
*/
void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf)
void lv_ddlist_get_selected_str(const lv_obj_t * ddlist, char * buf)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
@@ -328,7 +328,7 @@ void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf)
* @param ddlist pointer to a drop down list
* @return pointer to the call back function
*/
lv_action_t lv_ddlist_get_action(lv_obj_t * ddlist)
lv_action_t lv_ddlist_get_action(const lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
return ext->action;
@@ -339,7 +339,7 @@ lv_action_t lv_ddlist_get_action(lv_obj_t * ddlist)
* @param ddlist pointer to a drop down list object
* @return the height if the ddlist is opened (0: auto size)
*/
lv_coord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist)
lv_coord_t lv_ddlist_get_fix_height(const lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
return ext->fix_height;
@@ -350,7 +350,7 @@ lv_coord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist)
* @param ddlist pointer to a drop down list
* @return open/close animation time [ms]
*/
uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist)
uint16_t lv_ddlist_get_anim_time(const lv_obj_t * ddlist)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
return ext->anim_time;
@@ -363,7 +363,7 @@ uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_ddlist_get_style(lv_obj_t * ddlist, lv_ddlist_style_t type)
lv_style_t * lv_ddlist_get_style(const lv_obj_t * ddlist, lv_ddlist_style_t type)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);

View File

@@ -72,7 +72,7 @@ typedef enum {
* @param copy pointer to a drop down list object, if not NULL then the new object will be copied from it
* @return pointer to the created drop down list
*/
lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -149,42 +149,42 @@ void lv_ddlist_set_style(lv_obj_t *ddlist, lv_ddlist_style_t type, lv_style_t *s
* @param ddlist pointer to drop down list object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_ddlist_get_options(lv_obj_t * ddlist);
const char * lv_ddlist_get_options(const lv_obj_t * ddlist);
/**
* Get the selected option
* @param ddlist pointer to drop down list object
* @return id of the selected option (0 ... number of option - 1);
*/
uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
uint16_t lv_ddlist_get_selected(const lv_obj_t * ddlist);
/**
* Get the current selected option as a string
* @param ddlist pointer to ddlist object
* @param buf pointer to an array to store the string
*/
void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf);
void lv_ddlist_get_selected_str(const lv_obj_t * ddlist, char * buf);
/**
* Get the "option selected" callback function
* @param ddlist pointer to a drop down list
* @return pointer to the call back function
*/
lv_action_t lv_ddlist_get_action(lv_obj_t * ddlist);
lv_action_t lv_ddlist_get_action(const lv_obj_t * ddlist);
/**
* Get the fix height value.
* @param ddlist pointer to a drop down list object
* @return the height if the ddlist is opened (0: auto size)
*/
lv_coord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
lv_coord_t lv_ddlist_get_fix_height(const lv_obj_t * ddlist);
/**
* Get the scroll bar mode of a drop down list
* @param ddlist pointer to a drop down list object
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
*/
static inline lv_sb_mode_t lv_ddlist_get_sb_mode(lv_obj_t * ddlist)
static inline lv_sb_mode_t lv_ddlist_get_sb_mode(const lv_obj_t * ddlist)
{
return lv_page_get_sb_mode(ddlist);
}
@@ -194,7 +194,7 @@ static inline lv_sb_mode_t lv_ddlist_get_sb_mode(lv_obj_t * ddlist)
* @param ddlist pointer to a drop down list
* @return open/close animation time [ms]
*/
uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist);
uint16_t lv_ddlist_get_anim_time(const lv_obj_t * ddlist);
/**
* Get a style of a drop down list
@@ -202,7 +202,7 @@ uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_ddlist_get_style(lv_obj_t *ddlist, lv_ddlist_style_t type);
lv_style_t * lv_ddlist_get_style(const lv_obj_t *ddlist, lv_ddlist_style_t type);
/*=====================
* Other functions

View File

@@ -58,7 +58,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a gauge object, if not NULL then the new object will be copied from it
* @return pointer to the created gauge
*/
lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("gauge create started");
@@ -208,7 +208,7 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
* @param needle the id of the needle
* @return the value of the needle [min,max]
*/
int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle)
int16_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
int16_t min = lv_gauge_get_min_value(gauge);
@@ -223,7 +223,7 @@ int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle)
* @param gauge pointer to gauge
* @return count of needles
*/
uint8_t lv_gauge_get_needle_count(lv_obj_t * gauge)
uint8_t lv_gauge_get_needle_count(const lv_obj_t * gauge)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->needle_count;
@@ -234,7 +234,7 @@ uint8_t lv_gauge_get_needle_count(lv_obj_t * gauge)
* @param gauge pointer to a gauge object
* @return count of labels
*/
uint8_t lv_gauge_get_label_count(lv_obj_t * gauge)
uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->label_count;

View File

@@ -60,7 +60,7 @@ typedef struct
* @param copy pointer to a gauge object, if not NULL then the new object will be copied from it
* @return pointer to the created gauge
*/
lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -132,21 +132,21 @@ static inline void lv_gauge_set_style(lv_obj_t *gauge, lv_style_t *bg)
* @param needle the id of the needle
* @return the value of the needle [min,max]
*/
int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle);
int16_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle);
/**
* Get the count of needles on a gauge
* @param gauge pointer to gauge
* @return count of needles
*/
uint8_t lv_gauge_get_needle_count(lv_obj_t * gauge);
uint8_t lv_gauge_get_needle_count(const lv_obj_t * gauge);
/**
* Get the minimum value of a gauge
* @param gauge pointer to a gauge object
* @return the minimum value of the gauge
*/
static inline int16_t lv_gauge_get_min_value(lv_obj_t * lmeter)
static inline int16_t lv_gauge_get_min_value(const lv_obj_t * lmeter)
{
return lv_lmeter_get_min_value(lmeter);
}
@@ -156,7 +156,7 @@ static inline int16_t lv_gauge_get_min_value(lv_obj_t * lmeter)
* @param gauge pointer to a gauge object
* @return the maximum value of the gauge
*/
static inline int16_t lv_gauge_get_max_value(lv_obj_t * lmeter)
static inline int16_t lv_gauge_get_max_value(const lv_obj_t * lmeter)
{
return lv_lmeter_get_max_value(lmeter);
}
@@ -166,7 +166,7 @@ static inline int16_t lv_gauge_get_max_value(lv_obj_t * lmeter)
* @param gauge pointer to a gauge object
* @return the critical value
*/
static inline int16_t lv_gauge_get_critical_value(lv_obj_t * gauge)
static inline int16_t lv_gauge_get_critical_value(const lv_obj_t * gauge)
{
return lv_lmeter_get_value(gauge);
}
@@ -176,14 +176,14 @@ static inline int16_t lv_gauge_get_critical_value(lv_obj_t * gauge)
* @param gauge pointer to a gauge object
* @return count of labels
*/
uint8_t lv_gauge_get_label_count(lv_obj_t * gauge);
uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge);
/**
* Get the scale number of a gauge
* @param gauge pointer to a gauge object
* @return number of the scale units
*/
static inline uint8_t lv_gauge_get_line_count(lv_obj_t * gauge)
static inline uint8_t lv_gauge_get_line_count(const lv_obj_t * gauge)
{
return lv_lmeter_get_line_count(gauge);
}
@@ -193,7 +193,7 @@ static inline uint8_t lv_gauge_get_line_count(lv_obj_t * gauge)
* @param gauge pointer to a gauge object
* @return angle of the scale
*/
static inline uint16_t lv_gauge_get_scale_angle(lv_obj_t * gauge)
static inline uint16_t lv_gauge_get_scale_angle(const lv_obj_t * gauge)
{
return lv_lmeter_get_scale_angle(gauge);
}
@@ -203,7 +203,7 @@ static inline uint16_t lv_gauge_get_scale_angle(lv_obj_t * gauge)
* @param gauge pointer to a gauge object
* @return pointer to the gauge's style
*/
static inline lv_style_t * lv_gauge_get_style(lv_obj_t *gauge)
static inline lv_style_t * lv_gauge_get_style(const lv_obj_t *gauge)
{
return lv_obj_get_style(gauge);
}

View File

@@ -52,7 +52,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a image object, if not NULL then the new object will be copied from it
* @return pointer to the created image
*/
lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("image create started");
@@ -254,7 +254,7 @@ lv_img_src_t lv_img_get_src_type(const void * src)
* @param img pointer to an image
* @return file name
*/
const char * lv_img_get_file_name(lv_obj_t * img)
const char * lv_img_get_file_name(const lv_obj_t * img)
{
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
@@ -268,7 +268,7 @@ const char * lv_img_get_file_name(lv_obj_t * img)
* @param img pointer to an image
* @return true: auto size is enabled, false: auto size is disabled
*/
bool lv_img_get_auto_size(lv_obj_t * img)
bool lv_img_get_auto_size(const lv_obj_t * img)
{
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);

View File

@@ -59,7 +59,7 @@ typedef struct
* @param copy pointer to a image object, if not NULL then the new object will be copied from it
* @return pointer to the created image
*/
lv_obj_t * lv_img_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -131,21 +131,21 @@ lv_img_src_t lv_img_get_src_type(const void * src);
* @param img pointer to an image
* @return file name
*/
const char * lv_img_get_file_name(lv_obj_t * img);
const char * lv_img_get_file_name(const lv_obj_t * img);
/**
* Get the auto size enable attribute
* @param img pointer to an image
* @return true: auto size is enabled, false: auto size is disabled
*/
bool lv_img_get_auto_size(lv_obj_t * img);
bool lv_img_get_auto_size(const lv_obj_t * img);
/**
* Get the style of an image object
* @param img pointer to an image object
* @return pointer to the image's style
*/
static inline lv_style_t* lv_img_get_style(lv_obj_t *img)
static inline lv_style_t* lv_img_get_style(const lv_obj_t *img)
{
return lv_obj_get_style(img);
}
@@ -155,7 +155,7 @@ static inline lv_style_t* lv_img_get_style(lv_obj_t *img)
* @param img -
* @return false
*/
static inline bool lv_img_get_upscale(lv_obj_t * img)
static inline bool lv_img_get_upscale(const lv_obj_t * img)
{
return false;
}

View File

@@ -73,7 +73,7 @@ static const char * kb_map_num[] = {
* @param copy pointer to a keyboard object, if not NULL then the new object will be copied from it
* @return pointer to the created keyboard
*/
lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("keyboard create started");
@@ -271,7 +271,7 @@ void lv_kb_set_style(lv_obj_t * kb, lv_kb_style_t type, lv_style_t * style)
* @param kb pointer to a Keyboard object
* @return pointer to the assigned Text Area object
*/
lv_obj_t * lv_kb_get_ta(lv_obj_t * kb)
lv_obj_t * lv_kb_get_ta(const lv_obj_t * kb)
{
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->ta;
@@ -282,7 +282,7 @@ lv_obj_t * lv_kb_get_ta(lv_obj_t * kb)
* @param kb pointer to a Keyboard object
* @return the current mode from 'lv_kb_mode_t'
*/
lv_kb_mode_t lv_kb_get_mode(lv_obj_t * kb)
lv_kb_mode_t lv_kb_get_mode(const lv_obj_t * kb)
{
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->mode;
@@ -294,7 +294,7 @@ lv_kb_mode_t lv_kb_get_mode(lv_obj_t * kb)
* @param kb pointer to a Keyboard object
* @return true: show cursor on the current text area, false: hide cursor
*/
bool lv_kb_get_cursor_manage(lv_obj_t * kb)
bool lv_kb_get_cursor_manage(const lv_obj_t * kb)
{
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->cursor_mng == 0 ? false : true;
@@ -305,7 +305,7 @@ bool lv_kb_get_cursor_manage(lv_obj_t * kb)
* @param kb pointer to Keyboard object
* @return the ok callback
*/
lv_action_t lv_kb_get_ok_action(lv_obj_t * kb)
lv_action_t lv_kb_get_ok_action(const lv_obj_t * kb)
{
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->ok_action;
@@ -316,7 +316,7 @@ lv_action_t lv_kb_get_ok_action(lv_obj_t * kb)
* @param kb pointer to Keyboard object
* @return the close callback
*/
lv_action_t lv_kb_get_hide_action(lv_obj_t * kb)
lv_action_t lv_kb_get_hide_action(const lv_obj_t * kb)
{
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->hide_action;
@@ -328,7 +328,7 @@ lv_action_t lv_kb_get_hide_action(lv_obj_t * kb)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_kb_get_style(lv_obj_t * kb, lv_kb_style_t type)
lv_style_t * lv_kb_get_style(const lv_obj_t * kb, lv_kb_style_t type)
{
switch(type) {
case LV_KB_STYLE_BG:

View File

@@ -77,7 +77,7 @@ typedef enum {
* @param copy pointer to a keyboard object, if not NULL then the new object will be copied from it
* @return pointer to the created keyboard
*/
lv_obj_t * lv_kb_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -146,35 +146,35 @@ void lv_kb_set_style(lv_obj_t *kb, lv_kb_style_t type, lv_style_t *style);
* @param kb pointer to a Keyboard object
* @return pointer to the assigned Text Area object
*/
lv_obj_t * lv_kb_get_ta(lv_obj_t * kb);
lv_obj_t * lv_kb_get_ta(const lv_obj_t * kb);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @return the current mode from 'lv_kb_mode_t'
*/
lv_kb_mode_t lv_kb_get_mode(lv_obj_t * kb);
lv_kb_mode_t lv_kb_get_mode(const lv_obj_t * kb);
/**
* Get the current cursor manage mode.
* @param kb pointer to a Keyboard object
* @return true: show cursor on the current text area, false: hide cursor
*/
bool lv_kb_get_cursor_manage(lv_obj_t * kb);
bool lv_kb_get_cursor_manage(const lv_obj_t * kb);
/**
* Get the callback to call when the "Ok" button is pressed
* @param kb pointer to Keyboard object
* @return the ok callback
*/
lv_action_t lv_kb_get_ok_action(lv_obj_t * kb);
lv_action_t lv_kb_get_ok_action(const lv_obj_t * kb);
/**
* Get the callback to call when the "Hide" button is pressed
* @param kb pointer to Keyboard object
* @return the close callback
*/
lv_action_t lv_kb_get_hide_action(lv_obj_t * kb);
lv_action_t lv_kb_get_hide_action(const lv_obj_t * kb);
/**
* Get a style of a keyboard
@@ -182,7 +182,7 @@ lv_action_t lv_kb_get_hide_action(lv_obj_t * kb);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_kb_get_style(lv_obj_t *kb, lv_kb_style_t type);
lv_style_t * lv_kb_get_style(const lv_obj_t *kb, lv_kb_style_t type);
/**********************
* MACROS

View File

@@ -62,7 +62,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("label create started");
@@ -337,7 +337,7 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
* @param label pointer to a label object
* @return the text of the label
*/
char * lv_label_get_text(lv_obj_t * label)
char * lv_label_get_text(const lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
@@ -349,7 +349,7 @@ char * lv_label_get_text(lv_obj_t * label)
* @param label pointer to a label object
* @return the long mode
*/
lv_label_long_mode_t lv_label_get_long_mode(lv_obj_t * label)
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->long_mode;
@@ -360,7 +360,7 @@ lv_label_long_mode_t lv_label_get_long_mode(lv_obj_t * label)
* @param label pointer to a label object
* @return LV_LABEL_ALIGN_LEFT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_label_get_align(lv_obj_t * label)
lv_label_align_t lv_label_get_align(const lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->align;
@@ -371,7 +371,7 @@ lv_label_align_t lv_label_get_align(lv_obj_t * label)
* @param label pointer to a label object
* @return true: recoloring is enabled, false: disable
*/
bool lv_label_get_recolor(lv_obj_t * label)
bool lv_label_get_recolor(const lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->recolor == 0 ? false : true;
@@ -382,7 +382,7 @@ bool lv_label_get_recolor(lv_obj_t * label)
* @param label pointer to a label object
* @return true: draw body; false: don't draw body
*/
bool lv_label_get_body_draw(lv_obj_t * label)
bool lv_label_get_body_draw(const lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->body_draw == 0 ? false : true;
@@ -393,7 +393,7 @@ bool lv_label_get_body_draw(lv_obj_t * label)
* @param label pointer to a label object
* @return speed of animation in px/sec unit
*/
uint16_t lv_label_get_anim_speed(lv_obj_t * label)
uint16_t lv_label_get_anim_speed(const lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->anim_speed;
@@ -405,7 +405,7 @@ uint16_t lv_label_get_anim_speed(lv_obj_t * label)
* @param index index of the letter [0 ... text length]. Expressed in character index, not byte index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
*/
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, lv_point_t * pos)
void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t * pos)
{
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
@@ -487,7 +487,7 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, lv_point_t * pos)
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint16_t lv_label_get_letter_on(lv_obj_t * label, lv_point_t * pos)
uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
{
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);

View File

@@ -86,7 +86,7 @@ typedef struct
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -169,42 +169,42 @@ static inline void lv_label_set_style(lv_obj_t *label, lv_style_t *style)
* @param label pointer to a label object
* @return the text of the label
*/
char * lv_label_get_text(lv_obj_t * label);
char * lv_label_get_text(const lv_obj_t * label);
/**
* Get the long mode of a label
* @param label pointer to a label object
* @return the long mode
*/
lv_label_long_mode_t lv_label_get_long_mode(lv_obj_t * label);
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label);
/**
* Get the align attribute
* @param label pointer to a label object
* @return LV_LABEL_ALIGN_LEFT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_label_get_align(lv_obj_t * label);
lv_label_align_t lv_label_get_align(const lv_obj_t * label);
/**
* Get the recoloring attribute
* @param label pointer to a label object
* @return true: recoloring is enabled, false: disable
*/
bool lv_label_get_recolor(lv_obj_t * label);
bool lv_label_get_recolor(const lv_obj_t * label);
/**
* Get the body draw attribute
* @param label pointer to a label object
* @return true: draw body; false: don't draw body
*/
bool lv_label_get_body_draw(lv_obj_t *label);
bool lv_label_get_body_draw(const lv_obj_t *label);
/**
* Get the label's animation speed in LV_LABEL_LONG_ROLL and SCROLL modes
* @param label pointer to a label object
* @return speed of animation in px/sec unit
*/
uint16_t lv_label_get_anim_speed(lv_obj_t *label);
uint16_t lv_label_get_anim_speed(const lv_obj_t *label);
/**
* Get the relative x and y coordinates of a letter
@@ -212,7 +212,7 @@ uint16_t lv_label_get_anim_speed(lv_obj_t *label);
* @param index index of the letter [0 ... text length]. Expressed in character index, not byte index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
*/
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, lv_point_t * pos);
void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t * pos);
/**
* Get the index of letter on a relative point of a label
@@ -221,14 +221,14 @@ void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, lv_point_t * pos)
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint16_t lv_label_get_letter_on(lv_obj_t * label, lv_point_t * pos);
uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos);
/**
* Get the style of an label object
* @param label pointer to an label object
* @return pointer to the label's style
*/
static inline lv_style_t* lv_label_get_style(lv_obj_t *label)
static inline lv_style_t* lv_label_get_style(const lv_obj_t *label)
{
return lv_obj_get_style(label);
}

View File

@@ -50,7 +50,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a led object, if not NULL then the new object will be copied from it
* @return pointer to the created led
*/
lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("led create started");
@@ -159,7 +159,7 @@ void lv_led_toggle(lv_obj_t * led)
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_bright(lv_obj_t * led)
uint8_t lv_led_get_bright(const lv_obj_t * led)
{
lv_led_ext_t * ext = lv_obj_get_ext_attr(led);
return ext->bright;

View File

@@ -49,7 +49,7 @@ typedef struct
* @param copy pointer to a led object, if not NULL then the new object will be copied from it
* @return pointer to the created led
*/
lv_obj_t * lv_led_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Set the brightness of a LED object
@@ -91,14 +91,14 @@ static inline void lv_led_set_style(lv_obj_t *led, lv_style_t *style)
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_bright(lv_obj_t * led);
uint8_t lv_led_get_bright(const lv_obj_t * led);
/**
* Get the style of an led object
* @param led pointer to an led object
* @return pointer to the led's style
*/
static inline lv_style_t* lv_led_get_style(lv_obj_t *led)
static inline lv_style_t* lv_led_get_style(const lv_obj_t *led)
{
return lv_obj_get_style(led);
}

View File

@@ -48,7 +48,7 @@ static lv_signal_func_t ancestor_signal;
* @param par pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("line create started");
@@ -171,7 +171,7 @@ void lv_line_set_y_invert(lv_obj_t * line, bool yinv_en)
* @param line pointer to a line object
* @return true: auto size is enabled, false: disabled
*/
bool lv_line_get_auto_size(lv_obj_t * line)
bool lv_line_get_auto_size(const lv_obj_t * line)
{
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
@@ -183,7 +183,7 @@ bool lv_line_get_auto_size(lv_obj_t * line)
* @param line pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
bool lv_line_get_y_inv(lv_obj_t * line)
bool lv_line_get_y_inv(const lv_obj_t * line)
{
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);

View File

@@ -51,7 +51,7 @@ typedef struct
* @param par pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
lv_obj_t * lv_line_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -111,21 +111,21 @@ static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale)
* @param line pointer to a line object
* @return true: auto size is enabled, false: disabled
*/
bool lv_line_get_auto_size(lv_obj_t * line);
bool lv_line_get_auto_size(const lv_obj_t * line);
/**
* Get the y inversion attribute
* @param line pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
bool lv_line_get_y_inv(lv_obj_t * line);
bool lv_line_get_y_inv(const lv_obj_t * line);
/**
* Get the style of an line object
* @param line pointer to an line object
* @return pointer to the line's style
*/
static inline lv_style_t* lv_line_get_style(lv_obj_t *line)
static inline lv_style_t* lv_line_get_style(const lv_obj_t *line)
{
return lv_obj_get_style(line);
}
@@ -135,7 +135,7 @@ static inline lv_style_t* lv_line_get_style(lv_obj_t *line)
* @param line -
* @return false
*/
static inline bool lv_line_get_upscale(lv_obj_t * line)
static inline bool lv_line_get_upscale(const lv_obj_t * line)
{
return false;
}

View File

@@ -37,8 +37,8 @@
**********************/
static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
static lv_obj_t * get_next_btn(lv_obj_t * list, lv_obj_t * prev_btn);
static lv_obj_t * get_prev_btn(lv_obj_t * list, lv_obj_t * prev_btn);
static lv_obj_t * get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
static lv_obj_t * get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
static void refr_btn_width(lv_obj_t * list);
/**********************
@@ -69,7 +69,7 @@ static lv_obj_t * last_clicked_btn;
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("list create started");
@@ -312,7 +312,7 @@ void lv_list_set_style(lv_obj_t * list, lv_list_style_t type, lv_style_t * style
* @param btn pointer to list element
* @return pointer to the text
*/
const char * lv_list_get_btn_text(lv_obj_t * btn)
const char * lv_list_get_btn_text(const lv_obj_t * btn)
{
lv_obj_t * label = lv_list_get_btn_label(btn);
if(label == NULL) return "";
@@ -324,7 +324,7 @@ const char * lv_list_get_btn_text(lv_obj_t * btn)
* @param btn pointer to a list element (button)
* @return pointer to the label from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_label(lv_obj_t * btn)
lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn)
{
lv_obj_t * label = lv_obj_get_child(btn, NULL);
if(label == NULL) return NULL;
@@ -342,7 +342,7 @@ lv_obj_t * lv_list_get_btn_label(lv_obj_t * btn)
* @param btn pointer to a list element (button)
* @return pointer to the image from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_img(lv_obj_t * btn)
lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn)
{
#if USE_LV_IMG != 0
lv_obj_t * img = lv_obj_get_child(btn, NULL);
@@ -364,7 +364,7 @@ lv_obj_t * lv_list_get_btn_img(lv_obj_t * btn)
* @param list pointer to a list object
* @return duration of animation [ms]
*/
uint16_t lv_list_get_anim_time(lv_obj_t * list)
uint16_t lv_list_get_anim_time(const lv_obj_t * list)
{
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
return ext->anim_time;
@@ -376,7 +376,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_list_style_t type)
lv_style_t * lv_list_get_style(const lv_obj_t * list, lv_list_style_t type)
{
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
@@ -412,7 +412,7 @@ lv_style_t * lv_list_get_style(lv_obj_t * list, lv_list_style_t type)
* Move the list elements up by one
* @param list pointer a to list object
*/
void lv_list_up(lv_obj_t * list)
void lv_list_up(const lv_obj_t * list)
{
/*Search the first list element which 'y' coordinate is below the parent
* and position the list to show this element on the bottom*/
@@ -457,7 +457,7 @@ void lv_list_up(lv_obj_t * list)
* Move the list elements down by one
* @param list pointer to a list object
*/
void lv_list_down(lv_obj_t * list)
void lv_list_down(const lv_obj_t * list)
{
/*Search the first list element which 'y' coordinate is above the parent
* and position the list to show this element on the top*/
@@ -500,7 +500,7 @@ void lv_list_down(lv_obj_t * list)
* @param btn pointer to a list button to focus
* @param anim_en true: scroll with animation, false: without animation
*/
void lv_list_focus(lv_obj_t * btn, bool anim_en)
void lv_list_focus(const lv_obj_t * btn, bool anim_en)
{
#if USE_LV_ANIMATION == 0
@@ -701,7 +701,7 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
* @param prev_btn pointer to button. Search the next after it.
* @return pointer to the next button or NULL when no more buttons
*/
static lv_obj_t * get_next_btn(lv_obj_t * list, lv_obj_t * prev_btn)
static lv_obj_t * get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
{
/* Not a good practice but user can add/create objects to the lists manually.
* When getting the next button try to be sure that it is at least a button */
@@ -727,7 +727,7 @@ static lv_obj_t * get_next_btn(lv_obj_t * list, lv_obj_t * prev_btn)
* @param prev_btn pointer to button. Search the previous before it.
* @return pointer to the previous button or NULL when no more buttons
*/
static lv_obj_t * get_prev_btn(lv_obj_t * list, lv_obj_t * prev_btn)
static lv_obj_t * get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
{
/* Not a good practice but user can add/create objects to the lists manually.
* When getting the next button try to be sure that it is at least a button */

View File

@@ -79,7 +79,7 @@ typedef enum {
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
@@ -139,34 +139,34 @@ void lv_list_set_style(lv_obj_t *list, lv_list_style_t type, lv_style_t *style);
* @param btn pointer to list element
* @return pointer to the text
*/
const char * lv_list_get_btn_text(lv_obj_t * btn);
const char * lv_list_get_btn_text(const lv_obj_t * btn);
/**
* Get the label object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the label from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_label(lv_obj_t * btn);
lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn);
/**
* Get the image object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the image from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_img(lv_obj_t * btn);
lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn);
/**
* Get scroll animation duration
* @param list pointer to a list object
* @return duration of animation [ms]
*/
uint16_t lv_list_get_anim_time(lv_obj_t *list);
uint16_t lv_list_get_anim_time(const lv_obj_t *list);
/**
* Get the scroll bar mode of a list
* @param list pointer to a list object
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
*/
static inline lv_sb_mode_t lv_list_get_sb_mode(lv_obj_t * list)
static inline lv_sb_mode_t lv_list_get_sb_mode(const lv_obj_t * list)
{
return lv_page_get_sb_mode(list);
}
@@ -177,7 +177,7 @@ static inline lv_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_list_style_t type);
lv_style_t * lv_list_get_style(const lv_obj_t *list, lv_list_style_t type);
/*=====================
* Other functions
@@ -187,19 +187,19 @@ lv_style_t * lv_list_get_style(lv_obj_t *list, lv_list_style_t type);
* Move the list elements up by one
* @param list pointer a to list object
*/
void lv_list_up(lv_obj_t * list);
void lv_list_up(const lv_obj_t * list);
/**
* Move the list elements down by one
* @param list pointer to a list object
*/
void lv_list_down(lv_obj_t * list);
void lv_list_down(const lv_obj_t * list);
/**
* Focus on a list button. It ensures that the button will be visible on the list.
* @param btn pointer to a list button to focus
* @param anim_en true: scroll with animation, false: without animation
*/
void lv_list_focus(lv_obj_t *btn, bool anim_en);
void lv_list_focus(const lv_obj_t *btn, bool anim_en);
/**********************
* MACROS

View File

@@ -50,7 +50,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a line meter object, if not NULL then the new object will be copied from it
* @return pointer to the created line meter
*/
lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("line meter create started");
@@ -177,7 +177,7 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt)
* @param lmeter pointer to a line meter object
* @return the value of the line meter
*/
int16_t lv_lmeter_get_value(lv_obj_t * lmeter)
int16_t lv_lmeter_get_value(const lv_obj_t * lmeter)
{
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->cur_value;
@@ -188,7 +188,7 @@ int16_t lv_lmeter_get_value(lv_obj_t * lmeter)
* @param lmeter pointer to a line meter object
* @return the minimum value of the line meter
*/
int16_t lv_lmeter_get_min_value(lv_obj_t * lmeter)
int16_t lv_lmeter_get_min_value(const lv_obj_t * lmeter)
{
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->min_value;
@@ -199,7 +199,7 @@ int16_t lv_lmeter_get_min_value(lv_obj_t * lmeter)
* @param lmeter pointer to a line meter object
* @return the maximum value of the line meter
*/
int16_t lv_lmeter_get_max_value(lv_obj_t * lmeter)
int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter)
{
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->max_value;
@@ -210,7 +210,7 @@ int16_t lv_lmeter_get_max_value(lv_obj_t * lmeter)
* @param lmeter pointer to a line meter object
* @return number of the scale units
*/
uint8_t lv_lmeter_get_line_count(lv_obj_t * lmeter)
uint8_t lv_lmeter_get_line_count(const lv_obj_t * lmeter)
{
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->line_cnt ;
@@ -221,7 +221,7 @@ uint8_t lv_lmeter_get_line_count(lv_obj_t * lmeter)
* @param lmeter pointer to a line meter object
* @return angle of the scale
*/
uint16_t lv_lmeter_get_scale_angle(lv_obj_t * lmeter)
uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter)
{
lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->scale_angle;

View File

@@ -52,7 +52,7 @@ typedef struct
* @param copy pointer to a line meter object, if not NULL then the new object will be copied from it
* @return pointer to the created line meter
*/
lv_obj_t * lv_lmeter_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -100,42 +100,42 @@ static inline void lv_lmeter_set_style(lv_obj_t *lmeter, lv_style_t *bg)
* @param lmeter pointer to a line meter object
* @return the value of the line meter
*/
int16_t lv_lmeter_get_value(lv_obj_t *lmeter);
int16_t lv_lmeter_get_value(const lv_obj_t *lmeter);
/**
* Get the minimum value of a line meter
* @param lmeter pointer to a line meter object
* @return the minimum value of the line meter
*/
int16_t lv_lmeter_get_min_value(lv_obj_t * lmeter);
int16_t lv_lmeter_get_min_value(const lv_obj_t * lmeter);
/**
* Get the maximum value of a line meter
* @param lmeter pointer to a line meter object
* @return the maximum value of the line meter
*/
int16_t lv_lmeter_get_max_value(lv_obj_t * lmeter);
int16_t lv_lmeter_get_max_value(const lv_obj_t * lmeter);
/**
* Get the scale number of a line meter
* @param lmeter pointer to a line meter object
* @return number of the scale units
*/
uint8_t lv_lmeter_get_line_count(lv_obj_t * lmeter);
uint8_t lv_lmeter_get_line_count(const lv_obj_t * lmeter);
/**
* Get the scale angle of a line meter
* @param lmeter pointer to a line meter object
* @return angle of the scale
*/
uint16_t lv_lmeter_get_scale_angle(lv_obj_t * lmeter);
uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter);
/**
* Get the style of a line meter
* @param lmeter pointer to a line meter object
* @return pointer to the line meter's style
*/
static inline lv_style_t * lv_lmeter_get_style(lv_obj_t * lmeter)
static inline lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter)
{
return lv_obj_get_style(lmeter);
}

View File

@@ -58,7 +58,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a message box object, if not NULL then the new object will be copied from it
* @return pointer to the created message box
*/
lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("mesasge box create started");
@@ -285,7 +285,7 @@ void lv_mbox_set_style(lv_obj_t * mbox, lv_mbox_style_t type, lv_style_t * style
* @param mbox pointer to a message box object
* @return pointer to the text of the message box
*/
const char * lv_mbox_get_text(lv_obj_t * mbox)
const char * lv_mbox_get_text(const lv_obj_t * mbox)
{
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
@@ -298,7 +298,7 @@ const char * lv_mbox_get_text(lv_obj_t * mbox)
* @param btn pointer to a button of a message box
* @return pointer to the button's message box
*/
lv_obj_t * lv_mbox_get_from_btn(lv_obj_t * btn)
lv_obj_t * lv_mbox_get_from_btn(const lv_obj_t * btn)
{
lv_obj_t * mbox = lv_obj_get_parent(btn);
@@ -310,7 +310,7 @@ lv_obj_t * lv_mbox_get_from_btn(lv_obj_t * btn)
* @param mbox pointer to a message box object
* @return animation length in milliseconds (0: no animation)
*/
uint16_t lv_mbox_get_anim_time(lv_obj_t * mbox)
uint16_t lv_mbox_get_anim_time(const lv_obj_t * mbox)
{
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
return ext->anim_time;
@@ -322,7 +322,7 @@ uint16_t lv_mbox_get_anim_time(lv_obj_t * mbox)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_mbox_get_style(lv_obj_t * mbox, lv_mbox_style_t type)
lv_style_t * lv_mbox_get_style(const lv_obj_t * mbox, lv_mbox_style_t type)
{
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);

View File

@@ -78,7 +78,7 @@ typedef enum {
* @param copy pointer to a message box object, if not NULL then the new object will be copied from it
* @return pointer to the created message box
*/
lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
@@ -148,7 +148,7 @@ void lv_mbox_set_style(lv_obj_t *mbox, lv_mbox_style_t type, lv_style_t *style);
* @param mbox pointer to a message box object
* @return pointer to the text of the message box
*/
const char * lv_mbox_get_text(lv_obj_t * mbox);
const char * lv_mbox_get_text(const lv_obj_t * mbox);
/**
* Get the message box object from one of its button.
@@ -156,14 +156,14 @@ const char * lv_mbox_get_text(lv_obj_t * mbox);
* @param btn pointer to a button of a message box
* @return pointer to the button's message box
*/
lv_obj_t * lv_mbox_get_from_btn(lv_obj_t * btn);
lv_obj_t * lv_mbox_get_from_btn(const lv_obj_t * btn);
/**
* Get the animation duration (close animation time)
* @param mbox pointer to a message box object
* @return animation length in milliseconds (0: no animation)
*/
uint16_t lv_mbox_get_anim_time(lv_obj_t * mbox);
uint16_t lv_mbox_get_anim_time(const lv_obj_t * mbox);
/**
@@ -172,7 +172,7 @@ uint16_t lv_mbox_get_anim_time(lv_obj_t * mbox);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_mbox_get_style(lv_obj_t *mbox, lv_mbox_style_t type);
lv_style_t * lv_mbox_get_style(const lv_obj_t *mbox, lv_mbox_style_t type);
/**********************
* MACROS

View File

@@ -51,7 +51,7 @@ static lv_design_func_t ancestor_design;
* @param copy pointer to a template object, if not NULL then the new object will be copied from it
* @return pointer to the created template
*/
lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("template create started");
@@ -141,7 +141,7 @@ void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, lv_style_t * st
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_templ_get_style(lv_obj_t * templ, lv_templ_style_t type)
lv_style_t * lv_templ_get_style(const lv_obj_t * templ, lv_templ_style_t type)
{
lv_templ_ext_t * ext = lv_obj_get_ext_attr(templ);

View File

@@ -62,7 +62,7 @@ typedef enum {
* @param copy pointer to a template object, if not NULL then the new object will be copied from it
* @return pointer to the created template
*/
lv_obj_t * lv_templ_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
@@ -91,7 +91,7 @@ void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, lv_style_t *sty
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_templ_get_style(lv_obj_t * templ, lv_templ_style_t type);
lv_style_t * lv_templ_get_style(const lv_obj_t * templ, lv_templ_style_t type);
/*=====================
* Other functions

View File

@@ -55,7 +55,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a page object, if not NULL then the new object will be copied from it
* @return pointer to the created page
*/
lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("page create started");
@@ -248,7 +248,7 @@ void lv_page_set_style(lv_obj_t * page, lv_page_style_t type, lv_style_t * style
* @param page pointer to a page object
* @return pointer to a container which is the scrollable part of the page
*/
lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
lv_obj_t * lv_page_get_scrl(const lv_obj_t * page)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
@@ -260,7 +260,7 @@ lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
* @param page pointer to a page object
* @return the mode from 'lv_page_sb.mode_t' enum
*/
lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page)
lv_sb_mode_t lv_page_get_sb_mode(const lv_obj_t * page)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->sb.mode;
@@ -271,7 +271,7 @@ lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page)
* @param page pointer to a page object
* @return true: scrolling with arrows is enabled
*/
bool lv_page_get_arrow_scroll(lv_obj_t * page)
bool lv_page_get_arrow_scroll(const lv_obj_t * page)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->arrow_scroll ? true : false;
@@ -283,7 +283,7 @@ bool lv_page_get_arrow_scroll(lv_obj_t * page)
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t * lv_page_get_style(lv_obj_t * page, lv_page_style_t type)
lv_style_t * lv_page_get_style(const lv_obj_t * page, lv_page_style_t type)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
@@ -323,7 +323,7 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue)
* @param obj pointer to an object to focus (must be on the page)
* @param anim_time scroll animation time in milliseconds (0: no animation)
*/
void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time)
{
#if USE_LV_ANIMATION == 0

View File

@@ -83,7 +83,7 @@ typedef enum {
* @param copy pointer to a page object, if not NULL then the new object will be copied from it
* @return pointer to the created page
*/
lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
@@ -96,7 +96,7 @@ void lv_page_clean(lv_obj_t *obj);
* @param page pointer to a page object
* @return pointer to a container which is the scrollable part of the page
*/
lv_obj_t * lv_page_get_scrl(lv_obj_t * page);
lv_obj_t * lv_page_get_scrl(const lv_obj_t * page);
/*=====================
* Setter functions
@@ -191,7 +191,7 @@ void lv_page_set_style(lv_obj_t *page, lv_page_style_t type, lv_style_t *style);
* @param page pointer to a page object
* @return the mode from 'lv_page_sb.mode_t' enum
*/
lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page);
lv_sb_mode_t lv_page_get_sb_mode(const lv_obj_t * page);
/**
@@ -199,14 +199,14 @@ lv_sb_mode_t lv_page_get_sb_mode(lv_obj_t * page);
* @param page pointer to a page object
* @return true: scrolling with arrows is enabled
*/
bool lv_page_get_arrow_scroll(lv_obj_t * page);
bool lv_page_get_arrow_scroll(const lv_obj_t * page);
/**
* Get width of the scrollable part of a page
* @param page pointer to a page object
* @return the width of the scrollable
*/
static inline lv_coord_t lv_page_get_scrl_width(lv_obj_t *page)
static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t *page)
{
return lv_obj_get_width(lv_page_get_scrl(page));
}
@@ -216,7 +216,7 @@ static inline lv_coord_t lv_page_get_scrl_width(lv_obj_t *page)
* @param page pointer to a page object
* @return the height of the scrollable
*/
static inline lv_coord_t lv_page_get_scrl_height(lv_obj_t *page)
static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t *page)
{
return lv_obj_get_height(lv_page_get_scrl(page));
}
@@ -226,7 +226,7 @@ static inline lv_coord_t lv_page_get_scrl_height(lv_obj_t *page)
* @param page pointer to page object
* @return the layout from 'lv_cont_layout_t'
*/
static inline lv_layout_t lv_page_get_scrl_layout(lv_obj_t * page)
static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page)
{
return lv_cont_get_layout(lv_page_get_scrl(page));
}
@@ -236,7 +236,7 @@ static inline lv_layout_t lv_page_get_scrl_layout(lv_obj_t * page)
* @param page pointer to a page object
* @return true: horizontal fit is enabled; false: disabled
*/
static inline bool lv_page_get_scrl_hor_fit(lv_obj_t * page)
static inline bool lv_page_get_scrl_hor_fit(const lv_obj_t * page)
{
return lv_cont_get_hor_fit(lv_page_get_scrl(page));
}
@@ -246,7 +246,7 @@ static inline bool lv_page_get_scrl_hor_fit(lv_obj_t * page)
* @param page pointer to a page object
* @return true: vertical fit is enabled; false: disabled
*/
static inline bool lv_page_get_scrl_fit_ver(lv_obj_t * page)
static inline bool lv_page_get_scrl_fit_ver(const lv_obj_t * page)
{
return lv_cont_get_ver_fit(lv_page_get_scrl(page));
}
@@ -257,7 +257,7 @@ static inline bool lv_page_get_scrl_fit_ver(lv_obj_t * page)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_page_get_style(lv_obj_t *page, lv_page_style_t type);
lv_style_t * lv_page_get_style(const lv_obj_t *page, lv_page_style_t type);
/*=====================
* Other functions
@@ -276,7 +276,7 @@ void lv_page_glue_obj(lv_obj_t * obj, bool glue);
* @param obj pointer to an object to focus (must be on the page)
* @param anim_time scroll animation time in milliseconds (0: no animation)
*/
void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time);
void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, uint16_t anim_time);
/**********************
* MACROS

View File

@@ -53,7 +53,7 @@ static lv_design_func_t ancestor_design;
* @param copy pointer to a pre loader object, if not NULL then the new object will be copied from it
* @return pointer to the created pre loader
*/
lv_obj_t * lv_preload_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("preload create started");
@@ -182,7 +182,7 @@ void lv_preload_set_style(lv_obj_t * preload, lv_preload_style_t type, lv_style_
* Get the arc length [degree] of the a pre loader
* @param preload pointer to a pre loader object
*/
uint16_t lv_preload_get_arc_length(lv_obj_t * preload)
uint16_t lv_preload_get_arc_length(const lv_obj_t * preload)
{
lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload);
return ext->arc_length;
@@ -193,7 +193,7 @@ uint16_t lv_preload_get_arc_length(lv_obj_t * preload)
* Get the spin time of the arc
* @param preload pointer to a pre loader object [milliseconds]
*/
uint16_t lv_preload_get_spin_time(lv_obj_t * preload)
uint16_t lv_preload_get_spin_time(const lv_obj_t * preload)
{
lv_preload_ext_t * ext = lv_obj_get_ext_attr(preload);
return ext->time;
@@ -205,7 +205,7 @@ uint16_t lv_preload_get_spin_time(lv_obj_t * preload)
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_preload_get_style(lv_obj_t * preload, lv_preload_style_t type)
lv_style_t * lv_preload_get_style(const lv_obj_t * preload, lv_preload_style_t type)
{
switch(type) {
@@ -223,6 +223,11 @@ lv_style_t * lv_preload_get_style(lv_obj_t * preload, lv_preload_style_t type)
* Other functions
*====================*/
/**
* Automatically in an animation to rotate the arc of spinner.
* @param ptr pointer to preloader
* @param val the current desired value [0..360]
*/
void lv_preload_spinner_animation(void * ptr, int32_t val)
{
lv_obj_t * preload = ptr;

View File

@@ -70,7 +70,7 @@ typedef enum {
* @param copy pointer to a pre loader object, if not NULL then the new object will be copied from it
* @return pointer to the created pre loader
*/
lv_obj_t * lv_preload_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_preload_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
@@ -110,13 +110,13 @@ void lv_preload_set_style(lv_obj_t * preload, lv_preload_style_t type, lv_style_
* Get the arc length [degree] of the a pre loader
* @param preload pointer to a pre loader object
*/
uint16_t lv_preload_get_arc_length(lv_obj_t * preload);
uint16_t lv_preload_get_arc_length(const lv_obj_t * preload);
/**
* Get the spin time of the arc
* @param preload pointer to a pre loader object [milliseconds]
*/
uint16_t lv_preload_get_spin_time(lv_obj_t * preload);
uint16_t lv_preload_get_spin_time(const lv_obj_t * preload);
/**
* Get style of a pre loader.
@@ -124,11 +124,18 @@ uint16_t lv_preload_get_spin_time(lv_obj_t * preload);
* @param type which style should be get
* @return style pointer to the style
* */
lv_style_t * lv_preload_get_style(lv_obj_t * preload, lv_preload_style_t type);
lv_style_t * lv_preload_get_style(const lv_obj_t * preload, lv_preload_style_t type);
/*=====================
* Other functions
*====================*/
/**
* Get style of a pre loader.
* @param preload pointer to pre loader object
* @param type which style should be get
* @return style pointer to the style
* */
void lv_preload_spinner_animation(void * ptr, int32_t val);
/**********************

View File

@@ -58,7 +58,7 @@ static lv_signal_func_t ancestor_scrl_signal;
* @param copy pointer to a roller object, if not NULL then the new object will be copied from it
* @return pointer to the created roller
*/
lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("roller create started");
@@ -179,7 +179,7 @@ void lv_roller_set_style(lv_obj_t * roller, lv_roller_style_t type, lv_style_t *
* @param roller pointer to a roller object
* @return true: auto size enabled; false: manual width settings enabled
*/
bool lv_roller_get_hor_fit(lv_obj_t * roller)
bool lv_roller_get_hor_fit(const lv_obj_t * roller)
{
return lv_page_get_scrl_hor_fit(roller);
}
@@ -190,7 +190,7 @@ bool lv_roller_get_hor_fit(lv_obj_t * roller)
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t * lv_roller_get_style(lv_obj_t * roller, lv_roller_style_t type)
lv_style_t * lv_roller_get_style(const lv_obj_t * roller, lv_roller_style_t type)
{
switch(type) {
case LV_ROLLER_STYLE_BG:

View File

@@ -57,7 +57,7 @@ typedef enum {
* @param copy pointer to a roller object, if not NULL then the new object will be copied from it
* @return pointer to the created roller
*/
lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -137,7 +137,7 @@ void lv_roller_set_style(lv_obj_t *roller, lv_roller_style_t type, lv_style_t *s
* @param roller pointer to roller object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
static inline const char * lv_roller_get_options(lv_obj_t *roller)
static inline const char * lv_roller_get_options(const lv_obj_t *roller)
{
return lv_ddlist_get_options(roller);
}
@@ -147,7 +147,7 @@ static inline const char * lv_roller_get_options(lv_obj_t *roller)
* @param roller pointer to a roller object
* @return id of the selected option (0 ... number of option - 1);
*/
static inline uint16_t lv_roller_get_selected(lv_obj_t *roller)
static inline uint16_t lv_roller_get_selected(const lv_obj_t *roller)
{
return lv_ddlist_get_selected(roller);
}
@@ -157,7 +157,7 @@ static inline uint16_t lv_roller_get_selected(lv_obj_t *roller)
* @param roller pointer to roller object
* @param buf pointer to an array to store the string
*/
static inline void lv_roller_get_selected_str(lv_obj_t * roller, char * buf)
static inline void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf)
{
lv_ddlist_get_selected_str(roller, buf);
}
@@ -167,7 +167,7 @@ static inline void lv_roller_get_selected_str(lv_obj_t * roller, char * buf)
* @param roller pointer to a roller
* @return pointer to the call back function
*/
static inline lv_action_t lv_roller_get_action(lv_obj_t * roller)
static inline lv_action_t lv_roller_get_action(const lv_obj_t * roller)
{
return lv_ddlist_get_action(roller);
}
@@ -177,7 +177,7 @@ static inline lv_action_t lv_roller_get_action(lv_obj_t * roller)
* @param roller pointer to a roller
* @return open/close animation time [ms]
*/
static inline uint16_t lv_roller_get_anim_time(lv_obj_t * roller)
static inline uint16_t lv_roller_get_anim_time(const lv_obj_t * roller)
{
return lv_ddlist_get_anim_time(roller);
}
@@ -187,7 +187,7 @@ static inline uint16_t lv_roller_get_anim_time(lv_obj_t * roller)
* @param roller pointer to a roller object
* @return true: auto size enabled; false: manual width settings enabled
*/
bool lv_roller_get_hor_fit(lv_obj_t *roller);
bool lv_roller_get_hor_fit(const lv_obj_t *roller);
/**
* Get a style of a roller
@@ -195,7 +195,7 @@ bool lv_roller_get_hor_fit(lv_obj_t *roller);
* @param type which style should be get
* @return style pointer to a style
* */
lv_style_t * lv_roller_get_style(lv_obj_t *roller, lv_roller_style_t type);
lv_style_t * lv_roller_get_style(const lv_obj_t *roller, lv_roller_style_t type);
/**********************
* MACROS

View File

@@ -51,7 +51,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a slider object, if not NULL then the new object will be copied from it
* @return pointer to the created slider
*/
lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("slider create started");
@@ -173,7 +173,7 @@ void lv_slider_set_style(lv_obj_t * slider, lv_slider_style_t type, lv_style_t *
* @param slider pointer to a slider object
* @return the value of the slider
*/
int16_t lv_slider_get_value(lv_obj_t * slider)
int16_t lv_slider_get_value(const lv_obj_t * slider)
{
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
@@ -186,7 +186,7 @@ int16_t lv_slider_get_value(lv_obj_t * slider)
* @param slider pointer to slider object
* @return the callback function
*/
lv_action_t lv_slider_get_action(lv_obj_t * slider)
lv_action_t lv_slider_get_action(const lv_obj_t * slider)
{
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
return ext->action;
@@ -197,7 +197,7 @@ lv_action_t lv_slider_get_action(lv_obj_t * slider)
* @param slider pointer to a slider object
* @return true: drag in progress false: not dragged
*/
bool lv_slider_is_dragged(lv_obj_t * slider)
bool lv_slider_is_dragged(const lv_obj_t * slider)
{
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
return ext->drag_value == LV_SLIDER_NOT_PRESSED ? false : true;
@@ -209,7 +209,7 @@ bool lv_slider_is_dragged(lv_obj_t * slider)
* @return true: the knob is drawn always in the slider;
* false: the knob can be out on the edges
*/
bool lv_slider_get_knob_in(lv_obj_t * slider)
bool lv_slider_get_knob_in(const lv_obj_t * slider)
{
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
return ext->knob_in == 0 ? false : true;
@@ -221,7 +221,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_slider_style_t type)
lv_style_t * lv_slider_get_style(const lv_obj_t * slider, lv_slider_style_t type)
{
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);

View File

@@ -65,7 +65,7 @@ typedef enum
* @param copy pointer to a slider object, if not NULL then the new object will be copied from it
* @return pointer to the created slider
*/
lv_obj_t * lv_slider_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -135,14 +135,14 @@ void lv_slider_set_style(lv_obj_t *slider, lv_slider_style_t type, lv_style_t *s
* @param slider pointer to a slider object
* @return the value of the slider
*/
int16_t lv_slider_get_value(lv_obj_t * slider);
int16_t lv_slider_get_value(const lv_obj_t * slider);
/**
* Get the minimum value of a slider
* @param slider pointer to a slider object
* @return the minimum value of the slider
*/
static inline int16_t lv_slider_get_min_value(lv_obj_t * slider)
static inline int16_t lv_slider_get_min_value(const lv_obj_t * slider)
{
return lv_bar_get_min_value(slider);
}
@@ -152,7 +152,7 @@ static inline int16_t lv_slider_get_min_value(lv_obj_t * slider)
* @param slider pointer to a slider object
* @return the maximum value of the slider
*/
static inline int16_t lv_slider_get_max_value(lv_obj_t * slider)
static inline int16_t lv_slider_get_max_value(const lv_obj_t * slider)
{
return lv_bar_get_max_value(slider);
}
@@ -162,14 +162,14 @@ static inline int16_t lv_slider_get_max_value(lv_obj_t * slider)
* @param slider pointer to slider object
* @return the callback function
*/
lv_action_t lv_slider_get_action(lv_obj_t * slider);
lv_action_t lv_slider_get_action(const lv_obj_t * slider);
/**
* Give the slider is being dragged or not
* @param slider pointer to a slider object
* @return true: drag in progress false: not dragged
*/
bool lv_slider_is_dragged(lv_obj_t * slider);
bool lv_slider_is_dragged(const lv_obj_t * slider);
/**
* Get the 'knob in' attribute of a slider
@@ -177,7 +177,7 @@ bool lv_slider_is_dragged(lv_obj_t * slider);
* @return true: the knob is drawn always in the slider;
* false: the knob can be out on the edges
*/
bool lv_slider_get_knob_in(lv_obj_t * slider);
bool lv_slider_get_knob_in(const 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
* @return style pointer to a style
*/
lv_style_t * lv_slider_get_style(lv_obj_t *slider, lv_slider_style_t type);
lv_style_t * lv_slider_get_style(const lv_obj_t *slider, lv_slider_style_t type);
/**********************
* MACROS

View File

@@ -48,7 +48,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a switch object, if not NULL then the new object will be copied from it
* @return pointer to the created switch
*/
lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("switch create started");
@@ -175,7 +175,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_sw_style_t type)
lv_style_t * lv_sw_get_style(const lv_obj_t * sw, lv_sw_style_t type)
{
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);

View File

@@ -63,7 +63,7 @@ typedef enum {
* @param copy pointer to a switch object, if not NULL then the new object will be copied from it
* @return pointer to the created switch
*/
lv_obj_t * lv_sw_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
@@ -108,7 +108,7 @@ void lv_sw_set_style(lv_obj_t *sw, lv_sw_style_t type, lv_style_t *style);
* @param sw pointer to a switch object
* @return false: OFF; true: ON
*/
static inline bool lv_sw_get_state(lv_obj_t *sw)
static inline bool lv_sw_get_state(const lv_obj_t *sw)
{
return lv_bar_get_value(sw) == 0 ? false : true;
}
@@ -118,7 +118,7 @@ static inline bool lv_sw_get_state(lv_obj_t *sw)
* @param slider pointer to a switch object
* @return the callback function
*/
static inline lv_action_t lv_sw_get_action(lv_obj_t * slider)
static inline lv_action_t lv_sw_get_action(const lv_obj_t * slider)
{
return lv_slider_get_action(slider);
}
@@ -129,7 +129,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_sw_style_t type);
lv_style_t * lv_sw_get_style(const lv_obj_t *sw, lv_sw_style_t type);
/**********************
* MACROS

View File

@@ -72,7 +72,7 @@ static lv_signal_func_t scrl_signal;
* @param copy pointer to a text area object, if not NULL then the new object will be copied from it
* @return pointer to the created text area
*/
lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("text area create started");
@@ -551,7 +551,7 @@ void lv_ta_set_style(lv_obj_t * ta, lv_ta_style_t type, lv_style_t * style)
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_ta_get_text(lv_obj_t * ta)
const char * lv_ta_get_text(const lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
@@ -571,7 +571,7 @@ const char * lv_ta_get_text(lv_obj_t * ta)
* @param ta pointer to a text area object
* @return pointer to the label object
*/
lv_obj_t * lv_ta_get_label(lv_obj_t * ta)
lv_obj_t * lv_ta_get_label(const lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->label;
@@ -583,7 +583,7 @@ lv_obj_t * lv_ta_get_label(lv_obj_t * ta)
* @param ta pointer to a text area object
* @return the cursor position
*/
uint16_t lv_ta_get_cursor_pos(lv_obj_t * ta)
uint16_t lv_ta_get_cursor_pos(const lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->cursor.pos;
@@ -594,7 +594,7 @@ uint16_t lv_ta_get_cursor_pos(lv_obj_t * ta)
* @param ta pointer to a text area object
* @return element of 'lv_ta_cursor_type_t'
*/
lv_cursor_type_t lv_ta_get_cursor_type(lv_obj_t * ta)
lv_cursor_type_t lv_ta_get_cursor_type(const lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->cursor.type;
@@ -605,7 +605,7 @@ lv_cursor_type_t lv_ta_get_cursor_type(lv_obj_t * ta)
* @param ta pointer to a text area object
* @return true: password mode is enabled, false: disabled
*/
bool lv_ta_get_pwd_mode(lv_obj_t * ta)
bool lv_ta_get_pwd_mode(const lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->pwd_mode == 0 ? false : true;
@@ -616,7 +616,7 @@ bool lv_ta_get_pwd_mode(lv_obj_t * ta)
* @param ta pointer to a text area object
* @return true: one line configuration is enabled, false: disabled
*/
bool lv_ta_get_one_line(lv_obj_t * ta)
bool lv_ta_get_one_line(const lv_obj_t * ta)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->one_line == 0 ? false : true;
@@ -628,7 +628,7 @@ bool lv_ta_get_one_line(lv_obj_t * ta)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_ta_get_style(lv_obj_t * ta, lv_ta_style_t type)
lv_style_t * lv_ta_get_style(const lv_obj_t * ta, lv_ta_style_t type)
{
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);

View File

@@ -87,7 +87,7 @@ typedef enum {
* @param copy pointer to a text area object, if not NULL then the new object will be copied from it
* @return pointer to the created text area
*/
lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
@@ -181,56 +181,56 @@ void lv_ta_set_style(lv_obj_t *ta, lv_ta_style_t type, lv_style_t *style);
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_ta_get_text(lv_obj_t * ta);
const char * lv_ta_get_text(const lv_obj_t * ta);
/**
* Get the label of a text area
* @param ta pointer to a text area object
* @return pointer to the label object
*/
lv_obj_t * lv_ta_get_label(lv_obj_t * ta);
lv_obj_t * lv_ta_get_label(const lv_obj_t * ta);
/**
* Get the current cursor position in character index
* @param ta pointer to a text area object
* @return the cursor position
*/
uint16_t lv_ta_get_cursor_pos(lv_obj_t * ta);
uint16_t lv_ta_get_cursor_pos(const lv_obj_t * ta);
/**
* Get the current cursor visibility.
* @param ta pointer to a text area object
* @return true: the cursor is drawn, false: the cursor is hidden
*/
bool lv_ta_get_cursor_show(lv_obj_t * ta);
bool lv_ta_get_cursor_show(const lv_obj_t * ta);
/**
* Get the current cursor type.
* @param ta pointer to a text area object
* @return element of 'lv_cursor_type_t'
*/
lv_cursor_type_t lv_ta_get_cursor_type(lv_obj_t * ta);
lv_cursor_type_t lv_ta_get_cursor_type(const lv_obj_t * ta);
/**
* Get the password mode attribute
* @param ta pointer to a text area object
* @return true: password mode is enabled, false: disabled
*/
bool lv_ta_get_pwd_mode(lv_obj_t * ta);
bool lv_ta_get_pwd_mode(const lv_obj_t * ta);
/**
* Get the one line configuration attribute
* @param ta pointer to a text area object
* @return true: one line configuration is enabled, false: disabled
*/
bool lv_ta_get_one_line(lv_obj_t * ta);
bool lv_ta_get_one_line(const lv_obj_t * ta);
/**
* Get the scroll bar mode of a text area
* @param ta pointer to a text area object
* @return scrollbar mode from 'lv_page_sb_mode_t' enum
*/
static inline lv_sb_mode_t lv_ta_get_sb_mode(lv_obj_t * ta)
static inline lv_sb_mode_t lv_ta_get_sb_mode(const lv_obj_t * ta)
{
return lv_page_get_sb_mode(ta);
}
@@ -241,7 +241,7 @@ static inline lv_sb_mode_t lv_ta_get_sb_mode(lv_obj_t * ta)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_ta_get_style(lv_obj_t *ta, lv_ta_style_t type);
lv_style_t * lv_ta_get_style(const lv_obj_t *ta, lv_ta_style_t type);
/*=====================
* Other functions

View File

@@ -64,7 +64,7 @@ static const char * tab_def[] = {""};
* @param copy pointer to a tab object, if not NULL then the new object will be copied from it
* @return pointer to the created tab
*/
lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("tab view create started");
@@ -428,7 +428,7 @@ void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos)
* @param tabview pointer to Tab view object
* @return the active btn index
*/
uint16_t lv_tabview_get_tab_act(lv_obj_t * tabview)
uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->tab_cur;
@@ -439,7 +439,7 @@ uint16_t lv_tabview_get_tab_act(lv_obj_t * tabview)
* @param tabview pointer to Tab view object
* @return btn count
*/
uint16_t lv_tabview_get_tab_count(lv_obj_t * tabview)
uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->tab_cnt;
@@ -451,7 +451,7 @@ uint16_t lv_tabview_get_tab_count(lv_obj_t * tabview)
* @param id index of the btn (>= 0)
* @return pointer to page (lv_page) object
*/
lv_obj_t * lv_tabview_get_tab(lv_obj_t * tabview, uint16_t id)
lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
uint16_t i = 0;
@@ -472,7 +472,7 @@ lv_obj_t * lv_tabview_get_tab(lv_obj_t * tabview, uint16_t id)
* @param tabview pointer to a tabview object
* @param return the current btn load action
*/
lv_tabview_action_t lv_tabview_get_tab_load_action(lv_obj_t * tabview)
lv_tabview_action_t lv_tabview_get_tab_load_action(const lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->tab_load_action;
@@ -483,7 +483,7 @@ lv_tabview_action_t lv_tabview_get_tab_load_action(lv_obj_t * tabview)
* @param tabview pointer to Tab view object
* @return true: enable sliding; false: disable sliding
*/
bool lv_tabview_get_sliding(lv_obj_t * tabview)
bool lv_tabview_get_sliding(const lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->slide_enable ? true : false;
@@ -494,7 +494,7 @@ bool lv_tabview_get_sliding(lv_obj_t * tabview)
* @param tabview pointer to Tab view object
* @return time of animation in milliseconds
*/
uint16_t lv_tabview_get_anim_time(lv_obj_t * tabview)
uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->anim_time;
@@ -506,7 +506,7 @@ uint16_t lv_tabview_get_anim_time(lv_obj_t * tabview)
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_tabview_get_style(lv_obj_t * tabview, lv_tabview_style_t type)
lv_style_t * lv_tabview_get_style(const lv_obj_t * tabview, lv_tabview_style_t type)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
@@ -535,7 +535,7 @@ lv_style_t * lv_tabview_get_style(lv_obj_t * tabview, lv_tabview_style_t type)
* Get position of tab select buttons
* @param tabview pointer to a ab view object
*/
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(lv_obj_t * tabview)
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->btns_pos;

View File

@@ -91,7 +91,7 @@ typedef enum {
* @param copy pointer to a tab object, if not NULL then the new object will be copied from it
* @return pointer to the created tab
*/
lv_obj_t * lv_tabview_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
@@ -169,42 +169,42 @@ void lv_tabview_set_btns_pos(lv_obj_t *tabview, lv_tabview_btns_pos_t btns_pos);
* @param tabview pointer to Tab view object
* @return the active tab index
*/
uint16_t lv_tabview_get_tab_act(lv_obj_t * tabview);
uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview);
/**
* Get the number of tabs
* @param tabview pointer to Tab view object
* @return tab count
*/
uint16_t lv_tabview_get_tab_count(lv_obj_t * tabview);
uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview);
/**
* Get the page (content area) of a tab
* @param tabview pointer to Tab view object
* @param id index of the tab (>= 0)
* @return pointer to page (lv_page) object
*/
lv_obj_t * lv_tabview_get_tab(lv_obj_t * tabview, uint16_t id);
lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id);
/**
* Get the tab load action
* @param tabview pointer to a tabview object
* @param return the current tab load action
*/
lv_tabview_action_t lv_tabview_get_tab_load_action(lv_obj_t *tabview);
lv_tabview_action_t lv_tabview_get_tab_load_action(const lv_obj_t *tabview);
/**
* Get horizontal sliding is enabled or not
* @param tabview pointer to Tab view object
* @return true: enable sliding; false: disable sliding
*/
bool lv_tabview_get_sliding(lv_obj_t * tabview);
bool lv_tabview_get_sliding(const lv_obj_t * tabview);
/**
* Get the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @return time of animation in milliseconds
*/
uint16_t lv_tabview_get_anim_time(lv_obj_t * tabview);
uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview);
/**
* Get a style of a tab view
@@ -212,13 +212,13 @@ uint16_t lv_tabview_get_anim_time(lv_obj_t * tabview);
* @param type which style should be get
* @return style pointer to a style
*/
lv_style_t * lv_tabview_get_style(lv_obj_t *tabview, lv_tabview_style_t type);
lv_style_t * lv_tabview_get_style(const lv_obj_t *tabview, lv_tabview_style_t type);
/**
* Get position of tab select buttons
* @param tabview pointer to a ab view object
*/
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(lv_obj_t *tabview);
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t *tabview);
/**********************

View File

@@ -44,7 +44,7 @@ static lv_signal_func_t ancestor_signal;
* @param copy pointer to a window object, if not NULL then the new object will be copied from it
* @return pointer to the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("window create started");
@@ -309,7 +309,7 @@ void lv_win_set_style(lv_obj_t * win, lv_win_style_t type, lv_style_t * style)
* @param win pointer to a window object
* @return title string of the window
*/
const char * lv_win_get_title(lv_obj_t * win)
const char * lv_win_get_title(const lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_label_get_text(ext->title);
@@ -320,7 +320,7 @@ const char * lv_win_get_title(lv_obj_t * win)
* @param win pointer to a window object
* @return control button size
*/
lv_coord_t lv_win_get_btn_size(lv_obj_t * win)
lv_coord_t lv_win_get_btn_size(const lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->btn_size;
@@ -331,7 +331,7 @@ lv_coord_t lv_win_get_btn_size(lv_obj_t * win)
* @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t')
*/
lv_layout_t lv_win_get_layout(lv_obj_t * win)
lv_layout_t lv_win_get_layout(const lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_page_get_scrl_layout(ext->page);
@@ -342,7 +342,7 @@ lv_layout_t lv_win_get_layout(lv_obj_t * win)
* @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
*/
lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t * win)
lv_sb_mode_t lv_win_get_sb_mode(const lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_page_get_sb_mode(ext->page);
@@ -353,7 +353,7 @@ lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t * win)
* @param win pointer to a window object
* @return the width of the content_bg area
*/
lv_coord_t lv_win_get_width(lv_obj_t * win)
lv_coord_t lv_win_get_width(const lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * scrl = lv_page_get_scrl(ext->page);
@@ -368,7 +368,7 @@ lv_coord_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_btn(lv_obj_t * ctrl_btn)
lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn)
{
lv_obj_t * header = lv_obj_get_parent(ctrl_btn);
lv_obj_t * win = lv_obj_get_parent(header);
@@ -382,7 +382,7 @@ lv_obj_t * lv_win_get_from_btn(lv_obj_t * ctrl_btn)
* @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_style_t * lv_win_get_style(const lv_obj_t * win, lv_win_style_t type)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);

View File

@@ -88,7 +88,7 @@ typedef enum {
* @param copy pointer to a window object, if not NULL then the new object will be copied from it
* @return pointer to the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * par, lv_obj_t * copy);
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
@@ -165,35 +165,35 @@ void lv_win_set_style(lv_obj_t *win, lv_win_style_t type, lv_style_t *style);
* @param win pointer to a window object
* @return title string of the window
*/
const char * lv_win_get_title(lv_obj_t * win);
const char * lv_win_get_title(const lv_obj_t * win);
/**
* Get the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
lv_coord_t lv_win_get_btn_size(lv_obj_t * win);
lv_coord_t lv_win_get_btn_size(const lv_obj_t * win);
/**
* Get the layout of a window
* @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t')
*/
lv_layout_t lv_win_get_layout(lv_obj_t *win);
lv_layout_t lv_win_get_layout(const lv_obj_t *win);
/**
* Get the scroll bar mode of a window
* @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
*/
lv_sb_mode_t lv_win_get_sb_mode(lv_obj_t *win);
lv_sb_mode_t lv_win_get_sb_mode(const lv_obj_t *win);
/**
* Get width of the content area (page scrollable) of the window
* @param win pointer to a window object
* @return the width of the content area
*/
lv_coord_t lv_win_get_width(lv_obj_t * win);
lv_coord_t lv_win_get_width(const lv_obj_t * win);
/**
* Get the pointer of a widow from one of its control button.
@@ -201,7 +201,7 @@ lv_coord_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_btn(lv_obj_t * ctrl_btn);
lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn);
/**
* Get a style of a window
@@ -209,7 +209,7 @@ lv_obj_t * lv_win_get_from_btn(lv_obj_t * ctrl_btn);
* @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_style_t * lv_win_get_style(const lv_obj_t *win, lv_win_style_t type);
/*=====================
* Other functions