Subversion Repositories Kolibri OS

Rev

Rev 6887 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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