Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
3225 leency 1
//list_box
2
 
3
struct llist
4
{
5
	int x, y, w, h, min_h;
6
	int line_h;
7
	int count, visible, first, current;
8
	void ClearList();
9
	void SetSizes(int xx, yy, ww, hh, min_hh, line_hh);
10
	int MouseScroll(dword scroll_state);
11
};
12
 
13
 
14
void llist::ClearList()
15
{
16
	count = visible = first = current = 0;
17
}
18
 
19
 
20
void llist::SetSizes(int xx, yy, ww, hh, min_hh, line_hh)
21
{
22
	x = xx;
23
	y = yy;
24
	w = ww;
25
	h = hh;
26
	min_h = min_hh;
27
	line_h = line_hh;
3368 leency 28
	visible = h / line_h;
3225 leency 29
}
30
 
31
 
32
int llist::MouseScroll(dword scroll_state)
33
{
34
	if (scroll_state == 65535)
35
	{
36
		if (first == 0) return 0;
37
		if (first > 3) first -= 2; else first=0;
38
		return 1;
39
	}
40
	if (scroll_state == 1)
41
	{
42
		if (visible+first+3 >= count) first = count - visible; else first+=2;
43
		return 1;
44
	}
45
	return 0;
46
}