Kestrel Interface
Loading...
Searching...
No Matches
kest_ui.c
Go to the documentation of this file.
1#include "kest_int.h"
2
3#ifndef PRINTLINES_ALLOWED
4#ifndef PRINTLINES_ALLOWED
5#define PRINTLINES_ALLOWED 0
6#endif
7#endif
8
10
11static const char *FNAME = "kest_ui.c";
12
17
19
20lv_obj_t *keyboard;
21
23{
25 test_page_str *str = test_page.data_struct;
26
28
29 return NO_ERROR;
30}
31
33{
35
36 test_page.data_struct = kest_alloc(sizeof(test_page_str));
37
38 test_page_str *str = test_page.data_struct;
39
40 test_page.configured = 1;
41
42 test_page.create_ui = &create_test_page_ui;
43
44 test_page.panel = new_panel();
45 test_page.panel->text = "Test page";
46
47 ui_page_add_bottom_button(&test_page, "Test1", NULL);
48 ui_page_add_bottom_button(&test_page, "Test2", NULL);
49
51
53
56
57 kest_active_button_array_append_new(str->array, NULL, "Test1");
58 kest_active_button_array_append_new(str->array, NULL, "Test2");
59 kest_active_button_array_append_new(str->array, NULL, "Test3");
60 kest_active_button_array_append_new(str->array, NULL, "Test4");
61 kest_active_button_array_append_new(str->array, NULL, "Test5");
62}
63
65{
66 if (!page)
67 return ERR_NULL_PTR;
68
69 if (!page->screen)
70 return ERR_BAD_ARGS;
71
72 lv_obj_set_style_bg_color(page->screen, lv_color_hex(GLOBAL_BACKGROUND_COLOUR), 0);
73 lv_obj_set_style_bg_opa(page->screen, LV_OPA_COVER, 0);
74
75 return NO_ERROR;
76}
77
79{
80 if (!pages)
81 return ERR_NULL_PTR;
82
84 //init_effect_selector_eff(&pages->effect_selector);
85
86 //init_profile_list(&pages->profile_list);
89
92
93 return NO_ERROR;
94}
95
96static lv_style_t bg_style;
97
98static void screen_load_cb(lv_event_t *e)
99{
100 lv_obj_t *scr = lv_event_get_target(e);
101 lv_obj_add_style(scr, &bg_style, LV_PART_MAIN);
102}
103
104void init_global_bg(lv_disp_t *disp)
105{
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);
109
110 lv_obj_add_style(lv_scr_act(), &bg_style, LV_PART_MAIN);
111
112 // Attach once: every time a new screen is loaded on this display
113 lv_disp_get_scr_act(disp); // make sure disp is valid
114 //lv_disp_set_bg_color(disp, lv_palette_darken(LV_PALETTE_GREY, 3)); // initial screen
115 lv_obj_add_event_cb(lv_disp_get_scr_act(disp),
116 screen_load_cb,
117 LV_EVENT_SCREEN_LOAD_START,
118 NULL);
119}
120
121void kest_create_ui(lv_disp_t *disp)
122{
123 global_cxt.pages.backstage = lv_obj_create(NULL);
124
125 /*init_global_bg(disp);
126 lv_theme_default_init(disp,
127 lv_palette_main(LV_PALETTE_GREY),
128 lv_palette_main(LV_PALETTE_GREEN),
129 LV_THEME_DEFAULT_DARK,
130 GLOBAL_MAIN_FONT);
131
132 lv_disp_set_theme(disp, lv_theme_default_get());*/
133
134 //configure_profile_list(&global_cxt.pages.profile_list, &global_cxt.pages.main_menu);
135
136 configure_sequence_list(&global_cxt.pages.sequence_list, &global_cxt.pages.main_menu);
137
138 configure_ui_page(&global_cxt.pages.main_menu, NULL);
139
140 configure_ui_page(&global_cxt.pages.main_sequence_view, &global_cxt.main_sequence);
141
142 //init_test_page();
143 //create_test_page_ui();
144 //enter_ui_page(&test_page);
145
146 if (global_cxt.pages.current_page)
147 enter_ui_page(global_cxt.pages.current_page);
148 else
149 enter_ui_page(&global_cxt.pages.main_sequence_view);
150}
151
153{
154 if (!page)
155 return ERR_NULL_PTR;
156
158
159 page->screen = NULL;
160 page->panel = NULL;
161
162 page->configure = NULL;
163 page->create_ui = NULL;
164 page->free_ui = NULL;
165 page->free_all = NULL;
166 page->enter_page = NULL;
167 page->enter_page_from = NULL;
168 page->refresh = NULL;
169
170 page->data_struct = NULL;
171 page->parent = NULL;
172
173 page->configured = 0;
174 page->ui_created = 0;
175
177 page->container = NULL;
178
179 for (int i = 0; i < MAX_BOTTOM_BUTTONS; i++)
180 page->bottom_buttons[i] = NULL;
181
182 return NO_ERROR;
183}
184
186{
187 kest_ui_page *res = kest_alloc(sizeof(kest_ui_page));
188
189 if (!res)
190 return NULL;
191
192 init_ui_page(res);
193
194 return res;
195}
196
197int configure_ui_page(kest_ui_page *page, void *data)
198{
199 //kest_printf("configure_ui_page\n");
200 if (!page)
201 return ERR_NULL_PTR;
202
203 if (page->configured)
204 {
205 //kest_printf("page already configured\n");
206 return NO_ERROR;
207 }
208
209 if (page->configure)
210 {
211 //kest_printf("Function pointer exists\n");
212 page->configure(page, data);
213 }
214 else
215 {
216 //kest_printf("No configure function pointer!\n");
217 return ERR_BAD_ARGS;
218 }
219
220 page->configured = 1;
221
222 //kest_printf("configure_ui_page done\n");
223 return NO_ERROR;
224}
225
227{
228 if (!page)
229 return ERR_NULL_PTR;
230
231 if (page->ui_created)
232 return NO_ERROR;
233
234 if (page->create_ui)
235 page->create_ui(page);
236 else
237 return ERR_BAD_ARGS;
238
239 page->ui_created = 1;
240
241 return NO_ERROR;
242}
243
245{
246 if (!page)
247 {
248 KEST_PRINTF("Error! No page!\n");
249 return ERR_NULL_PTR;
250 }
251
252 if (!page->ui_created)
253 {
254 if (!page->configured)
255 {
256 KEST_PRINTF("Error! Page is unconfigured\n");
257 return ERR_BAD_ARGS;
258 }
259
260 if (!page->create_ui)
261 {
262 KEST_PRINTF("Error! Page has no UI, and no create_ui function pointer!\n");
263 return ERR_BAD_ARGS;
264 }
265 }
266
267 if (!page->ui_created)
268 {
269 KEST_PRINTF("Page has not created its UI yet. Creating now...\n");
270 page->create_ui(page);
271 }
272
273 if (page->refresh)
274 {
275 KEST_PRINTF("page has refresh; calling\n");
276 page->refresh(page);
277 }
278
279 if (page->enter_page)
280 {
281 KEST_PRINTF("page has 'enter_page'; calling\n");
282 page->enter_page(page);
283 }
284
285 if (!page->screen)
286 {
287 KEST_PRINTF("Error! Page has no screen!\n");
288 return ERR_BAD_ARGS;
289 }
290 lv_scr_load(page->screen);
291
292 global_cxt.pages.current_page = page;
293
295
296 return NO_ERROR;
297}
298
300{
301 if (!page)
302 {
303 KEST_PRINTF("Error! No page!\n");
304 return ERR_NULL_PTR;
305 }
306
307 if (!page->ui_created)
308 {
309 if (!page->configured)
310 {
311 KEST_PRINTF("Error! Page is unconfigured\n");
312 return ERR_BAD_ARGS;
313 }
314
315 if (!page->create_ui)
316 {
317 KEST_PRINTF("Error! Page has no UI, and no create_ui function pointer!\n");
318 return ERR_BAD_ARGS;
319 }
320 }
321
322 if (!page->ui_created)
323 {
324 KEST_PRINTF("Page has not created its UI yet. Creating now...\n");
325 page->create_ui(page);
326 }
327
328 if (page->refresh)
329 {
330 KEST_PRINTF("page has refresh; calling\n");
331 page->refresh(page);
332 }
333
334 if (page->enter_page)
335 {
336 KEST_PRINTF("page has 'enter_page'; calling\n");
337 page->enter_page(page);
338 }
339
340 if (!page->screen)
341 {
342 KEST_PRINTF("Error! Page has no screen!\n");
343 return ERR_BAD_ARGS;
344 }
345 lv_scr_load_anim(page->screen, LV_SCR_LOAD_ANIM_OUT_LEFT, UI_PAGE_TRANSITION_ANIM_MS, 0, false);
346
347 global_cxt.pages.current_page = page;
348
350
351 return NO_ERROR;
352}
353
355{
356 if (!page)
357 {
358 KEST_PRINTF("Error! No page!\n");
359 return ERR_NULL_PTR;
360 }
361
362 if (!page->ui_created)
363 {
364 if (!page->configured)
365 {
366 KEST_PRINTF("Error! Page is unconfigured\n");
367 return ERR_BAD_ARGS;
368 }
369
370 if (!page->create_ui)
371 {
372 KEST_PRINTF("Error! Page has no UI, and no create_ui function pointer!\n");
373 return ERR_BAD_ARGS;
374 }
375 }
376
377 if (!page->ui_created)
378 {
379 KEST_PRINTF("Page has not created its UI yet. Creating now...\n");
380 page->create_ui(page);
381 }
382
383 if (page->refresh)
384 {
385 KEST_PRINTF("page has refresh; calling\n");
386 page->refresh(page);
387 }
388
389 if (page->enter_page)
390 {
391 KEST_PRINTF("page has 'enter_page'; calling\n");
392 page->enter_page(page);
393 }
394
395 if (!page->screen)
396 {
397 KEST_PRINTF("Error! Page has no screen!\n");
398 return ERR_BAD_ARGS;
399 }
400 KEST_PRINTF("lv_scr_load...\n");
401 lv_scr_load_anim(page->screen, LV_SCR_LOAD_ANIM_OUT_RIGHT, UI_PAGE_TRANSITION_ANIM_MS, 0, false);
402
403 global_cxt.pages.current_page = page;
404
405
407
408 return NO_ERROR;
409}
410
412{
413 if (!_page)
414 return ERR_NULL_PTR;
415
416 enter_ui_page(*_page);
417
418 return NO_ERROR;
419}
420
422{
423 if (!_page)
424 return ERR_NULL_PTR;
425
427
428 return NO_ERROR;
429}
430
432{
433 if (!_page)
434 return ERR_NULL_PTR;
435
437
438 return NO_ERROR;
439}
440
441void enter_ui_page_cb(lv_event_t *e)
442{
443 //kest_printf("enter ui page callback triggered\n");
444 kest_ui_page *page = (kest_ui_page*)lv_event_get_user_data(e);
445 //kest_printf("Given page: %p\n", page);
446 if (page)
447 enter_ui_page(page);
448}
449
450void enter_ui_page_forwards_cb(lv_event_t *e)
451{
452 //kest_printf("enter ui page callback triggered\n");
453 kest_ui_page *page = (kest_ui_page*)lv_event_get_user_data(e);
454 //kest_printf("Given page: %p\n", page);
455 if (page)
457}
458
459void enter_ui_page_backwards_cb(lv_event_t *e)
460{
461 //kest_printf("enter ui page callback triggered\n");
462 kest_ui_page *page = (kest_ui_page*)lv_event_get_user_data(e);
463 //kest_printf("Given page: %p\n", page);
464 if (page)
466}
467
468void enter_parent_page_cb(lv_event_t *e)
469{
470 //kest_printf("enter_parent_page_cb\n");
471 kest_ui_page *page = lv_event_get_user_data(e);
472
473 if (!page)
474 {
475 //kest_printf("No page !\n");
476 return;
477 }
478
479 if (page->parent)
481 else
482 enter_ui_page_backwards(&global_cxt.pages.main_menu);
483}
484
486{
487 if (!page)
488 return;
489
490 if (!page->parent)
491 return;
492
493 if (page->parent->enter_page)
494 page->parent->enter_page(page->parent);
495 else
497}
498
500{
501 if (!panel)
502 return ERR_NULL_PTR;
503
504 panel->title = NULL;
505 panel->left_button = NULL;
506 panel->left_button_symbol = NULL;
507 panel->right_button = NULL;
508 panel->right_button_symbol = NULL;
509 panel->text = NULL;
510
511 return NO_ERROR;
512}
513
515{
516 if (!page)
517 return ERR_NULL_PTR;
518
519 page->panel = kest_alloc(sizeof(kest_ui_page_panel));
520
521 if (!page->panel)
522 return ERR_ALLOC_FAIL;
523
525
526 page->panel->panel = lv_obj_create(page->screen);
527
528 lv_obj_set_size (page->panel->panel, LV_PCT(100), TOP_PANEL_HEIGHT);
529 lv_obj_set_style_bg_color (page->panel->panel, lv_color_hex(TOP_PANEL_COLOUR), 0);
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);
533 lv_obj_set_style_pad_left (page->panel->panel, GLOBAL_PAD_WIDTH, 0);
534 lv_obj_set_style_pad_right (page->panel->panel, GLOBAL_PAD_WIDTH, 0);
535 //lv_obj_set_flex_flow (page->panel->panel, LV_FLEX_FLOW_ROW);
536 //lv_obj_set_flex_align (page->panel->panel, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
537
538 return NO_ERROR;
539}
540
541int set_panel_text(kest_ui_page *page, const char *text)
542{
543 if (!page)
544 return ERR_NULL_PTR;
545
546 if (!page->panel)
547 return ERR_BAD_ARGS;
548
549 page->panel->text = text;
550
551 if (text && page->ui_created && page->panel->panel)
552 {
553 if (!page->panel->title)
554 page->panel->title = lv_label_create(page->panel->panel);
555
556 lv_label_set_text(page->panel->title, page->panel->text);
557
558 lv_obj_set_style_text_color(page->panel->title, lv_color_hex(GLOBAL_MAIN_TEXT_COLOUR), 0);
559 lv_obj_set_style_text_font(page->panel->title, GLOBAL_MAIN_FONT, 0);
560
561 //lv_obj_set_flex_grow(page->panel->title, 1);
562 lv_obj_set_style_text_align(page->panel->title, LV_TEXT_ALIGN_CENTER, 0);
563 lv_obj_align_to(page->panel->title, page->panel->panel, LV_ALIGN_CENTER, 0, 0);
564 }
565 else
566 {
567 page->panel->title = NULL;
568 }
569
570 return NO_ERROR;
571}
572
573int set_panel_text_rw(kest_ui_page *page, const char *text)
574{
575 if (!page)
576 return ERR_NULL_PTR;
577
578 if (!page->panel)
579 return ERR_BAD_ARGS;
580
581 page->panel->text = text;
582
583 page->panel->title = lv_textarea_create(page->panel->panel);
584 lv_textarea_set_text(page->panel->title, page->panel->text);
585
586 lv_obj_set_style_text_color(page->panel->title, lv_color_hex(GLOBAL_MAIN_TEXT_COLOUR), 0);
587 lv_obj_set_style_text_font(page->panel->title, GLOBAL_MAIN_FONT, 0);
588
589 lv_obj_set_style_border_width(page->panel->title, 0, 0);
590 lv_obj_set_style_bg_color (page->panel->title, lv_color_hex(TOP_PANEL_COLOUR), 0);
591 lv_obj_set_size(page->panel->title, LV_SIZE_CONTENT, TOP_PANEL_HEIGHT * 0.7);
592 lv_textarea_set_one_line(page->panel->title, true);
593 lv_textarea_set_align(page->panel->title, LV_TEXT_ALIGN_CENTER);
594
595 lv_obj_align_to(page->panel->title, page->panel->panel, LV_ALIGN_CENTER, 0, 0);
596
597 return NO_ERROR;
598}
599
600int create_panel_rw_title(kest_ui_page *page, const char *text)
601{
602 if (!page)
603 return ERR_NULL_PTR;
604
605 create_panel(page);
606
607 set_panel_text_rw(page, text);
608
609 return NO_ERROR;
610}
611
612int create_panel_left_button(kest_ui_page *page, const char *button_text, lv_event_cb_t cb, void *cb_arg)
613{
614 if (!page)
615 return ERR_NULL_PTR;
616
617 if (!page->panel)
618 return ERR_BAD_ARGS;
619
620 page->panel->left_button = lv_btn_create(page->panel->panel);
622 lv_obj_align_to(page->panel->left_button, page->panel->panel, LV_ALIGN_LEFT_MID, 0, 0);
623
624 page->panel->left_button_symbol = lv_label_create(page->panel->left_button);
625 lv_label_set_text(page->panel->left_button_symbol, button_text);
626 lv_obj_center(page->panel->left_button_symbol);
627
628 if (cb)
629 lv_obj_add_event_cb(page->panel->left_button, cb, LV_EVENT_CLICKED, cb_arg);
630
631 return NO_ERROR;
632}
633
634int create_panel_right_button(kest_ui_page *page, const char *button_text, lv_event_cb_t cb, void *cb_arg)
635{
636 if (!page)
637 return ERR_NULL_PTR;
638
639 if (!page->panel)
640 return ERR_BAD_ARGS;
641
642 page->panel->right_button = lv_btn_create(page->panel->panel);
644 lv_obj_align_to(page->panel->right_button, page->panel->panel, LV_ALIGN_RIGHT_MID, 0, 0);
645
646 page->panel->right_button_symbol = lv_label_create(page->panel->right_button);
647 lv_label_set_text(page->panel->right_button_symbol, button_text);
648 lv_obj_center(page->panel->right_button_symbol);
649
650 if (cb)
651 lv_obj_add_event_cb(page->panel->right_button, cb, LV_EVENT_CLICKED, cb_arg);
652
653 return NO_ERROR;
654}
655
656int 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)
657{
658 if (!page)
659 return ERR_NULL_PTR;
660
661 create_panel(page);
662
663 create_panel_left_button(page, left_button_text, left_cb, left_cb_arg);
664
665 set_panel_text_rw(page, text);
666
667 return NO_ERROR;
668}
669
671{
672 return create_panel_with_left_button(page, LV_SYMBOL_LEFT, enter_parent_page_cb, page);
673}
674
676{
677 return create_panel_with_back_button_and_page_button(page, LV_SYMBOL_SETTINGS, settings_page);
678}
679
680int 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)
681{
682 return create_panel_with_left_and_right_buttons(page, LV_SYMBOL_LEFT, enter_parent_page_cb, page, right_button_text, right_cb, cb_arg);
683}
684
685int create_panel_with_left_button(kest_ui_page *page, const char *left_button_text, lv_event_cb_t left_cb, void *cb_arg)
686{
687 if (!page)
688 return ERR_NULL_PTR;
689
690 create_panel(page);
691
692 create_panel_left_button(page, left_button_text, left_cb, cb_arg);
693
694 return NO_ERROR;
695}
696
697int create_panel_with_right_button(kest_ui_page *page, const char *right_button_text, lv_event_cb_t right_cb, void *cb_arg)
698{
699 if (!page)
700 return ERR_NULL_PTR;
701
703
704 create_panel_right_button(page, right_button_text, right_cb, cb_arg);
705
706 return NO_ERROR;
707}
708
709int create_panel_with_back_button_and_page_button(kest_ui_page *page, const char *right_button_text, kest_ui_page *right_button_page)
710{
711 if (!page)
712 return ERR_NULL_PTR;
713
715
716 create_panel_right_button(page, right_button_text, enter_ui_page_forwards_cb, right_button_page);
717
718 return NO_ERROR;
719}
720
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)
724{
725 if (!page)
726 return ERR_NULL_PTR;
727
728 create_panel(page);
729
730 create_panel_left_button(page, left_button_text, left_cb, left_cb_arg);
731
732 create_panel_right_button(page, right_button_text, right_cb, right_cb_arg);
733
734 return NO_ERROR;
735}
736
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)
738{
739 if (!keyboard)
740 {
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);
744 }
745 else
746 {
747 lv_obj_set_parent(keyboard, parent);
748 }
749
750 lv_obj_clear_flag(keyboard, LV_OBJ_FLAG_HIDDEN);
751 lv_keyboard_set_textarea(keyboard, text_area);
752
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);
757}
758
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)
760{
761 //kest_printf("spawn_numerical_keyboard\n");
762
763 spawn_keyboard(parent, text_area, ok_cb, ok_arg, cancel_cb, cancel_arg);
764
765 lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_NUMBER);
766 //kest_printf("spawn_numerical_keyboard done\n");
767}
768
770{
771 if (keyboard)
772 lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN);
773
774 lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER);
775}
776
777void hide_keyboard_cb(lv_event_t *e)
778{
779 if (keyboard)
780 lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN);
781
782 lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_TEXT_LOWER);
783}
784
785int create_standard_container(lv_obj_t **cont, lv_obj_t *parent)
786{
787 if (!cont || !parent)
788 return ERR_NULL_PTR;
789
790 *cont = lv_obj_create(parent);
791 if (!*cont)
792 return ERR_ALLOC_FAIL;
793
795 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0, STANDARD_YPOS);
796
797 lv_obj_set_style_anim_time(*cont, 0, 0);
798
799 return NO_ERROR;
800}
801
802int create_standard_container_tall(lv_obj_t **cont, lv_obj_t *parent)
803{
804 if (!cont || !parent)
805 return ERR_NULL_PTR;
806
807 *cont = lv_obj_create(parent);
808
809 if (!*cont)
810 return ERR_ALLOC_FAIL;
811
813 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0, STANDARD_YPOS + (STANDARD_CONTAINER_TALL_HEIGHT - STANDARD_CONTAINER_HEIGHT) / 2);
814
815 lv_obj_set_style_anim_time(*cont, 0, 0);
816
817 return NO_ERROR;
818}
819
820int create_standard_menu_container(lv_obj_t **cont, lv_obj_t *parent)
821{
822 if (!cont || !parent)
823 return ERR_NULL_PTR;
824
825 *cont = lv_obj_create(parent);
826 if (!*cont)
827 return ERR_ALLOC_FAIL;
828
830 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0, STANDARD_YPOS);
831
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);
837
838 return NO_ERROR;
839}
840
841int create_standard_menu_container_tall(lv_obj_t **cont, lv_obj_t *parent)
842{
843 if (!cont || !parent)
844 return ERR_NULL_PTR;
845
846 *cont = lv_obj_create(parent);
847
848 if (!*cont)
849 return ERR_ALLOC_FAIL;
850
852 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0, STANDARD_YPOS + (STANDARD_CONTAINER_TALL_HEIGHT - STANDARD_CONTAINER_HEIGHT) / 2);
853
854 lv_obj_set_style_anim_time(*cont, 0, 0);
855
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);
861
862
863 return NO_ERROR;
864}
865
866int create_standard_button_list(lv_obj_t **cont, lv_obj_t *parent)
867{
868 if (!cont || !parent)
869 return ERR_NULL_PTR;
870
871 *cont = lv_obj_create(parent);
872 if (!*cont)
873 return ERR_ALLOC_FAIL;
874
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,
879 LV_FLEX_ALIGN_START,
880 LV_FLEX_ALIGN_CENTER,
881 LV_FLEX_ALIGN_CENTER);
882
883 return NO_ERROR;
884}
885
886int create_standard_button_list_tall(lv_obj_t **cont, lv_obj_t *parent)
887{
888 if (!cont || !parent)
889 return ERR_NULL_PTR;
890
891 *cont = lv_obj_create(parent);
892 if (!*cont)
893 return ERR_ALLOC_FAIL;
894
896 lv_obj_align_to(*cont, parent, LV_ALIGN_CENTER, 0, STANDARD_YPOS + (STANDARD_CONTAINER_TALL_HEIGHT - STANDARD_CONTAINER_HEIGHT) / 2);
897
898 lv_obj_set_flex_flow(*cont, LV_FLEX_FLOW_COLUMN);
899 lv_obj_set_flex_align(*cont,
900 LV_FLEX_ALIGN_START,
901 LV_FLEX_ALIGN_CENTER,
902 LV_FLEX_ALIGN_CENTER);
903
904 return NO_ERROR;
905}
906
907int create_standard_button_click(lv_obj_t **obj, lv_obj_t **label, lv_obj_t *parent,
908 char *text, lv_event_cb_t click_cb, void *click_cb_arg)
909{
910 if (!obj || !label || !parent)
911 return ERR_NULL_PTR;
912
913 *obj = lv_btn_create(parent);
914 lv_obj_set_size(*obj, LV_PCT(100), STANDARD_BUTTON_HEIGHT);
915
916 *label = lv_label_create(*obj);
917
918 if (text)
919 lv_label_set_text(*label, text);
920
921 lv_obj_center(*label);
922
923 lv_obj_add_event_cb(*obj, click_cb, LV_EVENT_CLICKED, click_cb_arg);
924
925 return NO_ERROR;
926}
927
928int create_standard_button_click_short(lv_obj_t **obj, lv_obj_t **label, lv_obj_t *parent,
929 char *text, lv_event_cb_t click_cb, void *click_cb_arg)
930{
931 if (!obj || !label || !parent)
932 return ERR_NULL_PTR;
933
934 *obj = lv_btn_create(parent);
935 lv_obj_set_size(*obj, LV_PCT(100), STANDARD_BUTTON_SHORT_HEIGHT);
936
937 *label = lv_label_create(*obj);
938
939 if (text)
940 lv_label_set_text(*label, text);
941
942 lv_obj_center(*label);
943
944 lv_obj_add_event_cb(*obj, click_cb, LV_EVENT_CLICKED, click_cb_arg);
945
946 return NO_ERROR;
947}
948
949int create_standard_button_long_press_release(lv_obj_t **obj, lv_obj_t **label, lv_obj_t *parent,
950 char *text, lv_event_cb_t press_cb, void *press_cb_arg, lv_event_cb_t release_cb, void *release_cb_arg)
951{
952 if (!obj || !label || !parent)
953 return ERR_NULL_PTR;
954
955 *obj = lv_btn_create(parent);
956 lv_obj_set_size(*obj, LV_PCT(100), STANDARD_BUTTON_HEIGHT);
957
958 *label = lv_label_create(*obj);
959
960 if (text)
961 lv_label_set_text(*label, text);
962
963 lv_obj_center(*label);
964
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);
967
968 return NO_ERROR;
969}
970
972{
973 if (!panel)
974 return ERR_NULL_PTR;
975
976 panel->panel = NULL;
977 panel->title = NULL;
978 panel->text = NULL;
979
980 panel->lb = NULL;
981 panel->rb = NULL;
982
983 panel->left_button = NULL;
984 panel->left_button_symbol = NULL;
985 panel->right_button = NULL;
986 panel->right_button_symbol = NULL;
987
988 return NO_ERROR;
989}
990
992{
994
995 if (!panel)
996 return NULL;
997
998 init_panel(panel);
999
1000 return panel;
1001}
1002
1003static void edit_rw_text_cb(lv_event_t *e)
1004{
1005 kest_ui_page *page = (kest_ui_page*)lv_event_get_user_data(e);
1006
1007 if (!page)
1008 return;
1009
1010 spawn_keyboard(page->screen, page->panel->title, page->panel->rw_save_cb, page, page->panel->rw_cancel_cb, page);
1011 lv_obj_add_state(page->panel->title, LV_STATE_FOCUSED);
1012}
1013
1014int ui_page_update_title(kest_ui_page *page, const char *text)
1015{
1016 if (!page)
1017 return ERR_NULL_PTR;
1018
1019 if (!page->panel)
1020 return ERR_BAD_ARGS;
1021
1022 if (page->panel->text != text)
1023 return ui_page_set_title(page, text);
1024
1025 return NO_ERROR;
1026}
1027
1029{
1030 if (!page)
1031 return ERR_NULL_PTR;
1032
1033 if (!page->panel)
1034 return ERR_BAD_ARGS;
1035
1036 char *text = page->panel->text ? page->panel->text : "";
1037
1038 if (page->panel->flags & TOP_PANEL_FLAG_RW_TITLE)
1039 {
1040 page->panel->title = lv_textarea_create(page->panel->panel);
1041 lv_textarea_set_text(page->panel->title, text);
1042
1043 lv_obj_set_style_border_width(page->panel->title, 0, 0);
1044 lv_obj_set_style_bg_color (page->panel->title, lv_color_hex(TOP_PANEL_COLOUR), 0);
1045 lv_textarea_set_one_line(page->panel->title, true);
1046 lv_textarea_set_align(page->panel->title, LV_TEXT_ALIGN_CENTER);
1047
1048
1049 lv_obj_add_event_cb(page->panel->title, edit_rw_text_cb, LV_EVENT_CLICKED, page);
1050 }
1051 else
1052 {
1053 page->panel->title = lv_label_create(page->panel->panel);
1054 lv_label_set_text(page->panel->title, text);
1055
1056 lv_obj_set_style_text_align(page->panel->title, LV_TEXT_ALIGN_CENTER, 0);
1057 lv_obj_align_to(page->panel->title, page->panel->panel, LV_ALIGN_CENTER, 0, 0);
1058 }
1059
1060 lv_obj_align_to(page->panel->title, page->panel->panel, LV_ALIGN_CENTER, 0, 0);
1061 //lv_obj_set_size(page->panel->title, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
1062
1063 return NO_ERROR;
1064}
1065
1066int ui_page_set_title(kest_ui_page *page, const char *text)
1067{
1068 if (!page)
1069 return ERR_NULL_PTR;
1070
1071 if (!page->panel)
1072 return ERR_BAD_ARGS;
1073
1074 page->panel->text = text;
1075
1076 if (text && page->ui_created && page->panel->panel)
1077 {
1078 if (!page->panel->title)
1080
1081 if (page->panel->flags & TOP_PANEL_FLAG_RW_TITLE)
1082 lv_textarea_set_text(page->panel->title, page->panel->text);
1083 else
1084 lv_label_set_text(page->panel->title, page->panel->text);
1085 }
1086 else
1087 {
1088 page->panel->title = NULL;
1089 }
1090
1091 return NO_ERROR;
1092}
1093
1095{
1096 if (!page)
1097 return ERR_NULL_PTR;
1098
1099 if (!page->panel)
1100 return ERR_BAD_ARGS;
1101
1102 page->panel->panel = lv_obj_create(page->screen);
1103
1104 lv_obj_set_size (page->panel->panel, LV_PCT(100), TOP_PANEL_HEIGHT);
1105 lv_obj_set_style_bg_color (page->panel->panel, lv_color_hex(TOP_PANEL_COLOUR), 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);
1109 lv_obj_set_style_pad_left (page->panel->panel, GLOBAL_PAD_WIDTH, 0);
1110 lv_obj_set_style_pad_right (page->panel->panel, GLOBAL_PAD_WIDTH, 0);
1111
1112 if (page->panel->lb)
1113 {
1114 create_button_ui(page->panel->lb, page->panel->panel);
1115 lv_obj_align_to(page->panel->lb->obj, page->panel->panel, LV_ALIGN_LEFT_MID, 0, 0);
1116 }
1117
1119
1120 if (page->panel->rb)
1121 {
1122 create_button_ui(page->panel->rb, page->panel->panel);
1123 lv_obj_align_to(page->panel->rb->obj, page->panel->panel, LV_ALIGN_RIGHT_MID, 0, 0);
1124 }
1125
1126 return NO_ERROR;
1127}
1128
1130{
1131 if (!page)
1132 return ERR_NULL_PTR;
1133
1134 if (!page->panel)
1135 return ERR_BAD_ARGS;
1136
1137 page->panel->lb = new_button(LV_SYMBOL_LEFT);
1138
1139 if (!page->panel->lb)
1140 return ERR_ALLOC_FAIL;
1141
1144
1146
1147 return NO_ERROR;
1148}
1149
1151{
1152 if (!page)
1153 return ERR_NULL_PTR;
1154
1155 if (!page->panel)
1156 return ERR_BAD_ARGS;
1157
1158 page->panel->lb = new_button(LV_SYMBOL_LEFT);
1159
1160 if (!page->panel->lb)
1161 return ERR_ALLOC_FAIL;
1162
1165
1167
1168 return NO_ERROR;
1169}
1170
1171int ui_page_add_left_panel_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
1172{
1173 if (!page)
1174 return ERR_NULL_PTR;
1175
1176 page->panel->lb = new_button(label);
1177
1178 if (!page->panel->lb)
1179 return ERR_ALLOC_FAIL;
1180
1183
1184 button_set_clicked_cb(page->panel->lb, cb, page);
1185
1186 return NO_ERROR;
1187}
1188
1189int ui_page_add_right_panel_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
1190{
1191 if (!page)
1192 return ERR_NULL_PTR;
1193
1194 page->panel->rb = new_button(label);
1195
1196 if (!page->panel->rb)
1197 return ERR_ALLOC_FAIL;
1198
1201
1202 button_set_clicked_cb(page->panel->rb, cb, page);
1203
1204 return NO_ERROR;
1205}
1206
1208{
1209 if (!page)
1210 return ERR_NULL_PTR;
1211
1212 page->screen = lv_obj_create(NULL);
1213
1214 if (!page->screen)
1215 return ERR_ALLOC_FAIL;
1216
1217 if (page->panel)
1218 {
1220 }
1221
1223
1225
1226 return NO_ERROR;
1227}
1228
1229
1231{
1232 if (!page)
1233 return ERR_NULL_PTR;
1234
1235 int tall = 1;
1236
1237 for (int i = 0; i < MAX_BOTTOM_BUTTONS; i++)
1238 {
1239 if (page->bottom_buttons[i])
1240 tall = 0;
1241 }
1242
1243 KEST_PRINTF("page->container_type = %d\n", page->container_type);
1244
1245 switch (page->container_type)
1246 {
1247 case CONTAINER_TYPE_STD:
1248 if (tall)
1249 return create_standard_container_tall(&page->container, page->screen);
1250
1251 return create_standard_container(&page->container, page->screen);
1252
1254 if (tall)
1256
1257 return create_standard_button_list(&page->container, page->screen);
1259 if (tall)
1261
1262 return create_standard_menu_container(&page->container, page->screen);
1263
1264 default:
1265 return ERR_BAD_ARGS;
1266 }
1267
1268 return NO_ERROR;
1269}
1270
1272{
1273 if (!page)
1274 return ERR_NULL_PTR;
1275
1276 int n = 0;
1277
1278 for (int i = 0; i < MAX_BOTTOM_BUTTONS; i++)
1279 {
1280 if (page->bottom_buttons[i])
1281 n++;
1282 }
1283
1284 if (!n)
1285 return NO_ERROR;
1286
1287 int pad = (n <= 1) ? 0 : (int)((float)BOTTOM_BUTTON_PADDING / n) + BOTTOM_BUTTON_PADDING / 2;
1288 int width = (int)(float)(STANDARD_CONTAINER_WIDTH - (n - 1) * pad) / n;
1289 int height = STANDARD_BUTTON_HEIGHT;
1290
1291 int pos;
1292
1293 for (int i = 0; i < MAX_BOTTOM_BUTTONS; i++)
1294 {
1295 if (page->bottom_buttons[i])
1296 {
1297 create_button_ui(page->bottom_buttons[i], page->screen);
1298 lv_obj_set_size(page->bottom_buttons[i]->obj, width, height);
1299
1300 pos = (i * (width + pad) + width / 2) - STANDARD_CONTAINER_WIDTH / 2;
1301 lv_obj_align(page->bottom_buttons[i]->obj, LV_ALIGN_BOTTOM_MID, pos, -50);
1302 }
1303 }
1304
1305 return NO_ERROR;
1306}
1307
1308kest_button *ui_page_add_bottom_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
1309{
1310 if (!page)
1311 return NULL;
1312
1313 int index = -1;
1314
1315 for (int i = 0; i < MAX_BOTTOM_BUTTONS; i++)
1316 {
1317 if (!page->bottom_buttons[i])
1318 {
1319 index = i;
1320 break;
1321 }
1322 }
1323
1324 if (index == -1)
1325 return NULL;
1326
1327 page->bottom_buttons[index] = new_button(label);
1328
1329 if (cb)
1330 button_set_clicked_cb(page->bottom_buttons[index], cb, page);
1331
1332 return page->bottom_buttons[index];
1333}
1334
1335int ui_page_set_title_rw(kest_ui_page *page, lv_event_cb_t save_cb, lv_event_cb_t cancel_cb)
1336{
1337 if (!page)
1338 return ERR_NULL_PTR;
1339
1340 if (!page->panel)
1341 return ERR_BAD_ARGS;
1342
1344
1345 page->panel->rw_save_cb = save_cb;
1346 page->panel->rw_cancel_cb = cancel_cb;
1347
1348 return NO_ERROR;
1349}
void * kest_alloc(size_t size)
Definition kest_alloc.c:11
int create_button_ui(kest_button *button, lv_obj_t *parent)
Definition kest_button.c:68
kest_active_button * kest_active_button_array_append_new(kest_active_button_array *array, void *data, char *label)
int kest_active_button_array_create_ui(kest_active_button_array *array, lv_obj_t *parent)
int kest_active_button_array_set_length(kest_active_button_array *array, int n)
int button_set_clicked_cb(kest_button *button, lv_event_cb_t cb, void *cb_arg)
kest_active_button_array * kest_active_button_array_new()
kest_button * new_button(const char *label)
Definition kest_button.c:54
#define STANDARD_BUTTON_SHORT_HEIGHT
Definition kest_button.h:9
#define STANDARD_BUTTON_HEIGHT
Definition kest_button.h:8
#define KEST_ACTIVE_BUTTON_ARRAY_FLAG_DELETEABLE
#define KEST_ACTIVE_BUTTON_ARRAY_FLAG_MOVEABLE
int kest_cxt_queue_save_state(kest_context *cxt)
#define ERR_ALLOC_FAIL
#define ERR_BAD_ARGS
#define NO_ERROR
#define ERR_NULL_PTR
kest_context global_cxt
Definition kest_int.c:12
#define IMPLEMENT_LINKED_PTR_LIST(X)
int init_main_menu(kest_ui_page *page)
Definition kest_menu.c:748
#define KEST_PRINTF(...)
Definition kest_printf.h:10
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()
Definition kest_ui.c:991
int ui_page_init_create_panel_label(kest_ui_page *page)
Definition kest_ui.c:1028
int ui_page_set_title_rw(kest_ui_page *page, lv_event_cb_t save_cb, lv_event_cb_t cancel_cb)
Definition kest_ui.c:1335
int create_test_page_ui(kest_ui_page *page)
Definition kest_ui.c:22
int ui_page_create_container(kest_ui_page *page)
Definition kest_ui.c:1230
int ui_page_add_left_panel_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
Definition kest_ui.c:1171
int enter_ui_page_forwards(kest_ui_page *page)
Definition kest_ui.c:299
kest_ui_page test_page
Definition kest_ui.c:18
int init_ui_page_panel_str(kest_ui_page_panel *panel)
Definition kest_ui.c:499
int ui_page_add_back_button(kest_ui_page *page)
Definition kest_ui.c:1129
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)
Definition kest_ui.c:721
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)
Definition kest_ui.c:928
kest_button * ui_page_add_bottom_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
Definition kest_ui.c:1308
void hide_keyboard()
Definition kest_ui.c:769
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)
Definition kest_ui.c:656
int ui_page_update_title(kest_ui_page *page, const char *text)
Definition kest_ui.c:1014
int ui_page_set_title(kest_ui_page *page, const char *text)
Definition kest_ui.c:1066
int create_standard_menu_container(lv_obj_t **cont, lv_obj_t *parent)
Definition kest_ui.c:820
void init_test_page()
Definition kest_ui.c:32
int enter_ui_page_backwardindirect_s(kest_ui_page **_page)
Definition kest_ui.c:431
int create_panel_with_back_and_settings_buttons(kest_ui_page *page, kest_ui_page *settings_page)
Definition kest_ui.c:675
int init_panel(kest_ui_page_panel *panel)
Definition kest_ui.c:971
int ui_page_create_base_ui(kest_ui_page *page)
Definition kest_ui.c:1207
int enter_ui_page_indirect(kest_ui_page **_page)
Definition kest_ui.c:411
int create_standard_container_tall(lv_obj_t **cont, lv_obj_t *parent)
Definition kest_ui.c:802
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)
Definition kest_ui.c:759
int create_panel_with_right_button(kest_ui_page *page, const char *right_button_text, lv_event_cb_t right_cb, void *cb_arg)
Definition kest_ui.c:697
int create_standard_button_list_tall(lv_obj_t **cont, lv_obj_t *parent)
Definition kest_ui.c:886
int create_standard_menu_container_tall(lv_obj_t **cont, lv_obj_t *parent)
Definition kest_ui.c:841
int create_page_ui(kest_ui_page *page)
Definition kest_ui.c:226
int create_panel_left_button(kest_ui_page *page, const char *button_text, lv_event_cb_t cb, void *cb_arg)
Definition kest_ui.c:612
int enter_ui_page_indirect_forwards(kest_ui_page **_page)
Definition kest_ui.c:421
int create_panel_rw_title(kest_ui_page *page, const char *text)
Definition kest_ui.c:600
int set_panel_text_rw(kest_ui_page *page, const char *text)
Definition kest_ui.c:573
int create_panel_with_back_button(kest_ui_page *page)
Definition kest_ui.c:670
void kest_ui_page_return_to_parent(kest_ui_page *page)
Definition kest_ui.c:485
lv_obj_t * keyboard
Definition kest_ui.c:20
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)
Definition kest_ui.c:737
void enter_ui_page_forwards_cb(lv_event_t *e)
Definition kest_ui.c:450
int set_panel_text(kest_ui_page *page, const char *text)
Definition kest_ui.c:541
int enter_ui_page_backwards(kest_ui_page *page)
Definition kest_ui.c:354
int create_panel_with_back_button_and_page_button(kest_ui_page *page, const char *right_button_text, kest_ui_page *right_button_page)
Definition kest_ui.c:709
void hide_keyboard_cb(lv_event_t *e)
Definition kest_ui.c:777
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)
Definition kest_ui.c:907
int init_ui_page(kest_ui_page *page)
Definition kest_ui.c:152
int enter_ui_page(kest_ui_page *page)
Definition kest_ui.c:244
int ui_page_create_panel_ui(kest_ui_page *page)
Definition kest_ui.c:1094
int kest_init_global_pages(kest_global_pages *pages)
Definition kest_ui.c:78
int ui_page_create_bottom_buttons(kest_ui_page *page)
Definition kest_ui.c:1271
int create_panel_with_left_button(kest_ui_page *page, const char *left_button_text, lv_event_cb_t left_cb, void *cb_arg)
Definition kest_ui.c:685
void enter_ui_page_cb(lv_event_t *e)
Definition kest_ui.c:441
int create_standard_button_list(lv_obj_t **cont, lv_obj_t *parent)
Definition kest_ui.c:866
int ui_page_add_right_panel_button(kest_ui_page *page, const char *label, lv_event_cb_t cb)
Definition kest_ui.c:1189
void kest_create_ui(lv_disp_t *disp)
Definition kest_ui.c:121
kest_ui_page * create_ui_page()
Definition kest_ui.c:185
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)
Definition kest_ui.c:949
void enter_ui_page_backwards_cb(lv_event_t *e)
Definition kest_ui.c:459
int create_standard_container(lv_obj_t **cont, lv_obj_t *parent)
Definition kest_ui.c:785
void init_global_bg(lv_disp_t *disp)
Definition kest_ui.c:104
int kest_ui_page_set_background_default(kest_ui_page *page)
Definition kest_ui.c:64
int create_panel_right_button(kest_ui_page *page, const char *button_text, lv_event_cb_t cb, void *cb_arg)
Definition kest_ui.c:634
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)
Definition kest_ui.c:680
int ui_page_add_parent_button(kest_ui_page *page)
Definition kest_ui.c:1150
void enter_parent_page_cb(lv_event_t *e)
Definition kest_ui.c:468
int create_panel(kest_ui_page *page)
Definition kest_ui.c:514
int configure_ui_page(kest_ui_page *page, void *data)
Definition kest_ui.c:197
#define GLOBAL_MAIN_FONT
Definition kest_ui.h:19
#define KEST_UI_PAGE_GENERIC
Definition kest_ui.h:75
#define GLOBAL_BACKGROUND_COLOUR
Definition kest_ui.h:21
#define CONTAINER_TYPE_STD_MENU
Definition kest_ui.h:73
#define TOP_PANEL_HEIGHT
Definition kest_ui.h:15
#define CONTAINER_TYPE_STD
Definition kest_ui.h:71
#define STANDARD_CONTAINER_WIDTH
Definition kest_ui.h:38
#define TOP_PANEL_COLOUR
Definition kest_ui.h:16
#define TOP_PANEL_FLAG_RW_TITLE
Definition kest_ui.h:44
#define UI_PAGE_TRANSITION_ANIM_MS
Definition kest_ui.h:23
#define KEST_UI_PAGE_MSV
Definition kest_ui.h:78
#define GLOBAL_PAD_WIDTH
Definition kest_ui.h:31
#define STANDARD_YPOS
Definition kest_ui.h:36
#define STANDARD_CONTAINER_HEIGHT
Definition kest_ui.h:39
#define BOTTOM_BUTTON_PADDING
Definition kest_ui.h:69
#define KEST_UI_PAGE_SEQ_LIST
Definition kest_ui.h:77
#define MAX_BOTTOM_BUTTONS
Definition kest_ui.h:68
#define CONTAINER_TYPE_STD_BTN_LIST
Definition kest_ui.h:72
#define STANDARD_TOP_PANEL_BUTTON_WIDTH
Definition kest_ui.h:28
#define STANDARD_TOP_PANEL_BUTTON_HEIGHT
Definition kest_ui.h:29
#define STANDARD_CONTAINER_TALL_HEIGHT
Definition kest_ui.h:40
#define GLOBAL_MAIN_TEXT_COLOUR
Definition kest_ui.h:18
lv_obj_t * obj
Definition kest_button.h:48
kest_ui_page main_sequence_view
Definition kest_ui.h:201
kest_ui_page sequence_list
Definition kest_ui.h:200
kest_ui_page main_menu
Definition kest_ui.h:199
lv_obj_t * right_button_symbol
Definition kest_ui.h:59
lv_obj_t * right_button
Definition kest_ui.h:58
kest_button * lb
Definition kest_ui.h:53
lv_obj_t * panel
Definition kest_ui.h:50
lv_obj_t * title
Definition kest_ui.h:51
lv_obj_t * left_button_symbol
Definition kest_ui.h:57
lv_event_cb_t rw_save_cb
Definition kest_ui.h:62
lv_obj_t * left_button
Definition kest_ui.h:56
lv_event_cb_t rw_cancel_cb
Definition kest_ui.h:63
kest_button * rb
Definition kest_ui.h:54
int(* free_ui)(struct kest_ui_page *page)
Definition kest_ui.h:98
int ui_created
Definition kest_ui.h:107
lv_obj_t * screen
Definition kest_ui.h:89
kest_ui_page_panel * panel
Definition kest_ui.h:94
kest_button * bottom_buttons[MAX_BOTTOM_BUTTONS]
Definition kest_ui.h:111
int(* enter_page_from)(struct kest_ui_page *page, struct kest_ui_page *prev)
Definition kest_ui.h:101
int(* create_ui)(struct kest_ui_page *page)
Definition kest_ui.h:97
int container_type
Definition kest_ui.h:91
lv_obj_t * container
Definition kest_ui.h:92
struct kest_ui_page * parent
Definition kest_ui.h:109
void * data_struct
Definition kest_ui.h:104
int configured
Definition kest_ui.h:106
int(* enter_page)(struct kest_ui_page *page)
Definition kest_ui.h:100
int(* refresh)(struct kest_ui_page *page)
Definition kest_ui.h:102
int(* free_all)(struct kest_ui_page *page)
Definition kest_ui.h:99
int(* configure)(struct kest_ui_page *page, void *data)
Definition kest_ui.h:96
kest_active_button_array * array
Definition kest_ui.c:15