aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/gui/UiApplication.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
committercrupest <crupest@outlook.com>2022-02-08 16:53:51 +0800
commit74bb9cd27242b9320f99ff4d2b50c3051576cc14 (patch)
tree744bac5799c593d1d6f81e7b09581bea626f2cde /include/cru/platform/gui/UiApplication.hpp
parentb90c398de829d1ba5329651d75bae82f5e4085fe (diff)
downloadcru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.gz
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.tar.bz2
cru-74bb9cd27242b9320f99ff4d2b50c3051576cc14.zip
...
Diffstat (limited to 'include/cru/platform/gui/UiApplication.hpp')
-rw-r--r--include/cru/platform/gui/UiApplication.hpp70
1 files changed, 0 insertions, 70 deletions
diff --git a/include/cru/platform/gui/UiApplication.hpp b/include/cru/platform/gui/UiApplication.hpp
deleted file mode 100644
index c917aa01..00000000
--- a/include/cru/platform/gui/UiApplication.hpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#pragma once
-#include "Base.hpp"
-
-#include "cru/common/Bitmask.hpp"
-#include "cru/platform/gui/Menu.hpp"
-
-#include "SaveOpenDialogOptions.hpp"
-
-#include <chrono>
-#include <functional>
-#include <memory>
-#include <vector>
-
-namespace cru::platform::gui {
-// The entry point of a ui application.
-struct CRU_PLATFORM_GUI_API IUiApplication : public virtual IPlatformResource {
- public:
- static IUiApplication* GetInstance() { return instance; }
-
- private:
- static IUiApplication* instance;
-
- protected:
- IUiApplication();
-
- public:
- ~IUiApplication() override;
-
- // 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(std::function<void()> handler) = 0;
-
- virtual bool IsQuitOnAllWindowClosed() = 0;
- virtual void SetQuitOnAllWindowClosed(bool quit_on_all_window_closed) = 0;
-
- // Timer id should always be positive (not 0) and never the same. So it's ok
- // to use negative value (or 0) to represent no timer.
- virtual long long SetImmediate(std::function<void()> action) = 0;
- virtual long long SetTimeout(std::chrono::milliseconds milliseconds,
- std::function<void()> action) = 0;
- virtual long long SetInterval(std::chrono::milliseconds milliseconds,
- std::function<void()> action) = 0;
- // Implementation should guarantee calls on timer id already canceled have no
- // effects and do not crash. Also canceling negative id or 0 should always
- // result in no-op.
- virtual void CancelTimer(long long id) = 0;
-
- virtual std::vector<INativeWindow*> GetAllWindow() = 0;
-
- virtual INativeWindow* CreateWindow() = 0;
-
- virtual cru::platform::graphics::IGraphicsFactory* GetGraphicsFactory() = 0;
-
- virtual ICursorManager* GetCursorManager() = 0;
-
- virtual IClipboard* GetClipboard() = 0;
-
- // If return nullptr, it means the menu is not supported.
- virtual IMenu* GetApplicationMenu();
-
- virtual std::optional<String> ShowSaveDialog(SaveDialogOptions options);
- virtual std::optional<std::vector<String>> ShowOpenDialog(
- OpenDialogOptions options);
-};
-} // namespace cru::platform::gui