Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
9635 leency 1
#ifndef INCLUDE_EVENTS_H
2
#define INCLUDE_EVENTS_H
3
#print "[include ]\n"
7521 leency 4
 
9635 leency 5
#include "../lib/collection.h"
7521 leency 6
 
7
#define ECTRL 300
8
 
9
struct EVENTS
10
{
9635 leency 11
	collection_int array;
7521 leency 12
	int new_id;
13
	void init();
14
	int add();
15
	int add_n();
16
	bool press();
17
};
18
 
19
void EVENTS::init(dword size)
20
{
9635 leency 21
	array.drop();
7521 leency 22
	new_id = 900;
23
}
24
 
25
int EVENTS::add(dword event1)
26
{
27
	new_id++;
28
	array.set(new_id, event1);
29
	return new_id;
30
}
31
 
32
int EVENTS::add_n(dword id, event2)
33
{
34
	array.set(id, event2);
35
	return new_id;
36
}
37
 
38
bool EVENTS::press(dword id)
39
{
40
	dword event3;
41
	if (array.get(id)) {
42
		event3 = array.get(id);
43
		event3();
44
		return true;
45
	}
46
	return false;
9635 leency 47
}
48
 
49
#endif