aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/gui/UiApplication.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-08-12 21:44:32 +0800
committercrupest <crupest@outlook.com>2021-08-12 21:44:32 +0800
commit2e379441f69c4fd3049d186f76b25457e6250282 (patch)
tree893771e5103ca9f3a34bb622251aaacb024cf1c2 /include/cru/platform/gui/UiApplication.hpp
parentd718b0f576aeae1fa853124caefc8b0078f1deed (diff)
downloadcru-2e379441f69c4fd3049d186f76b25457e6250282.tar.gz
cru-2e379441f69c4fd3049d186f76b25457e6250282.tar.bz2
cru-2e379441f69c4fd3049d186f76b25457e6250282.zip
...
Diffstat (limited to 'include/cru/platform/gui/UiApplication.hpp')
-rw-r--r--include/cru/platform/gui/UiApplication.hpp68
1 files changed, 1 insertions, 67 deletions
diff --git a/include/cru/platform/gui/UiApplication.hpp b/include/cru/platform/gui/UiApplication.hpp
index 5a5b0b13..407e4fa1 100644
--- a/include/cru/platform/gui/UiApplication.hpp
+++ b/include/cru/platform/gui/UiApplication.hpp
@@ -20,7 +20,7 @@ struct CreateWindowFlags {
};
// The entry point of a ui application.
-struct IUiApplication : public virtual INativeResource {
+struct CRU_PLATFORM_GUI_API IUiApplication : public virtual IPlatformResource {
public:
static IUiApplication* GetInstance() { return instance; }
@@ -66,70 +66,4 @@ struct IUiApplication : public virtual INativeResource {
virtual ICursorManager* GetCursorManager() = 0;
};
-
-class TimerAutoCanceler {
- public:
- TimerAutoCanceler() : id_(0) {}
- explicit TimerAutoCanceler(long long id) : id_(id) {}
-
- CRU_DELETE_COPY(TimerAutoCanceler)
-
- TimerAutoCanceler(TimerAutoCanceler&& other) : id_(other.id_) {
- other.id_ = 0;
- }
-
- TimerAutoCanceler& operator=(TimerAutoCanceler&& other) {
- if (&other == this) {
- return *this;
- }
- Reset(other.id_);
- other.id_ = 0;
- return *this;
- }
-
- TimerAutoCanceler& operator=(long long other) {
- return this->operator=(TimerAutoCanceler(other));
- }
-
- ~TimerAutoCanceler() { Reset(); }
-
- long long Release() {
- auto temp = id_;
- id_ = 0;
- return temp;
- }
-
- void Reset(long long id = 0) {
- if (id_ > 0) IUiApplication::GetInstance()->CancelTimer(id_);
- id_ = id;
- }
-
- explicit operator bool() const { return id_; }
-
- private:
- long long id_;
-};
-
-class TimerListAutoCanceler {
- public:
- TimerListAutoCanceler() = default;
- CRU_DELETE_COPY(TimerListAutoCanceler)
- CRU_DEFAULT_MOVE(TimerListAutoCanceler)
- ~TimerListAutoCanceler() = default;
-
- TimerListAutoCanceler& operator+=(long long id) {
- list_.push_back(TimerAutoCanceler(id));
- return *this;
- }
-
- void Clear() { list_.clear(); }
-
- bool IsEmpty() const { return list_.empty(); }
-
- private:
- std::vector<TimerAutoCanceler> list_;
-};
-
-// Bootstrap from this.
-std::unique_ptr<IUiApplication> CreateUiApplication();
} // namespace cru::platform::gui