7b960cd3a945d27e495a63e6b3548bfcfb47be73
[dana/openbox.git] / src / xeventhandler.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef   __xeventhandler_hh
3 #define   __xeventhandler_hh
4
5 extern "C" {
6 #include <X11/Xlib.h>
7 }
8
9 namespace ob {
10
11 //! Handles X events
12 /*!
13   There are 2 type of X events:<br>
14     a) User Actions<br>
15     b) Background Events<br>
16   <p>
17   User Actions are events like mouse drags and presses, key presses.
18   Background Events are everything else. Stuff that can't be bound to user
19     input.
20   <p>
21   When an XEvent comes to the application, it is sent to this class. This class
22   will determine what the event means, such as "A Left-Mouse-Button Drag on
23   this window", or "Double click with right mouse button on root window" or
24   "space bar pressed", or Background Event.
25   <p>
26   If the XEvent or combination of XEvents form a User Action, then the action
27   is dispatched to the OBBindingMapper.
28   <p>
29   If the XEvent is a Background Event, it is simply dealt with as appropriate.
30 */
31 class OBXEventHandler
32 {
33 private:
34   //! The time at which the last XEvent with a time was received
35   Time _lasttime;
36
37   //! Handles mouse button press events
38   /*!
39     @param e The XEvent to handle
40   */
41   void buttonPress(const XButtonEvent &e);
42   //! Handles mouse button release events
43   /*!
44     @param e The XEvent to handle
45   */
46   void buttonRelease(const XButtonEvent &e);
47   //! Handles keyboard key press events
48   /*!
49     @param e The XEvent to handle
50   */
51   void keyPress(const XKeyEvent &e); 
52   //! Handles mouse motion events
53   /*!
54     @param e The XEvent to handle
55   */
56   void motion(const XMotionEvent &e);
57   //! Handles mouse-enter events
58   /*!
59     @param e The XEvent to handle
60   */
61   void enterNotify(const XCrossingEvent &e);
62   //! Handles mouse-leave events
63   /*!
64     @param e The XEvent to handle
65   */
66   void leaveNotify(const XCrossingEvent &e);
67   //! Handles configure request events
68   /*!
69     @param e The XEvent to handle
70   */
71   void configureRequest(const XConfigureRequestEvent &e);
72   //! Handles window map request events
73   /*!
74     @param e The XEvent to handle
75   */
76   void mapRequest(const XMapRequestEvent &e);
77   //! Handles window unmap events
78   /*!
79     @param e The XEvent to handle
80   */
81   void unmapNotify(const XUnmapEvent &e);
82   //! Handles window destroy events
83   /*!
84     @param e The XEvent to handle
85   */
86   void destroyNotify(const XDestroyWindowEvent &e);
87   //! Handles window reparent events
88   /*!
89     @param e The XEvent to handle
90   */
91   void reparentNotify(const XReparentEvent &e);
92   //! Handles window property change events
93   /*!
94     @param e The XEvent to handle
95   */
96   void propertyNotify(const XPropertyEvent &e);
97   //! Handles window expose events
98   /*!
99     @param e The XEvent to handle
100   */
101   void expose(const XExposeEvent &e);
102   //! Handles colormap events
103   /*!
104     @param e The XEvent to handle
105   */
106   void colormapNotify(const XColormapEvent &e);
107   //! Handles focus-in events
108   /*!
109     @param e The XEvent to handle
110   */
111   void focusIn(const XFocusChangeEvent &e);
112   //! Handles focus-out events
113   /*!
114     @param e The XEvent to handle
115   */
116   void focusOut(const XFocusChangeEvent &e);
117 #if defined(SHAPE) || defined(DOXYGEN_IGNORE)
118   //! Handles Shape extension events
119   /*!
120     @param e The XEvent to handle
121   */
122   void shapeEvent(const XShapeEvent &e);
123 #endif // SHAPE 
124   //! Handles client message events
125   /*!
126     @param e The XEvent to handle
127   */
128   void clientMessage(const XClientMessageEvent &e);
129  
130   
131 public:
132   //! Constructs an OBXEventHandler object
133   OBXEventHandler();
134   
135   //! Handle an XEvent
136   /*!
137     @param e The XEvent to handle
138   */
139   void handle(const XEvent &e);
140 };
141
142 }
143
144 #endif // __xeventhandler_hh