1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
6 @brief The action interface for user-available actions
10 #include "otk/point.hh"
11 #include "otk/rect.hh"
12 #include "otk/eventhandler.hh"
23 //! The action interface for user-available actions
25 When these actions are fired, hooks to the guile engine are fired so that
28 class OBActions : public otk::OtkEventHandler {
30 #ifndef SWIG // get rid of a swig warning
31 struct ButtonReleaseAction {
35 ButtonReleaseAction() { win = 0; button = 0; time = 0; }
38 struct ButtonPressAction {
42 ButtonPressAction() { button = 0; }
46 // milliseconds XXX: config option
47 static const int BUTTONS = 5;
49 //! The mouse button currently being watched from a press for a CLICK
51 //! The last button release processed for CLICKs
52 ButtonReleaseAction _release;
53 //! The point where the mouse was when each mouse button was pressed
55 Used for motion events as the starting position.
57 ButtonPressAction *_posqueue[BUTTONS];
60 void insertPress(const XButtonEvent &e);
61 void removePress(const XButtonEvent &e);
63 PyObject *_callback[NUM_EVENTS];
66 //! Constructs an OBActions object
68 //! Destroys the OBActions object
71 virtual void buttonPressHandler(const XButtonEvent &e);
72 virtual void buttonReleaseHandler(const XButtonEvent &e);
74 virtual void enterHandler(const XCrossingEvent &e);
75 virtual void leaveHandler(const XCrossingEvent &e);
77 virtual void keyPressHandler(const XKeyEvent &e);
79 virtual void motionHandler(const XMotionEvent &e);
81 virtual void mapRequestHandler(const XMapRequestEvent &e);
82 virtual void unmapHandler(const XUnmapEvent &e);
83 virtual void destroyHandler(const XDestroyWindowEvent &e);
85 //! Bind a callback for an action
86 bool bind(EventAction action, PyObject *func);
88 //! Unbind the callback function from an action
89 bool unbind(EventAction action);
91 //! Remove all callback functions
97 #endif // __actions_hh