Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1176 | andrew_pro | 1 | /* |
2 | service structures of libGUI |
||
3 | */ |
||
4 | #define NULL (void*)0 |
||
5 | |||
6 | typedef unsigned int DWORD; |
||
7 | typedef unsigned char BYTE; |
||
8 | typedef unsigned short int WORD; |
||
9 | typedef unsigned int size_t; |
||
10 | |||
11 | #define stdcall __stdcall |
||
12 | #define cdecl __cdecl |
||
13 | |||
14 | ///////////////////////////////////////////////////////////////////////// |
||
15 | // libGUI sysyem messages types |
||
16 | ///////////////////////////////////////////////////////////////////////// |
||
17 | #define MESSAGE_FULL_REDRAW_ALL 1 |
||
18 | #define MESSAGE_KEYS_EVENT 2 |
||
19 | #define MESSAGE_SPECIALIZED 3 |
||
20 | #define MESSAGE_SET_FOCUSE 4 |
||
21 | #define MESSAGE_CHANGE_FOCUSE 5 |
||
22 | #define MESSAGE_MOUSE_EVENT 6 |
||
23 | #define MESSAGE_CHANGE_POSITION_EVENT 7 |
||
24 | #define MESSAGE_CHANGESIZE_EVENT 8 |
||
25 | #define MESSAGE_CALL_TIMER_EVENT 9 |
||
26 | #define MESSAGE_FULL_REDRAW_ALL_WITH_FINITION 10 |
||
27 | #define MESSAGE_SET_MAIN_PARENT 11 |
||
28 | #define MESSAGE_DESTROY_CONTROL -1 |
||
29 | |||
30 | ///////////////////////////////////////////////////////////////////////// |
||
31 | // system keys states |
||
32 | ///////////////////////////////////////////////////////////////////////// |
||
33 | #define KEY_DOWN 16 |
||
34 | #define KEY_UP 17 |
||
35 | #define KEY_HOTKEY 18 |
||
36 | ///////////////////////////////////////////////////////////////////////// |
||
37 | // system mouse buttons states |
||
38 | ///////////////////////////////////////////////////////////////////////// |
||
39 | #define MOUSE_LEFT_BUTTON_DOWN 19 |
||
40 | #define MOUSE_LEFT_BUTTON_UP 20 |
||
41 | #define MOUSE_RIGHT_BUTTON_DOWN 21 |
||
42 | #define MOUSE_RIGHT_BUTTON_UP 22 |
||
43 | #define MOUSE_MIDDLE_BUTTON_DOWN 23 |
||
44 | #define MOUSE_MIDDLE_BUTTON_UP 24 |
||
45 | #define MOUSE_4_BUTTON_DOWN 25 |
||
46 | #define MOUSE_4_BUTTON_UP 26 |
||
47 | #define MOUSE_5_BUTTON_DOWN 27 |
||
48 | #define MOUSE_5_BUTTON_UP 28 |
||
49 | |||
50 | |||
51 | //----------------------------------------------------------------------- |
||
52 | // CONNECT EVENTS FOR CALLBACKs |
||
53 | //----------------------------------------------------------------------- |
||
54 | |||
55 | //////////////////////////////////////////////////////////////// |
||
56 | // connect events for button |
||
57 | //////////////////////////////////////////////////////////////// |
||
58 | #define BUTTON_ENTER_EVENT 29 |
||
59 | #define BUTTON_LEAVE_EVENT 30 |
||
60 | #define BUTTON_PRESSED_EVENT 31 |
||
61 | #define BUTTON_RELEASED_EVENT 32 |
||
62 | |||
63 | //////////////////////////////////////////////////////////////// |
||
64 | // connect events for scroll bar |
||
65 | //////////////////////////////////////////////////////////////// |
||
66 | #define SCROLLBAR_CHANGED_EVENT 33 |
||
67 | |||
68 | //////////////////////////////////////////////////////////////// |
||
69 | // connect events for main parent window |
||
70 | //////////////////////////////////////////////////////////////// |
||
71 | #define DELETE_EVENT 36 |
||
72 | |||
73 | //////////////////////////////////////////////////////////////// |
||
74 | // font type structure |
||
75 | //////////////////////////////////////////////////////////////// |
||
76 | #pragma pack(push,1) |
||
77 | struct FONT |
||
78 | { |
||
79 | DWORD *fnt_draw; |
||
80 | DWORD *fnt_unpacker; |
||
81 | DWORD *fnt_fd; |
||
82 | DWORD *fnt_bk; |
||
83 | int sizex; |
||
84 | int sizey; |
||
85 | int size; |
||
86 | int encoding_type; |
||
87 | char *font; |
||
88 | char *fnt_name; |
||
89 | DWORD type; |
||
90 | DWORD flags; |
||
91 | }; |
||
92 | #pragma pack(pop) |
||
93 | |||
94 | typedef struct FONT font_t; |
||
95 | |||
96 | //////////////////////////////////////////////////////////////// |
||
97 | // header of parent of control |
||
98 | //////////////////////////////////////////////////////////////// |
||
99 | |||
100 | #pragma pack(push,1) |
||
101 | struct HEADERPARENT |
||
102 | { |
||
103 | DWORD *ctrl_proc; |
||
104 | DWORD *ctrl_fd; |
||
105 | DWORD *ctrl_bk; |
||
106 | DWORD *child_fd; |
||
107 | DWORD *child_bk; |
||
108 | DWORD *parent; |
||
109 | DWORD *main_parent; |
||
110 | DWORD ctrl_x; |
||
111 | DWORD ctrl_y; |
||
112 | DWORD ctrl_sizex; |
||
113 | DWORD ctrl_sizey; |
||
114 | DWORD ctrl_ID; |
||
115 | DWORD *active_control_for_keys; |
||
116 | DWORD *active_control_for_mouse; |
||
117 | DWORD *callback; |
||
118 | DWORD *finition; |
||
119 | DWORD *timer; |
||
120 | DWORD flags; |
||
121 | |||
122 | DWORD **control_for_callback_function; |
||
123 | DWORD **callback_for_control_callback; |
||
124 | DWORD number_callbacks; |
||
125 | DWORD *global_active_control_for_keys; |
||
126 | DWORD *message; |
||
127 | DWORD *timer_bk; |
||
128 | DWORD *timer_fd; |
||
129 | DWORD number_timers_for_controls; |
||
130 | DWORD *calev_bk; |
||
131 | DWORD *calev_fd; |
||
132 | DWORD *IDL_func; |
||
133 | DWORD *IDL_func_data; |
||
134 | }; |
||
135 | #pragma pack(pop) |
||
136 | |||
137 | typedef struct HEADERPARENT parent_t; |
||
138 | |||
139 | //////////////////////////////////////////////////////////////// |
||
140 | // header of control |
||
141 | //////////////////////////////////////////////////////////////// |
||
142 | #pragma pack(push,1) |
||
143 | struct HEADER |
||
144 | { |
||
145 | DWORD *ctrl_proc; |
||
146 | DWORD *ctrl_fd; |
||
147 | DWORD *ctrl_bk; |
||
148 | DWORD *child_fd; |
||
149 | DWORD *child_bk; |
||
150 | DWORD *parent; |
||
151 | DWORD *main_parent; |
||
152 | DWORD ctrl_x; |
||
153 | DWORD ctrl_y; |
||
154 | DWORD ctrl_sizex; |
||
155 | DWORD ctrl_sizey; |
||
156 | DWORD ctrl_ID; |
||
157 | DWORD *active_control_for_keys; |
||
158 | DWORD *active_control_for_mouse; |
||
159 | DWORD *callback; |
||
160 | DWORD *finition; |
||
161 | DWORD *timer; |
||
162 | DWORD flags; |
||
163 | }; |
||
164 | #pragma pack(pop) |
||
165 | |||
166 | typedef struct HEADER header_t; |
||
167 | //////////////////////////////////////////////////////////////// |
||
168 | // callback structure for callback function of control |
||
169 | //////////////////////////////////////////////////////////////// |
||
170 | #pragma pack(push,1) |
||
171 | struct CALLBACK |
||
172 | { |
||
173 | DWORD *clb_bk; |
||
174 | DWORD *clb_fd; |
||
175 | DWORD *clb_control; |
||
176 | DWORD *func; |
||
177 | DWORD *func_data; |
||
178 | DWORD connect_event; |
||
179 | DWORD flags; |
||
180 | }; |
||
181 | #pragma pack(pop) |
||
182 | |||
183 | typedef struct CALLBACK gui_callback_t; |
||
184 | //////////////////////////////////////////////////////////////// |
||
185 | // timer |
||
186 | //////////////////////////////////////////////////////////////// |
||
187 | #pragma pack(push,1) |
||
188 | struct TIMER |
||
189 | { |
||
190 | DWORD *tmr_bk; |
||
191 | DWORD *tmr_fd; |
||
192 | DWORD *tmr_parent; |
||
193 | DWORD *func; |
||
194 | DWORD *func_data; |
||
195 | DWORD last_time; |
||
196 | DWORD time_tick; |
||
197 | DWORD flags; |
||
198 | }; |
||
199 | #pragma pack(pop) |
||
200 | |||
201 | typedef struct TIMER gui_timer_t; |
||
202 | //////////////////////////////////////////////////////////////// |
||
203 | // structure for callback events |
||
204 | //////////////////////////////////////////////////////////////// |
||
205 | #pragma pack(push,1) |
||
206 | struct CALLBACKEVENT |
||
207 | { |
||
208 | DWORD *calev_bk; |
||
209 | DWORD *calev_fd; |
||
210 | DWORD *calev_parent; |
||
211 | DWORD *func; |
||
212 | DWORD *func_data; |
||
213 | DWORD event_type; |
||
214 | }; |
||
215 | #pragma pack(pop) |
||
216 | |||
217 | typedef struct CALLBACKEVENT gui_callbackevent_t; |
||
218 | |||
219 | //////////////////////////////////////////////////////////////// |
||
220 | // type of data - structure message |
||
221 | //////////////////////////////////////////////////////////////// |
||
222 | #pragma pack(push,1) |
||
223 | struct MESSAGE |
||
224 | { |
||
225 | DWORD type; |
||
226 | DWORD arg1; |
||
227 | DWORD arg2; |
||
228 | DWORD arg3; |
||
229 | DWORD arg4; |
||
230 | }; |
||
231 | #pragma pack(pop) |
||
232 | |||
233 | typedef struct MESSAGE gui_message_t; |
||
234 | |||
235 | //////////////////////////////////////////////////////////////// |
||
236 | // button |
||
237 | //////////////////////////////////////////////////////////////// |
||
238 | #pragma pack(push,1) |
||
239 | struct ControlButton |
||
240 | { |
||
241 | DWORD *ctrl_proc; |
||
242 | DWORD *ctrl_fd; |
||
243 | DWORD *ctrl_bk; |
||
244 | DWORD *child_fd; |
||
245 | DWORD *child_bk; |
||
246 | DWORD *parent; |
||
247 | DWORD *main_parent; |
||
248 | DWORD ctrl_x; |
||
249 | DWORD ctrl_y; |
||
250 | DWORD ctrl_sizex; |
||
251 | DWORD ctrl_sizey; |
||
252 | DWORD ctrl_ID; |
||
253 | DWORD *active_control_for_keys; |
||
254 | DWORD *active_control_for_mouse; |
||
255 | DWORD *callback; |
||
256 | DWORD *finition; |
||
257 | DWORD *timer; |
||
258 | DWORD flags; |
||
259 | |||
260 | //button's data |
||
261 | BYTE btn_flags; |
||
262 | |||
263 | #pragma pack(pop) |
||
264 | |||
265 | |||
266 | |||
267 | |||
268 | #pragma pack(push,1) |
||
269 | struct ButtonData |
||
270 | { |
||
271 | int x; |
||
272 | int y; |
||
273 | int width; |
||
274 | int height; |
||
275 | }; |
||
276 | #pragma pack(pop) |
||
277 | |||
278 | |||
279 | |||
280 | |||
281 | // scroller |
||
282 | //////////////////////////////////////////////////////////////// |
||
283 | #pragma pack(push,1) |
||
284 | struct ControlScrollBar |
||
285 | { |
||
286 | DWORD *ctrl_proc; |
||
287 | DWORD *ctrl_fd; |
||
288 | DWORD *ctrl_bk; |
||
289 | DWORD *child_fd; |
||
290 | DWORD *child_bk; |
||
291 | DWORD *parent; |
||
292 | DWORD *main_parent; |
||
293 | DWORD ctrl_x; |
||
294 | DWORD ctrl_y; |
||
295 | DWORD ctrl_sizex; |
||
296 | DWORD ctrl_sizey; |
||
297 | DWORD ctrl_ID; |
||
298 | DWORD *active_control_for_keys; |
||
299 | DWORD *active_control_for_mouse; |
||
300 | DWORD *callback; |
||
301 | DWORD *finition; |
||
302 | DWORD *timer; |
||
303 | DWORD flags; |
||
304 | |||
305 | |||
306 | float ruller_size; |
||
307 | float ruller_pos; |
||
308 | float ruller_step; |
||
309 | BYTE scb_flags; |
||
310 | }; |
||
311 | |||
312 | |||
313 | |||
314 | |||
315 | struct ScrollBarData |
||
316 | { |
||
317 | int x; |
||
318 | int y; |
||
319 | int width; |
||
320 | int height; |
||
321 | float ruller_size; |
||
322 | float ruller_pos; |
||
323 | float ruller_step; |
||
324 | }; |
||
325 | #pragma pack(pop) |
||
326 | |||
327 | |||
328 | //////////////////////////////////////////////////////////////// |
||
329 | // progressbar |
||
330 | //////////////////////////////////////////////////////////////// |
||
331 | #pragma pack(push,1) |
||
332 | struct ControlProgressBar |
||
333 | { |
||
334 | DWORD *ctrl_proc; |
||
335 | DWORD *ctrl_fd; |
||
336 | DWORD *ctrl_bk; |
||
337 | DWORD *child_fd; |
||
338 | DWORD *child_bk; |
||
339 | DWORD *parent; |
||
340 | DWORD *main_parent; |
||
341 | DWORD ctrl_x; |
||
342 | DWORD ctrl_y; |
||
343 | DWORD ctrl_sizex; |
||
344 | DWORD ctrl_sizey; |
||
345 | DWORD ctrl_ID; |
||
346 | DWORD *active_control_for_keys; |
||
347 | DWORD *active_control_for_mouse; |
||
348 | DWORD *callback; |
||
349 | DWORD *finition; |
||
350 | DWORD *timer; |
||
351 | DWORD flags; |
||
352 | |||
353 | |||
354 | float progress; |
||
355 | BYTE prb_flags; |
||
356 | }; |
||
357 | #pragma pack(pop) |
||
358 | |||
359 | |||
360 | |||
361 | |||
362 | struct ProgressBarData |
||
363 | { |
||
364 | int x; |
||
365 | int y; |
||
366 | int width; |
||
367 | int height; |
||
368 | float progress; |
||
369 | }; |
||
370 | #pragma pack(pop) |
||
371 | |||
372 | |||
373 | //////////////////////////////////////////////////////////////// |
||
374 | // scrolled window |
||
375 | //////////////////////////////////////////////////////////////// |
||
376 | #pragma pack(push,1) |
||
377 | struct ControlScrolledWindow |
||
378 | { |
||
379 | DWORD *ctrl_proc; |
||
380 | DWORD *ctrl_fd; |
||
381 | DWORD *ctrl_bk; |
||
382 | DWORD *child_fd; |
||
383 | DWORD *child_bk; |
||
384 | DWORD *parent; |
||
385 | DWORD *main_parent; |
||
386 | DWORD ctrl_x; |
||
387 | DWORD ctrl_y; |
||
388 | DWORD ctrl_sizex; |
||
389 | DWORD ctrl_sizey; |
||
390 | DWORD ctrl_ID; |
||
391 | DWORD *active_control_for_keys; |
||
392 | DWORD *active_control_for_mouse; |
||
393 | DWORD *callback; |
||
394 | DWORD *finition; |
||
395 | DWORD *timer; |
||
396 | DWORD flags; |
||
397 | |||
398 | |||
399 | DWORD virtual_x; |
||
400 | DWORD virtual_y; |
||
401 | DWORD virtual_sizex; |
||
402 | DWORD virtual_sizey; |
||
403 | DWORD *virtual_controls_x; |
||
404 | DWORD *virtual_controls_y; |
||
405 | DWORD number_virtual_controls; |
||
406 | DWORD scroll_arrea_sizex; |
||
407 | DWORD scroll_arrea_sizey; |
||
408 | DWORD *horizontal_scroll; |
||
409 | DWORD *vertical_scroll; |
||
410 | BYTE scw_flags; |
||
411 | }; |
||
412 | #pragma pack(pop) |
||
413 | |||
414 | |||
415 | |||
416 | |||
417 | struct ScrolledWindowData |
||
418 | { |
||
419 | int x; |
||
420 | int y; |
||
421 | int width; |
||
422 | int height; |
||
423 | }; |
||
424 | #pragma pack(pop) |
||
425 | |||
426 | |||
427 | |||
428 | |||
429 | // image |
||
430 | //////////////////////////////////////////////////////////////// |
||
431 | #pragma pack(push,1) |
||
432 | struct ControlImage |
||
433 | { |
||
434 | DWORD *ctrl_proc; |
||
435 | DWORD *ctrl_fd; |
||
436 | DWORD *ctrl_bk; |
||
437 | DWORD *child_fd; |
||
438 | DWORD *child_bk; |
||
439 | DWORD *parent; |
||
440 | DWORD *main_parent; |
||
441 | DWORD ctrl_x; |
||
442 | DWORD ctrl_y; |
||
443 | DWORD ctrl_sizex; |
||
444 | DWORD ctrl_sizey; |
||
445 | DWORD ctrl_ID; |
||
446 | DWORD *active_control_for_keys; |
||
447 | DWORD *active_control_for_mouse; |
||
448 | DWORD *callback; |
||
449 | DWORD *finition; |
||
450 | DWORD *timer; |
||
451 | DWORD flags; |
||
452 | |||
453 | |||
454 | char bytes_per_pixel; |
||
455 | char *img; |
||
456 | }; |
||
457 | #pragma pack(pop) |
||
458 | |||
459 | |||
460 | |||
461 | |||
462 | struct ImageData |
||
463 | { |
||
464 | int x; |
||
465 | int y; |
||
466 | int width; |
||
467 | int height; |
||
468 | char bits_per_pixel; |
||
469 | }; |
||
470 | #pragma pack(pop) |
||
471 | |||
472 | |||
473 | |||
474 | |||
475 | // text |
||
476 | //////////////////////////////////////////////////////////////// |
||
477 | #pragma pack(push,1) |
||
478 | struct ControlText |
||
479 | { |
||
480 | DWORD *ctrl_proc; |
||
481 | DWORD *ctrl_fd; |
||
482 | DWORD *ctrl_bk; |
||
483 | DWORD *child_fd; |
||
484 | DWORD *child_bk; |
||
485 | DWORD *parent; |
||
486 | DWORD *main_parent; |
||
487 | DWORD ctrl_x; |
||
488 | DWORD ctrl_y; |
||
489 | DWORD ctrl_sizex; |
||
490 | DWORD ctrl_sizey; |
||
491 | DWORD ctrl_ID; |
||
492 | DWORD *active_control_for_keys; |
||
493 | DWORD *active_control_for_mouse; |
||
494 | DWORD *callback; |
||
495 | DWORD *finition; |
||
496 | DWORD *timer; |
||
497 | DWORD flags; |
||
498 | |||
499 | |||
500 | DWORD color; |
||
501 | DWORD background_color; |
||
502 | char *text; |
||
503 | BYTE txt_flags; |
||
504 | }; |
||
505 | #pragma pack(pop) |
||
506 | |||
507 | |||
508 | |||
509 | |||
510 | struct TextData |
||
511 | { |
||
512 | int x; |
||
513 | int y; |
||
514 | DWORD *font; |
||
515 | DWORD color; |
||
516 | DWORD background_color; |
||
517 | char background; |
||
518 | char *text; |
||
519 | }; |
||
520 | #pragma pack(pop) |
||
521 | |||
522 | |||
523 | ///////////////////////////////////////////////////////////////// |
||
524 | // load libGUI library and link functions |
||
525 | ///////////////////////////////////////////////////////////////// |
||
526 | void LoadLibGUI(char *lib_path); |
||
527 | |||
528 | |||
529 | // libGUI service functions |
||
530 | //********************************************************************** |
||
531 | |||
532 | |||
533 | char (stdcall *InitLibGUI)(void); |
||
534 | void (stdcall *LibGUImain)(parent_t *WindowParent); |
||
535 | void (stdcall *QuitLibGUI)(parent_t *window); |
||
536 | |||
537 | |||
538 | void (stdcall *SetWindowSizeRequest)(parent_t *WindowParent,int size_x,int size_y); |
||
539 | |||
540 | |||
541 | void (stdcall *DestroyControl)(void *control); |
||
542 | void (stdcall *SetControlSizeRequest)(void *Control,int new_size_x,int new_size_y); |
||
543 | int (stdcall *GetControlSizeX)(void *Control); |
||
544 | int (stdcall *GetControlSizeY)(void *Control); |
||
545 | void (stdcall *SetControlNewPosition)(void *Control,int new_x,int new_y); |
||
546 | int (stdcall *GetControlPositionX)(void *Control); |
||
547 | int (stdcall *GetControlPositionY)(void *Control); |
||
548 | void* (stdcall *SetFocuse)(void *Control); |
||
549 | void (stdcall *RedrawControl)(void *Control); |
||
550 | void (stdcall *SpecialRedrawControl)(void *Control); |
||
551 | |||
552 | |||
553 | int event_name,void *callback_func, |
||
554 | void *callback_func_data); |
||
555 | void (stdcall *BlockCallbackFunction)(void *Control,gui_callback_t *callback_ID); |
||
556 | void (stdcall *UnblockCallbackFunction)(void *Control,gui_callback_t *callback_ID); |
||
557 | |||
558 | |||
559 | void (stdcall *DestroyIDL_Function)(parent_t *Parent); |
||
560 | |||
561 | |||
562 | int time_tick,void *func,void *func_data); |
||
563 | void (stdcall *DestroyTimerCallbackForFunction)(gui_timer_t *timer); |
||
564 | |||
565 | |||
566 | int event_type,void *func,void *func_data); |
||
567 | void (stdcall *DestroyCallbackFunctionForEvent)(gui_callbackevent_t *callback_event); |
||
568 | |||
569 | |||
570 | gui_button_t* (stdcall *CreateButtonWithText)(gui_button_data_t *info,char *txt); |
||
571 | |||
572 | |||
573 | void (stdcall *SetProgressBarPulse)(gui_progress_bar_t *ProgressBar,int time_update); |
||
574 | void (stdcall *ProgressBarSetText)(gui_progress_bar_t *pbar,char *txt); |
||
575 | char* (stdcall *ProgressBarGetText)(gui_progress_bar_t *pbar); |
||
576 | |||
577 | |||
578 | gui_scroll_bar_t* (stdcall *CreateVerticalScrollBar)(gui_scroll_bar_data_t *info_for_control); |
||
579 | |||
580 | |||
581 | void (stdcall *ScrolledWindowPackControls)(gui_scrolled_window_t *parent,void *Control); |
||
582 | |||
583 | |||
584 | |||
585 | |||
586 | void (stdcall *TextBackgroundOn)(gui_text_t *Text); |
||
587 | void (stdcall *TextBackgroundOff)(gui_text_t *Text); |
||
588 | |||
589 | |||
590 | void (stdcall *FreeFont)(font_t *font); |
||
591 |