From abc33d1b000ed7fbebbff9300864420fd6fb8fef Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 31 May 2019 08:18:04 +0200 Subject: Add (working) Cocoa UI support. --- plugingui/nativewindow_cocoa.h | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'plugingui/nativewindow_cocoa.h') diff --git a/plugingui/nativewindow_cocoa.h b/plugingui/nativewindow_cocoa.h index 100b3c7..3f0518a 100644 --- a/plugingui/nativewindow_cocoa.h +++ b/plugingui/nativewindow_cocoa.h @@ -26,6 +26,8 @@ */ #pragma once +#include + #include "nativewindow.h" namespace GUI @@ -40,21 +42,34 @@ public: ~NativeWindowCocoa(); // From NativeWindow: - void setFixedSize(int width, int height) override; - void resize(int width, int height) override; - void move(int x, int y) override; - void show() override; - void hide() override; - void setCaption(const std::string &caption) override; - void handleBuffer() override; - void redraw() override; - void grabMouse(bool grab) override; - bool hasEvent() override; - std::shared_ptr getNextEvent() override; - std::shared_ptr peekNextEvent() override; + virtual void setFixedSize(std::size_t width, std::size_t height) override; + virtual void resize(std::size_t width, std::size_t height) override; + virtual std::pair getSize() const override; + virtual void move(int x, int y) override; + virtual std::pair getPosition() const override; + virtual void show() override; + virtual void hide() override; + virtual bool visible() const override; + virtual void setCaption(const std::string &caption) override; + virtual void redraw(const Rect& dirty_rect) override; + virtual void grabMouse(bool grab) override; + virtual EventQueue getEvents() override; + virtual void* getNativeWindowHandle() const override; + + // Expose friend members of Window to ObjC++ implementation. + class Window& getWindow(); + class PixelBuffer& getWindowPixbuf(); + void resized(); + void pushBackEvent(std::shared_ptr event); private: + void updateLayerOffset(); + Window& window; + std::unique_ptr priv; + EventQueue event_queue; + void* native_window{nullptr}; + bool first{true}; }; } // GUI:: -- cgit v1.2.3