From b53527fbe50a953ad0e3225cc812eb76b8a1f82d Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 27 Jun 2019 17:02:58 +0800 Subject: ... --- include/cru/platform/native/native_window.hpp | 37 ++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'include/cru/platform/native/native_window.hpp') diff --git a/include/cru/platform/native/native_window.hpp b/include/cru/platform/native/native_window.hpp index bb97ef21..22a2dce0 100644 --- a/include/cru/platform/native/native_window.hpp +++ b/include/cru/platform/native/native_window.hpp @@ -1,13 +1,13 @@ #pragma once -#include "cru/common/base.hpp" +#include "../native_resource.hpp" +#include "../graphic_base.hpp" #include "basic_types.hpp" #include "cru/common/event.hpp" -#include "cru/common/ui_base.hpp" #include "native_event.hpp" namespace cru::platform::graph { -struct IPainter; +class Painter; } namespace cru::platform::native { @@ -19,7 +19,20 @@ namespace cru::platform::native { // Close or closed by the user, which leads to an invalid instance. You can // check the validity by IsValid. When you call perform native operations on the // invalid instance, there is no effect. -struct INativeWindow : public virtual Interface { +class NativeWindow : public NativeResource { + protected: + NativeWindow() = default; + + public: + NativeWindow(const NativeWindow& other) = delete; + NativeWindow& operator=(const NativeWindow& other) = delete; + + NativeWindow(NativeWindow&& other) = delete; + NativeWindow& operator=(NativeWindow&& other) = delete; + + ~NativeWindow() override = default; + + public: // Return if the window is still valid, that is, hasn't been closed or // destroyed. virtual bool IsValid() = 0; @@ -27,30 +40,30 @@ struct INativeWindow : public virtual Interface { virtual void Close() = 0; - virtual INativeWindow* GetParent() = 0; + virtual NativeWindow* GetParent() = 0; virtual bool IsVisible() = 0; virtual void SetVisible(bool is_visible) = 0; - virtual ui::Size GetClientSize() = 0; - virtual void SetClientSize(const ui::Size& size) = 0; + virtual Size GetClientSize() = 0; + virtual void SetClientSize(const Size& size) = 0; // Get the rect of the window containing frame. // The lefttop of the rect is relative to screen lefttop. - virtual ui::Rect GetWindowRect() = 0; + virtual Rect GetWindowRect() = 0; // Set the rect of the window containing frame. // The lefttop of the rect is relative to screen lefttop. - virtual void SetWindowRect(const ui::Rect& rect) = 0; + virtual void SetWindowRect(const Rect& rect) = 0; - virtual graph::IPainter* BeginPaint() = 0; + virtual graph::Painter* BeginPaint() = 0; virtual IEvent* DestroyEvent() = 0; virtual IEvent* PaintEvent() = 0; - virtual IEvent* ResizeEvent() = 0; + virtual IEvent* ResizeEvent() = 0; virtual IEvent* FocusEvent() = 0; virtual IEvent* MouseEnterLeaveEvent() = 0; - virtual IEvent* MouseMoveEvent() = 0; + virtual IEvent* MouseMoveEvent() = 0; virtual IEvent* MouseDownEvent() = 0; virtual IEvent* MouseUpEvent() = 0; virtual IEvent* KeyDownEvent() = 0; -- cgit v1.2.3