Subversion Repositories Kolibri OS

Rev

Rev 5676 | Rev 5702 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5676 Rev 5694
Line 12... Line 12...
12
	int x, y, w, h, min_h, line_h, text_y;
12
	int x, y, w, h, min_h, line_h, text_y;
13
	int column_max;
13
	int column_max;
14
	int count, visible, first, current; //visible = row_max
14
	int count, visible, first, current; //visible = row_max
15
	int active;
15
	int active;
16
	void ClearList();
16
	void ClearList();
17
	int ProcessKey(dword key);
-
 
18
	int MouseOver(int xx, yy);
17
	int MouseOver(int xx, yy);
19
	int ProcessMouse(int xx, yy);
18
	int ProcessMouse(int xx, yy);
-
 
19
	int ProcessKey(dword key);
20
	int KeyDown();
20
	int KeyDown();
21
	int KeyUp();
21
	int KeyUp();
22
	int KeyHome();
22
	int KeyHome();
23
	int KeyEnd();
23
	int KeyEnd();
-
 
24
	int KeyPgDown();
-
 
25
	int KeyPgUp();
-
 
26
	void CheckDoesValuesOkey();
24
	void SetSizes(int xx, yy, ww, hh, min_hh, line_hh);
27
	void SetSizes(int xx, yy, ww, hh, min_hh, line_hh);
25
	int MouseScroll(dword scroll_state);
28
	int MouseScroll(dword scroll_state);
26
	int MouseScrollNoSelection(dword scroll_state);
29
	int MouseScrollNoSelection(dword scroll_state);
27
	void debug_values();
30
	void debug_values();
28
}; 
31
}; 
Line 29... Line 32...
29
 
32
 
30
 
33
 
31
void llist::debug_values()
-
 
32
{
34
void llist::debug_values()
33
	debug("current: ");
35
{
34
	debugi(current);
-
 
35
	debug("first: ");
36
	char yi[128];
36
	debugi(first);
-
 
37
	debug("visible: ");
-
 
38
	debugi(visible);
37
	sprintf(#yi, "%s %d %s %d %s %d %s %d", "current:", current, "first:", first,
39
	debug("count: ");
38
	"visible:", visible, "count:", count);
Line 40... Line 39...
40
	debugi(count);
39
	debugln(#yi);
Line 54... Line 53...
54
	y = yy;
53
	y = yy;
55
	w = ww;
54
	w = ww;
56
	h = hh;
55
	h = hh;
57
	min_h = min_hh;
56
	min_h = min_hh;
58
	line_h = line_hh;
57
	line_h = line_hh;
59
	text_y = line_hh / 2 - 4;
58
	text_y = line_h / 2 - 4;
60
	visible = h / line_h;
59
	visible = h / line_h;
61
	column_max = w / 6;
60
	column_max = w / 6;
62
	//if (visible > count) visible=count;
61
	//if (visible > count) visible=count;
63
}
62
}
Line 126... Line 125...
126
	{
125
	{
127
		case ASCII_KEY_DOWN: return KeyDown();
126
		case ASCII_KEY_DOWN: return KeyDown();
128
		case ASCII_KEY_UP:   return KeyUp();
127
		case ASCII_KEY_UP:   return KeyUp();
129
		case ASCII_KEY_HOME: return KeyHome();
128
		case ASCII_KEY_HOME: return KeyHome();
130
		case ASCII_KEY_END:  return KeyEnd();
129
		case ASCII_KEY_END:  return KeyEnd();
-
 
130
		case ASCII_KEY_PGUP: return KeyPgUp();
-
 
131
		case ASCII_KEY_PGDN: return KeyPgDown();
131
	}
132
	}
132
	return 0;
133
	return 0;
133
}
134
}
Line 134... Line 135...
134
 
135
 
135
int llist::KeyDown()
136
int llist::KeyDown()
136
{
137
{
137
	if (current-first+1
138
	if (current-first+1
138
	{
139
	{
139
		if (current+1>=count) return 0;
140
		if (current + 1 >= count) return 0;
140
		current++;
141
		current++;
141
	}
142
	}
142
	else 
143
	else 
143
	{
144
	{
144
		if (visible+first>=count) return 0;
145
		if (visible + first >= count) return 0;
145
		first++;
146
		first++;
146
		current++;
147
		current++;
-
 
148
	}
-
 
149
	if (current < first) || (current > first + visible)
-
 
150
	{
-
 
151
		first = current;
-
 
152
		CheckDoesValuesOkey();
147
	}
153
	}
148
	return 1;
154
	return 1;
Line 149... Line 155...
149
}
155
}
150
 
156
 
151
int llist::KeyUp()
157
int llist::KeyUp()
152
{
158
{
153
	if (current>first) 
159
	if (current > first) 
154
	{
160
	{
155
		current--;
161
		current--;
156
	}
162
	}
157
	else
163
	else
158
	{
164
	{
159
		if (first==0) return 0;
165
		if (first == 0) return 0;
160
		first--;
166
		first--;
-
 
167
		current--;
-
 
168
	}
-
 
169
	if (current < first) || (current > first + visible)
-
 
170
	{
-
 
171
		first = current;
161
		current--;
172
		CheckDoesValuesOkey();
162
	}
173
	}
Line 163... Line 174...
163
	return 1;
174
	return 1;
164
}
175
}
165
 
176
 
166
int llist::KeyHome()
177
int llist::KeyHome()
167
{
-
 
168
	if (current==0) && (first==0) return 0;
178
{
169
	current=0;
179
	if (current==0) && (first==0) return 0;
Line 170... Line 180...
170
	first=0;
180
	current = first = 0;
171
	return 1;
181
	return 1;
172
}
182
}
173
 
183
 
174
int llist::KeyEnd()
184
int llist::KeyEnd()
-
 
185
{
-
 
186
	if (current==count-1) && (first==count-visible) return 0;
-
 
187
	current = count-1;
-
 
188
	first = count - visible;
-
 
189
	return 1;
-
 
190
}
-
 
191
 
-
 
192
int llist::KeyPgUp()
-
 
193
{
175
{
194
	if (count <= visible) return KeyHome();
176
	if (current==count-1) && (first==count-visible) return 0;
195
	if (first == 0) return 0;
Line -... Line 196...
-
 
196
	first -= visible;
-
 
197
	CheckDoesValuesOkey();
-
 
198
	return 1;
-
 
199
}
-
 
200
 
-
 
201
int llist::KeyPgDown()
-
 
202
{
-
 
203
	if (count <= visible) return KeyEnd();
-
 
204
	if (first == count - visible) return 0;
-
 
205
	first += visible;
-
 
206
	CheckDoesValuesOkey();
-
 
207
	return 1;
-
 
208
}
-
 
209
 
-
 
210
void llist::CheckDoesValuesOkey()
-
 
211
{
-
 
212
	if (first < 0) first = 0;
177
	current=count-1;
213
	if (visible + first > count) first = count - visible;
178
	first=count-visible;
214
	if (current >= count) current = count - 1;