Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

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