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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 calculate();
  20. virtual void shutdown();
  21. virtual void handleKeyboard(KeyboardButton key, bool pressed);
  22. virtual void handleText(char *text, bool notFinished);
  23. virtual void handleAction(ActionEvents action, bool isFinished);
  24. virtual void handleMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  25. virtual void handleMouseMotion(int xrel, int yrel, int xabs, int yabs);
  26. virtual void handleMouseScroll(int xrel, int yrel);
  27. virtual bool isOnTop();
  28. virtual void moveToTop();
  29. virtual void makeInvisible();
  30. // ----------------------------------
  31. static int passInitialize();
  32. static void passEvents();
  33. static void passDisplay();
  34. static void passCalculate();
  35. static void passShutdown();
  36. static void passKeyboard(KeyboardButton key, bool pressed);
  37. static void passText(char *text, bool notFinished);
  38. static void passMouseClick(unsigned int x, unsigned int y, KeyboardButton button, bool released);
  39. static void passMouseMotion(int xrel, int yrel, int xabs, int yabs);
  40. static void passMouseScroll(int xrel, int yrel);
  41. protected:
  42. static void addWindow(UI* window);
  43. static void removeWindow(UI *window);
  44. long zPos;
  45. private:
  46. static void findInList(UI *w, std::function<void (unsigned long i)> func);
  47. static bool isOnTop(unsigned long windowID);
  48. static void moveToTop(unsigned long windowID);
  49. static void makeInvisible(unsigned long windowID);
  50. static bool compareUIs(UI* a, UI* b);
  51. static std::vector<UI*> windows;
  52. };
  53. #endif