KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWTextPropertyEditor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWTextPropertyEditor.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 vtkKWTextPropertyEditor - a GUI component that can be used to edit vtkTextProperty objects
15 // .SECTION Description
16 // The vtkKWTextPropertyEditor creates a set of GUI components that can be displayed
17 // and used selectively to edit all or part of a vtkTextProperty object.
18 
19 
20 #ifndef __vtkKWTextPropertyEditor_h
21 #define __vtkKWTextPropertyEditor_h
22 
23 #include "vtkKWCompositeWidget.h"
24 
25 class vtkActor2D;
27 class vtkKWLabel;
31 class vtkKWPushButton;
33 class vtkTextProperty;
34 
36 {
37 public:
38  static vtkKWTextPropertyEditor* New();
40  void PrintSelf(ostream& os, vtkIndent indent);
41 
42  // Description
43  // Refresh/Update the interface according to the value of the text property
44  // and actor2d
45  virtual void Update();
46 
47  // Description:
48  // Set/Get the text property to control.
49  virtual void SetTextProperty(vtkTextProperty*);
50  vtkGetObjectMacro(TextProperty, vtkTextProperty);
51 
52  // Description:
53  // Set/Get the actor that uses TextProperty. This is optional, but might
54  // help to solve some backward compatibility issues. For example, the
55  // default vtkTextProperty color is -1, -1, -1 to specify to the mapper
56  // that the vtkActor2D color has to be used instead.
57  virtual void SetActor2D(vtkActor2D*);
58  vtkGetObjectMacro(Actor2D, vtkActor2D);
59 
60  // Description:
61  // Set the widget aspect to be long, i.e. the widgets will be packed on
62  // several rows, with description labels. The default is short (all widgets
63  // on a row).
64  virtual void SetLongFormat(int);
65  vtkBooleanMacro(LongFormat, int);
66  vtkGetMacro(LongFormat, int);
67 
68  // Description:
69  // Display the label on top (default, otherwise on left.
70  // Valid if LongFormat is On.
71  virtual void SetLabelOnTop(int);
72  vtkBooleanMacro(LabelOnTop, int);
73  vtkGetMacro(LabelOnTop, int);
74 
75  // Description:
76  // Set/Get the label visibility.
77  virtual void SetLabelVisibility(int);
78  vtkBooleanMacro(LabelVisibility, int);
79  vtkGetMacro(LabelVisibility, int);
80  vtkGetObjectMacro(Label, vtkKWLabel);
81 
82  // Description:
83  // Set/Get the color interface visibility.
84  virtual void SetColorVisibility(int);
85  vtkBooleanMacro(ColorVisibility, int);
86  vtkGetMacro(ColorVisibility, int);
87 
88  // Description:
89  // Set/Get the font family interface visibility.
90  virtual void SetFontFamilyVisibility(int);
91  vtkBooleanMacro(FontFamilyVisibility, int);
92  vtkGetMacro(FontFamilyVisibility, int);
93 
94  // Description:
95  // Set/Get the style interface visibility.
96  virtual void SetStylesVisibility(int);
97  vtkBooleanMacro(StylesVisibility, int);
98  vtkGetMacro(StylesVisibility, int);
99 
100  // Description:
101  // Set/Get the opacity interface visibility.
102  virtual void SetOpacityVisibility(int);
103  vtkBooleanMacro(OpacityVisibility, int);
104  vtkGetMacro(OpacityVisibility, int);
105 
106  // Description:
107  // Specifies a command to associate with the widget. This command is
108  // typically invoked each time a change is made to the text property.
109  // The 'object' argument is the object that will have the method called on
110  // it. The 'method' argument is the name of the method to be called and any
111  // arguments in string form. If the object is NULL, the method is still
112  // evaluated as a simple command.
113  virtual void SetChangedCommand(vtkObject *object, const char *method);
114 
115  // Description:
116  // Specifies a command to associate with the widget. This command is
117  // typically invoked each time a change is made to the color of
118  // the text property (the ChangedCommand is triggered too).
119  // The 'object' argument is the object that will have the method called on
120  // it. The 'method' argument is the name of the method to be called and any
121  // arguments in string form. If the object is NULL, the method is still
122  // evaluated as a simple command.
123  // The following parameters are also passed to the command:
124  // - the new RGB color: double, double, double
125  virtual void SetColorChangedCommand(vtkObject *object, const char *method);
126 
127  // Description:
128  // Set/Get the copy button visibility. This button can be used to
129  // synchronize different text property widgets.
130  virtual void SetCopyVisibility(int);
131  vtkBooleanMacro(CopyVisibility, int);
132  vtkGetMacro(CopyVisibility, int);
133  virtual vtkKWPushButton* GetCopyButton();
134 
135  // Description:
136  // Copy the values from another text widget
137  virtual void CopyValuesFrom(vtkKWTextPropertyEditor*);
138 
139  // Description:
140  // Save out the text properties to a file.
141  virtual void SaveInTclScript(ofstream *file, const char *tcl_name = 0,
142  int tabify = 1);
143 
144  // Description:
145  // Update the "enable" state of the object and its internal parts.
146  // Depending on different Ivars (this->Enabled, the application's
147  // Limited Edition Mode, etc.), the "enable" state of the object is updated
148  // and propagated to its internal parts/subwidgets. This will, for example,
149  // enable/disable parts of the widget UI, enable/disable the visibility
150  // of 3D widgets, etc.
151  virtual void UpdateEnableState();
152 
153  // Description:
154  // Set the text properties
155  virtual void SetColor(double, double, double);
156  virtual void SetColor(double *v) { this->SetColor(v[0], v[1], v[2]); };
157  virtual double* GetColor();
158  virtual void SetFontFamily(int);
159  virtual void SetBold(int);
160  virtual void SetItalic(int);
161  virtual void SetShadow(int);
162  virtual void SetOpacity(float);
163  virtual float GetOpacity();
164 
165  // Description:
166  // Callbacks. Internal, do not use.
167  virtual void ChangeColorButtonCallback(double, double, double);
168  virtual void FontFamilyCallback();
169  virtual void BoldCallback(int state);
170  virtual void ItalicCallback(int state);
171  virtual void ShadowCallback(int state);
172  virtual void OpacityCallback(double value);
173  virtual void OpacityEndCallback(double value);
174 
175 protected:
178 
179  // Description:
180  // Create the widget.
181  virtual void CreateWidget();
182 
183  virtual void Pack();
184 
185  void UpdateInterface();
186  void UpdateLabel();
187  void UpdateColorButton();
188  void UpdateFontFamilyOptionMenu();
189  void UpdateStylesCheckButtonSet();
190  void UpdateBoldCheckButton();
191  void UpdateItalicCheckButton();
192  void UpdateShadowCheckButton();
193  void UpdateOpacityScale();
194  void UpdatePushButtonSet();
195 
196  vtkTextProperty *TextProperty;
197  vtkActor2D *Actor2D;
198 
200 
204 
207 
210 
213 
216 
219 
220  virtual void InvokeChangedCommand();
221  virtual void InvokeColorChangedCommand(double r, double g, double b);
222 
225 
226 private:
227  vtkKWTextPropertyEditor(const vtkKWTextPropertyEditor&); // Not implemented
228  void operator=(const vtkKWTextPropertyEditor&); // Not implemented
229 };
230 
231 #endif
232