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 "vtkInteractionWidgetsModule.h" // For export macro 00058 #include "vtkInteractorObserver.h" 00059 00060 class vtkWidgetEventTranslator; 00061 class vtkWidgetCallbackMapper; 00062 class vtkWidgetRepresentation; 00063 00064 00065 class VTKINTERACTIONWIDGETS_EXPORT vtkAbstractWidget : public vtkInteractorObserver 00066 { 00067 public: 00069 00070 vtkTypeMacro(vtkAbstractWidget,vtkInteractorObserver); 00071 void PrintSelf(ostream& os, vtkIndent indent); 00073 00079 virtual void SetEnabled(int); 00080 00082 00086 vtkSetClampMacro(ProcessEvents, int, 0, 1); 00087 vtkGetMacro(ProcessEvents, int); 00088 vtkBooleanMacro(ProcessEvents, int); 00090 00092 00094 vtkWidgetEventTranslator *GetEventTranslator() 00095 {return this->EventTranslator;} 00097 00102 virtual void CreateDefaultRepresentation() = 0; 00103 00108 void Render(); 00109 00111 00115 void SetParent(vtkAbstractWidget *parent) {this->Parent = parent;} 00116 vtkGetObjectMacro(Parent,vtkAbstractWidget); 00118 00120 00124 vtkWidgetRepresentation *GetRepresentation() 00125 { 00126 this->CreateDefaultRepresentation(); 00127 return this->WidgetRep; 00128 } 00130 00132 00136 vtkSetMacro(ManagesCursor,int); 00137 vtkGetMacro(ManagesCursor,int); 00138 vtkBooleanMacro(ManagesCursor,int); 00140 00144 virtual void SetPriority( float ); 00145 00146 protected: 00147 vtkAbstractWidget(); 00148 ~vtkAbstractWidget(); 00149 00150 // Handles the events; centralized here for all widgets. 00151 static void ProcessEventsHandler(vtkObject* object, unsigned long event, 00152 void* clientdata, void* calldata); 00153 00154 // The representation for the widget. This is typically called by the 00155 // SetRepresentation() methods particular to each widget (i.e. subclasses 00156 // of this class). This method does the actual work; the SetRepresentation() 00157 // methods constrain the type that can be set. 00158 void SetWidgetRepresentation(vtkWidgetRepresentation *r); 00159 vtkWidgetRepresentation *WidgetRep; 00160 00161 // helper methods for cursor management 00162 int ManagesCursor; 00163 virtual void SetCursor(int vtkNotUsed(state)) {} 00164 00165 // For translating and invoking events 00166 vtkWidgetEventTranslator *EventTranslator; 00167 vtkWidgetCallbackMapper *CallbackMapper; 00168 00169 // The parent, if any, for this widget 00170 vtkAbstractWidget *Parent; 00171 00172 // Call data which can be retrieved by the widget. This data is set 00173 // by ProcessEvents() if call data is provided during a callback 00174 // sequence. 00175 void *CallData; 00176 00177 // Flag indicating if the widget should handle interaction events. 00178 // On by default. 00179 int ProcessEvents; 00180 00181 private: 00182 vtkAbstractWidget(const vtkAbstractWidget&); //Not implemented 00183 void operator=(const vtkAbstractWidget&); //Not implemented 00184 }; 00185 00186 #endif