KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWExtent.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWExtent.h,v $
4 
5  Copyright (c) Kitware, Inc.
6  All rights reserved.
7  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 // .NAME vtkKWExtent - six sliders defining a (xmin,xmax,ymin,ymax,zmin,zmax) extent
15 // .SECTION Description
16 // vtkKWExtent is a widget containing six sliders which represent the
17 // xmin, xmax, ymin, ymax, zmin, zmax extent of a volume. It is a
18 // convinience object and has logic to keep the min values less than
19 // or equal to the max values.
20 
21 #ifndef __vtkKWExtent_h
22 #define __vtkKWExtent_h
23 
24 #include "vtkKWCompositeWidget.h"
25 
26 #include "vtkKWRange.h" // Needed for some constants
27 
29 {
30 public:
31  static vtkKWExtent* New();
32  vtkTypeRevisionMacro(vtkKWExtent,vtkKWCompositeWidget);
33  void PrintSelf(ostream& os, vtkIndent indent);
34 
35  // Description:
36  // Set the Range of the Extent, this is the range of
37  // acceptable values for the sliders. Specified as
38  // minx maxx miny maxy minz maxz
39  virtual void SetExtentRange(const double extent[6]);
40  virtual void SetExtentRange(double, double, double, double, double, double);
41  virtual double* GetExtentRange();
42  virtual void GetExtentRange(
43  double&, double&, double&, double&, double&, double&);
44  virtual void GetExtentRange(double extent[6]);
45 
46  // Description:
47  // Set/Get the Extent.
48  vtkGetVector6Macro(Extent,double);
49  virtual void SetExtent(const double extent[6]);
50  virtual void SetExtent(double, double, double, double, double, double);
51 
52  // Description:
53  // Set/Get the visibility of the extent selectively (x, y, z).
54  virtual void SetExtentVisibility(int index, int arg);
55  vtkBooleanMacro(XExtentVisibility, int);
56  virtual int GetXExtentVisibility() { return this->ExtentVisibility[0]; };
57  virtual void SetXExtentVisibility(int arg)
58  { this->SetExtentVisibility(0, arg); };
59  vtkBooleanMacro(YExtentVisibility, int);
60  virtual int GetYExtentVisibility() { return this->ExtentVisibility[1]; };
61  virtual void SetYExtentVisibility(int arg)
62  { this->SetExtentVisibility(1, arg); };
63  vtkBooleanMacro(ZExtentVisibility, int);
64  virtual int GetZExtentVisibility() { return this->ExtentVisibility[2]; };
65  virtual void SetZExtentVisibility(int arg)
66  { this->SetExtentVisibility(2, arg); };
67 
68  // Description:
69  // Specifies commands to associate with the widget.
70  // 'Command' is invoked when the widget value is changing (i.e. during
71  // user interaction).
72  // 'StartCommand' is invoked at the beginning of a user interaction with
73  // the widget (when a mouse button is pressed over the widget for example).
74  // 'EndCommand' is invoked at the end of the user interaction with the
75  // widget (when the mouse button is released for example).
76  // The need for a 'Command', 'StartCommand' and 'EndCommand' can be
77  // explained as follows: 'EndCommand' can be used to be notified about any
78  // changes made to this widget *after* the corresponding user interaction has
79  // been performed (say, after releasing the mouse button that was dragging
80  // a slider, or after clicking on a checkbutton). 'Command' can be set
81  // *additionally* to be notified about the intermediate changes that
82  // occur *during* the corresponding user interaction (say, *while* dragging
83  // a slider). While setting 'EndCommand' is enough to be notified about
84  // any changes, setting 'Command' is an application-specific choice that
85  // is likely to depend on how fast you want (or can) answer to rapid changes
86  // occuring during a user interaction, if any. 'StartCommand' is rarely
87  // used but provides an opportunity for the application to modify its
88  // state and prepare itself for user-interaction; in that case, the
89  // 'EndCommand' is usually set in a symmetric fashion to set the application
90  // back to its previous state.
91  // The 'object' argument is the object that will have the method called on
92  // it. The 'method' argument is the name of the method to be called and any
93  // arguments in string form. If the object is NULL, the method is still
94  // evaluated as a simple command.
95  // The following parameters are also passed to the command:
96  // - the current extent: int, int, int, int, int, int (if the Resolution of
97  // all the visible ranges are integer); double, double, double, double,
98  // double, double otherwise.
99  // Note: the 'int' signature is for convenience, so that the command can
100  // be set to a callback accepting 'int'. In doubt, implement the callback
101  // using a 'double' signature that will accept both 'int' and 'double'.
102  virtual void SetCommand(vtkObject *object, const char *method);
103  virtual void SetStartCommand(vtkObject *object, const char *method);
104  virtual void SetEndCommand(vtkObject *object, const char *method);
105 
106  // Description:
107  // Events. The events are triggered when the extent slider is changed.
108  //BTX
109  enum
110  {
111  ChangeEvent = 10000,
112  StartChangeEvent = 10001,
113  EndChangeEvent = 10002
114  };
115  //ETX
116 
117  // Description:
118  // Set/Get whether the above commands should be called or not.
119  virtual void SetDisableCommands(int);
120  vtkBooleanMacro(DisableCommands, int);
121 
122  // Description:
123  // Set the ranges orientations and item positions.
124  // This just propagates the same method to the internal ranges.
125  virtual void SetOrientation(int);
126  virtual void SetOrientationToHorizontal()
127  { this->SetOrientation(vtkKWRange::OrientationHorizontal); };
128  virtual void SetOrientationToVertical()
129  { this->SetOrientation(vtkKWRange::OrientationVertical); };
130  virtual void SetLabelPosition(int);
131  virtual void SetLabelPositionToDefault()
132  { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionDefault); };
133  virtual void SetLabelPositionToTop()
134  { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionTop); };
135  virtual void SetLabelPositionToBottom()
136  { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionBottom); };
137  virtual void SetLabelPositionToLeft()
138  { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionLeft); };
139  virtual void SetLabelPositionToRight()
140  { this->SetLabelPosition(vtkKWWidgetWithLabel::LabelPositionRight); };
141  virtual void SetEntry1Position(int);
142  virtual void SetEntry1PositionToDefault()
143  { this->SetEntry1Position(vtkKWRange::EntryPositionDefault); };
144  virtual void SetEntry1PositionToTop()
145  { this->SetEntry1Position(vtkKWRange::EntryPositionTop); };
146  virtual void SetEntry1PositionToBottom()
147  { this->SetEntry1Position(vtkKWRange::EntryPositionBottom); };
148  virtual void SetEntry1PositionToLeft()
149  { this->SetEntry1Position(vtkKWRange::EntryPositionLeft); };
150  virtual void SetEntry1PositionToRight()
151  { this->SetEntry1Position(vtkKWRange::EntryPositionRight); };
152  virtual void SetEntry2Position(int);
153  virtual void SetEntry2PositionToDefault()
154  { this->SetEntry2Position(vtkKWRange::EntryPositionDefault); };
155  virtual void SetEntry2PositionToTop()
156  { this->SetEntry2Position(vtkKWRange::EntryPositionTop); };
157  virtual void SetEntry2PositionToBottom()
158  { this->SetEntry2Position(vtkKWRange::EntryPositionBottom); };
159  virtual void SetEntry2PositionToLeft()
160  { this->SetEntry2Position(vtkKWRange::EntryPositionLeft); };
161  virtual void SetEntry2PositionToRight()
162  { this->SetEntry2Position(vtkKWRange::EntryPositionRight); };
163  virtual void SetThickness(int);
164  virtual void SetInternalThickness(double);
165  virtual void SetRequestedLength(int);
166  virtual void SetSliderSize(int);
167  virtual void SetSliderCanPush(int);
168  vtkBooleanMacro(SliderCanPush, int);
169 
170  // Description:
171  // Update the "enable" state of the object and its internal parts.
172  // Depending on different Ivars (this->Enabled, the application's
173  // Limited Edition Mode, etc.), the "enable" state of the object is updated
174  // and propagated to its internal parts/subwidgets. This will, for example,
175  // enable/disable parts of the widget UI, enable/disable the visibility
176  // of 3D widgets, etc.
177  virtual void UpdateEnableState();
178 
179  // Description:
180  // Access the internal vtkKWRange's.
181  vtkKWRange* GetXRange() { return this->Range[0]; };
182  vtkKWRange* GetYRange() { return this->Range[1]; };
183  vtkKWRange* GetZRange() { return this->Range[2]; };
184  vtkKWRange* GetRange(int index);
185 
186  // Description:
187  // Callbacks. Internal, do not use.
188  virtual void RangeCommandCallback(double r0, double r1);
189  virtual void RangeStartCommandCallback(double r0, double r1);
190  virtual void RangeEndCommandCallback(double r0, double r1);
191  virtual void RangeEntriesCommandCallback(double r0, double r1);
192 
193 protected:
194  vtkKWExtent();
195  ~vtkKWExtent();
196 
197  // Description:
198  // Create the widget.
199  virtual void CreateWidget();
200 
201  char *Command;
203  char *EndCommand;
204 
205  virtual void InvokeExtentCommand(
206  const char *command,
207  double x0, double x1, double y0, double y1, double z0, double z1);
208  virtual void InvokeCommand(
209  double x0, double x1, double y0, double y1, double z0, double z1);
210  virtual void InvokeStartCommand(
211  double x0, double x1, double y0, double y1, double z0, double z1);
212  virtual void InvokeEndCommand(
213  double x0, double x1, double y0, double y1, double z0, double z1);
214 
215  double Extent[6];
216 
217  vtkKWRange *Range[3];
218 
219  int ExtentVisibility[3];
220 
221  // Pack or repack the widget
222 
223  virtual void Pack();
224 
225 private:
226 
227  // Temporary var for wrapping purposes
228 
229  double ExtentRangeTemp[6];
230 
231  vtkKWExtent(const vtkKWExtent&); // Not implemented
232  void operator=(const vtkKWExtent&); // Not implemented
233 };
234 
235 #endif
236