Subversion Repositories Kolibri OS

Rev

Rev 3368 | Go to most recent revision | Details | 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;
28
}
29
 
30
 
31
int llist::MouseScroll(dword scroll_state)
32
{
33
	if (scroll_state == 65535)
34
	{
35
		if (first == 0) return 0;
36
		if (first > 3) first -= 2; else first=0;
37
		return 1;
38
	}
39
	if (scroll_state == 1)
40
	{
41
		if (visible+first+3 >= count) first = count - visible; else first+=2;
42
		return 1;
43
	}
44
	return 0;
45
}