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

Hybrid/vtkXYPlotWidget.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkXYPlotWidget.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00050 #ifndef __vtkXYPlotWidget_h
00051 #define __vtkXYPlotWidget_h
00052 
00053 #include "vtkInteractorObserver.h"
00054 class vtkXYPlotActor;
00055 
00056 class VTK_HYBRID_EXPORT vtkXYPlotWidget : public vtkInteractorObserver
00057 {
00058 public:
00059   static vtkXYPlotWidget *New();
00060   vtkTypeRevisionMacro(vtkXYPlotWidget,vtkInteractorObserver);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00065   virtual void SetXYPlotActor(vtkXYPlotActor *scalarbar);
00066   vtkGetObjectMacro(XYPlotActor,vtkXYPlotActor);
00068   
00070   virtual void SetEnabled(int);
00071 
00072 protected:
00073   vtkXYPlotWidget();
00074   ~vtkXYPlotWidget();
00075 
00076   // the actor that is used
00077   vtkXYPlotActor *XYPlotActor;
00078 
00079   //handles the events
00080   static void ProcessEvents(vtkObject* object, 
00081                             unsigned long event,
00082                             void* clientdata, 
00083                             void* calldata);
00084 
00085   // ProcessEvents() dispatches to these methods.
00086   void OnLeftButtonDown();
00087   void OnLeftButtonUp();
00088   void OnMouseMove();
00089 
00090   // used to compute relative movements
00091   float StartPosition[2];
00092   
00093 //BTX - manage the state of the widget
00094   int State;
00095   enum WidgetState
00096   {
00097     Moving=0,
00098     AdjustingP1,
00099     AdjustingP2,
00100     AdjustingP3,
00101     AdjustingP4,
00102     AdjustingE1,
00103     AdjustingE2,
00104     AdjustingE3,
00105     AdjustingE4,
00106     Inside,
00107     Outside
00108   };
00109 //ETX
00110 
00111   // use to determine what state the mouse is over, edge1 p1, etc.
00112   // returns a state from the WidgetState enum above
00113   int ComputeStateBasedOnPosition(int X, int Y, int *pos1, int *pos2);
00114 
00115   // set the cursor to the correct shape based on State argument
00116   void SetCursor(int State);
00117 
00118 private:
00119   vtkXYPlotWidget(const vtkXYPlotWidget&);  //Not implemented
00120   void operator=(const vtkXYPlotWidget&);  //Not implemented
00121 };
00122 
00123 #endif