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