]> Dogcows Code - chaz/openbox/blob - src/actions.hh
actions class can sorta handle mouse enter/leave and press/release events
[chaz/openbox] / src / actions.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
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/display.hh"
10 #include "otk/point.hh"
11 #include "otk/rect.hh"
12
13 namespace ob {
14
15 //! The action interface for user-available actions
16 /*!
17 When these actions are fired, hooks to the guile engine are fired so that
18 guile code is run.
19 */
20 class OBActions {
21 public:
22 struct MousePressAction {
23 Window win;
24 unsigned int button;
25 Time time;
26 MousePressAction() { win = 0; button = 0; time = 0; }
27 };
28
29 private:
30 // milliseconds XXX: config option
31 static const unsigned int DOUBLECLICKDELAY = 200;
32
33 //! The last 2 button presses processed for CLICKs
34 /*!
35 Inserted such that index 0 is the latest action.
36 */
37 MousePressAction *_presses[2];
38 //! The mouse button currently being watched from a press for a CLICK
39 unsigned int _button;
40 //! The window the last enter action occured on (where the mouse is located)
41 Window _enter_win;
42
43 void insertPress(Window win, unsigned int button, Time time);
44
45 public:
46 OBActions();
47 virtual ~OBActions();
48
49 //! Notify that a mouse button press has occured on a window.
50 /*!
51 @param win The window on which the action was performed.
52 @param modifiers The modifier state for the action.
53 @param button The mouse button the action is for.
54 @param time The time at which the event occured (from the XEvent).
55 */
56 void bpress(Window win, unsigned int modifiers, unsigned int button,
57 Time time);
58
59 //! Notify that a mouse button release has occured on a window.
60 /*!
61 @param win The window on which the action was performed.
62 @param area The area of the window on which the action was performed.
63 @param mpos The position of the mouse pointer relative to the root window.
64 @param modifiers The modifier state for the action.
65 @param button The mouse button the action is for.
66 @param time The time at which the event occured (from the XEvent).
67 */
68 void brelease(Window win, const otk::Rect &area, const otk::Point &mpos,
69 unsigned int modifiers, unsigned int button, Time time);
70
71 //! Notify that a mouse enter action has occured on a window.
72 /*!
73 @param win The window on which the action was performed.
74 @param modifiers The modifier state for the action.
75 */
76 void enter(Window win, unsigned int modifiers);
77
78 //! Notify that a mouse leave action has occured on a window.
79 /*!
80 @param modifiers The modifier state for the action.
81 */
82 void leave(unsigned int modifiers);
83
84 //! Notify that a mouse drag is taking place.
85 /*!
86 @param win The window the drag is on
87 @param delta The change in position of the mouse pointer
88 @param modifiers The modifier state during the drag.
89 */
90 void drag(Window win, otk::Point delta, unsigned int modifiers,
91 unsigned int button, Time time);
92
93 //! Notify that a key press has occured on a window.
94 /*!
95 @param win The window the key press was on
96 @param modifiers The modifier state for the action.
97 @param keycode The keycode of the key pressed.
98 */
99 void key(Window win, unsigned int modifiers, unsigned int keycode);
100 };
101
102 }
103
104 #endif // __actions_hh
This page took 0.038421 seconds and 5 git commands to generate.