From 0531409611867ae8dad711e52d6534fa634d40cc Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 10 Sep 2017 17:52:32 +0200 Subject: Initial steps towards pugl domination! --- plugingui/nativewindow_pugl.h | 45 +++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'plugingui/nativewindow_pugl.h') diff --git a/plugingui/nativewindow_pugl.h b/plugingui/nativewindow_pugl.h index 000a48b..6a667f4 100644 --- a/plugingui/nativewindow_pugl.h +++ b/plugingui/nativewindow_pugl.h @@ -27,11 +27,15 @@ #pragma once #include "nativewindow.h" -#include "pugl.h" +extern "C" +{ +#include +} #include -namespace GUI { +namespace GUI +{ class Event; class Window; @@ -41,32 +45,39 @@ public: NativeWindowPugl(void* native_window, Window& window); ~NativeWindowPugl(); - void init(); - void setFixedSize(int width, int height); - void resize(int width, int height); - void move(int x, int y); - void show(); - void setCaption(const std::string &caption); - void hide(); - void handleBuffer(); - void redraw(); - void grabMouse(bool grab); - - bool hasEvent(); - Event *getNextEvent(); - Event *peekNextEvent(); + void setFixedSize(std::size_t width, std::size_t height) override; + void resize(std::size_t width, std::size_t height) override; + std::pair getSize() const override; + + void move(int x, int y) override; + std::pair getPosition() const override{ return {}; } + + void show() override; + void setCaption(const std::string &caption) override; + void hide() override; + bool visible() const override; + void redraw(const Rect& dirty_rect) override; + void grabMouse(bool grab) override; + + EventQueue getEvents() override; + + void* getNativeWindowHandle() const override; private: Window& window; - void* native_window{nullptr}; PuglView* view{nullptr}; std::list eventq; // Internal pugl c-callbacks + static void onEvent(PuglView* view, const PuglEvent* event); + static void onReshape(PuglView* view, int width, int height); static void onDisplay(PuglView* view); static void onMouse(PuglView* view, int button, bool press, int x, int y); static void onKeyboard(PuglView* view, bool press, uint32_t key); + + EventQueue event_queue; + std::uint32_t last_click{0}; }; } // GUI:: -- cgit v1.2.3