00001 /*========================================================================= 00002 00003 Module: $RCSfile: vtkKWHeaderAnnotationEditor.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 vtkKWHeaderAnnotationEditor - a header annotation widget 00015 // .SECTION Description 00016 // A class that provides a UI for header annotation (vtkTextActor). 00017 00018 #ifndef __vtkKWHeaderAnnotationEditor_h 00019 #define __vtkKWHeaderAnnotationEditor_h 00020 00021 #include "vtkKWCheckButtonWithPopupFrame.h" 00022 00023 class vtkKWEntryWithLabel; 00024 class vtkKWPopupButtonWithLabel; 00025 class vtkKWRenderWidget; 00026 class vtkKWTextPropertyEditor; 00027 class vtkTextActor; 00028 class vtkKWFrame; 00029 00030 class KWWidgets_EXPORT vtkKWHeaderAnnotationEditor : public vtkKWCheckButtonWithPopupFrame 00031 { 00032 public: 00033 static vtkKWHeaderAnnotationEditor* New(); 00034 vtkTypeRevisionMacro(vtkKWHeaderAnnotationEditor,vtkKWCheckButtonWithPopupFrame); 00035 void PrintSelf(ostream& os, vtkIndent indent); 00036 00037 // Description: 00038 // Makes the text property sub-widget popup (instead of displaying the 00039 // whole text property UI, which can be long). 00040 // This has to be called before Create(). Ignored if PopupMode is true. 00041 vtkSetMacro(PopupTextProperty, int); 00042 vtkGetMacro(PopupTextProperty, int); 00043 vtkBooleanMacro(PopupTextProperty, int); 00044 00045 // Description: 00046 // Set/Get the vtkKWRenderWidget that owns the header annotation. 00047 // It is not ref-counted. 00048 virtual void SetRenderWidget(vtkKWRenderWidget*); 00049 vtkGetObjectMacro(RenderWidget, vtkKWRenderWidget); 00050 00051 // Description: 00052 // Set/Get the annotation visibility 00053 virtual void SetVisibility(int i); 00054 virtual int GetVisibility(); 00055 vtkBooleanMacro(Visibility, int); 00056 00057 // Description: 00058 // Set/Get the event invoked when the anything in the annotation is changed. 00059 // Defaults to vtkKWEvent::ViewAnnotationChangedEvent 00060 vtkSetMacro(AnnotationChangedEvent, int); 00061 vtkGetMacro(AnnotationChangedEvent, int); 00062 00063 // Description: 00064 // Access to sub-widgets 00065 virtual vtkKWCheckButton* GetHeaderVisibilityButton() 00066 { return this->GetCheckButton(); }; 00067 00068 // Description: 00069 // Update the GUI according to the value of the ivars 00070 void Update(); 00071 00072 // Description: 00073 // Update the "enable" state of the object and its internal parts. 00074 // Depending on different Ivars (this->Enabled, the application's 00075 // Limited Edition Mode, etc.), the "enable" state of the object is updated 00076 // and propagated to its internal parts/subwidgets. This will, for example, 00077 // enable/disable parts of the widget UI, enable/disable the visibility 00078 // of 3D widgets, etc. 00079 virtual void UpdateEnableState(); 00080 00081 // Description: 00082 // Callbacks. Internal, do not use. 00083 virtual void CheckButtonCallback(int state); 00084 virtual void HeaderTextCallback(const char *value); 00085 virtual void TextPropertyCallback(); 00086 00087 protected: 00088 vtkKWHeaderAnnotationEditor(); 00089 ~vtkKWHeaderAnnotationEditor(); 00090 00091 // Description: 00092 // Create the widget. 00093 virtual void CreateWidget(); 00094 00095 int AnnotationChangedEvent; 00096 00097 vtkKWRenderWidget *RenderWidget; 00098 00099 // GUI 00100 00101 int PopupTextProperty; 00102 00103 vtkKWFrame *TextFrame; 00104 vtkKWEntryWithLabel *TextEntry; 00105 vtkKWTextPropertyEditor *TextPropertyWidget; 00106 vtkKWPopupButtonWithLabel *TextPropertyPopupButton; 00107 00108 virtual void Render(); 00109 virtual void SetHeaderText(const char *txt); 00110 00111 // Get the value that should be used to set the checkbutton state 00112 // (i.e. depending on the value this checkbutton is supposed to reflect, 00113 // for example, an annotation visibility). 00114 // This does *not* return the state of the widget. 00115 virtual int GetCheckButtonState() { return this->GetVisibility(); }; 00116 00117 // Send an event representing the state of the widget 00118 virtual void SendChangedEvent(); 00119 00120 private: 00121 vtkKWHeaderAnnotationEditor(const vtkKWHeaderAnnotationEditor&); // Not implemented 00122 void operator=(const vtkKWHeaderAnnotationEditor&); // Not Implemented 00123 }; 00124 00125 #endif 00126