Subversion Repositories Kolibri OS

Rev

Rev 8022 | Details | Compare with Previous | Last modification | View Log | RSS feed

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