VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkXYPlotWidget.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 =========================================================================*/ 00035 #ifndef __vtkXYPlotWidget_h 00036 #define __vtkXYPlotWidget_h 00037 00038 #include "vtkInteractorObserver.h" 00039 class vtkXYPlotActor; 00040 00041 class VTK_WIDGETS_EXPORT vtkXYPlotWidget : public vtkInteractorObserver 00042 { 00043 public: 00044 static vtkXYPlotWidget *New(); 00045 vtkTypeMacro(vtkXYPlotWidget,vtkInteractorObserver); 00046 void PrintSelf(ostream& os, vtkIndent indent); 00047 00049 00050 virtual void SetXYPlotActor(vtkXYPlotActor *); 00051 vtkGetObjectMacro(XYPlotActor,vtkXYPlotActor); 00053 00055 virtual void SetEnabled(int); 00056 00057 protected: 00058 vtkXYPlotWidget(); 00059 ~vtkXYPlotWidget(); 00060 00061 // the actor that is used 00062 vtkXYPlotActor *XYPlotActor; 00063 00064 //handles the events 00065 static void ProcessEvents(vtkObject* object, 00066 unsigned long event, 00067 void* clientdata, 00068 void* calldata); 00069 00070 // ProcessEvents() dispatches to these methods. 00071 void OnLeftButtonDown(); 00072 void OnLeftButtonUp(); 00073 void OnMouseMove(); 00074 00075 // used to compute relative movements 00076 float StartPosition[2]; 00077 00078 //BTX - manage the state of the widget 00079 int State; 00080 enum WidgetState 00081 { 00082 Moving=0, 00083 AdjustingP1, 00084 AdjustingP2, 00085 AdjustingP3, 00086 AdjustingP4, 00087 AdjustingE1, 00088 AdjustingE2, 00089 AdjustingE3, 00090 AdjustingE4, 00091 Inside, 00092 Outside 00093 }; 00094 //ETX 00095 00096 // use to determine what state the mouse is over, edge1 p1, etc. 00097 // returns a state from the WidgetState enum above 00098 int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2); 00099 00100 // set the cursor to the correct shape based on State argument 00101 void SetCursor(int State); 00102 00103 private: 00104 vtkXYPlotWidget(const vtkXYPlotWidget&); //Not implemented 00105 void operator=(const vtkXYPlotWidget&); //Not implemented 00106 }; 00107 00108 #endif