18#ifndef __VSF_MENUSYS_H__
19#define __VSF_MENUSYS_H__
23#include "../vsf_ui_cfg.h"
25#if VSF_USE_MENUSYS == ENABLED
27#if defined(__VSF_MENUSYS_IMPLEMENT)
28# define __PLOOC_CLASS_IMPLEMENT
29# undef VSF_MENUSYS_IMPLEMENT
30#elif defined(VSF_MENUSYS_INHERIT)
31# define __PLOOC_CLASS_INHERIT
32# undef VSF_MENUSYS_INHERIT
56#define __describe_menu(__name, __idx, __id, __x, __y, __w, __h, __item_num, __user_type, ...)\
57 typedef struct __##__name##_menu##__idx##_info_t { \
58 implement(vsf_menusys_menu_info_t) \
59 vsf_menusys_menu_item_t __items[(__item_num)]; \
60 } __##__name##_menu##__idx##_info_t; \
61 __##__name##_menu##__idx##_info_t __##__name##_menu##__idx##_info = { \
66 .item_num = (__item_num), \
68 .user_type = (__user_type), \
74#define __describe_menu_item(__idx, __ui_data) \
75 [__idx] = { .ui_data = (void *)(__ui_data), .anchor_type = VSF_MENU_ITEM_ANCHOR_TYPE_NONE, }
76#define __describe_menu_item_anchor_menu(__idx, __ui_data, __screen) \
77 [__idx] = { .ui_data = (void *)(__ui_data), .anchor_type = VSF_MENU_ITEM_ANCHOR_TYPE_MENU, .anchor.screen = (vsf_menusys_screen_t *)(__screen), }
78#define __describe_menu_item_anchor_callback(__idx, __ui_data, __callback) \
79 [__idx] = { .ui_data = (void *)(__ui_data), .anchor_type = VSF_MENU_ITEM_ANCHOR_TYPE_CALLBACK, .anchor.callback = (__callback), }
81#define __end_describe_menu(__n, __value) \
82 { .info = &__##__value##_menu##__n##_info.use_as__vsf_menusys_menu_info_t, },
84#define __end_describe_menu_screen(__name, __menu_num) \
85 typedef struct __##__name##_menu_screen_t { \
86 implement(vsf_menusys_screen_t) \
87 vsf_menusys_menu_t __menus[(__menu_num)]; \
88 } __##__name##_menu_screen_t; \
89 __##__name##_menu_screen_t __name = { \
90 .menu_num = (__menu_num), \
92 VSF_MREPEAT(__menu_num, __end_describe_menu, __name) \
96#define describe_menu_screen(__name)
97#define describe_menu(__name, __idx, __id, __x, __y, __w, __h, __item_num, __user_type, ...)\
98 __describe_menu(__name, __idx, (__id), (__x), (__y), (__w), (__h), (__item_num), (__user_type), __VA_ARGS__)
99#define describe_menu_item(__idx, __ui_data) \
100 __describe_menu_item(__idx, (__ui_data))
101#define describe_menu_item_anchor_menu(__idx, __ui_data, __screen) \
102 __describe_menu_item_anchor_menu((__idx), (__ui_data), (__screen))
103#define describe_menu_item_anchor_callback(__idx, __ui_data, __callback) \
104 __describe_menu_item_anchor_callback((__idx), (__ui_data), (__callback))
105#define end_describe_menu_screen(__name, __menu_num) \
106 __end_describe_menu_screen(__name, __menu_num)
108#define describe_menusys(__name, __screen_stack_size) \
109 typedef struct __##__name##_menusys_t { \
110 implement(vsf_menusys_t) \
111 vsf_menusys_screen_t * __screen_stack[(__screen_stack_size)]; \
112 } __##__name##_menusys_t; \
113 __##__name##_menusys_t __name = { \
114 .screen_stack_size = (__screen_stack_size), \
124 VSF_MENU_ITEM_ANCHOR_TYPE_NONE,
125 VSF_MENU_ITEM_ANCHOR_TYPE_MENU,
126 VSF_MENU_ITEM_ANCHOR_TYPE_CALLBACK,
162 vsf_menusys_menu_t menus[0];
172 vsf_menusys_screen_t * screen_stack[0];
unsigned short uint16_t
Definition lvgl.h:41
unsigned char uint8_t
Definition lvgl.h:40
signed char int8_t
Definition lvgl.h:38
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned short uint_fast16_t
Definition stdint.h:25
char int_fast8_t
Definition stdint.h:22
short int_fast16_t
Definition stdint.h:24