aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/native/native_window.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2019-06-27 17:02:58 +0800
committercrupest <crupest@outlook.com>2019-06-27 17:02:58 +0800
commitb53527fbe50a953ad0e3225cc812eb76b8a1f82d (patch)
treeeb81cd14d0a165c47f841ad94835f8987109de7e /include/cru/platform/native/native_window.hpp
parent8c5b05bcfce96495b4ffc4209ab8feda12597729 (diff)
downloadcru-b53527fbe50a953ad0e3225cc812eb76b8a1f82d.tar.gz
cru-b53527fbe50a953ad0e3225cc812eb76b8a1f82d.tar.bz2
cru-b53527fbe50a953ad0e3225cc812eb76b8a1f82d.zip
...
Diffstat (limited to 'include/cru/platform/native/native_window.hpp')
-rw-r--r--include/cru/platform/native/native_window.hpp37
1 files changed, 25 insertions, 12 deletions
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<std::nullptr_t>* DestroyEvent() = 0;
virtual IEvent<std::nullptr_t>* PaintEvent() = 0;
- virtual IEvent<ui::Size>* ResizeEvent() = 0;
+ virtual IEvent<Size>* ResizeEvent() = 0;
virtual IEvent<bool>* FocusEvent() = 0;
virtual IEvent<bool>* MouseEnterLeaveEvent() = 0;
- virtual IEvent<ui::Point>* MouseMoveEvent() = 0;
+ virtual IEvent<Point>* MouseMoveEvent() = 0;
virtual IEvent<NativeMouseButtonEventArgs>* MouseDownEvent() = 0;
virtual IEvent<NativeMouseButtonEventArgs>* MouseUpEvent() = 0;
virtual IEvent<int>* KeyDownEvent() = 0;