VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Interaction/Widgets/vtkWidgetCallbackMapper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkWidgetCallbackMapper.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00028 #ifndef vtkWidgetCallbackMapper_h
00029 #define vtkWidgetCallbackMapper_h
00030 
00031 #include "vtkInteractionWidgetsModule.h" // For export macro
00032 #include "vtkObject.h"
00033 
00034 class vtkWidgetEvent;
00035 class vtkAbstractWidget;
00036 class vtkWidgetEventTranslator;
00037 class vtkCallbackMap; // PIMPL encapsulation of STL map
00038 
00039 
00040 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetCallbackMapper : public vtkObject
00041 {
00042 public:
00044   static vtkWidgetCallbackMapper *New();
00045 
00047 
00048   vtkTypeMacro(vtkWidgetCallbackMapper,vtkObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00054   void SetEventTranslator(vtkWidgetEventTranslator *t);
00055   vtkGetObjectMacro(EventTranslator,vtkWidgetEventTranslator);
00057 
00058 //BTX
00060 
00061   typedef void (*CallbackType)(vtkAbstractWidget*);
00062 //ETX
00064 
00066 
00074   void SetCallbackMethod(unsigned long VTKEvent, unsigned long widgetEvent,
00075                          vtkAbstractWidget *w, CallbackType f);
00076   void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode,
00077                          int repeatCount, const char* keySym,
00078                          unsigned long widgetEvent,
00079                          vtkAbstractWidget *w, CallbackType f);
00080   //void SetCallbackMethod(vtkWidgetEvent *vtkEvent, unsigned long widgetEvent,
00081   //                       vtkAbstractWidget *w, CallbackType f);
00083 
00086   void InvokeCallback(unsigned long widgetEvent);
00087 
00088 protected:
00089   vtkWidgetCallbackMapper();
00090   ~vtkWidgetCallbackMapper();
00091 
00092   // Translates VTK events into widget events
00093   vtkWidgetEventTranslator *EventTranslator;
00094 
00095   // Invoke the method associated with a particular widget event
00096   vtkCallbackMap *CallbackMap;
00097 
00099 
00103   void SetCallbackMethod(unsigned long widgetEvent,
00104                          vtkAbstractWidget *w, CallbackType f);
00106 
00107 
00108 private:
00109   vtkWidgetCallbackMapper(const vtkWidgetCallbackMapper&);  //Not implemented
00110   void operator=(const vtkWidgetCallbackMapper&);  //Not implemented
00111 
00112 };
00113 
00114 
00115 #endif /* vtkWidgetCallbackMapper_h */
00116