• Main Page
  • Classes
  • Files
  • Directories
  • File List
  • File Members

vtkKWEventMap.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWEventMap.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 // .NAME vtkKWEventMap - map between mouse/keyboard event and actions
00015 // .SECTION Description
00016 // vtkKWEventMap maintains 3 lists of events -- for mouse, keyboard, and
00017 // keysym events.  The mouse event list maps between mouse button + modifier
00018 // keys and actions.  The keyboard event list maps between keys + modifier
00019 // keys and actions.  The keysym event list maps between keysyms and actions.
00020 
00021 #ifndef __vtkKWEventMap_h
00022 #define __vtkKWEventMap_h
00023 
00024 #include "vtkObject.h"
00025 #include "vtkKWWidgets.h" // Needed for export symbols directives
00026 
00027 class KWWidgets_EXPORT vtkKWEventMap : public vtkObject
00028 {
00029 public:
00030   static vtkKWEventMap *New();
00031   vtkTypeRevisionMacro(vtkKWEventMap, vtkObject);
00032   void PrintSelf(ostream& os, vtkIndent indent);
00033 
00034   // In the following code:
00035   // button:   0 = Left, 1 = Middle, 2 = Right
00036   // modifier: 0 = button only, 1 = button + shift, 2 = button + control
00037 
00038   //BTX
00039   enum 
00040   {
00041     LeftButton   = 0,
00042     MiddleButton = 1,
00043     RightButton  = 2
00044   };
00045   
00046   enum 
00047   {
00048     NoModifier      = 0,
00049     ShiftModifier   = 1,
00050     ControlModifier = 2,
00051     ControlShiftModifier = 3
00052   };
00053   //ETX
00054 
00055 
00056   //BTX
00057   // @cond nested_class
00058   class MouseEvent
00059   {
00060   public:
00061     int Button;
00062     int Modifier;
00063     char *Action;
00064     char *Context;
00065     char *Description;
00066   };
00067   // @endcond
00068   
00069   // @cond nested_class
00070   class KeyEvent
00071   {
00072   public:
00073     char Key;
00074     int Modifier;
00075     char *Action;
00076     char *Context;
00077     char *Description;
00078   };
00079   // @endcond
00080   
00081   // @cond nested_class
00082   class KeySymEvent
00083   {
00084   public:
00085     char *KeySym;
00086     int Modifier;
00087     char *Action;
00088     char *Context;
00089     char *Description;
00090   };
00091   // @endcond
00092   //ETX
00093 
00094   // ---------------------------------------------------------
00095 
00096   // Description:
00097   // Add a unique action with a specific mouse button and modifier key to
00098   // the list of mouse events.
00099   //BTX
00100   void AddMouseEvent(vtkKWEventMap::MouseEvent *me);
00101   //ETX
00102   void AddMouseEvent(int button, int modifier, const char *action); 
00103   void AddMouseEvent(int button, int modifier, const char *action, 
00104                      const char *context, const char *description);
00105 
00106   // Description:
00107   // Change the action to associate with a specific mouse button and modifier
00108   // key.  A mouse event with this button and modifier must have already have
00109   // been added.
00110   //BTX
00111   void SetMouseEvent(vtkKWEventMap::MouseEvent *me);
00112   //ETX
00113   void SetMouseEvent(int button, int modifier, const char *action);
00114   void SetMouseEvent(int button, int modifier, const char *action,
00115                      const char *context, const char *description);
00116 
00117   // Description:
00118   // Get the mouse event at the specified index.
00119   //BTX
00120   vtkKWEventMap::MouseEvent* GetMouseEvent(int index);
00121   //ETX
00122   
00123   // Description:
00124   // Remove the action associated with this mouse button and modifier key from
00125   // the list of mouse events (or all actions if action is NULL).
00126   //BTX
00127   void RemoveMouseEvent(vtkKWEventMap::MouseEvent *me);
00128   //ETX
00129   void RemoveMouseEvent(int button, int modifier, const char *action = NULL);
00130   void RemoveAllMouseEvents();
00131 
00132   // Description:
00133   // Return the string for the action of the mouse event indicated by this
00134   // button and modifier.
00135   const char* FindMouseAction(int button, int modifier);
00136   
00137   // Description:
00138   // Return the total number of mouse events.
00139   vtkGetMacro(NumberOfMouseEvents, int);
00140   
00141   // ---------------------------------------------------------
00142 
00143   // Description:
00144   // Add a unique action with a specific key and modifier key to
00145   // the list of key events.
00146   //BTX
00147   void AddKeyEvent(vtkKWEventMap::KeyEvent *me);
00148   //ETX
00149   void AddKeyEvent(char key, int modifier, const char *action);
00150   void AddKeyEvent(char key, int modifier, const char *action,
00151                    const char *context, const char *description);
00152   
00153   // Description:
00154   // Change the action to associate with a specific key and modifier key.
00155   // A key event with this key and modifier must have already been added.
00156   void SetKeyEvent(char key, int modifier, const char *action);
00157   void SetKeyEvent(char key, int modifier, const char *action,
00158                    const char *context, const char *description);
00159   
00160   // Description:
00161   // Get the key event at the specified index.
00162   //BTX
00163   vtkKWEventMap::KeyEvent* GetKeyEvent(int index);
00164   //ETX
00165   
00166   // Description:
00167   // Remove the action associated with this key and modifier key from the list
00168   // of key events (or all actions if action is NULL)..
00169   void RemoveKeyEvent(char key, int modifier, const char *action = NULL);
00170   void RemoveAllKeyEvents();
00171   
00172   // Description:
00173   // Return the string for the action of the key event indicated by this key
00174   // and modifier.
00175   const char* FindKeyAction(char key, int modifier);
00176   
00177   // Description:
00178   // Return the total number of key events.
00179   vtkGetMacro(NumberOfKeyEvents, int);
00180   
00181   // ---------------------------------------------------------
00182 
00183   // Description:
00184   // Add a unique action with a specific keysym to the list of keysym events.
00185   //BTX
00186   void AddKeySymEvent(vtkKWEventMap::KeySymEvent *me);
00187   //ETX
00188   void AddKeySymEvent(const char *keySym, int modifier, const char *action);
00189   void AddKeySymEvent(const char *keySym, int modifier, const char *action,
00190                       const char *context, const char *description);
00191   
00192   // Description:
00193   // Change the action to associate with a specific keysym.  A keysym event
00194   // with this keysym must have already been added.
00195   void SetKeySymEvent(const char *keySym, int modifier, const char *action);
00196   void SetKeySymEvent(const char *keySym, int modifier, const char *action,
00197                       const char *context, const char *description);
00198   
00199   // Description:
00200   // Get the keysym event at the specified index.
00201   //BTX
00202   vtkKWEventMap::KeySymEvent* GetKeySymEvent(int index);
00203   //ETX
00204   
00205   // Description:
00206   // Remove the action assiciated with this keysym from the list of keysym
00207   // events (or all actions if action is NULL)..
00208   void RemoveKeySymEvent(const char *keySym, int modifier, const char *action = NULL);
00209   void RemoveAllKeySymEvents();
00210   
00211   // Description:
00212   // Return the string for the action of the keysym event indicated by this
00213   // keysym.
00214   const char* FindKeySymAction(const char *keySym, int modifier);
00215   
00216   // Description:
00217   // Return the total number of keysym events.
00218   vtkGetMacro(NumberOfKeySymEvents, int);
00219 
00220   // Description:
00221   // Shallow copy.
00222   void ShallowCopy(vtkKWEventMap *tprop);
00223   
00224 protected:
00225   vtkKWEventMap();
00226   ~vtkKWEventMap();
00227   
00228   MouseEvent *MouseEvents;
00229   KeyEvent *KeyEvents;
00230   KeySymEvent *KeySymEvents;
00231 
00232   int NumberOfMouseEvents;
00233   int NumberOfKeyEvents;
00234   int NumberOfKeySymEvents;
00235   
00236 private:
00237   vtkKWEventMap(const vtkKWEventMap&);  // Not implemented
00238   void operator=(const vtkKWEventMap&);  // Not implemented
00239 };
00240 
00241 #endif
00242 

Generated on Mon Aug 16 2010 18:58:43 for KWWidgets by  doxygen 1.7.1