Rev 7252 | Rev 7450 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7252 | Rev 7447 | ||
---|---|---|---|
Line -... | Line 1... | ||
- | 1 | #ifndef INCLUDE_MENU_H |
|
1 | dword menu_process_id; |
2 | #define INCLUDE_MENU_H |
Line -... | Line 3... | ||
- | 3 | ||
- | 4 | #include "../lib/list_box.h" |
|
- | 5 | ||
- | 6 | :dword menu_process_id; |
|
2 | 7 | ||
3 | struct _menu |
8 | :struct _menu |
4 | { |
9 | { |
5 | dword appear_x, appear_y, text, identifier, selected; |
10 | dword appear_x, appear_y, text, identifier, selected; |
6 | llist list; |
11 | llist list; |
7 | void show(); |
12 | void show(); |
8 | char stak[4096]; |
13 | char stak[4096]; |
Line 9... | Line 14... | ||
9 | }menu; |
14 | } menu; |
10 | 15 | ||
- | 16 | void _menu::show(dword _appear_x, _appear_y, _menu_width, _text, _identifier) |
|
11 | void _menu::show(dword _appear_x, _appear_y, _menu_width, _text, _identifier) |
17 | { |
12 | { |
18 | #define ITEM_H 21 |
13 | appear_x = _appear_x; |
19 | appear_x = _appear_x; |
14 | appear_y = _appear_y; |
20 | appear_y = _appear_y; |
Line 15... | Line 21... | ||
15 | text = _text; |
21 | text = _text; |
16 | identifier = _identifier; |
22 | identifier = _identifier; |
17 | 23 | ||
18 | list.cur_y = -1; |
24 | list.cur_y = -1; |
Line 19... | Line 25... | ||
19 | list.ClearList(); |
25 | list.ClearList(); |
20 | list.count = chrnum(text, '\n')+1; |
26 | list.count = chrnum(text, '\n')+1; |
Line 21... | Line 27... | ||
21 | list.SetSizes(2,2,_menu_width,list.count*24,24); |
27 | list.SetSizes(2,2,_menu_width,list.count*ITEM_H,ITEM_H); |
22 | 28 | ||
23 | menu_process_id = CreateThread(#_menu_thread,#stak+4092); |
29 | menu_process_id = CreateThread(#_menu_thread,#stak+4092); |
24 | } |
30 | } |
25 | 31 | ||
26 | void _menu_thread() |
32 | :void _menu_thread() |
Line 47... | Line 53... | ||
47 | DrawPopup(0,0,menu.list.w,menu.list.h+3,0, 0xE4DFE1,0x9098B0); |
53 | DrawPopup(0,0,menu.list.w,menu.list.h+3,0, 0xE4DFE1,0x9098B0); |
48 | _menu_draw_list(); |
54 | _menu_draw_list(); |
49 | } |
55 | } |
50 | } |
56 | } |
Line 51... | Line 57... | ||
51 | 57 | ||
52 | void _menu_draw_list() |
58 | :void _menu_draw_list() |
53 | { |
59 | { |
54 | int N, bgcol; |
60 | int N, bgcol; |
55 | for (N=0; N |
61 | for (N=0; N |
56 | { |
62 | { |
57 | if (N==menu.list.cur_y) bgcol=0xFFFfff; else bgcol=0xE4DFE1; |
63 | if (N==menu.list.cur_y) bgcol=0xFFFfff; else bgcol=0xE4DFE1; |
58 | DrawBar(menu.list.x, N*menu.list.item_h+menu.list.y, menu.list.w-3, menu.list.item_h, bgcol); |
64 | DrawBar(menu.list.x, N*menu.list.item_h+menu.list.y, menu.list.w-3, menu.list.item_h, bgcol); |
59 | } |
65 | } |
60 | WriteTextLines(13, menu.list.item_h-12/2+menu.list.y, 0x90, 0, menu.text, menu.list.item_h); |
66 | WriteTextLines(13, menu.list.item_h-8/2+menu.list.y, 0x80, 0, menu.text, menu.list.item_h); |
61 | if (menu.selected) WriteText(5, menu.selected-1*menu.list.item_h+11, 0x80, 0xEE0000, "\x10"); |
67 | if (menu.selected) WriteText(5, menu.selected-1*menu.list.item_h+8, 0x80, 0xEE0000, "\x10"); |
Line 62... | Line 68... | ||
62 | } |
68 | } |
63 | 69 | ||
64 | void _menu_item_click() |
70 | :void _menu_item_click() |
65 | { |
71 | { |
66 | menu.list.cur_y = menu.identifier + menu.list.cur_y; |
72 | menu.list.cur_y = menu.identifier + menu.list.cur_y; |
Line 67... | Line 73... | ||
67 | KillProcess(menu_process_id); |
73 | KillProcess(menu_process_id); |
68 | } |
74 | } |
69 | 75 | ||
70 | void _menu_no_item_click() |
76 | :void _menu_no_item_click() |
71 | { |
77 | { |
72 | menu.list.cur_y = 0; |
78 | menu.list.cur_y = 0; |
- | 79 | KillProcess(menu_process_id); |
|
- | 80 | } |
|
73 | KillProcess(menu_process_id); |
81 |