Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3434 | leency | 1 | //Leency 2008-2013 |
2 | |||
3 | char *captions[] = { |
||
4 | "Open", "Enter", |
||
5 | "Open with...", "Ctrl+Ent", |
||
6 | "View as text", "F3", |
||
7 | "View as HEX", "F4", |
||
8 | "Rename", "F2", |
||
9 | "Delete", "Del", |
||
10 | 0}; |
||
11 | |||
12 | void FileMenu() |
||
13 | { |
||
14 | proc_info MenuForm; |
||
15 | word id, key, slot; |
||
16 | int ccount=0, linew=10, lineh=18, texty; |
||
17 | for (i=0; captions[i]!=0; i+=2) |
||
18 | { |
||
19 | ccount++; |
||
20 | if (strlen(captions[i])>linew) linew = strlen(captions[i]); |
||
21 | } |
||
22 | linew = linew + 3 * 6 + 70; |
||
23 | texty = lineh/2-4; |
||
24 | SetEventMask(100111b); |
||
25 | |||
26 | goto _MENU_DRAW; |
||
27 | loop() switch(WaitEvent()) |
||
28 | { |
||
29 | case evMouse: |
||
30 | slot = GetProcessSlot(MenuForm.ID); |
||
31 | if (slot != GetActiveProcess()) ExitProcess(); |
||
32 | break; |
||
33 | |||
34 | case evButton: |
||
35 | id=GetButtonID(); |
||
36 | if (id==100) Open(); |
||
37 | if (id==101) notify("Not compleated yet"); |
||
38 | if (id==102) ActionsProcess(3); |
||
39 | if (id==103) ActionsProcess(4); |
||
40 | if (id==104) ActionsProcess(2); |
||
41 | if (id==105) Del_Form(); |
||
42 | ExitProcess(); |
||
43 | break; |
||
44 | |||
45 | case evKey: |
||
46 | IF (GetKey()==27) ExitProcess(); |
||
47 | break; |
||
48 | |||
49 | case evReDraw: _MENU_DRAW: |
||
50 | DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+2,ccount*lineh+2,0x01,0xEEEeee,0x01fffFFF); |
||
51 | GetProcessInfo(#MenuForm, SelfInfo); |
||
52 | /* _PutImage(1,23, 16,44, #factions); //иконки */ |
||
53 | DrawRectangle(0,0,linew+1,ccount*lineh+1,col_border); |
||
54 | PutShadow(linew+2,1,1,ccount*lineh+1,0,1); |
||
55 | PutShadow(1,ccount*lineh+2,linew+1,1,0,1); |
||
56 | |||
57 | for (i=0; captions[i*2]!=0; i++) |
||
58 | { |
||
59 | DefineButton(1,i*lineh,linew,lineh-1,i+100+BT_HIDE,0xFFFFFF); |
||
60 | DrawBar(1,i*lineh+1,1,lineh,0xFFFfff); |
||
61 | DrawBar(2,i*lineh+1,linew-1,lineh,col_work); |
||
62 | WriteText(6,i*lineh+texty+1,0x80,0x000000,captions[i*2]); |
||
63 | WriteText(-strlen(captions[i*2+1])*6-7+linew,i*lineh+texty+1,0x80,0x999999,captions[i*2+1]); |
||
64 | } |
||
65 | } |
||
66 | } |