diff options
author | crupest <crupest@outlook.com> | 2020-11-09 20:45:27 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-09 20:45:27 +0800 |
commit | bed29872d2a7befff9d4cb7313cb40060326a95e (patch) | |
tree | 0439aa1d4a02a6bb5f92d48e5f585ad5d748059a /include/cru | |
parent | 014aaf773fd95a7f0dd1a766023a21fb6b54a1a1 (diff) | |
download | cru-bed29872d2a7befff9d4cb7313cb40060326a95e.tar.gz cru-bed29872d2a7befff9d4cb7313cb40060326a95e.tar.bz2 cru-bed29872d2a7befff9d4cb7313cb40060326a95e.zip |
...
Diffstat (limited to 'include/cru')
-rw-r--r-- | include/cru/ui/controls/RootControl.hpp | 3 | ||||
-rw-r--r-- | include/cru/ui/host/WindowHost.hpp | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/include/cru/ui/controls/RootControl.hpp b/include/cru/ui/controls/RootControl.hpp index d41f02d8..b3fa6101 100644 --- a/include/cru/ui/controls/RootControl.hpp +++ b/include/cru/ui/controls/RootControl.hpp @@ -24,9 +24,6 @@ class RootControl : public LayoutControl { // and shown. void Show(bool create = true); - // If native window does not exist, nothing will be done. It will not save it - // and use it when creating window. So call this after ensuring window - // created. void SetRect(const Rect& rect); protected: diff --git a/include/cru/ui/host/WindowHost.hpp b/include/cru/ui/host/WindowHost.hpp index 9fc24eb2..bd2f7c16 100644 --- a/include/cru/ui/host/WindowHost.hpp +++ b/include/cru/ui/host/WindowHost.hpp @@ -8,6 +8,7 @@ #include <functional> #include <memory> +#include <optional> namespace cru::ui::host { class LayoutPaintCycler; @@ -109,6 +110,14 @@ class WindowHost : public Object { return &native_window_change_event_; } + // If window exist, return window actual size. Otherwise if saved rect exists, + // return it. Otherwise return 0. + Rect GetWindowRect(); + + void SetSavedWindowRect(std::optional<Rect> rect); + + void SetWindowRect(const Rect& rect); + private: //*************** region: native messages *************** void OnNativeDestroy(platform::gui::INativeWindow* window, std::nullptr_t); @@ -161,5 +170,7 @@ class WindowHost : public Object { bool layout_prefer_to_fill_window_ = true; Event<platform::gui::INativeWindow*> native_window_change_event_; + + std::optional<Rect> saved_rect_; }; } // namespace cru::ui::host |