Subversion Repositories Kolibri OS

Rev

Rev 7757 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5977 leency 1
#include "..\lib\collection.h"
3363 leency 2
 
6021 leency 3
struct _history {
5977 leency 4
	collection items;
5
	int active;
7771 leency 6
	void clear();
5979 leency 7
	int add();
8
	int back();
9
	int forward();
5977 leency 10
	dword current();
7757 leency 11
};
3363 leency 12
 
6021 leency 13
int _history::add(dword in)
3363 leency 14
{
5977 leency 15
	if (!strcmp(in, items.get(active-1))) return 0;
16
	items.count = active;
17
	items.add(in);
18
	active++;
5974 leency 19
	return 1;
3363 leency 20
}
5974 leency 21
 
6021 leency 22
int _history::back()
5974 leency 23
{
5977 leency 24
	if (active==1) return 0;
25
	active--;
5979 leency 26
	return 1;
5974 leency 27
}
3363 leency 28
 
6021 leency 29
int _history::forward()
3363 leency 30
{
5977 leency 31
	if (active==items.count) return 0;
32
	active++;
5979 leency 33
	return 1;
5977 leency 34
}
35
 
6021 leency 36
dword _history::current()
5977 leency 37
{
38
	return items.get(active-1);
7771 leency 39
}
40
 
41
:void _history::clear()
42
{
43
	items.drop();
44
	active=0;
45
}