VTK  9.0.20200605
vtkWidgetCallbackMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWidgetCallbackMapper.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
29 #ifndef vtkWidgetCallbackMapper_h
30 #define vtkWidgetCallbackMapper_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
33 #include "vtkObject.h"
34 
35 class vtkWidgetEvent;
36 class vtkAbstractWidget;
38 class vtkCallbackMap; // PIMPL encapsulation of STL map
39 class vtkEventData;
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetCallbackMapper : public vtkObject
42 {
43 public:
47  static vtkWidgetCallbackMapper* New();
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
61  void SetEventTranslator(vtkWidgetEventTranslator* t);
62  vtkGetObjectMacro(EventTranslator, vtkWidgetEventTranslator);
64 
68  typedef void (*CallbackType)(vtkAbstractWidget*);
69 
71 
81  void SetCallbackMethod(
82  unsigned long VTKEvent, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
83  void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode, int repeatCount,
84  const char* keySym, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
85  void SetCallbackMethod(unsigned long VTKEvent, vtkEventData* ed, unsigned long widgetEvent,
86  vtkAbstractWidget* w, CallbackType f);
87  // void SetCallbackMethod(vtkWidgetEvent *vtkEvent, unsigned long widgetEvent,
88  // vtkAbstractWidget *w, CallbackType f);
90 
95  void InvokeCallback(unsigned long widgetEvent);
96 
97 protected:
99  ~vtkWidgetCallbackMapper() override;
100 
101  // Translates VTK events into widget events
103 
104  // Invoke the method associated with a particular widget event
105  vtkCallbackMap* CallbackMap;
106 
112  void SetCallbackMethod(unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
113 
114 private:
116  void operator=(const vtkWidgetCallbackMapper&) = delete;
117 };
118 
119 #endif /* vtkWidgetCallbackMapper_h */
vtkEventData
Definition: vtkEventData.h:65
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkWidgetCallbackMapper::EventTranslator
vtkWidgetEventTranslator * EventTranslator
Definition: vtkWidgetCallbackMapper.h:102
vtkWidgetCallbackMapper
map widget events into callbacks
Definition: vtkWidgetCallbackMapper.h:41
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:65
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkWidgetCallbackMapper::CallbackMap
vtkCallbackMap * CallbackMap
Definition: vtkWidgetCallbackMapper.h:105
vtkWidgetEvent
define widget events
Definition: vtkWidgetEvent.h:29
vtkWidgetEventTranslator
map VTK events into widget events
Definition: vtkWidgetEventTranslator.h:48