Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6887 | pavelyakov | 1 | #ifndef INCLUDE_WINDOW_H |
2 | #define INCLUDE_WINDOW_H |
||
3 | #include "../lib/gui.h" |
||
4 | |||
5 | |||
6 | #define WINDOW_NORMAL 0x34 |
||
7 | :struct window |
||
8 | { |
||
9 | void create(); |
||
10 | dword left,top,width,height; |
||
11 | dword caption,type,background; |
||
12 | dword onbutton,onkey,ondraw; |
||
13 | proc_info Form; |
||
14 | }; |
||
15 | |||
16 | void window::create() |
||
17 | { |
||
18 | word id=0; |
||
19 | IF(!caption)caption = "Window"; |
||
20 | IF(!width)width=350; |
||
21 | IF(!height)height=300; |
||
22 | IF(!type)type = WINDOW_NORMAL; |
||
23 | IF(!background)background = 0xDED7CE; |
||
24 | |||
25 | loop() switch(WaitEvent()) |
||
26 | { |
||
27 | case evButton: |
||
28 | id=GetButtonID(); |
||
29 | IF(onbutton)onbutton(id); |
||
30 | IF (id==1) ExitProcess(); |
||
31 | break; |
||
32 | |||
33 | case evKey: |
||
34 | GetKeys(); |
||
35 | IF(onkey)onbutton(key_scancode); |
||
36 | //if (key_scancode == SCAN_CODE_ESC ) ExitProcess(); |
||
37 | break; |
||
38 | |||
39 | case evReDraw: |
||
40 | GetProcessInfo(#Form, SelfInfo); |
||
41 | DefineAndDrawWindow(left,top,width,height,type,background,caption,0); |
||
42 | |||
43 | IF(ondraw)ondraw(); |
||
44 | break; |
||
45 | } |
||
46 | |||
47 | } |
||
48 | |||
49 | #endif |