summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/EventHandler.hh25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/FbTk/EventHandler.hh b/src/FbTk/EventHandler.hh
index 1fc73c4..10d9757 100644
--- a/src/FbTk/EventHandler.hh
+++ b/src/FbTk/EventHandler.hh
@@ -1,5 +1,5 @@
1// fluxbox.cc for Fluxbox Window Manager 1// EventHandler.cc for Fluxbox Window Manager
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) 2// Copyright (c) 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -19,23 +19,34 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: EventHandler.hh,v 1.1 2002/11/26 16:01:27 fluxgen Exp $ 22// $Id: EventHandler.hh,v 1.2 2002/11/27 21:41:38 fluxgen Exp $
23 23
24#ifndef FBTK_EVENTHANDLER_HH 24#ifndef FBTK_EVENTHANDLER_HH
25#define FBTK_EVENTHANDLER_HH 25#define FBTK_EVENTHANDLER_HH
26 26
27#include <X11/Xlib.h>
28
27namespace FbTk { 29namespace FbTk {
28 30
29/** 31/**
30 template eventhandler 32 interface for X events
31 Both return value and argument is generic.
32*/ 33*/
33template <typename Event_T, typename Event_ret_T = void>
34class EventHandler { 34class EventHandler {
35public: 35public:
36 virtual ~EventHandler() { } 36 virtual ~EventHandler() { }
37 37
38 virtual Event_ret_T handleEvent(Event_T * const) = 0; 38 /**
39 Events that don't have an specific event function
40 */
41 virtual void handleEvent(XEvent &ev) { }
42 virtual void buttonPressEvent(XButtonEvent &ev) { }
43 virtual void buttonReleaseEvent(XButtonEvent &ev) { }
44 virtual void exposeEvent(XExposeEvent &ev) { }
45 virtual void motionNotifyEvent(XMotionEvent &ev) { }
46 virtual void keyPressEvent(XKeyEvent &ev) { }
47 virtual void keyReleaseEvent(XKeyEvent &ev) { }
48 virtual void leaveNotifyEvent(XCrossingEvent &ev) { }
49 virtual void enterNotifyEvent(XCrossingEvent &ev) { }
39}; 50};
40 51
41}; 52};