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

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Module:    $RCSfile: vtkKWLabel.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 vtkKWLabel - label widget
00015 // .SECTION Description
00016 // A simple widget that represents a label. A label is a widget that displays
00017 // a textual string (or image). If text is displayed, it must all be in
00018 // a single font, but it can occupy multiple lines on the screen (if it
00019 // contains newlines or if wrapping occurs because of the WrapLength option).
00020 // For longer text and more justification options, see vtkKWMessage.
00021 // .SECTION See Also
00022 // vtkKWMessage
00023 
00024 #ifndef __vtkKWLabel_h
00025 #define __vtkKWLabel_h
00026 
00027 #include "vtkKWCoreWidget.h"
00028 
00029 class vtkKWIcon;
00030 
00031 class KWWidgets_EXPORT vtkKWLabel : public vtkKWCoreWidget
00032 {
00033 public:
00034   static vtkKWLabel* New();
00035   vtkTypeRevisionMacro(vtkKWLabel,vtkKWCoreWidget);
00036   void PrintSelf(ostream& os, vtkIndent indent);
00037 
00038   // Description:
00039   // Set the text on the label.
00040   virtual void SetText(const char*);
00041   vtkGetStringMacro(Text);
00042 
00043   // Description:
00044   // Set/Get the width of the label.
00045   // If an image is being displayed in the label then the value is in screen
00046   // units; for text it is in characters.
00047   virtual void SetWidth(int);
00048   virtual int GetWidth();
00049 
00050   // Description:
00051   // Set/Get the height of the label.
00052   // If an image is being displayed in the label then the value is in screen
00053   // units; for text it is in lines of text.
00054   virtual void SetHeight(int);
00055   virtual int GetHeight();
00056 
00057   // Description:
00058   // Set/Get the justification mode.
00059   // When there are multiple lines of text displayed in a widget, this option
00060   // determines how the lines line up with each other.
00061   // Valid constants can be found in vtkKWOptions::JustificationType.
00062   virtual void SetJustification(int);
00063   virtual int GetJustification();
00064   virtual void SetJustificationToLeft();
00065   virtual void SetJustificationToCenter();
00066   virtual void SetJustificationToRight();
00067 
00068   // Description:
00069   // Set/Get the anchoring.
00070   // Specifies how the information in a widget (e.g. text or a bitmap) is to
00071   // be displayed in the widget.
00072   // Valid constants can be found in vtkKWOptions::AnchorType.
00073   virtual void SetAnchor(int);
00074   virtual int GetAnchor();
00075   virtual void SetAnchorToNorth();
00076   virtual void SetAnchorToNorthEast();
00077   virtual void SetAnchorToEast();
00078   virtual void SetAnchorToSouthEast();
00079   virtual void SetAnchorToSouth();
00080   virtual void SetAnchorToSouthWest();
00081   virtual void SetAnchorToWest();
00082   virtual void SetAnchorToNorthWest();
00083   virtual void SetAnchorToCenter();
00084 
00085   // Description:
00086   // Set/Get the background color of the widget.
00087   virtual void GetBackgroundColor(double *r, double *g, double *b);
00088   virtual double* GetBackgroundColor();
00089   virtual void SetBackgroundColor(double r, double g, double b);
00090   virtual void SetBackgroundColor(double rgb[3])
00091     { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00092   
00093   // Description:
00094   // Set/Get the foreground color of the widget (or the default color).
00095   virtual void GetForegroundColor(double *r, double *g, double *b);
00096   virtual double* GetForegroundColor();
00097   virtual void SetForegroundColor(double r, double g, double b);
00098   virtual void SetForegroundColor(double rgb[3])
00099     { this->SetForegroundColor(rgb[0], rgb[1], rgb[2]); };
00100   virtual void GetDefaultForegroundColor(double *r, double *g, double *b);
00101   virtual double* GetDefaultForegroundColor();
00102 
00103   // Description:
00104   // Set/Get the highlight thickness, a non-negative value indicating the
00105   // width of the highlight rectangle to draw around the outside of the
00106   // widget when it has the input focus.
00107   virtual void SetHighlightThickness(int);
00108   virtual int GetHighlightThickness();
00109   
00110   // Description:
00111   // Set/Get the active background color of the widget. An element
00112   // (a widget or portion of a widget) is active if the mouse cursor is
00113   // positioned over the element and pressing a mouse button will cause some
00114   // action to occur.
00115   virtual void GetActiveBackgroundColor(double *r, double *g, double *b);
00116   virtual double* GetActiveBackgroundColor();
00117   virtual void SetActiveBackgroundColor(double r, double g, double b);
00118   virtual void SetActiveBackgroundColor(double rgb[3])
00119     { this->SetActiveBackgroundColor(rgb[0], rgb[1], rgb[2]); };
00120   
00121   // Description:
00122   // Set/Get the active foreground color of the widget. An element
00123   // (a widget or portion of a widget) is active if the mouse cursor is
00124   // positioned over the element and pressing a mouse button will cause some
00125   // action to occur.
00126   virtual void GetActiveForegroundColor(double *r, double *g, double *b);
00127   virtual double* GetActiveForegroundColor();
00128   virtual void SetActiveForegroundColor(double r, double g, double b);
00129   virtual void SetActiveForegroundColor(double rgb[3])
00130     { this->SetActiveForegroundColor(rgb[0], rgb[1], rgb[2]); };
00131   
00132   // Description:
00133   // Set/Get the foreground color of the widget when it is disabled.
00134   virtual void GetDisabledForegroundColor(double *r, double *g, double *b);
00135   virtual double* GetDisabledForegroundColor();
00136   virtual void SetDisabledForegroundColor(double r, double g, double b);
00137   virtual void SetDisabledForegroundColor(double rgb[3])
00138     { this->SetDisabledForegroundColor(rgb[0], rgb[1], rgb[2]); };
00139 
00140   // Description:
00141   // Set/Get the border width, a non-negative value indicating the width of
00142   // the 3-D border to draw around the outside of the widget (if such a border
00143   // is being drawn; the Relief option typically determines this).
00144   virtual void SetBorderWidth(int);
00145   virtual int GetBorderWidth();
00146   
00147   // Description:
00148   // Set/Get the 3-D effect desired for the widget. 
00149   // The value indicates how the interior of the widget should appear
00150   // relative to its exterior. 
00151   // Valid constants can be found in vtkKWOptions::ReliefType.
00152   virtual void SetRelief(int);
00153   virtual int GetRelief();
00154   virtual void SetReliefToRaised();
00155   virtual void SetReliefToSunken();
00156   virtual void SetReliefToFlat();
00157   virtual void SetReliefToRidge();
00158   virtual void SetReliefToSolid();
00159   virtual void SetReliefToGroove();
00160 
00161   // Description:
00162   // Set/Get the padding that will be applied around each widget (in pixels).
00163   // Specifies a non-negative value indicating how much extra space to request
00164   // for the widget in the X and Y-direction. When computing how large a
00165   // window it needs, the widget will add this amount to the width it would
00166   // normally need (as determined by the width of the things displayed
00167   // in the widget); if the geometry manager can satisfy this request, the 
00168   // widget will end up with extra internal space around what it displays 
00169   // inside. 
00170   virtual void SetPadX(int);
00171   virtual int GetPadX();
00172   virtual void SetPadY(int);
00173   virtual int GetPadY();
00174 
00175   // Description:
00176   // Set/Get the wrap length mode.
00177   // For widgets that can perform word-wrapping, this option specifies the
00178   // maximum line length. Lines that would exceed this length are wrapped onto
00179   // the next line, so that no line is longer than the specified length. 
00180   // The value may be specified in any of the standard forms for screen
00181   // distances (i.e, "2i" means 2 inches).
00182   // If this value is less than or equal to 0 then no wrapping is done: lines
00183   // will break only at newline characters in the text. 
00184   virtual void SetWrapLength(const char *length);
00185   virtual const char* GetWrapLength();
00186   
00187   // Description:
00188   // Adjust the -wraplength argument so that it matches the width of
00189   // the widget automatically (through the Configure event).
00190   virtual void SetAdjustWrapLengthToWidth(int);
00191   vtkGetMacro(AdjustWrapLengthToWidth, int);
00192   vtkBooleanMacro(AdjustWrapLengthToWidth, int);
00193 
00194   // Description:
00195   // Specifies the font to use when drawing text inside the widget. 
00196   // You can use predefined font names (e.g. 'system'), or you can specify
00197   // a set of font attributes with a platform-independent name, for example,
00198   // 'times 12 bold'. In this example, the font is specified with a three
00199   // element list: the first element is the font family, the second is the
00200   // size, the third is a list of style parameters (normal, bold, roman, 
00201   // italic, underline, overstrike). Example: 'times 12 {bold italic}'.
00202   // The Times, Courier and Helvetica font families are guaranteed to exist
00203   // and will be matched to the corresponding (closest) font on your system.
00204   // If you are familiar with the X font names specification, you can also
00205   // describe the font that way (say, '*times-medium-r-*-*-12*').
00206   virtual void SetFont(const char *font);
00207   virtual const char* GetFont();
00208 
00209   // Description:
00210   // Specifies an image to display in the widget. Typically, if the image
00211   // is specified then it overrides other options that specify a bitmap or
00212   // textual value to display in the widget. Invoke vtkKWWidget's 
00213   // SetConfigurationOption("-image", imagename) to use a specific 
00214   // pre-existing Tk image, or call one of the following functions:
00215   // The SetImageToPredefinedIcon method accepts an index to one of the
00216   // predefined icon listed in vtkKWIcon.
00217   // The SetImageToPixels method sets the image using pixel data. It expects
00218   // a pointer to the pixels and the structure of the image, i.e. its width, 
00219   // height and the pixel_size (how many bytes per pixel, say 3 for RGB, or
00220   // 1 for grayscale). If buffer_length = 0, it is computed automatically
00221   // from the previous parameters. If it is not, it will most likely indicate
00222   // that the buffer has been encoded using base64 and/or zlib.
00223   // If pixel_size > 3 (i.e. RGBA), the image is blend the with background
00224   // color of the widget.
00225   // Check the SetCompoundMode method if you want to display both the
00226   // image and the label at the same time.
00227   virtual void SetImageToIcon(vtkKWIcon *icon);
00228   virtual void SetImageToPredefinedIcon(int icon_index);
00229   virtual void SetImageToPixels(
00230     const unsigned char *pixels, int width, int height, int pixel_size,
00231     unsigned long buffer_length = 0);
00232   
00233   // Description:
00234   // Specifies if the widget should display text and bitmaps/images at the
00235   // same time, and if so, where the bitmap/image should be placed relative 
00236   // to the text. 
00237   // Valid constants can be found in vtkKWOptions::CompoundModeType.
00238   // The (default) value CompoundModeNone specifies that the bitmap or image 
00239   // should (if defined) be displayed instead of the text. 
00240   virtual void SetCompoundMode(int);
00241   virtual int GetCompoundMode();
00242   virtual void SetCompoundModeToNone();
00243   virtual void SetCompoundModeToLeft();
00244   virtual void SetCompoundModeToCenter();
00245   virtual void SetCompoundModeToRight();
00246   virtual void SetCompoundModeToTop();
00247   virtual void SetCompoundModeToBottom();
00248 
00249   // Description:
00250   // Update the "enable" state of the object and its internal parts.
00251   // Depending on different Ivars (this->Enabled, the application's 
00252   // Limited Edition Mode, etc.), the "enable" state of the object is updated
00253   // and propagated to its internal parts/subwidgets. This will, for example,
00254   // enable/disable parts of the widget UI, enable/disable the visibility
00255   // of 3D widgets, etc.
00256   virtual void UpdateEnableState();
00257 
00258   // Description:
00259   // Callbacks. Internal, do not use.
00260   virtual void AdjustWrapLengthToWidthCallback();
00261 
00262 protected:
00263   vtkKWLabel();
00264   ~vtkKWLabel();
00265 
00266   // Description:
00267   // Create the widget.
00268   virtual void CreateWidget();
00269   
00270   virtual void UpdateBindings();
00271   virtual void UpdateText();
00272 
00273 private:
00274   char* Text;
00275   int AdjustWrapLengthToWidth;
00276   vtkKWIcon *Icon;
00277 
00278   vtkKWLabel(const vtkKWLabel&); // Not implemented
00279   void operator=(const vtkKWLabel&); // Not implemented
00280 };
00281 
00282 #endif

Generated by  doxygen 1.6.2