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/eventhandler.h | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'plugingui/eventhandler.h') diff --git a/plugingui/eventhandler.h b/plugingui/eventhandler.h index 028418d..b865cbb 100644 --- a/plugingui/eventhandler.h +++ b/plugingui/eventhandler.h @@ -24,39 +24,38 @@ * along with DrumGizmo; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#ifndef __DRUMGIZMO_EVENTHANDLER_H__ -#define __DRUMGIZMO_EVENTHANDLER_H__ +#pragma once #include "guievent.h" #include "nativewindow.h" -//#include "window.h" +#include "notifier.h" namespace GUI { + class Window; class EventHandler { public: - EventHandler(NativeWindow *native, Window *window); - - void processEvents(); + EventHandler(NativeWindow *nativeWindow, Window *window); - bool hasEvent(); - Event *getNextEvent(); + //! \brief Process all evebts currently in the event queue. + void processEvents(); - void registerCloseHandler(void (*handler)(void *), void *ptr); + //! \brief Query if any events are currently in the event queue. + bool hasEvent(); -private: - Window *window; - int last_click; - void (*closeHandler)(void *); - void *closeHandlerPtr; + //! \brief Get a single event from the event queue. + //! \return A pointer to the event or nullptr if there are none. + Event *getNextEvent(); - // Used to ignore mouse button release after a double click. - bool last_was_dbl_click; + Notifier<> closeNotifier; - NativeWindow *native; -}; +private: + Window *window; + NativeWindow *nativeWindow; + // Used to ignore mouse button release after a double click. + bool lastWasDoubleClick; }; -#endif/*__DRUMGIZMO_EVENTHANDLER_H__*/ +} // GUI:: -- cgit v1.2.3