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

Hybrid/vtkScalarBarWidget.h

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