Rev 6746 | Rev 7450 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6746 | Rev 6782 | ||
---|---|---|---|
1 | #define MEMSIZE 4096*10 |
1 | #define MEMSIZE 4096*10 |
2 | 2 | ||
3 | #include "../lib/io.h" |
3 | #include "../lib/io.h" |
4 | #include "../lib/list_box.h" |
4 | #include "../lib/list_box.h" |
5 | #include "../lib/gui.h" |
5 | #include "../lib/gui.h" |
6 | #include "../lib/menu.h" |
6 | #include "../lib/menu.h" |
7 | 7 | ||
8 | struct _object |
8 | struct _object |
9 | { |
9 | { |
10 | int x,y,w,h,id; |
10 | int x,y,w,h,id; |
11 | }; |
11 | }; |
12 | 12 | ||
13 | _object butv = { 20, 20, 100, 30, 10}; |
13 | _object butv = { 20, 20, 100, 30, 10}; |
14 | _object buta = {150, 20, 100, 30, 20}; |
14 | _object buta = {150, 20, 100, 30, 20}; |
15 | 15 | ||
16 | char vegetables[] = |
16 | char vegetables[] = |
17 | "Onion |
17 | "Onion |
18 | Melon |
18 | Melon |
19 | Tomato |
19 | Tomato |
20 | Squash |
20 | Squash |
21 | Salad"; |
21 | Salad"; |
22 | 22 | ||
23 | char animals[] = |
23 | char animals[] = |
24 | "Cat |
24 | "Cat |
25 | Dog |
25 | Dog |
26 | Pig |
26 | Pig |
27 | Cow |
27 | Cow |
28 | Goat |
28 | Goat |
29 | Rabbit"; |
29 | Rabbit"; |
30 | 30 | ||
31 | byte category; |
31 | byte category; |
32 | 32 | ||
33 | 33 | ||
34 | void main() |
34 | void main() |
35 | { |
35 | { |
36 | proc_info Form; |
36 | proc_info Form; |
37 | int id; |
37 | int id; |
38 | 38 | ||
39 | loop() switch(WaitEvent()) |
39 | loop() switch(WaitEvent()) |
40 | { |
40 | { |
41 | case evButton: |
41 | case evButton: |
42 | id=GetButtonID(); |
42 | id=GetButtonID(); |
43 | if (id==1) ExitProcess(); |
43 | if (id==1) ExitProcess(); |
44 | if (id==butv.id) { |
44 | if (id==butv.id) { |
45 | menu.selected = category+1; |
45 | menu.selected = category+1; |
46 | menu.show(Form.left+5 + butv.x, Form.top+skin_height + butv.y + butv.h, 100, #vegetables, butv.id); |
46 | menu.show(Form.left+5 + butv.x, Form.top+skin_height + butv.y + butv.h, 140, #vegetables, butv.id); |
47 | } |
47 | } |
48 | if (id==buta.id) { |
48 | if (id==buta.id) { |
49 | menu.selected = 0; |
49 | menu.selected = 0; |
50 | menu.show(Form.left+5 + buta.x, Form.top+skin_height + buta.y + buta.h, 120, #animals, buta.id); |
50 | menu.show(Form.left+5 + buta.x, Form.top+skin_height + buta.y + buta.h, 140, #animals, buta.id); |
51 | } |
51 | } |
52 | break; |
52 | break; |
53 | 53 | ||
54 | case evKey: |
54 | case evKey: |
55 | GetKeys(); |
55 | GetKeys(); |
56 | break; |
56 | break; |
57 | 57 | ||
58 | case evReDraw: |
58 | case evReDraw: |
59 | if (menu.list.cur_y) { |
59 | if (menu.list.cur_y) { |
60 | if (menu.list.cur_y > butv.id) && (menu.list.cur_y < buta.id) category = menu.list.cur_y - butv.id; |
60 | if (menu.list.cur_y > butv.id) && (menu.list.cur_y < buta.id) category = menu.list.cur_y - butv.id; |
61 | } |
61 | } |
62 | DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0); |
62 | DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0); |
63 | GetProcessInfo(#Form, SelfInfo); |
63 | GetProcessInfo(#Form, SelfInfo); |
64 | WriteText(10,110,0x80,0,#param); |
64 | WriteText(10,110,0x80,0,#param); |
65 | DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables"); |
65 | DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables"); |
66 | DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal"); |
66 | DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal"); |
67 | break; |
67 | break; |
68 | } |
68 | } |
69 | }> |
69 | }> |