@@ -84,19 +84,26 @@ else:
8484{.deadCodeElim : on .}
8585
8686const
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
100107
101108# -- Types -------------------------
102109
113120 multiAccess* : bool
114121 serverRoot* : bool
115122 serverPort* : cuint
116- isBindAll* : bool
117123 url* : cstring
118- cbAll* : array [1 , proc (e: Event )]
119124 html* : cstring
120125 htmlCpy* : cstring
121126 icon* : cstring
126131 connections* : cuint
127132 runtime* : cuint
128133 detectProcessClose* : bool
134+ hasEvents* : bool
129135 # when defined(windows):
130136 # serverThread: Handle
131137 # else:
142148 window* : ptr Window
143149 data* : pointer
144150 response* : pointer
151+ `type`* : cint
145152
146153 JavascriptResult * {.bycopy .} = object
147154 error* : bool
158165 internalId* : cstring
159166 elementName* : cstring
160167 data* : pointer
168+ dataLen* : cuint
169+ eventType* : cint
161170
162171 CmdAsync * {.bycopy .} = object
163172 win* : ptr Window
214223 cb_interface* : array [WEBUI_MAX_ARRAY , proc (elementId: cuint ;
215224 windowId: cuint ; elementName: cstring ; window: ptr Window ;
216225 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 .}]
220226 executablePath* : cstring
221227 ptrList* : array [WEBUI_MAX_ARRAY , pointer ]
222228 ptrPosition* : cuint
@@ -248,8 +254,6 @@ proc script*(win: ptr Window; script: ptr Script) {.cdecl,
248254proc `bind` * (win: ptr Window ; element: cstring ; `func`: proc (
249255 e: ptr Event ) {.cdecl .}): cuint {.
250256 cdecl , importc : " webui_bind" , webui .}
251- proc bindAll * (win: ptr Window ; `func`: proc (e: ptr Event ) {.cdecl .}) {.cdecl ,
252- importc : " webui_bind_all" , webui .}
253257proc open * (win: ptr Window ; url: cstring ; browser: cuint ): bool {.cdecl ,
254258 importc : " webui_open" , webui .}
255259proc scriptCleanup * (script: ptr Script ) {.cdecl ,
@@ -309,7 +313,7 @@ proc windowReceive*(win: ptr Window; packet: cstring; len: csize_t) {.cdecl,
309313proc windowSend * (win: ptr Window ; packet: cstring ;
310314 packetsSize: csize_t ) {.cdecl , importc : " _webui_window_send" , webui .}
311315proc windowEvent * (win: ptr Window ; elementId: cstring ; element: cstring ;
312- data: pointer ; dataLen: cuint ) {.cdecl ,
316+ data: pointer ; dataLen: cuint , eventType: cint ) {.cdecl ,
313317 importc : " _webui_window_event" , webui .}
314318proc windowGetNumber * (win: ptr Window ): cuint {.cdecl ,
315319 importc : " _webui_window_get_number" , webui .}
@@ -388,3 +392,6 @@ proc freeAllMem*() {.cdecl, importc: "_webui_free_all_mem", webui.}
388392
389393proc showWindow * (win: ptr Window ; html: cstring ; browser: cuint ): bool {.cdecl ,
390394 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