From 769c7b28ffe1f899c06ba938fbcd2e7eab7f7aed Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Mon, 30 Jul 2018 06:52:29 +0200 Subject: [PATCH] add 'const' attribute to pointer where possible --- lv_core/lv_group.c | 14 ++++----- lv_core/lv_group.h | 14 ++++----- lv_core/lv_indev.c | 10 +++--- lv_core/lv_indev.h | 10 +++--- lv_core/lv_obj.c | 70 ++++++++++++++++++++--------------------- lv_core/lv_obj.h | 60 +++++++++++++++++------------------ lv_draw/lv_draw_rect.c | 17 +++++++--- lv_misc/lv_ll.c | 12 +++---- lv_misc/lv_ll.h | 8 ++--- lv_objx/lv_arc.c | 4 +-- lv_objx/lv_arc.h | 4 +-- lv_objx/lv_bar.c | 10 +++--- lv_objx/lv_bar.h | 10 +++--- lv_objx/lv_btn.c | 14 ++++----- lv_objx/lv_btn.h | 20 ++++++------ lv_objx/lv_btnm.c | 10 +++--- lv_objx/lv_btnm.h | 10 +++--- lv_objx/lv_calendar.c | 16 +++++----- lv_objx/lv_calendar.h | 16 +++++----- lv_objx/lv_cb.c | 6 ++-- lv_objx/lv_cb.h | 10 +++--- lv_objx/lv_chart.c | 12 +++---- lv_objx/lv_chart.h | 14 ++++----- lv_objx/lv_cont.c | 8 ++--- lv_objx/lv_cont.h | 10 +++--- lv_objx/lv_ddlist.c | 16 +++++----- lv_objx/lv_ddlist.h | 18 +++++------ lv_objx/lv_gauge.c | 8 ++--- lv_objx/lv_gauge.h | 20 ++++++------ lv_objx/lv_img.c | 6 ++-- lv_objx/lv_img.h | 10 +++--- lv_objx/lv_kb.c | 14 ++++----- lv_objx/lv_kb.h | 14 ++++----- lv_objx/lv_label.c | 18 +++++------ lv_objx/lv_label.h | 20 ++++++------ lv_objx/lv_led.c | 4 +-- lv_objx/lv_led.h | 6 ++-- lv_objx/lv_line.c | 6 ++-- lv_objx/lv_line.h | 10 +++--- lv_objx/lv_list.c | 26 +++++++-------- lv_objx/lv_list.h | 20 ++++++------ lv_objx/lv_lmeter.c | 12 +++---- lv_objx/lv_lmeter.h | 14 ++++----- lv_objx/lv_mbox.c | 10 +++--- lv_objx/lv_mbox.h | 10 +++--- lv_objx/lv_objx_templ.c | 4 +-- lv_objx/lv_objx_templ.h | 4 +-- lv_objx/lv_page.c | 12 +++---- lv_objx/lv_page.h | 22 ++++++------- lv_objx/lv_preload.c | 13 +++++--- lv_objx/lv_preload.h | 15 ++++++--- lv_objx/lv_roller.c | 6 ++-- lv_objx/lv_roller.h | 16 +++++----- lv_objx/lv_slider.c | 12 +++---- lv_objx/lv_slider.h | 16 +++++----- lv_objx/lv_sw.c | 4 +-- lv_objx/lv_sw.h | 8 ++--- lv_objx/lv_ta.c | 16 +++++----- lv_objx/lv_ta.h | 20 ++++++------ lv_objx/lv_tabview.c | 18 +++++------ lv_objx/lv_tabview.h | 18 +++++------ lv_objx/lv_win.c | 16 +++++----- lv_objx/lv_win.h | 16 +++++----- 63 files changed, 454 insertions(+), 433 deletions(-) diff --git a/lv_core/lv_group.c b/lv_core/lv_group.c index 1c6f1850a..b2d6f4c93 100644 --- a/lv_core/lv_group.c +++ b/lv_core/lv_group.c @@ -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; diff --git a/lv_core/lv_group.h b/lv_core/lv_group.h index c77afa86d..27b02e074 100644 --- a/lv_core/lv_group.h +++ b/lv_core/lv_group.h @@ -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); /********************** diff --git a/lv_core/lv_indev.c b/lv_core/lv_indev.c index 1fb9727f5..cc862236c 100644 --- a/lv_core/lv_indev.c +++ b/lv_core/lv_indev.c @@ -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; diff --git a/lv_core/lv_indev.h b/lv_core/lv_indev.h index 0ff4d1ebc..63ed1968e 100644 --- a/lv_core/lv_indev.h +++ b/lv_core/lv_indev.h @@ -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 diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index 99257e09a..77fc156ca 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -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; diff --git a/lv_core/lv_obj.h b/lv_core/lv_obj.h index 8c4f1df5f..f450f8859 100644 --- a/lv_core/lv_obj.h +++ b/lv_core/lv_obj.h @@ -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 diff --git a/lv_draw/lv_draw_rect.c b/lv_draw/lv_draw_rect.c index 30996bc53..269999dcc 100644 --- a/lv_draw/lv_draw_rect.c +++ b/lv_draw/lv_draw_rect.c @@ -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 diff --git a/lv_misc/lv_ll.c b/lv_misc/lv_ll.c index 185157d9f..0ebea4922 100644 --- a/lv_misc/lv_ll.c +++ b/lv_misc/lv_ll.c @@ -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 *)); } diff --git a/lv_misc/lv_ll.h b/lv_misc/lv_ll.h index e472f8e06..43f865182 100644 --- a/lv_misc/lv_ll.h +++ b/lv_misc/lv_ll.h @@ -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 diff --git a/lv_objx/lv_arc.c b/lv_objx/lv_arc.c index 9dabd7e4a..53494d5c7 100644 --- a/lv_objx/lv_arc.c +++ b/lv_objx/lv_arc.c @@ -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) { diff --git a/lv_objx/lv_arc.h b/lv_objx/lv_arc.h index acf3976de..e9f97e9ce 100644 --- a/lv_objx/lv_arc.h +++ b/lv_objx/lv_arc.h @@ -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 diff --git a/lv_objx/lv_bar.c b/lv_objx/lv_bar.c index 975c9b9bd..aca32328a 100644 --- a/lv_objx/lv_bar.c +++ b/lv_objx/lv_bar.c @@ -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); diff --git a/lv_objx/lv_bar.h b/lv_objx/lv_bar.h index 1a9ef5c2f..2c0de508d 100644 --- a/lv_objx/lv_bar.h +++ b/lv_objx/lv_bar.h @@ -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 diff --git a/lv_objx/lv_btn.c b/lv_objx/lv_btn.c index ecdef4c4d..409d2c123 100644 --- a/lv_objx/lv_btn.c +++ b/lv_objx/lv_btn.c @@ -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); diff --git a/lv_objx/lv_btn.h b/lv_objx/lv_btn.h index 2ccd7aae6..0fed43676 100644 --- a/lv_objx/lv_btn.h +++ b/lv_objx/lv_btn.h @@ -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 diff --git a/lv_objx/lv_btnm.c b/lv_objx/lv_btnm.c index a488923c3..43a7fa647 100644 --- a/lv_objx/lv_btnm.c +++ b/lv_objx/lv_btnm.c @@ -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); diff --git a/lv_objx/lv_btnm.h b/lv_objx/lv_btnm.h index 03e62ade6..47f567193 100644 --- a/lv_objx/lv_btnm.h +++ b/lv_objx/lv_btnm.h @@ -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 diff --git a/lv_objx/lv_calendar.c b/lv_objx/lv_calendar.c index 2b778b850..a06cdb55a 100644 --- a/lv_objx/lv_calendar.c +++ b/lv_objx/lv_calendar.c @@ -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); diff --git a/lv_objx/lv_calendar.h b/lv_objx/lv_calendar.h index 78c26f95d..2c3262b60 100644 --- a/lv_objx/lv_calendar.h +++ b/lv_objx/lv_calendar.h @@ -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 diff --git a/lv_objx/lv_cb.c b/lv_objx/lv_cb.c index 19699560f..21befa0f9 100644 --- a/lv_objx/lv_cb.c +++ b/lv_objx/lv_cb.c @@ -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); diff --git a/lv_objx/lv_cb.h b/lv_objx/lv_cb.h index f80b300d3..1d3b89da5 100644 --- a/lv_objx/lv_cb.h +++ b/lv_objx/lv_cb.h @@ -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 diff --git a/lv_objx/lv_chart.c b/lv_objx/lv_chart.c index b4d1f983c..4d9e95831 100644 --- a/lv_objx/lv_chart.c +++ b/lv_objx/lv_chart.c @@ -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; diff --git a/lv_objx/lv_chart.h b/lv_objx/lv_chart.h index 84a393142..07f5a380c 100644 --- a/lv_objx/lv_chart.h +++ b/lv_objx/lv_chart.h @@ -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); } diff --git a/lv_objx/lv_cont.c b/lv_objx/lv_cont.c index d8c72f840..e4a486e78 100644 --- a/lv_objx/lv_cont.c +++ b/lv_objx/lv_cont.c @@ -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; diff --git a/lv_objx/lv_cont.h b/lv_objx/lv_cont.h index 335b8c282..8b6835c47 100644 --- a/lv_objx/lv_cont.h +++ b/lv_objx/lv_cont.h @@ -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); } diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index 5197e27f6..c7a4400f9 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -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); diff --git a/lv_objx/lv_ddlist.h b/lv_objx/lv_ddlist.h index e6f27b194..b1bb044b8 100644 --- a/lv_objx/lv_ddlist.h +++ b/lv_objx/lv_ddlist.h @@ -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 diff --git a/lv_objx/lv_gauge.c b/lv_objx/lv_gauge.c index 7cd3af3ef..66ee2c78e 100644 --- a/lv_objx/lv_gauge.c +++ b/lv_objx/lv_gauge.c @@ -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; diff --git a/lv_objx/lv_gauge.h b/lv_objx/lv_gauge.h index 3ac1908fc..4542c4c91 100644 --- a/lv_objx/lv_gauge.h +++ b/lv_objx/lv_gauge.h @@ -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); } diff --git a/lv_objx/lv_img.c b/lv_objx/lv_img.c index c9e914e72..81b357270 100644 --- a/lv_objx/lv_img.c +++ b/lv_objx/lv_img.c @@ -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); diff --git a/lv_objx/lv_img.h b/lv_objx/lv_img.h index 4922af074..861ff56dc 100644 --- a/lv_objx/lv_img.h +++ b/lv_objx/lv_img.h @@ -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; } diff --git a/lv_objx/lv_kb.c b/lv_objx/lv_kb.c index 940b69abc..a19c4a38a 100644 --- a/lv_objx/lv_kb.c +++ b/lv_objx/lv_kb.c @@ -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: diff --git a/lv_objx/lv_kb.h b/lv_objx/lv_kb.h index 5042432c5..c4984807a 100644 --- a/lv_objx/lv_kb.h +++ b/lv_objx/lv_kb.h @@ -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 diff --git a/lv_objx/lv_label.c b/lv_objx/lv_label.c index b8ccb4184..95eec4516 100644 --- a/lv_objx/lv_label.c +++ b/lv_objx/lv_label.c @@ -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); diff --git a/lv_objx/lv_label.h b/lv_objx/lv_label.h index fefc4db15..e6363da14 100644 --- a/lv_objx/lv_label.h +++ b/lv_objx/lv_label.h @@ -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); } diff --git a/lv_objx/lv_led.c b/lv_objx/lv_led.c index f50e4778d..75773c29d 100644 --- a/lv_objx/lv_led.c +++ b/lv_objx/lv_led.c @@ -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; diff --git a/lv_objx/lv_led.h b/lv_objx/lv_led.h index 63f7898fb..25e48a79c 100644 --- a/lv_objx/lv_led.h +++ b/lv_objx/lv_led.h @@ -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); } diff --git a/lv_objx/lv_line.c b/lv_objx/lv_line.c index b2bb17334..c5d802255 100644 --- a/lv_objx/lv_line.c +++ b/lv_objx/lv_line.c @@ -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); diff --git a/lv_objx/lv_line.h b/lv_objx/lv_line.h index 70883bac5..9ba153ce7 100644 --- a/lv_objx/lv_line.h +++ b/lv_objx/lv_line.h @@ -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; } diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index a2fa39d20..8ab000725 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -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 */ diff --git a/lv_objx/lv_list.h b/lv_objx/lv_list.h index 2b40f7ffe..1acd9df06 100644 --- a/lv_objx/lv_list.h +++ b/lv_objx/lv_list.h @@ -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 diff --git a/lv_objx/lv_lmeter.c b/lv_objx/lv_lmeter.c index d80840700..455d4e6b2 100644 --- a/lv_objx/lv_lmeter.c +++ b/lv_objx/lv_lmeter.c @@ -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; diff --git a/lv_objx/lv_lmeter.h b/lv_objx/lv_lmeter.h index f33acbe57..0235d34f9 100644 --- a/lv_objx/lv_lmeter.h +++ b/lv_objx/lv_lmeter.h @@ -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); } diff --git a/lv_objx/lv_mbox.c b/lv_objx/lv_mbox.c index a3fc331e8..b4ddc26ee 100644 --- a/lv_objx/lv_mbox.c +++ b/lv_objx/lv_mbox.c @@ -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); diff --git a/lv_objx/lv_mbox.h b/lv_objx/lv_mbox.h index 66588b3c3..1f4b21505 100644 --- a/lv_objx/lv_mbox.h +++ b/lv_objx/lv_mbox.h @@ -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 diff --git a/lv_objx/lv_objx_templ.c b/lv_objx/lv_objx_templ.c index 2c7bf0396..8947ad66f 100644 --- a/lv_objx/lv_objx_templ.c +++ b/lv_objx/lv_objx_templ.c @@ -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); diff --git a/lv_objx/lv_objx_templ.h b/lv_objx/lv_objx_templ.h index b921a24c0..afe20b90b 100644 --- a/lv_objx/lv_objx_templ.h +++ b/lv_objx/lv_objx_templ.h @@ -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 diff --git a/lv_objx/lv_page.c b/lv_objx/lv_page.c index eb8b48788..e126da5f6 100644 --- a/lv_objx/lv_page.c +++ b/lv_objx/lv_page.c @@ -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 diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 773a2e306..070fd1f6f 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -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 diff --git a/lv_objx/lv_preload.c b/lv_objx/lv_preload.c index 9de13a13d..d84023a37 100644 --- a/lv_objx/lv_preload.c +++ b/lv_objx/lv_preload.c @@ -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; diff --git a/lv_objx/lv_preload.h b/lv_objx/lv_preload.h index 224dcb6f9..b6200a5fb 100644 --- a/lv_objx/lv_preload.h +++ b/lv_objx/lv_preload.h @@ -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); /********************** diff --git a/lv_objx/lv_roller.c b/lv_objx/lv_roller.c index 32c22eec7..55219c467 100644 --- a/lv_objx/lv_roller.c +++ b/lv_objx/lv_roller.c @@ -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: diff --git a/lv_objx/lv_roller.h b/lv_objx/lv_roller.h index 71c5d9543..c99f9b9e4 100644 --- a/lv_objx/lv_roller.h +++ b/lv_objx/lv_roller.h @@ -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 diff --git a/lv_objx/lv_slider.c b/lv_objx/lv_slider.c index 2dcc8db02..17e53b5ac 100644 --- a/lv_objx/lv_slider.c +++ b/lv_objx/lv_slider.c @@ -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); diff --git a/lv_objx/lv_slider.h b/lv_objx/lv_slider.h index 1cae9b00e..8eb2bd2d7 100644 --- a/lv_objx/lv_slider.h +++ b/lv_objx/lv_slider.h @@ -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 diff --git a/lv_objx/lv_sw.c b/lv_objx/lv_sw.c index 47954f089..a39021f42 100644 --- a/lv_objx/lv_sw.c +++ b/lv_objx/lv_sw.c @@ -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); diff --git a/lv_objx/lv_sw.h b/lv_objx/lv_sw.h index 898b4efe0..9a2bb8a5a 100644 --- a/lv_objx/lv_sw.h +++ b/lv_objx/lv_sw.h @@ -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 diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index d871fe815..b939a08e3 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -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); diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index a89383d7c..a7d5525ed 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -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 diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index 9d76c43bc..e7f90618a 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -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; diff --git a/lv_objx/lv_tabview.h b/lv_objx/lv_tabview.h index beee8e112..67838a826 100644 --- a/lv_objx/lv_tabview.h +++ b/lv_objx/lv_tabview.h @@ -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); /********************** diff --git a/lv_objx/lv_win.c b/lv_objx/lv_win.c index 87feea42a..1d8d6fcbc 100644 --- a/lv_objx/lv_win.c +++ b/lv_objx/lv_win.c @@ -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); diff --git a/lv_objx/lv_win.h b/lv_objx/lv_win.h index 94be309de..8032a3982 100644 --- a/lv_objx/lv_win.h +++ b/lv_objx/lv_win.h @@ -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