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