aboutsummaryrefslogtreecommitdiff
path: root/src/ui/window.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-10 19:57:33 +0800
committercrupest <crupest@outlook.com>2018-11-10 19:57:33 +0800
commitfd3f899964bb0a3cad80bbb9afc4445fac1e6412 (patch)
tree6e7c9dcda090b0fd0153c634165393e693894c10 /src/ui/window.hpp
parenta46c8d05392cf07c4897f9856e35bcd3f2382b25 (diff)
downloadcru-fd3f899964bb0a3cad80bbb9afc4445fac1e6412.tar.gz
cru-fd3f899964bb0a3cad80bbb9afc4445fac1e6412.tar.bz2
cru-fd3f899964bb0a3cad80bbb9afc4445fac1e6412.zip
Develop parent window.
Diffstat (limited to 'src/ui/window.hpp')
-rw-r--r--src/ui/window.hpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/ui/window.hpp b/src/ui/window.hpp
index 82cbfc4f..963bff78 100644
--- a/src/ui/window.hpp
+++ b/src/ui/window.hpp
@@ -83,14 +83,26 @@ namespace cru::ui
- class Window : public Control
+ class Window final : public Control
{
friend class WindowManager;
public:
static constexpr auto control_type = L"Window";
- Window();
- explicit Window(Window* parent);
+ public:
+ static Window* CreateOverlapped();
+ static Window* CreatePopup(Window* parent, bool caption = false);
+
+ private:
+ struct tag_overlapped_constructor {};
+ struct tag_popup_constructor {};
+
+ explicit Window(tag_overlapped_constructor);
+ Window(tag_popup_constructor, Window* parent, bool caption);
+
+ void AfterCreateHwnd(WindowManager* window_manager);
+
+ public:
Window(const Window& other) = delete;
Window(Window&& other) = delete;
Window& operator=(const Window& other) = delete;
@@ -100,6 +112,8 @@ namespace cru::ui
public:
StringView GetControlType() const override final;
+ void SetDeleteThisOnDestroy(bool value);
+
//*************** region: handle ***************
//Get the handle of the window. Return null if window is invalid.
@@ -117,6 +131,11 @@ namespace cru::ui
//*************** region: window operations ***************
+ Window* GetParentWindow() const
+ {
+ return parent_window_;
+ }
+
//Close and destroy the window if the window is valid.
void Close();
@@ -286,7 +305,10 @@ namespace cru::ui
void DispatchMouseHoverControlChangeEvent(Control* old_control, Control * new_control, const Point& point);
private:
+ bool delete_this_on_destroy_ = true;
+
HWND hwnd_ = nullptr;
+ Window* parent_window_ = nullptr;
std::shared_ptr<graph::WindowRenderTarget> render_target_{};
std::list<Control*> control_list_{};