VTK
dox/Widgets/vtkHandleWidget.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkHandleWidget.h
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 =========================================================================*/
00069 #ifndef __vtkHandleWidget_h
00070 #define __vtkHandleWidget_h
00071 
00072 #include "vtkAbstractWidget.h"
00073 
00074 class vtkHandleRepresentation;
00075 
00076 
00077 class VTK_WIDGETS_EXPORT vtkHandleWidget : public vtkAbstractWidget
00078 {
00079 public:
00081   static vtkHandleWidget *New();
00082 
00084 
00085   vtkTypeMacro(vtkHandleWidget,vtkAbstractWidget);
00086   void PrintSelf(ostream& os, vtkIndent indent);
00088 
00090 
00093   void SetRepresentation(vtkHandleRepresentation *r)
00094     {this->Superclass::SetWidgetRepresentation(reinterpret_cast<vtkWidgetRepresentation*>(r));}
00096   
00098 
00099   vtkHandleRepresentation *GetHandleRepresentation()
00100     {return reinterpret_cast<vtkHandleRepresentation*>(this->WidgetRep);}
00102 
00105   void CreateDefaultRepresentation();
00106   
00108 
00111   vtkSetMacro( EnableAxisConstraint, int );
00112   vtkGetMacro( EnableAxisConstraint, int );
00113   vtkBooleanMacro( EnableAxisConstraint, int );
00115 
00117 
00119   vtkSetMacro( AllowHandleResize, int );
00120   vtkGetMacro( AllowHandleResize, int );
00121   vtkBooleanMacro( AllowHandleResize, int );
00123 
00125 
00126   vtkGetMacro( WidgetState, int );
00128 
00129   //BTX - manage the state of the widget
00130   enum _WidgetState {Start=0,Active};
00131   //ETX
00132   
00133 protected:
00134   vtkHandleWidget();
00135   ~vtkHandleWidget();
00136 
00137   // These are the callbacks for this widget
00138   static void GenericAction(vtkHandleWidget*);
00139   static void SelectAction(vtkAbstractWidget*);
00140   static void EndSelectAction(vtkAbstractWidget*);
00141   static void TranslateAction(vtkAbstractWidget*);
00142   static void ScaleAction(vtkAbstractWidget*);
00143   static void MoveAction(vtkAbstractWidget*);
00144 
00145   // helper methods for cursor management
00146   void SetCursor(int state);
00147 
00148   int WidgetState;
00149   int EnableAxisConstraint;
00150 
00151   // Allow resizing of handles.
00152   int AllowHandleResize;
00153 
00154 private:
00155   vtkHandleWidget(const vtkHandleWidget&);  //Not implemented
00156   void operator=(const vtkHandleWidget&);  //Not implemented
00157 };
00158 
00159 #endif