aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/cru/osx/gui/Window.hpp55
-rw-r--r--src/osx/gui/Window.mm27
2 files changed, 79 insertions, 3 deletions
diff --git a/include/cru/osx/gui/Window.hpp b/include/cru/osx/gui/Window.hpp
index 14ad05ad..1e790a65 100644
--- a/include/cru/osx/gui/Window.hpp
+++ b/include/cru/osx/gui/Window.hpp
@@ -1,18 +1,67 @@
#pragma once
#include "Resource.hpp"
-#include "cru/platform/gui/Base.hpp"
#include "cru/platform/gui/Window.hpp"
+#include <memory>
+
namespace cru::platform::gui::osx {
-class OsxWindow : public OsxGuiResource, public virtual INativeWindow {
+namespace details {
+class OsxWindowPrivate;
+}
+
+class OsxUiApplication;
+
+class OsxWindow : public OsxGuiResource, public INativeWindow {
+ friend details::OsxWindowPrivate;
+
public:
- OsxWindow();
+ explicit OsxWindow(OsxUiApplication* ui_application);
CRU_DELETE_COPY(OsxWindow)
CRU_DELETE_MOVE(OsxWindow)
~OsxWindow() override;
+ public:
+ void Close() override;
+
+ INativeWindow* GetParent() override;
+
+ bool IsVisible() override;
+ void SetVisible(bool is_visible) override;
+
+ Size GetClientSize() override;
+ void SetClientSize(const Size& size) override;
+
+ Rect GetWindowRect() override;
+ void SetWindowRect(const Rect& rect) override;
+
+ Point GetMousePosition() override;
+
+ bool CaptureMouse() override;
+ bool ReleaseMouse() override;
+
+ void SetCursor(std::shared_ptr<ICursor> cursor) override;
+
+ void RequestRepaint() override;
+
+ std::unique_ptr<graphics::IPainter> BeginPaint() override;
+
+ IEvent<std::nullptr_t>* DestroyEvent() override;
+ IEvent<std::nullptr_t>* PaintEvent() override;
+ IEvent<Size>* ResizeEvent() override;
+ IEvent<FocusChangeType>* FocusEvent() override;
+ IEvent<MouseEnterLeaveType>* MouseEnterLeaveEvent() override;
+ IEvent<Point>* MouseMoveEvent() override;
+ IEvent<NativeMouseButtonEventArgs>* MouseDownEvent() override;
+ IEvent<NativeMouseButtonEventArgs>* MouseUpEvent() override;
+ IEvent<NativeMouseWheelEventArgs>* MouseWheelEvent() override;
+ IEvent<NativeKeyEventArgs>* KeyDownEvent() override;
+ IEvent<NativeKeyEventArgs>* KeyUpEvent() override;
+
+ IInputMethodContext* GetInputMethodContext() override;
+
private:
+ std::unique_ptr<details::OsxWindowPrivate> p_;
};
} // namespace cru::platform::gui::osx
diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm
index e69de29b..1ee0299a 100644
--- a/src/osx/gui/Window.mm
+++ b/src/osx/gui/Window.mm
@@ -0,0 +1,27 @@
+#include "cru/osx/gui/Window.hpp"
+
+#include "cru/osx/gui/UiApplication.hpp"
+
+namespace cru::platform::gui::osx {
+namespace details {
+class OsxWindowPrivate {
+ friend OsxWindow;
+
+ public:
+ explicit OsxWindowPrivate(OsxWindow* osx_window) : osx_window_(osx_window) {}
+
+ CRU_DELETE_COPY(OsxWindowPrivate)
+ CRU_DELETE_MOVE(OsxWindowPrivate)
+
+ ~OsxWindowPrivate() = default;
+
+ private:
+ OsxWindow* osx_window_;
+};
+}
+
+OsxWindow::OsxWindow(OsxUiApplication* ui_application)
+ : OsxGuiResource(ui_application), p_(new details::OsxWindowPrivate(this)) {}
+
+OsxWindow::~OsxWindow() {}
+}