summaryrefslogtreecommitdiff
path: root/plugingui/eventhandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/eventhandler.h')
-rw-r--r--plugingui/eventhandler.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/plugingui/eventhandler.h b/plugingui/eventhandler.h
index 028418d..b011f87 100644
--- a/plugingui/eventhandler.h
+++ b/plugingui/eventhandler.h
@@ -24,39 +24,42 @@
* 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);
+ EventHandler(NativeWindow& nativeWindow, Window& window);
- void processEvents();
+ //! \brief Process all events currently in the event queue.
+ void processEvents();
- bool hasEvent();
- Event *getNextEvent();
+ //! \brief Query if any events are currently in the event queue.
+ bool hasEvent();
- void registerCloseHandler(void (*handler)(void *), void *ptr);
+ //! \brief Get a single event from the event queue.
+ //! \return A pointer to the event or nullptr if there are none.
+ Event *getNextEvent();
-private:
- Window *window;
- int last_click;
- void (*closeHandler)(void *);
- void *closeHandlerPtr;
+ //! \brief Get a single event from the event queue without popping it.
+ //! \return A pointer to the event or nullptr if there are none.
+ Event *peekNextEvent();
- // 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::