diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-10-08 07:30:10 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-10-08 07:30:10 +0200 |
commit | 02f78d5eb03670bc07f615ad629e1ec03959be14 (patch) | |
tree | 544ce15e8aabd0b9ae4b59221db040d8ab9e7170 /plugingui/eventhandler.h | |
parent | f8740b3195bdff33d11d4cd23cdd791aec175c5c (diff) |
Refactored EventHandler and friends.
Diffstat (limited to 'plugingui/eventhandler.h')
-rw-r--r-- | plugingui/eventhandler.h | 37 |
1 files changed, 18 insertions, 19 deletions
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:: |