#pragma once #include #include #include #include #include #include namespace hex { class View { public: View(std::string viewName); virtual ~View() = default; virtual void drawContent() = 0; virtual void drawMenu(); virtual bool handleShortcut(int key, int mods); static std::vector>& getDeferedCalls(); static void postEvent(Events eventType, const void *userData = nullptr); static void drawCommonInterfaces(); static void showErrorPopup(std::string_view errorMessage); virtual bool hasViewMenuItemEntry(); virtual ImVec2 getMinSize(); virtual ImVec2 getMaxSize(); bool& getWindowOpenState(); const std::string getName() const; protected: void subscribeEvent(Events eventType, std::function callback); void unsubscribeEvent(Events eventType); void doLater(std::function &&function); protected: void confirmButtons(const char *textLeft, const char *textRight, std::function leftButtonFn, std::function rightButtonFn); private: std::string m_viewName; bool m_windowOpen = false; }; }