mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-16 20:02:35 +03:00
babba2a8ce
IconEdit: use event model netcheck: example of event model, can be used for network testing git-svn-id: svn://kolibrios.org@7521 a494cfbc-eb01-0410-851d-a64ba20cac60
46 lines
605 B
C
46 lines
605 B
C
|
|
#ifndef INCLUDE_ARRAY_H
|
|
#include "../lib/array.h"
|
|
#endif
|
|
|
|
#define ECTRL 300
|
|
|
|
struct EVENTS
|
|
{
|
|
Array array;
|
|
int new_id;
|
|
void init();
|
|
int add();
|
|
int add_n();
|
|
bool press();
|
|
};
|
|
|
|
void EVENTS::init(dword size)
|
|
{
|
|
array.init(size);
|
|
new_id = 900;
|
|
}
|
|
|
|
int EVENTS::add(dword event1)
|
|
{
|
|
new_id++;
|
|
array.set(new_id, event1);
|
|
return new_id;
|
|
}
|
|
|
|
int EVENTS::add_n(dword id, event2)
|
|
{
|
|
array.set(id, event2);
|
|
return new_id;
|
|
}
|
|
|
|
bool EVENTS::press(dword id)
|
|
{
|
|
dword event3;
|
|
if (array.get(id)) {
|
|
event3 = array.get(id);
|
|
event3();
|
|
return true;
|
|
}
|
|
return false;
|
|
} |