summaryrefslogtreecommitdiff
path: root/otk/eventhandler.hh
blob: 05dfac3bc95c92b68176aa0eb8f4c2f56ff230ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef __eventhandler__hh
#define __eventhandler__hh

extern "C" {
#include <X11/Xlib.h>
}

namespace otk {

class OtkEventHandler{
public:
  //! Dispatches events to one of the other handlers based on their type.
  virtual void handle(const XEvent &e);

  //! Called whenever any key is pressed.
  virtual void keyPressHandler(const XKeyEvent &) {}

  //! Called whenever any key is released.
  virtual void keyReleaseHandler(const XKeyEvent &) {}

  //! Called whenever a button of the pointer is pressed.
  virtual void buttonPressHandler(const XButtonEvent &) {}

  //! Called whenever a button of the pointer is released.
  virtual void buttonReleaseHandler(const XButtonEvent &) {}

  //! Called whenever the pointer enters a window.
  virtual void enterHandler(const XCrossingEvent &) {}

  //! Called whenever the pointer leaves a window.
  virtual void leaveHandler(const XCrossingEvent &) {}

  //! Called when a window gains focus.
  virtual void focusHandler(const XFocusChangeEvent &) {}

  //! Called when a window looses focus.
  virtual void unfocusHandler(const XFocusChangeEvent &) {}

  //! Called when a window becomes visible to the user.
  virtual void exposeHandler(const XExposeEvent &) {}

  //! Called to handle GraphicsExpose events.
  virtual void graphicsExposeHandler(const XGraphicsExposeEvent &) {}

  //! Called to handle NoExpose events.
  virtual void noExposeEventHandler(const XNoExposeEvent &) {}

  //! Called when the window requests a change in its z-order.
  virtual void circulateRequestHandler(const XCirculateRequestEvent &)
  {}

  //! Called when a different client initiates a configure window request.
  virtual void configureRequestHandler(const XConfigureRequestEvent &)
  {}

  //! Called when a different client tries to map a window.
  virtual void mapRequestHandler(const XMapRequestEvent &) {}

  //! Called when another client attemps to change the size of a window.
  virtual void resizeRequestHandler(const XResizeRequestEvent &) {}

  //! Called when the z-order of the window has changed.
  virtual void circulateHandler(const XCirculateEvent &) {}

  //! Called when the window as been reconfigured.
  virtual void configureHandler(const XConfigureEvent &) {}

  //! Called when a window is created.
  virtual void createHandler(const XCreateWindowEvent &) {}

  //! Called when a window is destroyed.
  virtual void destroyHandler(const XDestroyWindowEvent &) {}

  //! Called when a window is moved because of a change in the size of its 
  //! parent.
  virtual void gravityHandler(const XGravityEvent &) {}

  //! Called when a window is mapped.
  virtual void mapHandler(const XMapEvent &) {}

  //! Called when the server generats a MappingNotify event
  virtual void mappingHandler(const XMappingEvent &) {}

  //! Called when a window is reparented
  virtual void reparentHandler(const XReparentEvent &) {}

  //! Called when a window is unmapped
  virtual void unmapHandler(const XUnmapEvent &) {}

  //! Called when a the visibilty of a window changes
  virtual void visibilityHandler(const XVisibilityEvent &) {}

  //! Called when the colormap changes, or is installed or unistalled
  virtual void colorMapHandler(const XColormapEvent &) {}

  //! Called when a client calls XSendEvent
  virtual void clientMessageHandler(const XClientMessageEvent &) {}

  //! Called when a property of a window changes
  virtual void propertyHandler(const XPropertyEvent &) {}

  //! Called when the client loses ownership of a selection
  virtual void selectionClearHandler(const XSelectionClearEvent &) {}

  //! Called when a ConvertSelection protocol request is sent
  virtual void selectionHandler(const XSelectionEvent &) {}

  //! Called when a SelectionEvent occurs
  virtual void selectionRequestHandler(const XSelectionRequestEvent &) {}

  virtual ~OtkEventHandler();

protected:
  /*! Constructor for the XEventHandler class.
    This is protected so that XEventHandlers can't be instantiated on their
    own.
  */
  OtkEventHandler();

private:
};

}

#endif