Subversion Repositories Kolibri OS

Rev

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