-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui_menu.tbh
176 lines (138 loc) · 3.17 KB
/
ui_menu.tbh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
'===========================================================================
' ui_menu library
'
' required device specific properties and methods:
' sub lcd_clear(x as word, y as word, width as word, height as word)
' function device_settings_sg(byref setting_name as string,index as byte, byref setting_val as string, byref stg_num as byte, rw as en_stg_rdwr) as ok_ng
' function device_operation(s as string(1)) as en_device_func_result
' sub device_key_proc(key_event as pl_kp_event_codes, key_code as byte)
' sub device_command_confirm(s as string)
'
''===========================================================================
#ifndef LCD_FIX_FONT
#define LCD_FIX_FONT "Tibbo-5x7(V).bin"
#endif
#ifndef LCD_STD_FONT
#define LCD_STD_FONT "Tibbo-5x7(VP).bin"
#endif
#ifndef MENU_MAX_LVL
#define MENU_MAX_LVL 5
#endif
#ifndef MENU_MAX_ITEM_PER_LVL
#define MENU_MAX_ITEM_PER_LVL 10
#endif
#ifndef BMP_CANCEL_XOFFSET
#define BMP_CANCEL_XOFFSET 69
#endif
#ifndef BMP_ENTER_XOFFSET
#define BMP_ENTER_XOFFSET 86
#endif
#ifndef BMP_UP_XOFFSET
#define BMP_UP_XOFFSET 103
#endif
#ifndef BMP_DOWN_XOFFSET
#define BMP_DOWN_XOFFSET 120
#endif
#ifndef LCD_MENU_TOUT
#define LCD_MENU_TOUT 200
#endif
#ifndef DISPLAY_STR_LEN
#define DISPLAY_STR_LEN 255
#endif
#ifndef UM_VER_SPACING
#define UM_VER_SPACING 3
#endif
#ifndef UM_HOR_SPACING
#define UM_HOR_SPACING 3
#endif
#ifndef SCROLL_BAR_WIDTH
#define SCROLL_BAR_WIDTH 25
#endif
#ifndef SCROLL_ARROW_HEIGHT
#define SCROLL_ARROW_HEIGHT 20
#endif
#ifndef SCROLL_MIN_HEIGHT
#define SCROLL_MIN_HEIGHT 4
#endif
#ifndef SCROLL_CUROSR_WIDTH
#define SCROLL_CUROSR_WIDTH 20
#endif
#ifndef CURSOR_BAR_LEN_OFFSET
#define CURSOR_BAR_LEN_OFFSET 2
#endif
#ifndef LCD_CURSORCOLOR
#define LCD_CURSORCOLOR 63080
#endif
#ifndef LCD_DISABLE_FORECOLOR
#define LCD_DISABLE_FORECOLOR 33840
#endif
#ifndef LCD_FORECOLOR
#define LCD_FORECOLOR 65535
#endif
#ifndef SCROLL_BORDER
#define SCROLL_BORDER 2
#endif
#ifndef SMALL_ICON_FILE
#define SMALL_ICON_FILE "small_icons.bmp"
#endif
#ifndef TAB
#define TAB 9
#endif
#ifndef CR
#define CR 13
#endif
#ifndef COMMA
#define COMMA 44
#endif
#ifndef MENU_IB_INSERT
#define MENU_IB_INSERT NO
#endif
#ifndef MENU_SCRIPT_FILE
#define MENU_SCRIPT_FILE "menu_descr.txt"
#endif
#ifndef STD_INPUT_WAIT_TIME
#define STD_INPUT_WAIT_TIME 20 'in 0.5 seconds
#endif
#ifndef LIST_BOX_X
#define LIST_BOX_X 0
#endif
#ifndef LIST_BOX_Y
#define LIST_BOX_Y 0
#endif
#ifndef LIST_BOX_W
#define LIST_BOX_W lcd.width
#endif
#ifndef LIST_BOX_H
#define LIST_BOX_H lcd.height
#endif
#ifndef LCD_BACKCOLOR
#define LCD_BACKCOLOR 0
#endif
enum ui_menu_results
MENU_RESULT_OK
MENU_RESULT_TIMEOUT
end enum
enum menu_key_actions
MENU_KEY_UP,
MENU_KEY_DOWN,
MENU_KEY_IN,
MENU_KEY_OUT
end enum
type menu_display_item
display_item_type as string(1)
display_string_addr as word
display_string_len as byte
display_item_data_addr as word
display_item_data_len as byte
end type
declare function ui_menu(
x_coord as word,
y_coord as word,
width as word,
height as word,
byref menu_states as string(MENU_MAX_LVL),
byref menu_descriptor_file as string(20),
access_level as byte,
timeout as byte
) as ui_menu_results
declare ui_menu_exit_flag as no_yes