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.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #include "imgui/imgui.h"
  13. class UI {
  14. public:
  15. virtual ~UI();
  16. virtual int initialize();
  17. virtual void eventsFinished();
  18. virtual void display();
  19. virtual void handleKeyboard(KeyboardButton key, bool pressed);
  20. virtual void handleText(char *text, bool notFinished);
  21. virtual void handleAction(ActionEvents action, bool isFinished);
  22. virtual void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  23. virtual void handleMouseMotion(int xrel, int yrel, int xabs, int yabs);
  24. virtual void handleMouseScroll(int xrel, int yrel);
  25. virtual bool isOnTop();
  26. virtual void moveToTop();
  27. virtual void makeInvisible();
  28. // ----------------------------------
  29. static int passInitialize();
  30. static void passEvents();
  31. static void passDisplay();
  32. static void passKeyboard(KeyboardButton key, bool pressed);
  33. static void passText(char *text, bool notFinished);
  34. static void passMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  35. static void passMouseMotion(int xrel, int yrel, int xabs, int yabs);
  36. static void passMouseScroll(int xrel, int yrel);
  37. protected:
  38. static void addWindow(UI* window);
  39. static void removeWindow(UI *window);
  40. long zPos;
  41. private:
  42. static void findInList(UI *w, std::function<void (unsigned long i)> func);
  43. static bool isOnTop(unsigned long windowID);
  44. static void moveToTop(unsigned long windowID);
  45. static void makeInvisible(unsigned long windowID);
  46. static bool compareUIs(UI* a, UI* b);
  47. static std::vector<UI*> windows;
  48. };
  49. #endif