Subversion Repositories Kolibri OS

Rev

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

  1. #ifndef INCLUDE_EVENTS_H
  2. #define INCLUDE_EVENTS_H
  3. #print "[include <collection.h>]\n"
  4.  
  5. #include "../lib/collection.h"
  6.  
  7. #define ECTRL 300
  8.  
  9. struct EVENTS
  10. {
  11.         collection_int array;
  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. {
  21.         array.drop();
  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;
  47. }
  48.  
  49. #endif