Subversion Repositories Kolibri OS

Rev

Rev 7450 | Rev 8020 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6041 leency 1
#define MEMSIZE 4096*10
2
 
3
#include "../lib/io.h"
4
#include "../lib/list_box.h"
5
#include "../lib/gui.h"
7782 leency 6
#include "../lib/fs.h"
6041 leency 7
 
8
struct _object
9
{
10
	int x,y,w,h,id;
11
};
12
 
7782 leency 13
_object butv = { 20, 20, 100, 20, 10};
14
_object buta = {150, 20, 100, 20, 20};
6041 leency 15
 
16
char vegetables[] =
7782 leency 17
"Onion
6041 leency 18
Melon
19
Tomato
20
Squash
21
Salad";
22
 
23
char animals[] =
7782 leency 24
"Cat
6041 leency 25
Dog
26
Pig
27
Cow
28
Goat
29
Rabbit";
30
 
31
 
32
 
33
void main()
34
{
7782 leency 35
	dword menu_id=0, click_id;
6041 leency 36
	proc_info Form;
7782 leency 37
	byte current_animal=1, current_veg=3;
6041 leency 38
	int id;
39
 
40
	loop() switch(WaitEvent())
41
	{
42
	 case evButton:
43
		id=GetButtonID();
44
		if (id==1) ExitProcess();
45
		if (id==butv.id) {
7782 leency 46
			menu_id = butv.id;
47
			open_lmenu(Form.left+3 + butv.x, Form.top+skin_height + butv.y + butv.h,
48
				MENU_ALIGN_TOP_LEFT, current_veg, #vegetables);
6041 leency 49
		}
50
		if (id==buta.id) {
7782 leency 51
			menu_id = buta.id;
52
			open_lmenu(Form.left+5 + buta.x + buta.w, Form.top+skin_height + buta.y + buta.h,
53
				MENU_ALIGN_TOP_RIGHT, current_animal, #animals);
6041 leency 54
		}
55
		break;
56
 
57
	case evKey:
58
		GetKeys();
59
		break;
60
 
61
	 case evReDraw:
7782 leency 62
		if (click_id = get_menu_click()) {
63
			if (menu_id == butv.id) current_veg = click_id;
64
			if (menu_id == buta.id) current_animal = click_id;
65
			menu_id = 0;
6041 leency 66
		}
6746 leency 67
		DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
6041 leency 68
		GetProcessInfo(#Form, SelfInfo);
69
		WriteText(10,110,0x80,0,#param);
70
		DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables");
71
		DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal");
72
		break;
73
	}
74
}