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