From 02f78d5eb03670bc07f615ad629e1ec03959be14 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 8 Oct 2015 07:30:10 +0200 Subject: Refactored EventHandler and friends. --- plugingui/nativewindow.h | 61 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 19 deletions(-) (limited to 'plugingui/nativewindow.h') diff --git a/plugingui/nativewindow.h b/plugingui/nativewindow.h index d68909d..46891f2 100644 --- a/plugingui/nativewindow.h +++ b/plugingui/nativewindow.h @@ -24,8 +24,7 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __DRUMGIZMO_NATIVEWINDOW_H__ -#define __DRUMGIZMO_NATIVEWINDOW_H__ +#pragma once #include @@ -33,25 +32,49 @@ namespace GUI { +//! \brief Interface class for native window implementations. class NativeWindow { public: - NativeWindow() {} - virtual ~NativeWindow() {} - - virtual void setFixedSize(int width, int height) = 0; - virtual void resize(int width, int height) = 0; - virtual void move(int x, int y) = 0; - virtual void show() = 0; - virtual void setCaption(const std::string &caption) = 0; - virtual void hide() = 0; - virtual void handleBuffer() = 0; - virtual void redraw() = 0; - virtual void grabMouse(bool grab) = 0; - - virtual bool hasEvent() = 0; - virtual Event *getNextEvent() = 0; -}; + NativeWindow() {} + virtual ~NativeWindow() {} + + //! \brief Set a fixed size to the window. + //! It resizes the window and disallows user resizing. + virtual void setFixedSize(int width, int height) = 0; + + // TODO: setScalable(bool) ?? + + //! \brief Set a new size of the window. + virtual void resize(int width, int height) = 0; + + //! \brief Move the window to a new position. + virtual void move(int x, int y) = 0; + + //! \brief Show the window if it is hidden. + virtual void show() = 0; + + //! \brief Hides the window. + virtual void hide() = 0; + + //! \brief Sets the window caption in the title bar (if it has one). + virtual void setCaption(const std::string &caption) = 0; + + //! \brief Recreate a window render buffer based on the internal buffer. + //! This need to be called whenever the internal buffer size has changed. + virtual void handleBuffer() = 0; + + //! \brief Draw the internal rendering buffer to the window buffer. + virtual void redraw() = 0; + + //! \brief Toggle capture mouse mode. + virtual void grabMouse(bool grab) = 0; + + //! \brief Query if the event queue contains any events. + virtual bool hasEvent() = 0; + //! \brief Read a single event from the event queue. + //! \return A pointer to the event or nullptr is none exists. + virtual Event *getNextEvent() = 0; }; -#endif/*__DRUMGIZMO_NATIVEWINDOW_H__*/ +} // GUI:: -- cgit v1.2.3