Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

/src/actions.hh

Go to the documentation of this file.
00001 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
00002 #ifndef __actions_hh
00003 #define __actions_hh
00004 
00005 /*! @file actions.hh
00006   @brief The action interface for user-available actions
00007 */
00008 
00009 #include "widgetbase.hh"
00010 #include "otk/point.hh"
00011 #include "otk/rect.hh"
00012 #include "otk/eventhandler.hh"
00013 
00014 extern "C" {
00015 #include <X11/Xlib.h>
00016 #include <Python.h>
00017 }
00018 
00019 #include <map>
00020 
00021 namespace ob {
00022 
00023 //! The action interface for user-available actions
00024 /*!
00025   When these actions are fired, hooks to the guile engine are fired so that
00026   guile code is run.
00027 */
00028 class Actions : public otk::EventHandler {
00029 public:
00030 #ifndef   SWIG // get rid of a swig warning
00031   struct ButtonReleaseAction {
00032     Window win;
00033     unsigned int button;
00034     Time time;
00035     ButtonReleaseAction() { win = 0; button = 0; time = 0; }
00036   };
00037   
00038   struct ButtonPressAction {
00039     unsigned int button;
00040     otk::Point pos;
00041     otk::Rect clientarea;
00042     ButtonPressAction() { button = 0; }
00043   };
00044 #endif // SWIG
00045 private:
00046   // milliseconds XXX: config option
00047   static const int BUTTONS = 5;
00048   
00049   //! The mouse button currently being watched from a press for a CLICK
00050   unsigned int _button;
00051   //! The last button release processed for CLICKs
00052   ButtonReleaseAction _release;
00053   //! The point where the mouse was when each mouse button was pressed
00054   /*!
00055     Used for motion events as the starting position.
00056   */
00057   ButtonPressAction *_posqueue[BUTTONS];
00058   //! This is set to true once a drag has started and false when done to make
00059   //! sure the threshold isnt checked anymore once a drag is underway
00060   bool _dragging;
00061 
00062   
00063   void insertPress(const XButtonEvent &e);
00064   void removePress(const XButtonEvent &e);
00065 
00066 public:
00067   //! Constructs an Actions object
00068   Actions();
00069   //! Destroys the Actions object
00070   virtual ~Actions();
00071 
00072   virtual void buttonPressHandler(const XButtonEvent &e);
00073   virtual void buttonReleaseHandler(const XButtonEvent &e);
00074   
00075   virtual void enterHandler(const XCrossingEvent &e);
00076   virtual void leaveHandler(const XCrossingEvent &e);
00077 
00078   virtual void keyPressHandler(const XKeyEvent &e);
00079   virtual void keyReleaseHandler(const XKeyEvent &e);
00080 
00081   virtual void motionHandler(const XMotionEvent &e);
00082 
00083 #ifdef    XKB
00084   virtual void xkbHandler(const XkbEvent &e);
00085 #endif // XKB
00086 
00087 };
00088 
00089 }
00090 
00091 #endif // __actions_hh

Generated on Tue Feb 4 22:58:57 2003 for Openbox by doxygen1.3-rc2