KWWidgets
|
00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWScalarBarAnnotation.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 vtkKWScalarBarAnnotation - a scalar bar annotation widget 00015 // .SECTION Description 00016 // A class that provides a UI for a scalar bar widget (vtkScalarBarWidget). 00017 00018 #ifndef __vtkKWScalarBarAnnotation_h 00019 #define __vtkKWScalarBarAnnotation_h 00020 00021 #include "vtkKWCheckButtonWithPopupFrame.h" 00022 00023 class vtkKWFrame; 00024 class vtkKWEntryWithLabel; 00025 class vtkKWPopupButtonWithLabel; 00026 class vtkKWScalarComponentSelectionWidget; 00027 class vtkKWScaleWithEntry; 00028 class vtkKWTextPropertyEditor; 00029 class vtkKWThumbWheel; 00030 class vtkScalarBarWidget; 00031 class vtkVolumeProperty; 00032 00033 class KWWidgets_EXPORT vtkKWScalarBarAnnotation : public vtkKWCheckButtonWithPopupFrame 00034 { 00035 public: 00036 static vtkKWScalarBarAnnotation* New(); 00037 vtkTypeRevisionMacro(vtkKWScalarBarAnnotation,vtkKWCheckButtonWithPopupFrame); 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 00040 // Description: 00041 // Makes the text property sub-widgets popup (instead of displaying the 00042 // whole text property UI, which can be long). 00043 // This has to be called before Create(). Ignored if PopupMode is true. 00044 vtkSetMacro(PopupTextProperty, int); 00045 vtkGetMacro(PopupTextProperty, int); 00046 vtkBooleanMacro(PopupTextProperty, int); 00047 00048 // Description: 00049 // Set/Get the vtkScalarBarWidget that owns the scalar bar actor. 00050 virtual void SetScalarBarWidget(vtkScalarBarWidget*); 00051 vtkGetObjectMacro(ScalarBarWidget, vtkScalarBarWidget); 00052 00053 // Description: 00054 // Set/Get the scalar bar visibility 00055 virtual void SetVisibility(int i); 00056 virtual int GetVisibility(); 00057 vtkBooleanMacro(Visibility, int); 00058 00059 // Description: 00060 // Set/Get the event invoked when the anything in the annotation is changed. 00061 // Defaults to vtkKWEvent::ViewAnnotationChangedEvent 00062 vtkSetMacro(AnnotationChangedEvent, int); 00063 vtkGetMacro(AnnotationChangedEvent, int); 00064 00065 // Description: 00066 // Set/Get the volume property that can be used to set the LUT of the 00067 // scalar bar actor (i.e. allow the user to choose which component to 00068 // visualize) 00069 virtual void SetVolumeProperty(vtkVolumeProperty *prop); 00070 vtkGetObjectMacro(VolumeProperty, vtkVolumeProperty); 00071 00072 // Description: 00073 // Set/Get the number of components corresponding to the data represented 00074 // by the volume property 00075 virtual void SetNumberOfComponents(int); 00076 vtkGetMacro(NumberOfComponents, int); 00077 00078 // Description: 00079 // Set/Get the event invoked when the component is changed. 00080 // Defaults to vtkKWEvent::ScalarComponentChangedEvent 00081 vtkSetMacro(ScalarComponentChangedEvent, int); 00082 vtkGetMacro(ScalarComponentChangedEvent, int); 00083 00084 // Description: 00085 // Set/Get the LabelFormat UI visibility, which might be a bit confusing 00086 virtual void SetLabelFormatVisibility(int i); 00087 vtkGetMacro(LabelFormatVisibility, int); 00088 vtkBooleanMacro(LabelFormatVisibility, int); 00089 00090 // Description: 00091 // Access to sub-widgets 00092 virtual vtkKWCheckButton* GetScalarBarVisibilityButton() 00093 { return this->GetCheckButton(); }; 00094 00095 // Description: 00096 // Update the GUI according to the value of the ivars 00097 void Update(); 00098 00099 // Description: 00100 // Update the "enable" state of the object and its internal parts. 00101 // Depending on different Ivars (this->Enabled, the application's 00102 // Limited Edition Mode, etc.), the "enable" state of the object is updated 00103 // and propagated to its internal parts/subwidgets. This will, for example, 00104 // enable/disable parts of the widget UI, enable/disable the visibility 00105 // of 3D widgets, etc. 00106 virtual void UpdateEnableState(); 00107 00108 // Description: 00109 // Callbacks. Internal, do not use. 00110 virtual void CheckButtonCallback(int state); 00111 virtual void SelectedComponentCallback(int); 00112 virtual void ScalarBarTitleCallback(const char *value); 00113 virtual void ScalarBarLabelFormatCallback(const char *value); 00114 virtual void TitleTextPropertyCallback(); 00115 virtual void LabelTextPropertyCallback(); 00116 virtual void MaximumNumberOfColorsEndCallback(double value); 00117 virtual void NumberOfLabelsEndCallback(double value); 00118 00119 protected: 00120 vtkKWScalarBarAnnotation(); 00121 ~vtkKWScalarBarAnnotation(); 00122 00123 // Description: 00124 // Create the widget. 00125 virtual void CreateWidget(); 00126 00127 int PopupTextProperty; 00128 int AnnotationChangedEvent; 00129 int ScalarComponentChangedEvent; 00130 int NumberOfComponents; 00131 int LabelFormatVisibility; 00132 00133 vtkScalarBarWidget *ScalarBarWidget; 00134 vtkVolumeProperty *VolumeProperty; 00135 00136 // GUI 00137 00138 vtkKWScalarComponentSelectionWidget *ComponentSelectionWidget; 00139 vtkKWFrame *TitleFrame; 00140 vtkKWEntryWithLabel *TitleEntry; 00141 vtkKWTextPropertyEditor *TitleTextPropertyWidget; 00142 vtkKWPopupButtonWithLabel *TitleTextPropertyPopupButton; 00143 vtkKWFrame *LabelFrame; 00144 vtkKWEntryWithLabel *LabelFormatEntry; 00145 vtkKWTextPropertyEditor *LabelTextPropertyWidget; 00146 vtkKWPopupButtonWithLabel *LabelTextPropertyPopupButton; 00147 vtkKWThumbWheel *MaximumNumberOfColorsThumbWheel; 00148 vtkKWScaleWithEntry *NumberOfLabelsScale; 00149 00150 virtual void PackLabelFrameChildren(); 00151 virtual void Render(); 00152 virtual void SetScalarBarTitle(const char *txt); 00153 virtual void SetScalarBarLabelFormat(const char *txt); 00154 00155 // Get the value that should be used to set the checkbutton state 00156 // (i.e. depending on the value this checkbutton is supposed to reflect, 00157 // for example, an annotation visibility). 00158 // This does *not* return the state of the widget. 00159 virtual int GetCheckButtonState() { return this->GetVisibility(); }; 00160 00161 // Send an event representing the state of the widget 00162 virtual void SendChangedEvent(); 00163 00164 private: 00165 vtkKWScalarBarAnnotation(const vtkKWScalarBarAnnotation&); // Not implemented 00166 void operator=(const vtkKWScalarBarAnnotation&); // Not Implemented 00167 }; 00168 00169 #endif 00170