diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-09-10 17:52:32 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-06-08 19:29:07 +0200 |
commit | 0531409611867ae8dad711e52d6534fa634d40cc (patch) | |
tree | ac2bf00c7db33eb15ef98e6a63bf3ff7c03d073e /plugingui/nativewindow_pugl.h | |
parent | d866740fee61bdf1bbbb539bf9856b99e8152d89 (diff) |
Initial steps towards pugl domination!
Diffstat (limited to 'plugingui/nativewindow_pugl.h')
-rw-r--r-- | plugingui/nativewindow_pugl.h | 45 |
1 files changed, 28 insertions, 17 deletions
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 <pugl/pugl.h> +} #include <list> -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<std::size_t, std::size_t> getSize() const override; + + void move(int x, int y) override; + std::pair<int, int> 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<Event*> 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:: |