1 #ifndef __eventhandler__hh
2 #define __eventhandler__hh
8 #include <X11/extensions/shape.h>
14 class OtkEventHandler{
16 //! Dispatches events to one of the other handlers based on their type.
17 virtual void handle(const XEvent &e);
19 //! Called whenever any key is pressed.
20 virtual void keyPressHandler(const XKeyEvent &) {}
22 //! Called whenever any key is released.
23 virtual void keyReleaseHandler(const XKeyEvent &) {}
25 //! Called whenever a button of the pointer is pressed.
26 virtual void buttonPressHandler(const XButtonEvent &) {}
28 //! Called whenever a button of the pointer is released.
29 virtual void buttonReleaseHandler(const XButtonEvent &) {}
31 //! Called whenever the pointer enters a window.
32 virtual void enterHandler(const XCrossingEvent &) {}
34 //! Called whenever the pointer leaves a window.
35 virtual void leaveHandler(const XCrossingEvent &) {}
37 //! Called when a window gains focus.
38 virtual void focusHandler(const XFocusChangeEvent &) {}
40 //! Called when a window looses focus.
41 virtual void unfocusHandler(const XFocusChangeEvent &) {}
43 //! Called when a window becomes visible to the user.
44 virtual void exposeHandler(const XExposeEvent &) {}
46 //! Called to handle GraphicsExpose events.
47 virtual void graphicsExposeHandler(const XGraphicsExposeEvent &) {}
49 //! Called to handle NoExpose events.
50 virtual void noExposeEventHandler(const XNoExposeEvent &) {}
52 //! Called when the window requests a change in its z-order.
53 virtual void circulateRequestHandler(const XCirculateRequestEvent &)
56 //! Called when a different client initiates a configure window request.
57 virtual void configureRequestHandler(const XConfigureRequestEvent &)
60 //! Called when a different client tries to map a window.
61 virtual void mapRequestHandler(const XMapRequestEvent &) {}
63 //! Called when another client attemps to change the size of a window.
64 virtual void resizeRequestHandler(const XResizeRequestEvent &) {}
66 //! Called when the z-order of the window has changed.
67 virtual void circulateHandler(const XCirculateEvent &) {}
69 //! Called when the window as been reconfigured.
70 virtual void configureHandler(const XConfigureEvent &) {}
72 //! Called when a window is created.
73 virtual void createHandler(const XCreateWindowEvent &) {}
75 //! Called when a window is destroyed.
76 virtual void destroyHandler(const XDestroyWindowEvent &) {}
78 //! Called when a window is moved because of a change in the size of its
80 virtual void gravityHandler(const XGravityEvent &) {}
82 //! Called when a window is mapped.
83 virtual void mapHandler(const XMapEvent &) {}
85 //! Called when the server generats a MappingNotify event
86 virtual void mappingHandler(const XMappingEvent &) {}
88 //! Called when a window is reparented
89 virtual void reparentHandler(const XReparentEvent &) {}
91 //! Called when a window is unmapped
92 virtual void unmapHandler(const XUnmapEvent &) {}
94 //! Called when a the visibilty of a window changes
95 virtual void visibilityHandler(const XVisibilityEvent &) {}
97 //! Called when the colormap changes, or is installed or unistalled
98 virtual void colorMapHandler(const XColormapEvent &) {}
100 //! Called when a property of a window changes
101 virtual void propertyHandler(const XPropertyEvent &) {}
103 //! Called when the client loses ownership of a selection
104 virtual void selectionClearHandler(const XSelectionClearEvent &) {}
106 //! Called when a ConvertSelection protocol request is sent
107 virtual void selectionHandler(const XSelectionEvent &) {}
109 //! Called when a SelectionEvent occurs
110 virtual void selectionRequestHandler(const XSelectionRequestEvent &) {}
112 //! Called when a client calls XSendEvent
114 Some types of client messages are filtered out and sent to more specific
115 event handler functions.
117 virtual void clientMessageHandler(const XClientMessageEvent &);
119 #if defined(SHAPE) || defined(DOXYGEN_IGNORE)
120 //! Called when a shape extention event fires
121 virtual void shapeHandler(const XShapeEvent &) {};
124 virtual ~OtkEventHandler();
127 /*! Constructor for the XEventHandler class.
128 This is protected so that XEventHandlers can't be instantiated on their