• Main Page
  • Classes
  • Files
  • Directories
  • File List
  • File Members

vtkKWTextPropertyEditor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWTextPropertyEditor.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 vtkKWTextPropertyEditor - a GUI component that can be used to edit vtkTextProperty objects
00015 // .SECTION Description
00016 // The vtkKWTextPropertyEditor creates a set of GUI components that can be displayed
00017 // and used selectively to edit all or part of a vtkTextProperty object.
00018 
00019 
00020 #ifndef __vtkKWTextPropertyEditor_h
00021 #define __vtkKWTextPropertyEditor_h
00022 
00023 #include "vtkKWCompositeWidget.h"
00024 
00025 class vtkActor2D;
00026 class vtkKWChangeColorButton;
00027 class vtkKWLabel;
00028 class vtkKWCheckButtonSetWithLabel;
00029 class vtkKWMenuButtonWithLabel;
00030 class vtkKWPushButtonSetWithLabel;
00031 class vtkKWPushButton;
00032 class vtkKWScaleWithEntry;
00033 class vtkTextProperty;
00034 
00035 class KWWidgets_EXPORT vtkKWTextPropertyEditor : public vtkKWCompositeWidget
00036 {
00037 public:
00038   static vtkKWTextPropertyEditor* New();
00039   vtkTypeRevisionMacro(vtkKWTextPropertyEditor,vtkKWCompositeWidget);
00040   void PrintSelf(ostream& os, vtkIndent indent);
00041 
00042   // Description
00043   // Refresh/Update the interface according to the value of the text property
00044   // and actor2d
00045   virtual void Update();
00046 
00047   // Description:
00048   // Set/Get the text property to control.
00049   virtual void SetTextProperty(vtkTextProperty*);
00050   vtkGetObjectMacro(TextProperty, vtkTextProperty);
00051 
00052   // Description:
00053   // Set/Get the actor that uses TextProperty. This is optional, but might
00054   // help to solve some backward compatibility issues. For example, the
00055   // default vtkTextProperty color is -1, -1, -1 to specify to the mapper
00056   // that the vtkActor2D color has to be used instead.
00057   virtual void SetActor2D(vtkActor2D*);
00058   vtkGetObjectMacro(Actor2D, vtkActor2D);
00059 
00060   // Description:
00061   // Set the widget aspect to be long, i.e. the widgets will be packed on 
00062   // several rows, with description labels. The default is short (all widgets
00063   // on a row).
00064   virtual void SetLongFormat(int);
00065   vtkBooleanMacro(LongFormat, int);
00066   vtkGetMacro(LongFormat, int);
00067 
00068   // Description:
00069   // Display the label on top (default, otherwise on left. 
00070   // Valid if LongFormat is On.
00071   virtual void SetLabelOnTop(int);
00072   vtkBooleanMacro(LabelOnTop, int);
00073   vtkGetMacro(LabelOnTop, int);
00074 
00075   // Description:
00076   // Set/Get the label visibility.
00077   virtual void SetLabelVisibility(int);
00078   vtkBooleanMacro(LabelVisibility, int);
00079   vtkGetMacro(LabelVisibility, int);
00080   vtkGetObjectMacro(Label, vtkKWLabel);
00081 
00082   // Description:
00083   // Set/Get the color interface visibility.
00084   virtual void SetColorVisibility(int);
00085   vtkBooleanMacro(ColorVisibility, int);
00086   vtkGetMacro(ColorVisibility, int);
00087 
00088   // Description:
00089   // Set/Get the font family interface visibility.
00090   virtual void SetFontFamilyVisibility(int);
00091   vtkBooleanMacro(FontFamilyVisibility, int);
00092   vtkGetMacro(FontFamilyVisibility, int);
00093 
00094   // Description:
00095   // Set/Get the style interface visibility.
00096   virtual void SetStylesVisibility(int);
00097   vtkBooleanMacro(StylesVisibility, int);
00098   vtkGetMacro(StylesVisibility, int);
00099 
00100   // Description:
00101   // Set/Get the opacity interface visibility.
00102   virtual void SetOpacityVisibility(int);
00103   vtkBooleanMacro(OpacityVisibility, int);
00104   vtkGetMacro(OpacityVisibility, int);
00105 
00106   // Description:
00107   // Specifies a command to associate with the widget. This command is 
00108   // typically invoked each time a change is made to the text property.
00109   // The 'object' argument is the object that will have the method called on
00110   // it. The 'method' argument is the name of the method to be called and any
00111   // arguments in string form. If the object is NULL, the method is still
00112   // evaluated as a simple command. 
00113   virtual void SetChangedCommand(vtkObject *object, const char *method);
00114 
00115   // Description:
00116   // Specifies a command to associate with the widget. This command is 
00117   // typically invoked each time a change is made to the color of
00118   // the text property (the ChangedCommand is triggered too).
00119   // The 'object' argument is the object that will have the method called on
00120   // it. The 'method' argument is the name of the method to be called and any
00121   // arguments in string form. If the object is NULL, the method is still
00122   // evaluated as a simple command. 
00123   // The following parameters are also passed to the command:
00124   // - the new RGB color: double, double, double
00125   virtual void SetColorChangedCommand(vtkObject *object, const char *method);
00126 
00127   // Description:
00128   // Set/Get the copy button visibility. This button can be used to
00129   // synchronize different text property widgets.
00130   virtual void SetCopyVisibility(int);
00131   vtkBooleanMacro(CopyVisibility, int);
00132   vtkGetMacro(CopyVisibility, int);
00133   virtual vtkKWPushButton* GetCopyButton();
00134 
00135   // Description:
00136   // Copy the values from another text widget
00137   virtual void CopyValuesFrom(vtkKWTextPropertyEditor*);
00138 
00139   // Description:
00140   // Save out the text properties to a file.
00141   virtual void SaveInTclScript(ofstream *file, const char *tcl_name = 0,
00142                                int tabify = 1);
00143 
00144   // Description:
00145   // Update the "enable" state of the object and its internal parts.
00146   // Depending on different Ivars (this->Enabled, the application's 
00147   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00148   // and propagated to its internal parts/subwidgets. This will, for example,
00149   // enable/disable parts of the widget UI, enable/disable the visibility
00150   // of 3D widgets, etc.
00151   virtual void UpdateEnableState();
00152 
00153   // Description:
00154   // Set the text properties
00155   virtual void SetColor(double, double, double);
00156   virtual void SetColor(double *v) { this->SetColor(v[0], v[1], v[2]); };
00157   virtual double* GetColor();
00158   virtual void SetFontFamily(int);
00159   virtual void SetBold(int);
00160   virtual void SetItalic(int);
00161   virtual void SetShadow(int);
00162   virtual void SetOpacity(float);
00163   virtual float GetOpacity();
00164 
00165   // Description:
00166   // Callbacks. Internal, do not use.
00167   virtual void ChangeColorButtonCallback(double, double, double);
00168   virtual void FontFamilyCallback();
00169   virtual void BoldCallback(int state);
00170   virtual void ItalicCallback(int state);
00171   virtual void ShadowCallback(int state);
00172   virtual void OpacityCallback(double value);
00173   virtual void OpacityEndCallback(double value);
00174 
00175 protected:
00176   vtkKWTextPropertyEditor();
00177   ~vtkKWTextPropertyEditor();
00178 
00179   // Description:
00180   // Create the widget.
00181   virtual void CreateWidget();
00182 
00183   virtual void Pack();
00184 
00185   void UpdateInterface();
00186   void UpdateLabel();
00187   void UpdateColorButton();
00188   void UpdateFontFamilyOptionMenu();
00189   void UpdateStylesCheckButtonSet();
00190   void UpdateBoldCheckButton();
00191   void UpdateItalicCheckButton();
00192   void UpdateShadowCheckButton();
00193   void UpdateOpacityScale();
00194   void UpdatePushButtonSet();
00195 
00196   vtkTextProperty *TextProperty;
00197   vtkActor2D *Actor2D;
00198 
00199   int LongFormat;
00200 
00201   int LabelVisibility;
00202   int LabelOnTop;
00203   vtkKWLabel *Label;
00204 
00205   int ColorVisibility;
00206   vtkKWChangeColorButton *ChangeColorButton;
00207 
00208   int FontFamilyVisibility;
00209   vtkKWMenuButtonWithLabel *FontFamilyOptionMenu;
00210 
00211   int StylesVisibility;
00212   vtkKWCheckButtonSetWithLabel *StylesCheckButtonSet;
00213   
00214   int OpacityVisibility;
00215   vtkKWScaleWithEntry *OpacityScale;
00216 
00217   char *ChangedCommand;
00218   char *ColorChangedCommand;
00219 
00220   virtual void InvokeChangedCommand();
00221   virtual void InvokeColorChangedCommand(double r, double g, double b);
00222 
00223   int CopyVisibility;
00224   vtkKWPushButtonSetWithLabel *PushButtonSet;
00225 
00226 private:
00227   vtkKWTextPropertyEditor(const vtkKWTextPropertyEditor&); // Not implemented
00228   void operator=(const vtkKWTextPropertyEditor&); // Not implemented
00229 };
00230 
00231 #endif
00232 

Generated on Mon Aug 16 2010 18:58:47 for KWWidgets by  doxygen 1.7.1