• Main Page
  • Classes
  • Files
  • Directories
  • File List
  • File Members

vtkKWExtent.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWExtent.h,v $
00004 
00005   Copyright (c) Kitware, Inc.
00006   All rights reserved.
00007   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE.  See the above copyright notice for more information.
00012 
00013 =========================================================================*/
00014 // .NAME vtkKWExtent - six sliders defining a (xmin,xmax,ymin,ymax,zmin,zmax) extent
00015 // .SECTION Description
00016 // vtkKWExtent is a widget containing six sliders which represent the
00017 // xmin, xmax, ymin, ymax, zmin, zmax extent of a volume. It is a 
00018 // convinience object and has logic to keep the min values less than
00019 // or equal to the max values.
00020 
00021 #ifndef __vtkKWExtent_h
00022 #define __vtkKWExtent_h
00023 
00024 #include "vtkKWCompositeWidget.h"
00025 
00026 #include "vtkKWRange.h" // Needed for some constants
00027 
00028 class KWWidgets_EXPORT vtkKWExtent : public vtkKWCompositeWidget
00029 {
00030 public:
00031   static vtkKWExtent* New();
00032   vtkTypeRevisionMacro(vtkKWExtent,vtkKWCompositeWidget);
00033   void PrintSelf(ostream& os, vtkIndent indent);
00034 
00035   // Description:
00036   // Set the Range of the Extent, this is the range of
00037   // acceptable values for the sliders. Specified as 
00038   // minx maxx miny maxy minz maxz
00039   virtual void SetExtentRange(const double extent[6]);
00040   virtual void SetExtentRange(double, double, double, double, double, double);
00041   virtual double* GetExtentRange();
00042   virtual void GetExtentRange(
00043     double&, double&, double&, double&, double&, double&);
00044   virtual void GetExtentRange(double extent[6]);
00045   
00046   // Description:
00047   // Set/Get the Extent.
00048   vtkGetVector6Macro(Extent,double);
00049   virtual void SetExtent(const double extent[6]);
00050   virtual void SetExtent(double, double, double, double, double, double);
00051 
00052   // Description:
00053   // Set/Get the visibility of the extent selectively (x, y, z).
00054   virtual void SetExtentVisibility(int index, int arg);
00055   vtkBooleanMacro(XExtentVisibility, int);
00056   virtual int GetXExtentVisibility() { return this->ExtentVisibility[0]; };
00057   virtual void SetXExtentVisibility(int arg) 
00058     { this->SetExtentVisibility(0, arg); };
00059   vtkBooleanMacro(YExtentVisibility, int);
00060   virtual int GetYExtentVisibility() { return this->ExtentVisibility[1]; };
00061   virtual void SetYExtentVisibility(int arg) 
00062     { this->SetExtentVisibility(1, arg); };
00063   vtkBooleanMacro(ZExtentVisibility, int);
00064   virtual int GetZExtentVisibility() { return this->ExtentVisibility[2]; };
00065   virtual void SetZExtentVisibility(int arg) 
00066     { this->SetExtentVisibility(2, arg); };
00067 
00068   // Description:
00069   // Specifies commands to associate with the widget. 
00070   // 'Command' is invoked when the widget value is changing (i.e. during
00071   // user interaction).
00072   // 'StartCommand' is invoked at the beginning of a user interaction with
00073   // the widget (when a mouse button is pressed over the widget for example).
00074   // 'EndCommand' is invoked at the end of the user interaction with the 
00075   // widget (when the mouse button is released for example).
00076   // The need for a 'Command', 'StartCommand' and 'EndCommand' can be
00077   // explained as follows: 'EndCommand' can be used to be notified about any
00078   // changes made to this widget *after* the corresponding user interaction has
00079   // been performed (say, after releasing the mouse button that was dragging
00080   // a slider, or after clicking on a checkbutton). 'Command' can be set
00081   // *additionally* to be notified about the intermediate changes that
00082   // occur *during* the corresponding user interaction (say, *while* dragging
00083   // a slider). While setting 'EndCommand' is enough to be notified about
00084   // any changes, setting 'Command' is an application-specific choice that
00085   // is likely to depend on how fast you want (or can) answer to rapid changes
00086   // occuring during a user interaction, if any. 'StartCommand' is rarely
00087   // used but provides an opportunity for the application to modify its
00088   // state and prepare itself for user-interaction; in that case, the
00089   // 'EndCommand' is usually set in a symmetric fashion to set the application
00090   // back to its previous state.
00091   // The 'object' argument is the object that will have the method called on
00092   // it. The 'method' argument is the name of the method to be called and any
00093   // arguments in string form. If the object is NULL, the method is still
00094   // evaluated as a simple command. 
00095   // The following parameters are also passed to the command:
00096   // - the current extent: int, int, int, int, int, int (if the Resolution of
00097   //   all the visible ranges are integer); double, double, double, double, 
00098   //   double, double otherwise.
00099   //   Note: the 'int' signature is for convenience, so that the command can
00100   //   be set to a callback accepting 'int'. In doubt, implement the callback
00101   //   using a 'double' signature that will accept both 'int' and 'double'.
00102   virtual void SetCommand(vtkObject *object, const char *method);
00103   virtual void SetStartCommand(vtkObject *object, const char *method);
00104   virtual void SetEndCommand(vtkObject *object, const char *method);
00105 
00106   // Description:
00107   // Events. The events are triggered when the extent slider is changed.
00108   //BTX
00109   enum
00110   {
00111     ChangeEvent = 10000,
00112     StartChangeEvent = 10001,
00113     EndChangeEvent = 10002
00114   };
00115   //ETX
00116 
00117   // Description:
00118   // Set/Get whether the above commands should be called or not.
00119   virtual void SetDisableCommands(int);
00120   vtkBooleanMacro(DisableCommands, int);
00121 
00122   // Description:
00123   // Set the ranges orientations and item positions.
00124   // This just propagates the same method to the internal ranges.
00125   virtual void SetOrientation(int);
00126   virtual void SetOrientationToHorizontal()
00127     { this->SetOrientation(vtkKWRange::OrientationHorizontal); };
00128   virtual void SetOrientationToVertical() 
00129     { this->SetOrientation(vtkKWRange::OrientationVertical); };
00130   virtual void SetLabelPosition(int);
00131   virtual void SetLabelPositionToDefault()
00132     { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionDefault); };
00133   virtual void SetLabelPositionToTop()
00134     { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionTop); };
00135   virtual void SetLabelPositionToBottom()
00136     { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionBottom); };
00137   virtual void SetLabelPositionToLeft()
00138     { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionLeft); };
00139   virtual void SetLabelPositionToRight()
00140     { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionRight); };
00141   virtual void SetEntry1Position(int);
00142   virtual void SetEntry1PositionToDefault()
00143     { this->SetEntry1Position(vtkKWRange::EntryPositionDefault); };
00144   virtual void SetEntry1PositionToTop()
00145     { this->SetEntry1Position(vtkKWRange::EntryPositionTop); };
00146   virtual void SetEntry1PositionToBottom()
00147     { this->SetEntry1Position(vtkKWRange::EntryPositionBottom); };
00148   virtual void SetEntry1PositionToLeft()
00149     { this->SetEntry1Position(vtkKWRange::EntryPositionLeft); };
00150   virtual void SetEntry1PositionToRight()
00151     { this->SetEntry1Position(vtkKWRange::EntryPositionRight); };
00152   virtual void SetEntry2Position(int);
00153   virtual void SetEntry2PositionToDefault()
00154     { this->SetEntry2Position(vtkKWRange::EntryPositionDefault); };
00155   virtual void SetEntry2PositionToTop()
00156     { this->SetEntry2Position(vtkKWRange::EntryPositionTop); };
00157   virtual void SetEntry2PositionToBottom()
00158     { this->SetEntry2Position(vtkKWRange::EntryPositionBottom); };
00159   virtual void SetEntry2PositionToLeft()
00160     { this->SetEntry2Position(vtkKWRange::EntryPositionLeft); };
00161   virtual void SetEntry2PositionToRight()
00162     { this->SetEntry2Position(vtkKWRange::EntryPositionRight); };
00163   virtual void SetThickness(int);
00164   virtual void SetInternalThickness(double);
00165   virtual void SetRequestedLength(int);
00166   virtual void SetSliderSize(int);
00167   virtual void SetSliderCanPush(int);
00168   vtkBooleanMacro(SliderCanPush, int);
00169 
00170   // Description:
00171   // Update the "enable" state of the object and its internal parts.
00172   // Depending on different Ivars (this->Enabled, the application's 
00173   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00174   // and propagated to its internal parts/subwidgets. This will, for example,
00175   // enable/disable parts of the widget UI, enable/disable the visibility
00176   // of 3D widgets, etc.
00177   virtual void UpdateEnableState();
00178 
00179   // Description:
00180   // Access the internal vtkKWRange's.
00181   vtkKWRange* GetXRange() { return this->Range[0]; };
00182   vtkKWRange* GetYRange() { return this->Range[1]; };
00183   vtkKWRange* GetZRange() { return this->Range[2]; };
00184   vtkKWRange* GetRange(int index);
00185 
00186   // Description:
00187   // Callbacks. Internal, do not use.
00188   virtual void RangeCommandCallback(double r0, double r1);
00189   virtual void RangeStartCommandCallback(double r0, double r1);
00190   virtual void RangeEndCommandCallback(double r0, double r1);
00191   virtual void RangeEntriesCommandCallback(double r0, double r1);
00192 
00193 protected:
00194   vtkKWExtent();
00195   ~vtkKWExtent();
00196 
00197   // Description:
00198   // Create the widget.
00199   virtual void CreateWidget();
00200 
00201   char *Command;
00202   char *StartCommand;
00203   char *EndCommand;
00204 
00205   virtual void InvokeExtentCommand(
00206     const char *command, 
00207     double x0, double x1, double y0, double y1, double z0, double z1);
00208   virtual void InvokeCommand(
00209     double x0, double x1, double y0, double y1, double z0, double z1);
00210   virtual void InvokeStartCommand(
00211     double x0, double x1, double y0, double y1, double z0, double z1);
00212   virtual void InvokeEndCommand(
00213     double x0, double x1, double y0, double y1, double z0, double z1);
00214 
00215   double Extent[6];
00216 
00217   vtkKWRange  *Range[3];
00218 
00219   int ExtentVisibility[3];
00220 
00221   // Pack or repack the widget
00222 
00223   virtual void Pack();
00224 
00225 private:
00226 
00227   // Temporary var for wrapping purposes
00228 
00229   double ExtentRangeTemp[6];
00230 
00231   vtkKWExtent(const vtkKWExtent&); // Not implemented
00232   void operator=(const vtkKWExtent&); // Not implemented
00233 };
00234 
00235 #endif
00236 

Generated on Sat Dec 11 2010 02:07:57 for KWWidgets by  doxygen 1.7.2