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