#pragma once #include "../resource.hpp" #include #include #include namespace cru::platform::graph { struct IGraphFactory; } namespace cru::platform::native { struct INativeWindow; struct ICursorManager; // The entry point of a ui application. struct IUiApplication : public virtual INativeResource { public: // Block current thread and run the message loop. Return the exit code when // message loop gets a quit message (possibly posted by method RequestQuit). virtual int Run() = 0; // Post a quit message with given quit code. virtual void RequestQuit(int quit_code) = 0; virtual void AddOnQuitHandler(const std::function& handler) = 0; virtual void InvokeLater(const std::function& action) = 0; virtual unsigned long SetTimeout(std::chrono::milliseconds milliseconds, const std::function& action) = 0; virtual unsigned long SetInterval(std::chrono::milliseconds milliseconds, const std::function& action) = 0; virtual void CancelTimer(unsigned long id) = 0; virtual std::vector GetAllWindow() = 0; virtual INativeWindow* CreateWindow(INativeWindow* parent) = 0; virtual cru::platform::graph::IGraphFactory* GetGraphFactory() = 0; virtual ICursorManager* GetCursorManager() = 0; }; } // namespace cru::platform::native