Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Hybrid/vtkScalarBarWidget.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkScalarBarWidget.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 =========================================================================*/ 00040 #ifndef __vtkScalarBarWidget_h 00041 #define __vtkScalarBarWidget_h 00042 00043 #include "vtkInteractorObserver.h" 00044 class vtkScalarBarActor; 00045 00046 class VTK_HYBRID_EXPORT vtkScalarBarWidget : public vtkInteractorObserver 00047 { 00048 public: 00049 static vtkScalarBarWidget *New(); 00050 vtkTypeRevisionMacro(vtkScalarBarWidget,vtkInteractorObserver); 00051 void PrintSelf(ostream& os, vtkIndent indent); 00052 00054 00055 void SetScalarBarActor(vtkScalarBarActor *scalarbar); 00056 vtkGetObjectMacro(ScalarBarActor,vtkScalarBarActor); 00058 00060 virtual void SetEnabled(int); 00061 00062 protected: 00063 vtkScalarBarWidget(); 00064 ~vtkScalarBarWidget(); 00065 00066 // the actor that is used 00067 vtkScalarBarActor *ScalarBarActor; 00068 00069 //handles the events 00070 static void ProcessEvents(vtkObject* object, 00071 unsigned long event, 00072 void* clientdata, 00073 void* calldata); 00074 00075 // ProcessEvents() dispatches to these methods. 00076 void OnLeftButtonDown(); 00077 void OnLeftButtonUp(); 00078 void OnRightButtonDown(); 00079 void OnRightButtonUp(); 00080 void OnMouseMove(); 00081 00082 // used to compute relative movements 00083 double StartPosition[2]; 00084 00085 //BTX - manage the state of the widget 00086 int State; 00087 // use this to track whether left/right button was pressed to gate 00088 // action on button up event. 00089 int LeftButtonDown; 00090 int RightButtonDown; 00091 enum WidgetState 00092 { 00093 Moving=0, 00094 AdjustingP1, 00095 AdjustingP2, 00096 AdjustingP3, 00097 AdjustingP4, 00098 AdjustingE1, 00099 AdjustingE2, 00100 AdjustingE3, 00101 AdjustingE4, 00102 Inside, 00103 Outside 00104 }; 00105 //ETX 00106 00107 // use to determine what state the mouse is over, edge1 p1, etc. 00108 // returns a state from the WidgetState enum above 00109 int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2); 00110 00111 // set the cursor to the correct shape based on State argument 00112 void SetCursor(int State); 00113 00114 private: 00115 vtkScalarBarWidget(const vtkScalarBarWidget&); //Not implemented 00116 void operator=(const vtkScalarBarWidget&); //Not implemented 00117 }; 00118 00119 #endif