Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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