-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNAVFoundation.UIUtils.axi
209 lines (142 loc) · 5.12 KB
/
NAVFoundation.UIUtils.axi
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
PROGRAM_NAME='NAVFoundation.UIUtils'
/*
_ _ _ ___ __
| \ | | ___ _ __ __ _ __ _| |_ ___ / \ \ / /
| \| |/ _ \| '__/ _` |/ _` | __/ _ \ / _ \ \ / /
| |\ | (_) | | | (_| | (_| | || __// ___ \ V /
|_| \_|\___/|_| \__, |\__,_|\__\___/_/ \_\_/
|___/
MIT License
Copyright (c) 2023 Norgate AV Services Limited
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#IF_NOT_DEFINED __NAV_FOUNDATION_UIUTILS__
#DEFINE __NAV_FOUNDATION_UIUTILS__ 'NAVFoundation.UIUtils'
#include 'NAVFoundation.Core.axi'
DEFINE_CONSTANT
DEFINE_TYPE
////////////////////////////////////////////////////////////
// Button
////////////////////////////////////////////////////////////
struct _NAVUIButton {
char Label[NAV_MAX_CHARS]
char Bitmap[NAV_MAX_CHARS]
integer Icon
integer Enabled
integer Hidden
integer Channel
integer Address
}
////////////////////////////////////////////////////////////
// UI State
////////////////////////////////////////////////////////////
struct _NAVUIState {
integer CurrentPage
integer CurrentPopupPage
}
define_function NAVShowButtonArray(dev device[], integer address, integer state) {
NAVCommandArray(device, "'^SHO-', itoa(address), ',', itoa(state)")
}
define_function NAVShowButton(dev device, integer address, integer state) {
NAVCommand(device, "'^SHO-', itoa(address), ',', itoa(state)")
}
define_function NAVEnableButtonArray(dev device[], integer address, integer state) {
NAVCommandArray(device, "'^ENA-', itoa(address), ',', itoa(state)")
}
define_function NAVEnableButton(dev device, integer address, integer state) {
NAVCommand(device, "'^ENA-', itoa(address), ',', itoa(state)")
}
define_function NAVPageArray(dev device[], char page[]) {
NAVCommandArray(device, "'PAGE-', page")
}
define_function NAVPage(dev device, char page[]) {
NAVCommand(device, "'PAGE-', page")
}
define_function NAVPopupShowArray(dev device[], char popup[], char page[]) {
if (!length_array(popup)) {
return
}
if(length_array(page)) {
NAVCommandArray(device, "'@PPN-', popup, ';', page")
return
}
NAVCommandArray(device, "'@PPN-', popup")
}
define_function NAVPopupShow(dev device, char popup[], char page[]) {
if (!length_array(popup)) {
return
}
if(length_array(page)) {
NAVCommand(device, "'@PPN-', popup,';', page")
return
}
NAVCommand(device, "'@PPN-', popup")
}
define_function NAVPopupHideArray(dev device[], char popup[], char page[]) {
if (!length_array(popup)) {
return
}
if(length_array(page)) {
NAVCommandArray(device, "'@PPF-', popup, ';', page")
return
}
NAVCommandArray(device, "'@PPF-', popup")
}
define_function NAVPopupHide(dev device, char popup[], char page[]) {
if (!length_array(popup)) {
return
}
if(length_array(page)) {
NAVCommand(device, "'@PPF-', popup, ';', page")
return
}
NAVCommand(device, "'@PPF-', popup")
}
define_function NAVPopupKillArray(dev device[], char popup[]) {
NAVCommandArray(device, "'@PPK-', popup")
}
define_function NAVPopupKill(dev device, char popup[]) {
NAVCommand(device, "'@PPK-', popup")
}
define_function NAVPopupsClearArray(dev device[]) {
NAVCommandArray(device, "'@PPX'")
}
define_function NAVPopupsClear(dev device) {
NAVCommand(device, "'@PPX'")
}
define_function NAVTextArray(dev device[], integer address, char states[], char text[]) {
NAVCommandArray(device, "'^TXT-', itoa(address), ',', states, ',', text")
}
define_function NAVText(dev device, integer address, char states[], char text[]) {
NAVCommand(device, "'^TXT-', itoa(address), ',', states, ',', text")
}
define_function NAVDoubleBeepArray(dev device[]) {
NAVCommandArray(device, "'ADBEEP'")
}
define_function NAVDoubleBeep(dev device) {
NAVCommand(device, "'ADBEEP'")
}
define_function NAVBeepArray(dev device[]) {
NAVCommandArray(device, "'ABEEP'")
}
define_function NAVBeep(dev device) {
NAVCommand(device, "'ABEEP'")
}
define_function NAVPanelUpdate(dev device) {
NAVCommand(device, "'@UPD'")
}
#END_IF /* __NAV_FOUNDATION_UIUTILS__ */