Subversion Repositories Kolibri OS

Rev

Rev 2793 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2764 leency 1
//Leency - 2012
2
 
3
#define ITEM_HEIGHT 18
4
#define ITEM_WIDTH  138
5
 
6
char *ITEMS_LIST[]={
2793 leency 7
"View in Tinypad   F3",
8
"View in TextEdit  F4",
2764 leency 9
"--------------------", //сделать определение таких линий и рисовать их
10
"KOI-8         Ctrl+K",
11
"UTF           Ctrl+U",
12
0};
13
 
14
proc_info MenuForm;
15
 
16
 
17
void menu_rmb()
18
{
19
 
20
	mouse mm;
2793 leency 21
	int items_num, items_cur;
22
	byte id, key;
2764 leency 23
 
24
	SetEventMask(100111b);
25
 
2799 leency 26
	loop() switch(WaitEvent())
2764 leency 27
	{
28
		case evMouse:
2793 leency 29
				mm.get();
2799 leency 30
				if (mm.lkm) || (mm.pkm)
31
					if (mm.x>ITEM_WIDTH) || (mm.y>items_num*ITEM_HEIGHT+1) ExitProcess();
32
 
2793 leency 33
				id=mm.y/ITEM_HEIGHT;
34
				if (id<0) || (id+1>items_num) break;
35
				if (items_cur<>id)
36
				{
37
					items_cur=id;
38
					goto _ITEMS_DRAW;
39
				}
40
 
2764 leency 41
				break;
42
 
43
		case evButton:
44
				id=GetButtonID();
45
				if (id==1) ExitProcess();
2793 leency 46
				_BUTTON_MARK:
2764 leency 47
				if (id==10) WB1.Scan(52); //View html code
2793 leency 48
				if (id==11) WB1.Scan(53); //View html code
49
				if (id==12) break;
50
				if (id==13) WB1.Scan(11); //KOI
51
				if (id==14) WB1.Scan(21); //UTF
2764 leency 52
 
53
				ExitProcess();
54
				break;
55
 
56
		case evKey:
2793 leency 57
				key = GetKey();
58
				if (key==27) ExitProcess();
59
				if (key==178) && (items_cur)
60
				{
61
					items_cur--;
62
					goto _ITEMS_DRAW;
63
				}
64
				if (key==177) && (items_cur+1
65
				{
66
					items_cur++;
67
					goto _ITEMS_DRAW;
68
				}
69
				if (key==13)
70
				{
71
					id=items_cur+10;
72
					//WriteDebug(IntToStr(id));
73
					goto _BUTTON_MARK;
74
				}
2764 leency 75
				break;
76
 
77
		case evReDraw:
78
				for (items_num=0; ITEMS_LIST[items_num]<>0; items_num++;) {};
2793 leency 79
				DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinWidth()+3,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,0x10FFFFFF,0,0,0);
2764 leency 80
 
2793 leency 81
				DrawRegion(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x777777); //ободок
82
				_ITEMS_DRAW:
2764 leency 83
				for (i=0; i
84
				{
85
					DefineButton(0, i*ITEM_HEIGHT, ITEM_WIDTH, ITEM_HEIGHT, i+10+BT_HIDE, 0xFFFFFF);
2793 leency 86
					if (i<>items_cur) EDX=0xFFFFFF; else EDX=0x94AECE;
87
					DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, EDX);
2764 leency 88
					WriteText(8,i*ITEM_HEIGHT+6,0x80,0x000000,ITEMS_LIST[i],0);
89
				}
90
	}
91
}