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 "vtkInteractorObserver.h"
58 
62 
63 
65 {
66 public:
68 
70  void PrintSelf(ostream& os, vtkIndent indent);
72 
78  virtual void SetEnabled(int);
79 
81 
85  vtkSetClampMacro(ProcessEvents, int, 0, 1);
86  vtkGetMacro(ProcessEvents, int);
87  vtkBooleanMacro(ProcessEvents, int);
89 
91 
93  vtkWidgetEventTranslator *GetEventTranslator()
94  {return this->EventTranslator;}
96 
101  virtual void CreateDefaultRepresentation() = 0;
102 
107  void Render();
108 
110 
114  void SetParent(vtkAbstractWidget *parent) {this->Parent = parent;}
115  vtkGetObjectMacro(Parent,vtkAbstractWidget);
117 
119 
123  vtkWidgetRepresentation *GetRepresentation()
124  {
125  this->CreateDefaultRepresentation();
126  return this->WidgetRep;
127  }
129 
131 
135  vtkSetMacro(ManagesCursor,int);
136  vtkGetMacro(ManagesCursor,int);
137  vtkBooleanMacro(ManagesCursor,int);
139 
143  virtual void SetPriority( float );
144 
145 protected:
148 
149  // Handles the events; centralized here for all widgets.
150  static void ProcessEventsHandler(vtkObject* object, unsigned long event,
151  void* clientdata, void* calldata);
152 
153  // The representation for the widget. This is typically called by the
154  // SetRepresentation() methods particular to each widget (i.e. subclasses
155  // of this class). This method does the actual work; the SetRepresentation()
156  // methods constrain the type that can be set.
157  void SetWidgetRepresentation(vtkWidgetRepresentation *r);
159 
160  // helper methods for cursor management
162  virtual void SetCursor(int vtkNotUsed(state)) {}
163 
164  // For translating and invoking events
167 
168  // The parent, if any, for this widget
170 
171  // Call data which can be retrieved by the widget. This data is set
172  // by ProcessEvents() if call data is provided during a callback
173  // sequence.
174  void *CallData;
175 
176  // Flag indicating if the widget should handle interaction events.
177  // On by default.
179 
180 private:
181  vtkAbstractWidget(const vtkAbstractWidget&); //Not implemented
182  void operator=(const vtkAbstractWidget&); //Not implemented
183 };
184 
185 #endif