3#ifndef PRINTLINES_ALLOWED
4#ifndef PRINTLINES_ALLOWED
5#define PRINTLINES_ALLOWED 0
11static const char *FNAME =
"kest_ui.c";
73 lv_obj_set_style_bg_opa(page->
screen, LV_OPA_COVER, 0);
96static lv_style_t bg_style;
98static void screen_load_cb(lv_event_t *e)
100 lv_obj_t *scr = lv_event_get_target(e);
101 lv_obj_add_style(scr, &bg_style, LV_PART_MAIN);
106 lv_style_init(&bg_style);
107 lv_style_set_bg_color(&bg_style, lv_color_black());
108 lv_style_set_bg_opa(&bg_style, LV_OPA_COVER);
110 lv_obj_add_style(lv_scr_act(), &bg_style, LV_PART_MAIN);
113 lv_disp_get_scr_act(disp);
115 lv_obj_add_event_cb(lv_disp_get_scr_act(disp),
117 LV_EVENT_SCREEN_LOAD_START,
123 global_cxt.pages.backstage = lv_obj_create(NULL);
262 KEST_PRINTF(
"Error! Page has no UI, and no create_ui function pointer!\n");
269 KEST_PRINTF(
"Page has not created its UI yet. Creating now...\n");
290 lv_scr_load(page->
screen);
317 KEST_PRINTF(
"Error! Page has no UI, and no create_ui function pointer!\n");
324 KEST_PRINTF(
"Page has not created its UI yet. Creating now...\n");
372 KEST_PRINTF(
"Error! Page has no UI, and no create_ui function pointer!\n");
379 KEST_PRINTF(
"Page has not created its UI yet. Creating now...\n");
530 lv_obj_set_style_pad_all (page->
panel->
panel, 0, 0);
531 lv_obj_set_style_border_width(page->
panel->
panel, 0, 0);
532 lv_obj_set_style_radius (page->
panel->
panel, 0, 0);
562 lv_obj_set_style_text_align(page->
panel->
title, LV_TEXT_ALIGN_CENTER, 0);
589 lv_obj_set_style_border_width(page->
panel->
title, 0, 0);
592 lv_textarea_set_one_line(page->
panel->
title,
true);
593 lv_textarea_set_align(page->
panel->
title, LV_TEXT_ALIGN_CENTER);
629 lv_obj_add_event_cb(page->
panel->
left_button, cb, LV_EVENT_CLICKED, cb_arg);
722 const char *left_button_text, lv_event_cb_t left_cb,
void *left_cb_arg,
723 const char *right_button_text, lv_event_cb_t right_cb,
void *right_cb_arg)
737void spawn_keyboard(lv_obj_t *parent, lv_obj_t *text_area,
void (*ok_cb)(lv_event_t*),
void *ok_arg,
void (*cancel_cb)(lv_event_t*),
void *cancel_arg)
741 keyboard = lv_keyboard_create(parent);
742 lv_obj_set_size(
keyboard, LV_PCT(100), LV_PCT(33));
743 lv_obj_add_flag(
keyboard, LV_OBJ_FLAG_HIDDEN);
747 lv_obj_set_parent(
keyboard, parent);
750 lv_obj_clear_flag(
keyboard, LV_OBJ_FLAG_HIDDEN);
751 lv_keyboard_set_textarea(
keyboard, text_area);
753 lv_obj_add_event_cb(
keyboard, ok_cb, LV_EVENT_READY, ok_arg);
754 lv_obj_add_event_cb(
keyboard, cancel_cb, LV_EVENT_CANCEL, cancel_arg);
755 lv_obj_add_event_cb(text_area, cancel_cb, LV_EVENT_DEFOCUSED, cancel_arg);
756 lv_obj_add_event_cb(text_area, cancel_cb, LV_EVENT_LEAVE, cancel_arg);
759void spawn_numerical_keyboard(lv_obj_t *parent, lv_obj_t *text_area,
void (*ok_cb)(lv_event_t*),
void *ok_arg,
void (*cancel_cb)(lv_event_t*),
void *cancel_arg)
763 spawn_keyboard(parent, text_area, ok_cb, ok_arg, cancel_cb, cancel_arg);
765 lv_keyboard_set_mode(
keyboard, LV_KEYBOARD_MODE_NUMBER);
772 lv_obj_add_flag(
keyboard, LV_OBJ_FLAG_HIDDEN);
774 lv_keyboard_set_mode(
keyboard, LV_KEYBOARD_MODE_TEXT_LOWER);
780 lv_obj_add_flag(
keyboard, LV_OBJ_FLAG_HIDDEN);
782 lv_keyboard_set_mode(
keyboard, LV_KEYBOARD_MODE_TEXT_LOWER);
787 if (!cont || !parent)
790 *cont = lv_obj_create(parent);
795 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0,
STANDARD_YPOS);
797 lv_obj_set_style_anim_time(*cont, 0, 0);
804 if (!cont || !parent)
807 *cont = lv_obj_create(parent);
815 lv_obj_set_style_anim_time(*cont, 0, 0);
822 if (!cont || !parent)
825 *cont = lv_obj_create(parent);
830 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0,
STANDARD_YPOS);
832 lv_obj_set_style_anim_time(*cont, 0, 0);
833 lv_obj_set_flex_align(*cont,
834 LV_FLEX_ALIGN_SPACE_EVENLY,
835 LV_FLEX_ALIGN_CENTER,
836 LV_FLEX_ALIGN_CENTER);
843 if (!cont || !parent)
846 *cont = lv_obj_create(parent);
854 lv_obj_set_style_anim_time(*cont, 0, 0);
856 lv_obj_set_flex_flow(*cont, LV_FLEX_FLOW_ROW);
857 lv_obj_set_flex_align(*cont,
858 LV_FLEX_ALIGN_SPACE_EVENLY,
859 LV_FLEX_ALIGN_CENTER,
860 LV_FLEX_ALIGN_CENTER);
868 if (!cont || !parent)
871 *cont = lv_obj_create(parent);
876 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0,
STANDARD_YPOS);
877 lv_obj_set_flex_flow(*cont, LV_FLEX_FLOW_COLUMN);
878 lv_obj_set_flex_align(*cont,
880 LV_FLEX_ALIGN_CENTER,
881 LV_FLEX_ALIGN_CENTER);
888 if (!cont || !parent)
891 *cont = lv_obj_create(parent);
898 lv_obj_set_flex_flow(*cont, LV_FLEX_FLOW_COLUMN);
899 lv_obj_set_flex_align(*cont,
901 LV_FLEX_ALIGN_CENTER,
902 LV_FLEX_ALIGN_CENTER);
908 char *text, lv_event_cb_t click_cb,
void *click_cb_arg)
910 if (!obj || !label || !parent)
913 *obj = lv_btn_create(parent);
916 *label = lv_label_create(*obj);
919 lv_label_set_text(*label, text);
921 lv_obj_center(*label);
923 lv_obj_add_event_cb(*obj, click_cb, LV_EVENT_CLICKED, click_cb_arg);
929 char *text, lv_event_cb_t click_cb,
void *click_cb_arg)
931 if (!obj || !label || !parent)
934 *obj = lv_btn_create(parent);
937 *label = lv_label_create(*obj);
940 lv_label_set_text(*label, text);
942 lv_obj_center(*label);
944 lv_obj_add_event_cb(*obj, click_cb, LV_EVENT_CLICKED, click_cb_arg);
950 char *text, lv_event_cb_t press_cb,
void *press_cb_arg, lv_event_cb_t release_cb,
void *release_cb_arg)
952 if (!obj || !label || !parent)
955 *obj = lv_btn_create(parent);
958 *label = lv_label_create(*obj);
961 lv_label_set_text(*label, text);
963 lv_obj_center(*label);
965 lv_obj_add_event_cb(*obj, press_cb, LV_EVENT_LONG_PRESSED, press_cb_arg);
966 lv_obj_add_event_cb(*obj, release_cb, LV_EVENT_RELEASED, release_cb_arg);
1003static void edit_rw_text_cb(lv_event_t *e)
1011 lv_obj_add_state(page->
panel->
title, LV_STATE_FOCUSED);
1041 lv_textarea_set_text(page->
panel->
title, text);
1043 lv_obj_set_style_border_width(page->
panel->
title, 0, 0);
1045 lv_textarea_set_one_line(page->
panel->
title,
true);
1046 lv_textarea_set_align(page->
panel->
title, LV_TEXT_ALIGN_CENTER);
1049 lv_obj_add_event_cb(page->
panel->
title, edit_rw_text_cb, LV_EVENT_CLICKED, page);
1056 lv_obj_set_style_text_align(page->
panel->
title, LV_TEXT_ALIGN_CENTER, 0);
1106 lv_obj_set_style_pad_all (page->
panel->
panel, 0, 0);
1107 lv_obj_set_style_border_width(page->
panel->
panel, 0, 0);
1108 lv_obj_set_style_radius (page->
panel->
panel, 0, 0);
1212 page->
screen = lv_obj_create(NULL);
void * kest_alloc(size_t size)
int kest_cxt_queue_save_state(kest_context *cxt)
#define IMPLEMENT_LINKED_PTR_LIST(X)
int init_sequence_list(kest_ui_page *page)
int configure_sequence_list(kest_ui_page *page, void *data)
int init_sequence_view(kest_ui_page *page)
kest_ui_page_panel * new_panel()
int ui_page_init_create_panel_label(kest_ui_page *page)
int ui_page_set_title_rw(kest_ui_page *page, lv_event_cb_t save_cb, lv_event_cb_t cancel_cb)
int create_test_page_ui(kest_ui_page *page)
int ui_page_create_container(kest_ui_page *page)
int ui_page_add_left_panel_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
int enter_ui_page_forwards(kest_ui_page *page)
int init_ui_page_panel_str(kest_ui_page_panel *panel)
int ui_page_add_back_button(kest_ui_page *page)
int create_panel_with_left_and_right_buttons(kest_ui_page *page, const char *left_button_text, lv_event_cb_t left_cb, void *left_cb_arg, const char *right_button_text, lv_event_cb_t right_cb, void *right_cb_arg)
int create_standard_button_click_short(lv_obj_t **obj, lv_obj_t **label, lv_obj_t *parent, char *text, lv_event_cb_t click_cb, void *click_cb_arg)
kest_button * ui_page_add_bottom_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
int create_panel_rw_title_and_left_button(kest_ui_page *page, const char *text, const char *left_button_text, lv_event_cb_t left_cb, void *left_cb_arg)
int ui_page_update_title(kest_ui_page *page, const char *text)
int ui_page_set_title(kest_ui_page *page, const char *text)
int create_standard_menu_container(lv_obj_t **cont, lv_obj_t *parent)
int enter_ui_page_backwardindirect_s(kest_ui_page **_page)
int create_panel_with_back_and_settings_buttons(kest_ui_page *page, kest_ui_page *settings_page)
int init_panel(kest_ui_page_panel *panel)
int ui_page_create_base_ui(kest_ui_page *page)
int enter_ui_page_indirect(kest_ui_page **_page)
int create_standard_container_tall(lv_obj_t **cont, lv_obj_t *parent)
void spawn_numerical_keyboard(lv_obj_t *parent, lv_obj_t *text_area, void(*ok_cb)(lv_event_t *), void *ok_arg, void(*cancel_cb)(lv_event_t *), void *cancel_arg)
int create_panel_with_right_button(kest_ui_page *page, const char *right_button_text, lv_event_cb_t right_cb, void *cb_arg)
int create_standard_button_list_tall(lv_obj_t **cont, lv_obj_t *parent)
int create_standard_menu_container_tall(lv_obj_t **cont, lv_obj_t *parent)
int create_page_ui(kest_ui_page *page)
int create_panel_left_button(kest_ui_page *page, const char *button_text, lv_event_cb_t cb, void *cb_arg)
int enter_ui_page_indirect_forwards(kest_ui_page **_page)
int create_panel_rw_title(kest_ui_page *page, const char *text)
int set_panel_text_rw(kest_ui_page *page, const char *text)
int create_panel_with_back_button(kest_ui_page *page)
void kest_ui_page_return_to_parent(kest_ui_page *page)
void spawn_keyboard(lv_obj_t *parent, lv_obj_t *text_area, void(*ok_cb)(lv_event_t *), void *ok_arg, void(*cancel_cb)(lv_event_t *), void *cancel_arg)
void enter_ui_page_forwards_cb(lv_event_t *e)
int set_panel_text(kest_ui_page *page, const char *text)
int enter_ui_page_backwards(kest_ui_page *page)
int create_panel_with_back_button_and_page_button(kest_ui_page *page, const char *right_button_text, kest_ui_page *right_button_page)
void hide_keyboard_cb(lv_event_t *e)
int create_standard_button_click(lv_obj_t **obj, lv_obj_t **label, lv_obj_t *parent, char *text, lv_event_cb_t click_cb, void *click_cb_arg)
int init_ui_page(kest_ui_page *page)
int enter_ui_page(kest_ui_page *page)
int ui_page_create_panel_ui(kest_ui_page *page)
int kest_init_global_pages(kest_global_pages *pages)
int ui_page_create_bottom_buttons(kest_ui_page *page)
int create_panel_with_left_button(kest_ui_page *page, const char *left_button_text, lv_event_cb_t left_cb, void *cb_arg)
void enter_ui_page_cb(lv_event_t *e)
int create_standard_button_list(lv_obj_t **cont, lv_obj_t *parent)
int ui_page_add_right_panel_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
void kest_create_ui(lv_disp_t *disp)
kest_ui_page * create_ui_page()
int create_standard_button_long_press_release(lv_obj_t **obj, lv_obj_t **label, lv_obj_t *parent, char *text, lv_event_cb_t press_cb, void *press_cb_arg, lv_event_cb_t release_cb, void *release_cb_arg)
void enter_ui_page_backwards_cb(lv_event_t *e)
int create_standard_container(lv_obj_t **cont, lv_obj_t *parent)
void init_global_bg(lv_disp_t *disp)
int kest_ui_page_set_background_default(kest_ui_page *page)
int create_panel_right_button(kest_ui_page *page, const char *button_text, lv_event_cb_t cb, void *cb_arg)
int create_panel_with_back_button_and_right_button(kest_ui_page *page, const char *right_button_text, lv_event_cb_t right_cb, void *cb_arg)
int ui_page_add_parent_button(kest_ui_page *page)
void enter_parent_page_cb(lv_event_t *e)
int create_panel(kest_ui_page *page)
int configure_ui_page(kest_ui_page *page, void *data)
#define KEST_UI_PAGE_GENERIC
#define GLOBAL_BACKGROUND_COLOUR
#define CONTAINER_TYPE_STD_MENU
#define CONTAINER_TYPE_STD
#define STANDARD_CONTAINER_WIDTH
#define TOP_PANEL_FLAG_RW_TITLE
#define UI_PAGE_TRANSITION_ANIM_MS
#define STANDARD_CONTAINER_HEIGHT
#define BOTTOM_BUTTON_PADDING
#define KEST_UI_PAGE_SEQ_LIST
#define MAX_BOTTOM_BUTTONS
#define CONTAINER_TYPE_STD_BTN_LIST
#define STANDARD_TOP_PANEL_BUTTON_WIDTH
#define STANDARD_TOP_PANEL_BUTTON_HEIGHT
#define STANDARD_CONTAINER_TALL_HEIGHT
#define GLOBAL_MAIN_TEXT_COLOUR
kest_ui_page main_sequence_view
kest_ui_page sequence_list
lv_obj_t * right_button_symbol
lv_obj_t * left_button_symbol
lv_event_cb_t rw_cancel_cb
int(* free_ui)(struct kest_ui_page *page)
kest_ui_page_panel * panel
kest_button * bottom_buttons[MAX_BOTTOM_BUTTONS]
int(* enter_page_from)(struct kest_ui_page *page, struct kest_ui_page *prev)
int(* create_ui)(struct kest_ui_page *page)
struct kest_ui_page * parent
int(* enter_page)(struct kest_ui_page *page)
int(* refresh)(struct kest_ui_page *page)
int(* free_all)(struct kest_ui_page *page)
int(* configure)(struct kest_ui_page *page, void *data)
kest_active_button_array * array