Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UI.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*!
  2. * \file include/UI.h
  3. * \brief Abstract UI interface
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _UI_H_
  8. #define _UI_H_
  9. #include <functional>
  10. #include <memory>
  11. #include <vector>
  12. class UI {
  13. public:
  14. virtual ~UI();
  15. virtual void display();
  16. virtual void handleKeyboard(KeyboardButton key, bool pressed);
  17. virtual void handleText(char *text, bool notFinished);
  18. virtual void handleAction(ActionEvents action, bool isFinished);
  19. virtual void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  20. virtual void handleMouseMotion(int xrel, int yrel);
  21. virtual void handleMouseScroll(int xrel, int yrel);
  22. virtual bool isOnTop();
  23. virtual void moveToTop();
  24. virtual void makeInvisible();
  25. static void addWindow(UI* window);
  26. static void removeWindow(UI *window);
  27. static void displayInOrder();
  28. static void passKeyboard(KeyboardButton key, bool pressed);
  29. static void passText(char *text, bool notFinished);
  30. static void passMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  31. static void passMouseMotion(int xrel, int yrel);
  32. static void passMouseScroll(int xrel, int yrel);
  33. protected:
  34. long zPos;
  35. private:
  36. static void findInList(UI *w, std::function<void (unsigned long i)> func);
  37. static bool isOnTop(unsigned long windowID);
  38. static void moveToTop(unsigned long windowID);
  39. static void makeInvisible(unsigned long windowID);
  40. static bool compareUIs(UI* a, UI* b);
  41. static std::vector<UI*> windows;
  42. };
  43. #endif