VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAbstractWidget.h,v 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 =========================================================================*/ 00054 #ifndef __vtkAbstractWidget_h 00055 #define __vtkAbstractWidget_h 00056 00057 #include "vtkInteractorObserver.h" 00058 00059 class vtkWidgetEventTranslator; 00060 class vtkWidgetCallbackMapper; 00061 class vtkWidgetRepresentation; 00062 00063 00064 class VTK_WIDGETS_EXPORT vtkAbstractWidget : public vtkInteractorObserver 00065 { 00066 public: 00068 00069 vtkTypeMacro(vtkAbstractWidget,vtkInteractorObserver); 00070 void PrintSelf(ostream& os, vtkIndent indent); 00072 00078 virtual void SetEnabled(int); 00079 00081 00085 vtkSetClampMacro(ProcessEvents, int, 0, 1); 00086 vtkGetMacro(ProcessEvents, int); 00087 vtkBooleanMacro(ProcessEvents, int); 00089 00091 00093 vtkWidgetEventTranslator *GetEventTranslator() 00094 {return this->EventTranslator;} 00096 00101 virtual void CreateDefaultRepresentation() = 0; 00102 00107 void Render(); 00108 00110 00114 void SetParent(vtkAbstractWidget *parent) {this->Parent = parent;} 00115 vtkGetObjectMacro(Parent,vtkAbstractWidget); 00117 00119 00123 vtkWidgetRepresentation *GetRepresentation() 00124 { 00125 this->CreateDefaultRepresentation(); 00126 return this->WidgetRep; 00127 } 00129 00131 00135 vtkSetMacro(ManagesCursor,int); 00136 vtkGetMacro(ManagesCursor,int); 00137 vtkBooleanMacro(ManagesCursor,int); 00139 00143 virtual void SetPriority( float ); 00144 00145 protected: 00146 vtkAbstractWidget(); 00147 ~vtkAbstractWidget(); 00148 00149 // Handles the events; centralized here for all widgets. 00150 static void ProcessEventsHandler(vtkObject* object, unsigned long event, 00151 void* clientdata, void* calldata); 00152 00153 // The representation for the widget. This is typically called by the 00154 // SetRepresentation() methods particular to each widget (i.e. subclasses 00155 // of this class). This method does the actual work; the SetRepresentation() 00156 // methods constrain the type that can be set. 00157 void SetWidgetRepresentation(vtkWidgetRepresentation *r); 00158 vtkWidgetRepresentation *WidgetRep; 00159 00160 // helper methods for cursor management 00161 int ManagesCursor; 00162 virtual void SetCursor(int vtkNotUsed(state)) {} 00163 00164 // For translating and invoking events 00165 vtkWidgetEventTranslator *EventTranslator; 00166 vtkWidgetCallbackMapper *CallbackMapper; 00167 00168 // The parent, if any, for this widget 00169 vtkAbstractWidget *Parent; 00170 00171 // Call data which can be retrieved by the widget. This data is set 00172 // by ProcessEvents() if call data is provided during a callback 00173 // sequence. 00174 void *CallData; 00175 00176 // Flag indicating if the widget should handle interaction events. 00177 // On by default. 00178 int ProcessEvents; 00179 00180 private: 00181 vtkAbstractWidget(const vtkAbstractWidget&); //Not implemented 00182 void operator=(const vtkAbstractWidget&); //Not implemented 00183 }; 00184 00185 #endif