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 =========================================================================*/
54 #ifndef vtkAbstractWidget_h
55 #define vtkAbstractWidget_h
56 
57 #include "vtkInteractionWidgetsModule.h" // For export macro
58 #include "vtkInteractorObserver.h"
59 
63 
64 
66 {
67 public:
69 
71  void PrintSelf(ostream& os, vtkIndent indent);
73 
79  virtual void SetEnabled(int);
80 
82 
86  vtkSetClampMacro(ProcessEvents, int, 0, 1);
87  vtkGetMacro(ProcessEvents, int);
88  vtkBooleanMacro(ProcessEvents, int);
90 
92 
95  {return this->EventTranslator;}
97 
102  virtual void CreateDefaultRepresentation() = 0;
103 
108  void Render();
109 
111 
115  void SetParent(vtkAbstractWidget *parent) {this->Parent = parent;}
116  vtkGetObjectMacro(Parent,vtkAbstractWidget);
118 
120 
125  {
126  this->CreateDefaultRepresentation();
127  return this->WidgetRep;
128  }
130 
132 
136  vtkSetMacro(ManagesCursor,int);
137  vtkGetMacro(ManagesCursor,int);
138  vtkBooleanMacro(ManagesCursor,int);
140 
144  virtual void SetPriority( float );
145 
146 protected:
149 
150  // Handles the events; centralized here for all widgets.
151  static void ProcessEventsHandler(vtkObject* object, unsigned long event,
152  void* clientdata, void* calldata);
153 
154  // The representation for the widget. This is typically called by the
155  // SetRepresentation() methods particular to each widget (i.e. subclasses
156  // of this class). This method does the actual work; the SetRepresentation()
157  // methods constrain the type that can be set.
158  void SetWidgetRepresentation(vtkWidgetRepresentation *r);
160 
161  // helper methods for cursor management
163  virtual void SetCursor(int vtkNotUsed(state)) {}
164 
165  // For translating and invoking events
168 
169  // The parent, if any, for this widget
171 
172  // Call data which can be retrieved by the widget. This data is set
173  // by ProcessEvents() if call data is provided during a callback
174  // sequence.
175  void *CallData;
176 
177  // Flag indicating if the widget should handle interaction events.
178  // On by default.
180 
181 private:
182  vtkAbstractWidget(const vtkAbstractWidget&); //Not implemented
183  void operator=(const vtkAbstractWidget&); //Not implemented
184 };
185 
186 #endif
virtual void SetCursor(int vtkNotUsed(state))
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkWidgetCallbackMapper * CallbackMapper
map VTK events into widget events
virtual void SetEnabled(int)
vtkWidgetEventTranslator * GetEventTranslator()
abstract class defines interface between the widget and widget representation classes ...
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
vtkWidgetRepresentation * WidgetRep
#define VTKINTERACTIONWIDGETS_EXPORT
virtual void SetPriority(float)
a simple class to control print indentation
Definition: vtkIndent.h:38
define the API for widget / widget representation
map widget events into callbacks
void PrintSelf(ostream &os, vtkIndent indent)
void SetParent(vtkAbstractWidget *parent)
vtkAbstractWidget * Parent
vtkWidgetRepresentation * GetRepresentation()
vtkWidgetEventTranslator * EventTranslator