KWWidgets
debian/tmp/usr/include/KWWidgets/vtkKWMessage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Module: $RCSfile: vtkKWMessage.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 vtkKWMessage - message widget
15 // .SECTION Description
16 // A simple widget that represents a message (a long unit of text). A message
17 // is a widget that displays a textual string. A message widget (vtkKWMessage)
18 // has several special features compared to a label (vtkKWLabel).
19 // First, It breaks up its string into lines in order to produce a given
20 // aspect ratio for the window. The line breaks are chosen at word boundaries
21 // wherever possible (if not even a single word would fit on a line, then the
22 // word will be split across lines). Newline characters in the string will
23 // force line breaks; they can be used, for example, to leave blank lines in
24 // the display.
25 // The second feature of a message widget is justification. The text may be
26 // displayed left-justified (each line starts at the left side of
27 // the window), centered on a line-by-line basis, or right-justified (each
28 // line ends at the right side of the window).
29 // For short text, or to set an image as a label, see vtkKWLabel.
30 // .SECTION See Also
31 // vtkKWLabel
32 
33 #ifndef __vtkKWMessage_h
34 #define __vtkKWMessage_h
35 
36 #include "vtkKWCoreWidget.h"
37 
39 {
40 public:
41  static vtkKWMessage* New();
42  vtkTypeRevisionMacro(vtkKWMessage,vtkKWCoreWidget);
43  void PrintSelf(ostream& os, vtkIndent indent);
44 
45  // Description:
46  // Set the text on the message.
47  virtual void SetText(const char*);
48  vtkGetStringMacro(Text);
49  virtual void AppendText(const char*);
50 
51  // Description:
52  // Set/Get width of the message (in pixels).
53  // Specifies the length of lines in the window. If this option has a value
54  // greater than zero then the AspectRatio setting is ignored and the width
55  // setting determines the line length. If this option has a value less than
56  // or equal to zero, then the AspectRatio determines the line length.
57  virtual void SetWidth(int);
58  virtual int GetWidth();
59 
60  // Description:
61  // Set/Get aspect ratio of the message.
62  // Specifies a non-negative integer value indicating desired aspect ratio
63  // for the text. The aspect ratio is specified as 100*width/height.
64  // 100 means the text should be as wide as it is tall, 200 means the text
65  // should be twice as wide as it is tall, 50 means the text should be twice
66  // as tall as it is wide, and so on. It is used to choose line length for
67  // the text if the Width setting isn't specified.
68  virtual void SetAspectRatio(int);
69  virtual int GetAspectRatio();
70 
71  // Description:
72  // Set/Get the background color of the widget.
73  virtual void GetBackgroundColor(double *r, double *g, double *b);
74  virtual double* GetBackgroundColor();
75  virtual void SetBackgroundColor(double r, double g, double b);
76  virtual void SetBackgroundColor(double rgb[3])
77  { this->SetBackgroundColor(rgb[0], rgb[1], rgb[2]); };
78 
79  // Description:
80  // Set/Get the foreground color of the widget.
81  virtual void GetForegroundColor(double *r, double *g, double *b);
82  virtual double* GetForegroundColor();
83  virtual void SetForegroundColor(double r, double g, double b);
84  virtual void SetForegroundColor(double rgb[3])
85  { this->SetForegroundColor(rgb[0], rgb[1], rgb[2]); };
86 
87  // Description:
88  // Set/Get the highlight thickness, a non-negative value indicating the
89  // width of the highlight rectangle to draw around the outside of the
90  // widget when it has the input focus.
91  virtual void SetHighlightThickness(int);
92  virtual int GetHighlightThickness();
93 
94  // Description:
95  // Set/Get the border width, a non-negative value indicating the width of
96  // the 3-D border to draw around the outside of the widget (if such a border
97  // is being drawn; the Relief option typically determines this).
98  virtual void SetBorderWidth(int);
99  virtual int GetBorderWidth();
100 
101  // Description:
102  // Set/Get the 3-D effect desired for the widget.
103  // The value indicates how the interior of the widget should appear
104  // relative to its exterior.
105  // Valid constants can be found in vtkKWOptions::ReliefType.
106  virtual void SetRelief(int);
107  virtual int GetRelief();
108  virtual void SetReliefToRaised();
109  virtual void SetReliefToSunken();
110  virtual void SetReliefToFlat();
111  virtual void SetReliefToRidge();
112  virtual void SetReliefToSolid();
113  virtual void SetReliefToGroove();
114 
115  // Description:
116  // Specifies the font to use when drawing text inside the widget.
117  // You can use predefined font names (e.g. 'system'), or you can specify
118  // a set of font attributes with a platform-independent name, for example,
119  // 'times 12 bold'. In this example, the font is specified with a three
120  // element list: the first element is the font family, the second is the
121  // size, the third is a list of style parameters (normal, bold, roman,
122  // italic, underline, overstrike). Example: 'times 12 {bold italic}'.
123  // The Times, Courier and Helvetica font families are guaranteed to exist
124  // and will be matched to the corresponding (closest) font on your system.
125  // If you are familiar with the X font names specification, you can also
126  // describe the font that way (say, '*times-medium-r-*-*-12*').
127  virtual void SetFont(const char *font);
128  virtual const char* GetFont();
129 
130  // Description:
131  // Set/Get the padding that will be applied around each widget (in pixels).
132  // Specifies a non-negative value indicating how much extra space to request
133  // for the widget in the X and Y-direction. When computing how large a
134  // window it needs, the widget will add this amount to the width it would
135  // normally need (as determined by the width of the things displayed
136  // in the widget); if the geometry manager can satisfy this request, the
137  // widget will end up with extra internal space around what it displays
138  // inside.
139  virtual void SetPadX(int);
140  virtual int GetPadX();
141  virtual void SetPadY(int);
142  virtual int GetPadY();
143 
144  // Description:
145  // Set/Get the justification mode.
146  // When there are multiple lines of text displayed in a widget, this option
147  // determines how the lines line up with each other.
148  // This option works together with the Anchor, AspectRatio, and Width
149  // settings to provide a variety of arrangements of the text within the
150  // window. The AspectRatio and Width settings determine the amount of screen
151  // space needed to display the text. The Anchor setting determines where
152  // this rectangular area is displayed within the widget's window, and the
153  // Justification setting determines how each line is displayed within that
154  // rectangular region. For example, suppose Anchor is East and Justification
155  // is Left, and that the message window is much larger than needed for the
156  // text. The text will displayed so that the left edges of all the lines
157  // line up and the right edge of the longest line is on the right side of
158  // the window; the entire text block will be centered in the vertical span
159  // of the window. Note that the superclass's PadX and PadY setting can be
160  // use to provide additional margins.
161  // Valid constants can be found in vtkKWOptions::JustificationType.
162  virtual void SetJustification(int);
163  virtual int GetJustification();
164  virtual void SetJustificationToLeft();
165  virtual void SetJustificationToCenter();
166  virtual void SetJustificationToRight();
167 
168  // Description:
169  // Set/Get the anchoring.
170  // Specifies how the information in a widget (e.g. text) is to
171  // be displayed in the widget. See example in the Justification method doc.
172  // Valid constants can be found in vtkKWOptions::AnchorType.
173  virtual void SetAnchor(int);
174  virtual int GetAnchor();
175  virtual void SetAnchorToNorth();
176  virtual void SetAnchorToNorthEast();
177  virtual void SetAnchorToEast();
178  virtual void SetAnchorToSouthEast();
179  virtual void SetAnchorToSouth();
180  virtual void SetAnchorToSouthWest();
181  virtual void SetAnchorToWest();
182  virtual void SetAnchorToNorthWest();
183  virtual void SetAnchorToCenter();
184 
185 protected:
186  vtkKWMessage();
187  ~vtkKWMessage();
188 
189  // Description:
190  // Create the widget.
191  virtual void CreateWidget();
192 
193  virtual void UpdateText();
194 
195 private:
196  char* Text;
197 
198  vtkKWMessage(const vtkKWMessage&); // Not implemented
199  void operator=(const vtkKWMessage&); // Not implemented
200 };
201 
202 #endif