debian/tmp/usr/include/KWWidgets/vtkKWText.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWText.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 vtkKWText - a multi-line text entry widget
00015 // .SECTION Description
00016 // A simple widget used for collecting keyboard input from the user. This
00017 // widget provides support for multi-line input.
00018 // Use vtkKWTextWithScrollbars if you need scrollbars.
00019 // .SECTION See Also
00020 // vtkKWTextWithScrollbars
00021 
00022 #ifndef __vtkKWText_h
00023 #define __vtkKWText_h
00024 
00025 #include "vtkKWCoreWidget.h"
00026 
00027 class vtkKWTextInternals;
00028 
00029 class KWWidgets_EXPORT vtkKWText : public vtkKWCoreWidget
00030 {
00031 public:
00032   static vtkKWText* New();
00033   vtkTypeRevisionMacro(vtkKWText,vtkKWCoreWidget);
00034   void PrintSelf(ostream& os, vtkIndent indent);
00035 
00036   // Description:
00037   // Set/Get the value of the text. AppendText() can also be used
00038   // to add text at the end. If a tag is provided, it will be used to 
00039   // tag the corresponding text.
00040   virtual char *GetText();
00041   virtual void SetText(const char *);
00042   virtual void SetText(const char *, const char *tag);
00043   virtual void AppendText(const char *);
00044   virtual void AppendText(const char *, const char *tag);
00045 
00046   // Description:
00047   // Set/Get if this text is read-only. Default is Off.
00048   virtual void SetReadOnly(int val);
00049   vtkGetMacro(ReadOnly, int);
00050   vtkBooleanMacro(ReadOnly, int);
00051 
00052   // Description:
00053   // Set/Get if quick formatting is enabled.
00054   // In this mode, strings can be tagged using markers:
00055   // ** : bold      (ex: this is **bold**)
00056   // ~~ : italic    (ex: this is ~~italic~~)
00057   // __ : underline (ex: this is __underline__)
00058   virtual void SetQuickFormatting(int);
00059   vtkGetMacro(QuickFormatting, int);
00060   vtkBooleanMacro(QuickFormatting, int);
00061 
00062   // Description:
00063   // Set/Get the width/height, in characters.
00064   virtual void SetWidth(int);
00065   virtual int GetWidth();
00066   virtual void SetHeight(int);
00067   virtual int GetHeight();
00068 
00069   // Description:
00070   // Set/Get the background color of the widget.
00071   virtual void GetBackgroundColor(double *r, double *g, double *b);
00072   virtual double* GetBackgroundColor();
00073   virtual void SetBackgroundColor(double r, double g, double b);
00074   virtual void SetBackgroundColor(double rgb[3])
00075     { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00076   
00077   // Description:
00078   // Set/Get the foreground color of the widget.
00079   virtual void GetForegroundColor(double *r, double *g, double *b);
00080   virtual double* GetForegroundColor();
00081   virtual void SetForegroundColor(double r, double g, double b);
00082   virtual void SetForegroundColor(double rgb[3])
00083     { this->SetForegroundColor(rgb[0], rgb[1], rgb[2]); };
00084 
00085   // Description:
00086   // Set/Get the highlight thickness, a non-negative value indicating the
00087   // width of the highlight rectangle to draw around the outside of the
00088   // widget when it has the input focus.
00089   virtual void SetHighlightThickness(int);
00090   virtual int GetHighlightThickness();
00091   
00092   // Description:
00093   // Set/Get the border width, a non-negative value indicating the width of
00094   // the 3-D border to draw around the outside of the widget (if such a border
00095   // is being drawn; the Relief option typically determines this).
00096   virtual void SetBorderWidth(int);
00097   virtual int GetBorderWidth();
00098   
00099   // Description:
00100   // Set/Get the 3-D effect desired for the widget. 
00101   // The value indicates how the interior of the widget should appear
00102   // relative to its exterior. 
00103   // Valid constants can be found in vtkKWOptions::ReliefType.
00104   virtual void SetRelief(int);
00105   virtual int GetRelief();
00106   virtual void SetReliefToRaised();
00107   virtual void SetReliefToSunken();
00108   virtual void SetReliefToFlat();
00109   virtual void SetReliefToRidge();
00110   virtual void SetReliefToSolid();
00111   virtual void SetReliefToGroove();
00112 
00113   // Description:
00114   // Specifies the font to use when drawing text inside the widget. 
00115   // You can use predefined font names (e.g. 'system'), or you can specify
00116   // a set of font attributes with a platform-independent name, for example,
00117   // 'times 12 bold'. In this example, the font is specified with a three
00118   // element list: the first element is the font family, the second is the
00119   // size, the third is a list of style parameters (normal, bold, roman, 
00120   // italic, underline, overstrike). Example: 'times 12 {bold italic}'.
00121   // The Times, Courier and Helvetica font families are guaranteed to exist
00122   // and will be matched to the corresponding (closest) font on your system.
00123   // If you are familiar with the X font names specification, you can also
00124   // describe the font that way (say, '*times-medium-r-*-*-12*').
00125   virtual void SetFont(const char *font);
00126   virtual const char* GetFont();
00127 
00128   // Description:
00129   // Set/Get the padding that will be applied around each widget (in pixels).
00130   // Specifies a non-negative value indicating how much extra space to request
00131   // for the widget in the X and Y-direction. When computing how large a
00132   // window it needs, the widget will add this amount to the width it would
00133   // normally need (as determined by the width of the things displayed
00134   // in the widget); if the geometry manager can satisfy this request, the 
00135   // widget will end up with extra internal space around what it displays 
00136   // inside. 
00137   virtual void SetPadX(int);
00138   virtual int GetPadX();
00139   virtual void SetPadY(int);
00140   virtual int GetPadY();
00141 
00142   // Description:
00143   // Set the wrap mode.
00144   virtual void SetWrapToNone();
00145   virtual void SetWrapToWord();
00146   virtual void SetWrapToChar();
00147 
00148   // Description:
00149   // Add a tag matcher. Whenever a regular expression 'regexp' is matched
00150   // it will be tagged with 'tag'.
00151   virtual void AddTagMatcher(const char *regexp, const char *tag);
00152 
00153   // Description:
00154   // Set the resize-to-grid flag.
00155   // Specifies a boolean value that determines whether this widget controls
00156   // the resizing grid for its top-level window. This option is typically
00157   // used in text widgets, where the information in the widget has a natural
00158   // size (the size of a character) and it makes sense for the window's
00159   // dimensions to be integral numbers of these units. These natural window
00160   // sizes form a grid. If the setGrid option is set to true then the widget
00161   // will communicate with the window manager so that when the user 
00162   // interactively resizes the top-level window that contains the widget, 
00163   // the dimensions of the window will be displayed to the user in grid units
00164   // and the window size will be constrained to integral numbers of grid units.
00165   vtkBooleanMacro(ResizeToGrid, int);
00166   virtual void SetResizeToGrid(int);
00167   virtual int GetResizeToGrid();
00168 
00169   // Description:
00170   // Adjusts the view in the widget so that the character at the end is
00171   // completely visible.
00172   virtual void SeeEnd();
00173 
00174   // Description:
00175   // Update the "enable" state of the object and its internal parts.
00176   // Depending on different Ivars (this->Enabled, the application's 
00177   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00178   // and propagated to its internal parts/subwidgets. This will, for example,
00179   // enable/disable parts of the widget UI, enable/disable the visibility
00180   // of 3D widgets, etc.
00181   virtual void UpdateEnableState();
00182 
00183   // Description:
00184   // Some constants
00185   //BTX
00186   static const char *MarkerBold;
00187   static const char *MarkerItalic;
00188   static const char *MarkerUnderline;
00189   static const char *TagBold;
00190   static const char *TagItalic;
00191   static const char *TagUnderline;
00192   static const char *TagFgNavy;
00193   static const char *TagFgRed;
00194   static const char *TagFgBlue;
00195   static const char *TagFgDarkGreen;
00196   //ETX
00197 
00198 protected:
00199   vtkKWText();
00200   ~vtkKWText();
00201 
00202   // Description:
00203   // Create the widget.
00204   virtual void CreateWidget();
00205 
00206   int ReadOnly;
00207   int QuickFormatting;
00208 
00209   //BTX
00210   // PIMPL Encapsulation for STL containers
00211   vtkKWTextInternals *Internals;
00212   //ETX
00213 
00214   virtual void AppendTextInternalTagging(const char *, const char *tag);
00215   virtual void AppendTextInternal(const char *, const char *tag);
00216 
00217 private:
00218 
00219   char *InternalTextString;
00220   vtkGetStringMacro(InternalTextString);
00221   vtkSetStringMacro(InternalTextString);
00222 
00223   vtkKWText(const vtkKWText&); // Not implemented
00224   void operator=(const vtkKWText&); // Not implemented
00225 };
00226 
00227 #endif