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

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