]> icculus.org git repositories - mikachu/openbox.git/blob - src/actions.hh
add some const
[mikachu/openbox.git] / src / actions.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __actions_hh
3 #define __actions_hh
4
5 /*! @file actions.hh
6   @brief The action interface for user-available actions
7 */
8
9 #include "otk/point.hh"
10 #include "otk/rect.hh"
11 #include "otk/eventhandler.hh"
12
13 extern "C" {
14 #include <X11/Xlib.h>
15 }
16
17 namespace ob {
18
19 //! The action interface for user-available actions
20 /*!
21   When these actions are fired, hooks to the guile engine are fired so that
22   guile code is run.
23 */
24 class OBActions : public otk::OtkEventHandler {
25 public:
26   // update the same enum in openbox.i when making changes to this
27   enum ActionType {
28     Action_ButtonPress,
29     Action_ButtonRelease,
30     Action_Click,
31     Action_DoubleClick,
32     Action_EnterWindow,
33     Action_LeaveWindow,
34     Action_KeyPress,
35     Action_MouseMotion,
36     NUM_ACTIONS
37   };
38   
39   struct ButtonReleaseAction {
40     Window win;
41     unsigned int button;
42     Time time;
43     ButtonReleaseAction() { win = 0; button = 0; time = 0; }
44   };
45
46 private:
47   // milliseconds XXX: config option
48   static const unsigned int DOUBLECLICKDELAY;
49   
50   //! The mouse button currently being watched from a press for a CLICK
51   unsigned int _button;
52   //! The last button release processed for CLICKs
53   ButtonReleaseAction _release;
54
55 public:
56   //! Constructs an OBActions object
57   OBActions();
58   //! Destroys the OBActions object
59   virtual ~OBActions();
60
61   virtual void buttonPressHandler(const XButtonEvent &e);
62   virtual void buttonReleaseHandler(const XButtonEvent &e);
63   
64   virtual void enterHandler(const XCrossingEvent &e);
65   virtual void leaveHandler(const XCrossingEvent &e);
66
67   virtual void keyPressHandler(const XKeyEvent &e);
68
69   virtual void motionHandler(const XMotionEvent &e);
70 };
71
72 }
73
74 #endif // __actions_hh