@@ -84,19 +84,26 @@ else:
84
84
{.deadCodeElim : on .}
85
85
86
86
const
87
- WEBUI_VERSION * = " 2.1.0" # # Version
88
- WEBUI_HEADER_SIGNATURE * = 0x FF # # All packets should start with this 8bit
89
- WEBUI_HEADER_JS * = 0x FE # # Javascript result in frontend
90
- WEBUI_HEADER_CLICK * = 0x FD # # Click event
91
- WEBUI_HEADER_SWITCH * = 0x FC # # Frontend refresh
92
- WEBUI_HEADER_CLOSE * = 0x FB # # Close window
93
- WEBUI_HEADER_CALL_FUNC * = 0x FA # # Call a backend function
94
- WEBUI_MAX_ARRAY * = (1024 ) # # Max num of threads, servers, windows, pointers...
95
- WEBUI_MIN_PORT * = (10000 ) # # Minimum socket port
96
- WEBUI_MAX_PORT * = (65500 ) # # Should be less than 65535
97
- WEBUI_MAX_BUF * = (1024000 ) # # 1024 Kb max dynamic memory allocation
98
- WEBUI_DEFAULT_PATH * = " ." # # Default root path
99
- WEBUI_DEF_TIMEOUT * = (8 ) # # Default startup timeout in seconds
87
+ WEBUI_VERSION * = " 2.1.1" # # Version
88
+ WEBUI_HEADER_SIGNATURE * = 0x FF # # All packets should start with this 8bit
89
+ WEBUI_HEADER_JS * = 0x FE # # Javascript result in frontend
90
+ WEBUI_HEADER_CLICK * = 0x FD # # Click event
91
+ WEBUI_HEADER_SWITCH * = 0x FC # # Frontend refresh
92
+ WEBUI_HEADER_CLOSE * = 0x FB # # Close window
93
+ WEBUI_HEADER_CALL_FUNC * = 0x FA # # Call a backend function
94
+ WEBUI_MAX_ARRAY * = (1024 ) # # Max num of threads, servers, windows, pointers...
95
+ WEBUI_MIN_PORT * = (10000 ) # # Minimum socket port
96
+ WEBUI_MAX_PORT * = (65500 ) # # Should be less than 65535
97
+ WEBUI_MAX_BUF * = (1024000 ) # # 1024 Kb max dynamic memory allocation
98
+ WEBUI_DEFAULT_PATH * = " ." # # Default root path
99
+ WEBUI_DEF_TIMEOUT * = (8 ) # # Default startup timeout in seconds
100
+ WEBUI_EVENT_CONNECTED * = (1 ) # # Window connected
101
+ WEBUI_EVENT_MULTI_CONNECTION * = (2 ) # # Multi clients connected
102
+ WEBUI_EVENT_UNWANTED_CONNECTION * = (3 ) # # Unwanted client connected
103
+ WEBUI_EVENT_DISCONNECTED * = (4 ) # # Window disconnected
104
+ WEBUI_EVENT_MOUSE_CLICK * = (5 ) # # Mouse Click
105
+ WEBUI_EVENT_NAVIGATION * = (6 ) # # The window URL changed
106
+ WEBUI_EVENT_CALLBACK * = (7 ) # # Function call
100
107
101
108
# -- Types -------------------------
102
109
113
120
multiAccess* : bool
114
121
serverRoot* : bool
115
122
serverPort* : cuint
116
- isBindAll* : bool
117
123
url* : cstring
118
- cbAll* : array [1 , proc (e: Event )]
119
124
html* : cstring
120
125
htmlCpy* : cstring
121
126
icon* : cstring
126
131
connections* : cuint
127
132
runtime* : cuint
128
133
detectProcessClose* : bool
134
+ hasEvents* : bool
129
135
# when defined(windows):
130
136
# serverThread: Handle
131
137
# else:
142
148
window* : ptr Window
143
149
data* : pointer
144
150
response* : pointer
151
+ `type`* : cint
145
152
146
153
JavascriptResult * {.bycopy .} = object
147
154
error* : bool
158
165
internalId* : cstring
159
166
elementName* : cstring
160
167
data* : pointer
168
+ dataLen* : cuint
169
+ eventType* : cint
161
170
162
171
CmdAsync * {.bycopy .} = object
163
172
win* : ptr Window
214
223
cb_interface* : array [WEBUI_MAX_ARRAY , proc (elementId: cuint ;
215
224
windowId: cuint ; elementName: cstring ; window: ptr Window ;
216
225
data: cstring ; response: cstringArray ) {.cdecl .}]
217
- cb_interface_all* : array [1 , proc (elementId: cuint ; windowId: cuint ;
218
- elementName: cstring ; window: ptr Window ; data: cstring ;
219
- response: cstringArray ) {.cdecl .}]
220
226
executablePath* : cstring
221
227
ptrList* : array [WEBUI_MAX_ARRAY , pointer ]
222
228
ptrPosition* : cuint
@@ -248,8 +254,6 @@ proc script*(win: ptr Window; script: ptr Script) {.cdecl,
248
254
proc `bind` * (win: ptr Window ; element: cstring ; `func`: proc (
249
255
e: ptr Event ) {.cdecl .}): cuint {.
250
256
cdecl , importc : " webui_bind" , webui .}
251
- proc bindAll * (win: ptr Window ; `func`: proc (e: ptr Event ) {.cdecl .}) {.cdecl ,
252
- importc : " webui_bind_all" , webui .}
253
257
proc open * (win: ptr Window ; url: cstring ; browser: cuint ): bool {.cdecl ,
254
258
importc : " webui_open" , webui .}
255
259
proc scriptCleanup * (script: ptr Script ) {.cdecl ,
@@ -309,7 +313,7 @@ proc windowReceive*(win: ptr Window; packet: cstring; len: csize_t) {.cdecl,
309
313
proc windowSend * (win: ptr Window ; packet: cstring ;
310
314
packetsSize: csize_t ) {.cdecl , importc : " _webui_window_send" , webui .}
311
315
proc windowEvent * (win: ptr Window ; elementId: cstring ; element: cstring ;
312
- data: pointer ; dataLen: cuint ) {.cdecl ,
316
+ data: pointer ; dataLen: cuint , eventType: cint ) {.cdecl ,
313
317
importc : " _webui_window_event" , webui .}
314
318
proc windowGetNumber * (win: ptr Window ): cuint {.cdecl ,
315
319
importc : " _webui_window_get_number" , webui .}
@@ -388,3 +392,6 @@ proc freeAllMem*() {.cdecl, importc: "_webui_free_all_mem", webui.}
388
392
389
393
proc showWindow * (win: ptr Window ; html: cstring ; browser: cuint ): bool {.cdecl ,
390
394
importc : " _webui_show_window" , webui .}
395
+ proc generateInternalId * (win: ptr Window ; element: cstring ): cstring {.cdecl ,
396
+ importc : " _webui_generate_internal_id" , webui .}
397
+
0 commit comments