VTK
vtkAbstractWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAbstractWidget.h,v
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 =========================================================================*/
52 #ifndef vtkAbstractWidget_h
53 #define vtkAbstractWidget_h
54 
55 #include "vtkInteractionWidgetsModule.h" // For export macro
56 #include "vtkInteractorObserver.h"
57 
61 
62 
63 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractWidget : public vtkInteractorObserver
64 {
65 public:
67 
71  void PrintSelf(ostream& os, vtkIndent indent);
73 
81  virtual void SetEnabled(int);
82 
84 
90  vtkSetClampMacro(ProcessEvents, int, 0, 1);
91  vtkGetMacro(ProcessEvents, int);
92  vtkBooleanMacro(ProcessEvents, int);
94 
100  {return this->EventTranslator;}
101 
108  virtual void CreateDefaultRepresentation() = 0;
109 
116  void Render();
117 
124  void SetParent(vtkAbstractWidget *parent) {this->Parent = parent;}
125  vtkGetObjectMacro(Parent,vtkAbstractWidget);
126 
128 
135  {
136  this->CreateDefaultRepresentation();
137  return this->WidgetRep;
138  }
140 
142 
149  vtkSetMacro(ManagesCursor,int);
150  vtkGetMacro(ManagesCursor,int);
151  vtkBooleanMacro(ManagesCursor,int);
153 
159  virtual void SetPriority( float );
160 
161 protected:
164 
165  // Handles the events; centralized here for all widgets.
166  static void ProcessEventsHandler(vtkObject* object, unsigned long event,
167  void* clientdata, void* calldata);
168 
169  // The representation for the widget. This is typically called by the
170  // SetRepresentation() methods particular to each widget (i.e. subclasses
171  // of this class). This method does the actual work; the SetRepresentation()
172  // methods constrain the type that can be set.
173  void SetWidgetRepresentation(vtkWidgetRepresentation *r);
175 
176  // helper methods for cursor management
178  virtual void SetCursor(int vtkNotUsed(state)) {}
179 
180  // For translating and invoking events
183 
184  // The parent, if any, for this widget
186 
187  // Call data which can be retrieved by the widget. This data is set
188  // by ProcessEvents() if call data is provided during a callback
189  // sequence.
190  void *CallData;
191 
192  // Flag indicating if the widget should handle interaction events.
193  // On by default.
195 
196 private:
197  vtkAbstractWidget(const vtkAbstractWidget&) VTK_DELETE_FUNCTION;
198  void operator=(const vtkAbstractWidget&) VTK_DELETE_FUNCTION;
199 };
200 
201 #endif
virtual void SetCursor(int vtkNotUsed(state))
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkWidgetCallbackMapper * CallbackMapper
map VTK events into widget events
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
vtkWidgetEventTranslator * GetEventTranslator()
Get the event translator.
abstract class defines interface between the widget and widget representation classes ...
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
vtkWidgetRepresentation * WidgetRep
virtual void SetPriority(float)
Set/Get the priority at which events are processed.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
define the API for widget / widget representation
map widget events into callbacks
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
void SetParent(vtkAbstractWidget *parent)
Specifying a parent to this widget is used when creating composite widgets.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
vtkAbstractWidget * Parent
vtkWidgetRepresentation * GetRepresentation()
Return an instance of vtkWidgetRepresentation used to represent this widget in the scene...
vtkWidgetEventTranslator * EventTranslator