1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __eventhandler__hh
3 #define __eventhandler__hh
9 #include <X11/extensions/shape.h>
13 #include <X11/XKBlib.h>
22 //! Dispatches events to one of the other handlers based on their type.
23 virtual void handle(const XEvent &e);
25 //! Called whenever any key is pressed.
26 virtual void keyPressHandler(const XKeyEvent &) {}
28 //! Called whenever any key is released.
29 virtual void keyReleaseHandler(const XKeyEvent &) {}
31 //! Called whenever a button of the pointer is pressed.
32 virtual void buttonPressHandler(const XButtonEvent &) {}
34 //! Called whenever a button of the pointer is released.
35 virtual void buttonReleaseHandler(const XButtonEvent &) {}
37 //! Called whenever the pointer moved
38 virtual void motionHandler(const XMotionEvent &) {}
40 //! Called whenever the pointer enters a window.
41 virtual void enterHandler(const XCrossingEvent &) {}
43 //! Called whenever the pointer leaves a window.
44 virtual void leaveHandler(const XCrossingEvent &) {}
46 //! Called when a window gains focus.
47 virtual void focusHandler(const XFocusChangeEvent &) {}
49 //! Called when a window looses focus.
50 virtual void unfocusHandler(const XFocusChangeEvent &) {}
52 //! Called when a window becomes visible to the user.
53 virtual void exposeHandler(const XExposeEvent &) {}
55 //! Called to handle GraphicsExpose events.
56 virtual void graphicsExposeHandler(const XGraphicsExposeEvent &) {}
58 //! Called to handle NoExpose events.
59 virtual void noExposeEventHandler(const XNoExposeEvent &) {}
61 //! Called when the window requests a change in its z-order.
62 virtual void circulateRequestHandler(const XCirculateRequestEvent &)
65 //! Called when a different client initiates a configure window request.
66 virtual void configureRequestHandler(const XConfigureRequestEvent &)
69 //! Called when a different client tries to map a window.
70 virtual void mapRequestHandler(const XMapRequestEvent &) {}
72 //! Called when another client attemps to change the size of a window.
73 virtual void resizeRequestHandler(const XResizeRequestEvent &) {}
75 //! Called when the z-order of the window has changed.
76 virtual void circulateHandler(const XCirculateEvent &) {}
78 //! Called when the window as been reconfigured.
79 virtual void configureHandler(const XConfigureEvent &) {}
81 //! Called when a window is created.
82 virtual void createHandler(const XCreateWindowEvent &) {}
84 //! Called when a window is destroyed.
85 virtual void destroyHandler(const XDestroyWindowEvent &) {}
87 //! Called when a window is moved because of a change in the size of its
89 virtual void gravityHandler(const XGravityEvent &) {}
91 //! Called when a window is mapped.
92 virtual void mapHandler(const XMapEvent &) {}
94 //! Called when the server generats a MappingNotify event
95 virtual void mappingHandler(const XMappingEvent &) {}
97 //! Called when a window is reparented
98 virtual void reparentHandler(const XReparentEvent &) {}
100 //! Called when a window is unmapped
101 virtual void unmapHandler(const XUnmapEvent &) {}
103 //! Called when a the visibilty of a window changes
104 virtual void visibilityHandler(const XVisibilityEvent &) {}
106 //! Called when the colormap changes, or is installed or unistalled
107 virtual void colorMapHandler(const XColormapEvent &) {}
109 //! Called when a property of a window changes
110 virtual void propertyHandler(const XPropertyEvent &) {}
112 //! Called when the client loses ownership of a selection
113 virtual void selectionClearHandler(const XSelectionClearEvent &) {}
115 //! Called when a ConvertSelection protocol request is sent
116 virtual void selectionHandler(const XSelectionEvent &) {}
118 //! Called when a SelectionEvent occurs
119 virtual void selectionRequestHandler(const XSelectionRequestEvent &) {}
121 //! Called when a client calls XSendEvent
123 Some types of client messages are filtered out and sent to more specific
124 event handler functions.
126 virtual void clientMessageHandler(const XClientMessageEvent &);
128 #if defined(SHAPE) || defined(DOXYGEN_IGNORE)
129 //! Called when a shape extension event fires
130 virtual void shapeHandler(const XShapeEvent &) {}
133 #if defined(XKB) || defined(DOXYGEN_IGNORE)
134 //! Called when an xkb extension event fires
135 virtual void xkbHandler(const XkbEvent &) {}
138 virtual ~EventHandler();
141 /*! Constructor for the EventHandler class.
142 This is protected so that EventHandlers can't be instantiated on their