diff options
author | crupest <crupest@outlook.com> | 2020-11-09 20:06:04 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-11-09 20:06:04 +0800 |
commit | 68fc33443981fcd499dfe263c228787e213ae943 (patch) | |
tree | 6a11d424a958d9c566e4c0b85b32212bfad9a1dc /include/cru/ui/controls/Window.hpp | |
parent | ddc6d6478f849ef10b832bc8b1d8ab7fe9454601 (diff) | |
download | cru-68fc33443981fcd499dfe263c228787e213ae943.tar.gz cru-68fc33443981fcd499dfe263c228787e213ae943.tar.bz2 cru-68fc33443981fcd499dfe263c228787e213ae943.zip |
...
Diffstat (limited to 'include/cru/ui/controls/Window.hpp')
-rw-r--r-- | include/cru/ui/controls/Window.hpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/include/cru/ui/controls/Window.hpp b/include/cru/ui/controls/Window.hpp index 996bc75e..cca56b64 100644 --- a/include/cru/ui/controls/Window.hpp +++ b/include/cru/ui/controls/Window.hpp @@ -1,36 +1,32 @@ #pragma once -#include "LayoutControl.hpp" +#include "cru/platform/gui/Base.hpp" +#include "cru/ui/controls/RootControl.hpp" + +#include "cru/common/Base.hpp" namespace cru::ui::controls { -class Window final : public LayoutControl { +class Window final : public RootControl { public: static constexpr std::u16string_view control_type = u"Window"; public: - static Window* CreateOverlapped(); + static Window* Create(Control* attached_control = nullptr); private: - Window(); + explicit Window(Control* attached_control); public: - Window(const Window& other) = delete; - Window(Window&& other) = delete; - Window& operator=(const Window& other) = delete; - Window& operator=(Window&& other) = delete; + CRU_DELETE_COPY(Window) + CRU_DELETE_MOVE(Window) + ~Window() override; public: - std::u16string_view GetControlType() const final; - - render::RenderObject* GetRenderObject() const override; - - // If create is false and native window is not create, it will not be created - // and shown. - void Show(bool create = true); - - private: - std::unique_ptr<host::WindowHost> window_host_; + std::u16string_view GetControlType() const final { return control_type; } - std::unique_ptr<render::StackLayoutRenderObject> render_object_; + protected: + gsl::not_null<platform::gui::INativeWindow*> CreateNativeWindow( + gsl::not_null<host::WindowHost*> host, + platform::gui::INativeWindow* parent) override; }; } // namespace cru::ui::controls |