Rev 3434 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3434 | leency | 1 | //Leency 2008-2013 |
2 | |||
3 | char *captions[] = { |
||
4 | "Open", "Enter", |
||
3439 | leency | 5 | "Open with...", "CrlEnt", |
3434 | leency | 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; |
||
3439 | leency | 15 | mouse mm; |
3434 | leency | 16 | word id, key, slot; |
3439 | leency | 17 | int ccount=0, cur, newi, linew=10, lineh=18, texty; |
3434 | leency | 18 | for (i=0; captions[i]!=0; i+=2) |
19 | { |
||
20 | ccount++; |
||
21 | if (strlen(captions[i])>linew) linew = strlen(captions[i]); |
||
22 | } |
||
3439 | leency | 23 | linew = linew + 3 * 6 + 50; |
3434 | leency | 24 | texty = lineh/2-4; |
25 | SetEventMask(100111b); |
||
26 | |||
27 | goto _MENU_DRAW; |
||
28 | loop() switch(WaitEvent()) |
||
29 | { |
||
30 | case evMouse: |
||
31 | slot = GetProcessSlot(MenuForm.ID); |
||
32 | if (slot != GetActiveProcess()) ExitProcess(); |
||
3439 | leency | 33 | mm.get(); |
34 | newi = mm.y - 1 / lineh; |
||
35 | //if (m.y<0) || (newi+1>items_num) || (m.x<0) || (m.x>ITEM_WIDTH) break; |
||
36 | if (cur<>newi) |
||
37 | { |
||
38 | cur=newi; |
||
39 | goto _ITEMS_DRAW; |
||
40 | } |
||
3434 | leency | 41 | break; |
42 | |||
43 | case evButton: |
||
44 | id=GetButtonID(); |
||
45 | if (id==100) Open(); |
||
46 | if (id==101) notify("Not compleated yet"); |
||
47 | if (id==102) ActionsProcess(3); |
||
48 | if (id==103) ActionsProcess(4); |
||
49 | if (id==104) ActionsProcess(2); |
||
50 | if (id==105) Del_Form(); |
||
51 | ExitProcess(); |
||
52 | break; |
||
53 | |||
54 | case evKey: |
||
55 | IF (GetKey()==27) ExitProcess(); |
||
56 | break; |
||
57 | |||
58 | case evReDraw: _MENU_DRAW: |
||
3439 | leency | 59 | DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+2,ccount*lineh+5,0x01, 0, 0, 0x01fffFFF); |
3434 | leency | 60 | GetProcessInfo(#MenuForm, SelfInfo); |
61 | /* _PutImage(1,23, 16,44, #factions); //иконки */ |
||
3439 | leency | 62 | DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border); |
63 | DrawBar(1,1,linew,1,0xFFFfff); |
||
64 | PutShadow(linew+2,1,1,ccount*lineh+2,0,1); |
||
65 | PutShadow(1,ccount*lineh+3,linew+2,1,0,1); |
||
3434 | leency | 66 | |
3439 | leency | 67 | _ITEMS_DRAW: |
3434 | leency | 68 | for (i=0; captions[i*2]!=0; i++) |
69 | { |
||
3439 | leency | 70 | DefineButton(1,i*lineh+1,linew,lineh-1,i+100+BT_HIDE+BT_NOFRAME,0xFFFFFF); |
71 | DrawBar(1,i*lineh+2,1,lineh,0xFFFfff); |
||
72 | if (i==cur) DrawBar(2,i*lineh+2,linew-1,lineh,0xFFFfff); else DrawBar(2,i*lineh+2,linew-1,lineh,col_work); |
||
73 | WriteText(7,i*lineh+texty+2,0x80,0x000000,captions[i*2]); |
||
74 | WriteText(-strlen(captions[i*2+1])*6-6+linew,i*lineh+texty+2,0x80,0x999999,captions[i*2+1]); |
||
3434 | leency | 75 | } |
76 | } |
||
77 | }>0)>0)> |