KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWScalarBarAnnotation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWScalarBarAnnotation.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 vtkKWScalarBarAnnotation - a scalar bar annotation widget
15 // .SECTION Description
16 // A class that provides a UI for a scalar bar widget (vtkScalarBarWidget).
17 
18 #ifndef __vtkKWScalarBarAnnotation_h
19 #define __vtkKWScalarBarAnnotation_h
20 
22 
23 class vtkKWFrame;
29 class vtkKWThumbWheel;
30 class vtkScalarBarWidget;
31 class vtkVolumeProperty;
32 
34 {
35 public:
36  static vtkKWScalarBarAnnotation* New();
38  void PrintSelf(ostream& os, vtkIndent indent);
39 
40  // Description:
41  // Makes the text property sub-widgets popup (instead of displaying the
42  // whole text property UI, which can be long).
43  // This has to be called before Create(). Ignored if PopupMode is true.
44  vtkSetMacro(PopupTextProperty, int);
45  vtkGetMacro(PopupTextProperty, int);
46  vtkBooleanMacro(PopupTextProperty, int);
47 
48  // Description:
49  // Set/Get the vtkScalarBarWidget that owns the scalar bar actor.
50  virtual void SetScalarBarWidget(vtkScalarBarWidget*);
51  vtkGetObjectMacro(ScalarBarWidget, vtkScalarBarWidget);
52 
53  // Description:
54  // Set/Get the scalar bar visibility
55  virtual void SetVisibility(int i);
56  virtual int GetVisibility();
57  vtkBooleanMacro(Visibility, int);
58 
59  // Description:
60  // Set/Get the event invoked when the anything in the annotation is changed.
61  // Defaults to vtkKWEvent::ViewAnnotationChangedEvent
62  vtkSetMacro(AnnotationChangedEvent, int);
63  vtkGetMacro(AnnotationChangedEvent, int);
64 
65  // Description:
66  // Set/Get the volume property that can be used to set the LUT of the
67  // scalar bar actor (i.e. allow the user to choose which component to
68  // visualize)
69  virtual void SetVolumeProperty(vtkVolumeProperty *prop);
70  vtkGetObjectMacro(VolumeProperty, vtkVolumeProperty);
71 
72  // Description:
73  // Set/Get the number of components corresponding to the data represented
74  // by the volume property
75  virtual void SetNumberOfComponents(int);
76  vtkGetMacro(NumberOfComponents, int);
77 
78  // Description:
79  // Set/Get the event invoked when the component is changed.
80  // Defaults to vtkKWEvent::ScalarComponentChangedEvent
81  vtkSetMacro(ScalarComponentChangedEvent, int);
82  vtkGetMacro(ScalarComponentChangedEvent, int);
83 
84  // Description:
85  // Set/Get the LabelFormat UI visibility, which might be a bit confusing
86  virtual void SetLabelFormatVisibility(int i);
87  vtkGetMacro(LabelFormatVisibility, int);
88  vtkBooleanMacro(LabelFormatVisibility, int);
89 
90  // Description:
91  // Access to sub-widgets
92  virtual vtkKWCheckButton* GetScalarBarVisibilityButton()
93  { return this->GetCheckButton(); };
94 
95  // Description:
96  // Update the GUI according to the value of the ivars
97  void Update();
98 
99  // Description:
100  // Update the "enable" state of the object and its internal parts.
101  // Depending on different Ivars (this->Enabled, the application's
102  // Limited Edition Mode, etc.), the "enable" state of the object is updated
103  // and propagated to its internal parts/subwidgets. This will, for example,
104  // enable/disable parts of the widget UI, enable/disable the visibility
105  // of 3D widgets, etc.
106  virtual void UpdateEnableState();
107 
108  // Description:
109  // Callbacks. Internal, do not use.
110  virtual void CheckButtonCallback(int state);
111  virtual void SelectedComponentCallback(int);
112  virtual void ScalarBarTitleCallback(const char *value);
113  virtual void ScalarBarLabelFormatCallback(const char *value);
114  virtual void TitleTextPropertyCallback();
115  virtual void LabelTextPropertyCallback();
116  virtual void MaximumNumberOfColorsEndCallback(double value);
117  virtual void NumberOfLabelsEndCallback(double value);
118 
119 protected:
122 
123  // Description:
124  // Create the widget.
125  virtual void CreateWidget();
126 
132 
133  vtkScalarBarWidget *ScalarBarWidget;
134  vtkVolumeProperty *VolumeProperty;
135 
136  // GUI
137 
149 
150  virtual void PackLabelFrameChildren();
151  virtual void Render();
152  virtual void SetScalarBarTitle(const char *txt);
153  virtual void SetScalarBarLabelFormat(const char *txt);
154 
155  // Get the value that should be used to set the checkbutton state
156  // (i.e. depending on the value this checkbutton is supposed to reflect,
157  // for example, an annotation visibility).
158  // This does *not* return the state of the widget.
159  virtual int GetCheckButtonState() { return this->GetVisibility(); };
160 
161  // Send an event representing the state of the widget
162  virtual void SendChangedEvent();
163 
164 private:
165  vtkKWScalarBarAnnotation(const vtkKWScalarBarAnnotation&); // Not implemented
166  void operator=(const vtkKWScalarBarAnnotation&); // Not Implemented
167 };
168 
169 #endif
170