3#ifndef PRINTLINES_ALLOWED
4#define PRINTLINES_ALLOWED 0
9static const char *FNAME =
"kest_active_button.c";
75 KEST_PRINTF(
"WARNING: attempt to call create_button_ui on a button for which button->obj is not NULL. button->obj = %p", button->
obj);
79 button->
obj = lv_btn_create(parent);
85 lv_obj_add_flag(button->
obj, LV_OBJ_FLAG_HIDDEN);
87 lv_obj_set_style_opa(button->
obj, button->
opacity, 0);
90 lv_obj_add_state(button->
obj, LV_STATE_DISABLED);
93 lv_obj_clear_flag(button->
obj, LV_OBJ_FLAG_CLICKABLE);
100 button->
label = lv_label_create(button->
obj);
104 lv_obj_del(button->
obj);
116 lv_obj_del(button->
label);
117 button->
label = NULL;
118 lv_obj_del(button->
obj);
127 lv_obj_center(button->
label);
152 button->
label = lv_label_create(button->
obj);
153 lv_obj_center(button->
label);
221 if (button->
obj && label)
226 lv_label_set_text(button->
label, label);
255 lv_obj_align(button->
obj, button->
alignment, offs_x, offs_y);
265 button->
width = width;
269 lv_obj_set_size(button->
obj, width, height);
276 if (!button || !sub_button)
302 lv_obj_add_flag(button->
obj, LV_OBJ_FLAG_HIDDEN);
324 lv_obj_clear_flag(button->
obj, LV_OBJ_FLAG_HIDDEN);
326 lv_obj_set_style_opa(button->
obj, button->
opacity, 0);
341 lv_obj_add_flag(button->
obj, LV_OBJ_FLAG_CLICKABLE);
355 lv_obj_clear_flag(button->
obj, LV_OBJ_FLAG_CLICKABLE);
381 lv_obj_set_style_opa(button->
obj, button->
opacity, 0);
396 lv_obj_clear_state(button->
obj, LV_STATE_DISABLED);
412 lv_obj_add_state(button->
obj, LV_STATE_DISABLED);
427 lv_obj_clear_state(button->
obj, LV_STATE_PRESSED);
428 lv_obj_clear_state(button->
obj, LV_STATE_CHECKED);
429 lv_obj_clear_state(button->
obj, LV_STATE_FOCUSED);
444 lv_obj_del(button->
label);
445 button->
label = NULL;
450 lv_obj_del(button->
obj);
469 button->
popup = NULL;
502 lv_msgbox_close(button->
popup);
504 button->
popup = NULL;
517 #if LVGL_MAJOR_VERSION == 8
518 const char *button_text = lv_msgbox_get_active_btn_text(button->
popup);
526 lv_msgbox_close(button->
popup);
527 button->
popup = NULL;
550 lv_msgbox_add_text(button->
popup,
"\n\tAre you sure?");
574 int32_t new_height = ((float)value / 1000.0) * button->
button.
height;
575 int32_t new_width = ((float)value / 1000.0) * button->
button.
width;
579 lv_obj_set_height(button->
button.
obj, new_height);
580 lv_obj_set_width (button->
button.
obj, new_width);
585 lv_obj_align(button->
button.
obj, LV_ALIGN_TOP_MID, 0, button->
pos_y);
596 button->
pos_y = value;
641 #ifdef ACTIVE_BUTTON_USE_SCALE_ANIM
649 lv_anim_set_var (&button->
scale_anim, button);
652 lv_anim_set_values (&button->
scale_anim, initial,
final);
653 lv_anim_path_ease_in_out(&button->
scale_anim);
665 lv_anim_set_var (&button->
glide_anim, button);
669 lv_anim_path_ease_in_out(&button->
glide_anim);
756 if (button->
index == i)
788 KEST_PRINTF(
"Transformer widget long press callback triggered but pointer to struct not passed");
809 KEST_PRINTF(
"Transformer widget long press callback triggered but pointer to struct not passed");
827 lv_obj_remove_flag(button->
array->
container, LV_OBJ_FLAG_SCROLLABLE);
830 lv_point_t touch_point;
831 lv_indev_t *indev = lv_indev_get_act();
832 lv_indev_get_point(indev, &touch_point);
834 lv_point_t local_point = touch_point;
835 lv_obj_t *parent = lv_obj_get_parent(button->
button.
obj);
837 lv_area_t parent_coords;
838 lv_obj_get_coords(parent, &parent_coords);
840 local_point.y -= parent_coords.y1;
848 lv_obj_move_foreground(button->
button.
obj);
867 KEST_PRINTF(
"Transformer widget long press callback triggered but pointer to struct not passed");
874 lv_point_t touch_point;
875 lv_indev_t *indev = lv_indev_get_act();
876 lv_indev_get_point(indev, &touch_point);
878 lv_point_t local_point = touch_point;
879 lv_obj_t *parent = lv_obj_get_parent(button->
button.
obj);
881 lv_area_t parent_coords;
882 lv_obj_get_coords(parent, &parent_coords);
884 local_point.y -= parent_coords.y1;
903 if (new_index == button->
index)
906 if (new_index < button->index)
908 for (
int i = button->
index; i > new_index; i--)
917 else if (new_index > button->
index)
919 for (
int i = button->
index; i < new_index; i++)
959 lv_obj_add_flag(button->
array->
container, LV_OBJ_FLAG_SCROLLABLE);
991 lv_obj_clear_flag(button->
button.
obj, LV_OBJ_FLAG_CLICKABLE);
1033 KEST_PRINTF(
"WARNING: kest_active_button_add_del_button called with button for which button->del_button is not NULL: it is %p", button->
del_button);
1115 lv_anim_del(button, NULL);
1270 for (
int i = 0; i < n; i++)
1292 KEST_PRINTF(
"kest_active_button_array_append_new\n");
1309 button->
data = data;
1327 KEST_PRINTF(
"kest_active_button_array_append_new done\n");
1333 if (!button || !array)
1343 button->
array = array;
1361 if (index < 0 || index > array->
n_buttons - 1)
1368 for (
int i = index; i < array->
n_buttons; i++)
1384 if (!array || !parent)
1390 for (
int i = 0; i < array->
n_buttons; i++)
1406 for (
int i = 0; i < array->
n_buttons; i++)
void kest_free(void *ptr)
void * kest_alloc(size_t size)
#define IMPLEMENT_LINKED_PTR_LIST(X)
void(* update)(void *representer, void *representee)