]> icculus.org git repositories - mikachu/openbox.git/blob - otk/eventhandler.hh
remove the word "sticky" from everywhere, and replace with "all desktops". change...
[mikachu/openbox.git] / otk / eventhandler.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __eventhandler__hh
3 #define __eventhandler__hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7
8 #ifdef    SHAPE
9 #include <X11/extensions/shape.h>
10 #endif // SHAPE
11
12 #ifdef    XKB
13 #include <X11/XKBlib.h>
14 #endif // XKB
15
16 }
17
18 namespace otk {
19
20 class EventHandler {
21 public:
22   //! Dispatches events to one of the other handlers based on their type.
23   virtual void handle(const XEvent &e);
24
25   //! Called whenever any key is pressed.
26   virtual void keyPressHandler(const XKeyEvent &) {}
27
28   //! Called whenever any key is released.
29   virtual void keyReleaseHandler(const XKeyEvent &) {}
30
31   //! Called whenever a button of the pointer is pressed.
32   virtual void buttonPressHandler(const XButtonEvent &) {}
33
34   //! Called whenever a button of the pointer is released.
35   virtual void buttonReleaseHandler(const XButtonEvent &) {}
36
37   //! Called whenever the pointer moved
38   virtual void motionHandler(const XMotionEvent &) {}
39
40   //! Called whenever the pointer enters a window.
41   virtual void enterHandler(const XCrossingEvent &) {}
42
43   //! Called whenever the pointer leaves a window.
44   virtual void leaveHandler(const XCrossingEvent &) {}
45
46   //! Called when a window gains focus.
47   virtual void focusHandler(const XFocusChangeEvent &) {}
48
49   //! Called when a window looses focus.
50   virtual void unfocusHandler(const XFocusChangeEvent &) {}
51
52   //! Called when a window becomes visible to the user.
53   virtual void exposeHandler(const XExposeEvent &) {}
54
55   //! Called to handle GraphicsExpose events.
56   virtual void graphicsExposeHandler(const XGraphicsExposeEvent &) {}
57
58   //! Called to handle NoExpose events.
59   virtual void noExposeEventHandler(const XNoExposeEvent &) {}
60
61   //! Called when the window requests a change in its z-order.
62   virtual void circulateRequestHandler(const XCirculateRequestEvent &)
63   {}
64
65   //! Called when a different client initiates a configure window request.
66   virtual void configureRequestHandler(const XConfigureRequestEvent &)
67   {}
68
69   //! Called when a different client tries to map a window.
70   virtual void mapRequestHandler(const XMapRequestEvent &) {}
71
72   //! Called when another client attemps to change the size of a window.
73   virtual void resizeRequestHandler(const XResizeRequestEvent &) {}
74
75   //! Called when the z-order of the window has changed.
76   virtual void circulateHandler(const XCirculateEvent &) {}
77
78   //! Called when the window as been reconfigured.
79   virtual void configureHandler(const XConfigureEvent &) {}
80
81   //! Called when a window is created.
82   virtual void createHandler(const XCreateWindowEvent &) {}
83
84   //! Called when a window is destroyed.
85   virtual void destroyHandler(const XDestroyWindowEvent &) {}
86
87   //! Called when a window is moved because of a change in the size of its 
88   //! parent.
89   virtual void gravityHandler(const XGravityEvent &) {}
90
91   //! Called when a window is mapped.
92   virtual void mapHandler(const XMapEvent &) {}
93
94   //! Called when the server generats a MappingNotify event
95   virtual void mappingHandler(const XMappingEvent &) {}
96
97   //! Called when a window is reparented
98   virtual void reparentHandler(const XReparentEvent &) {}
99
100   //! Called when a window is unmapped
101   virtual void unmapHandler(const XUnmapEvent &) {}
102
103   //! Called when a the visibilty of a window changes
104   virtual void visibilityHandler(const XVisibilityEvent &) {}
105
106   //! Called when the colormap changes, or is installed or unistalled
107   virtual void colorMapHandler(const XColormapEvent &) {}
108
109   //! Called when a property of a window changes
110   virtual void propertyHandler(const XPropertyEvent &) {}
111
112   //! Called when the client loses ownership of a selection
113   virtual void selectionClearHandler(const XSelectionClearEvent &) {}
114
115   //! Called when a ConvertSelection protocol request is sent
116   virtual void selectionHandler(const XSelectionEvent &) {}
117
118   //! Called when a SelectionEvent occurs
119   virtual void selectionRequestHandler(const XSelectionRequestEvent &) {}
120
121   //! Called when a client calls XSendEvent
122   /*!
123     Some types of client messages are filtered out and sent to more specific
124     event handler functions.
125   */
126   virtual void clientMessageHandler(const XClientMessageEvent &);
127
128 #if defined(SHAPE) || defined(DOXYGEN_IGNORE)
129   //! Called when a shape extension event fires
130   virtual void shapeHandler(const XShapeEvent &) {}
131 #endif // SHAPE 
132
133 #if defined(XKB) || defined(DOXYGEN_IGNORE)
134   //! Called when an xkb extension event fires
135   virtual void xkbHandler(const XkbEvent &) {}
136 #endif // XKB
137
138   virtual ~EventHandler();
139
140 protected:
141   /*! Constructor for the EventHandler class.
142     This is protected so that EventHandlers can't be instantiated on their
143     own.
144   */
145   EventHandler();
146
147 private:
148 };
149
150 }
151
152 #endif