]> git.saurik.com Git - wxWidgets.git/blame - interface/stattext.h
removing old files
[wxWidgets.git] / interface / stattext.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: stattext.h
e54c96f1 3// Purpose: interface of wxStaticText
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxStaticText
11 @wxheader{stattext.h}
7c913512 12
23324ae1 13 A static text control displays one or more lines of read-only text.
7c913512 14
23324ae1 15 @beginStyleTable
8c6791e4 16 @style{wxALIGN_LEFT}
23324ae1 17 Align the text to the left
8c6791e4 18 @style{wxALIGN_RIGHT}
23324ae1 19 Align the text to the right
8c6791e4 20 @style{wxALIGN_CENTRE}
23324ae1 21 Center the text (horizontally)
8c6791e4 22 @style{wxST_NO_AUTORESIZE}
23324ae1
FM
23 By default, the control will adjust its size to exactly fit to the
24 size of the text when SetLabel is called. If this style flag is
25 given, the control will not change its size (this style is
26 especially useful with controls which also have wxALIGN_RIGHT or
27 CENTER style because otherwise they won't make sense any longer
28 after a call to SetLabel)
8c6791e4 29 @style{wxST_ELLIPSIZE_START}
23324ae1
FM
30 If the text width exceeds the control width, replace the beginning
31 of the text with an ellipsis
8c6791e4 32 @style{wxST_ELLIPSIZE_MIDDLE}
23324ae1
FM
33 Same as above, but replace the text in the middle of the control
34 with an ellipsis
8c6791e4 35 @style{wxST_ELLIPSIZE_END}
23324ae1 36 Same as above, but replace the end of the text with an ellipsis
8c6791e4 37 @style{wxST_MARKUP}
23324ae1
FM
38 Support markup in the label; see SetLabel for more information
39 @endStyleTable
7c913512 40
23324ae1
FM
41 @library{wxcore}
42 @category{ctrl}
0c7fe6f2 43 <!-- @appearance{statictext.png} -->
7c913512 44
e54c96f1 45 @see wxStaticBitmap, wxStaticBox
23324ae1
FM
46*/
47class wxStaticText : public wxControl
48{
49public:
671600d8
RR
50 /**
51 Default constructor.
52 */
53 wxStaticText();
54
23324ae1
FM
55 /**
56 Constructor, creating and showing a text control.
3c4f71cc 57
7c913512 58 @param parent
4cc4bfaf 59 Parent window. Should not be @NULL.
7c913512 60 @param id
4cc4bfaf 61 Control identifier. A value of -1 denotes a default value.
7c913512 62 @param label
4cc4bfaf 63 Text label.
7c913512 64 @param pos
4cc4bfaf 65 Window position.
7c913512 66 @param size
4cc4bfaf 67 Window size.
7c913512 68 @param style
4cc4bfaf 69 Window style. See wxStaticText.
7c913512 70 @param name
4cc4bfaf 71 Window name.
3c4f71cc 72
4cc4bfaf 73 @see Create()
23324ae1 74 */
7c913512
FM
75 wxStaticText(wxWindow* parent, wxWindowID id,
76 const wxString& label,
77 const wxPoint& pos = wxDefaultPosition,
78 const wxSize& size = wxDefaultSize,
79 long style = 0,
80 const wxString& name = "staticText");
23324ae1
FM
81
82 /**
83 Creation function, for two-step construction. For details see wxStaticText().
84 */
85 bool Create(wxWindow* parent, wxWindowID id,
86 const wxString& label,
87 const wxPoint& pos = wxDefaultPosition,
88 const wxSize& size = wxDefaultSize,
89 long style = 0,
90 const wxString& name = "staticText");
91
92 /**
93 Returns the contents of the control.
23324ae1
FM
94 Note that the returned string contains both the mnemonics (@c characters),
95 if any, and markup tags, if any.
23324ae1
FM
96 Use GetLabelText() if only the
97 label text is needed.
98 */
328f5751 99 wxString GetLabel() const;
23324ae1
FM
100
101 //@{
102 /**
103 The first form returns the control's label without the mnemonics characters (if
7c913512 104 any)
23324ae1 105 and without the markup (if the control has @c wxST_MARKUP style).
4cc4bfaf 106 The second (static) version returns the given @a label string without the
7c913512 107 mnemonics
23324ae1
FM
108 characters (if any) and without the markup.
109 */
110 wxString GetLabelText();
328f5751 111 const static wxString GetLabelText(const wxString& label);
23324ae1
FM
112 //@}
113
114 /**
115 Sets the static text label and updates the controls size to exactly fit the
116 label unless the control has wxST_NO_AUTORESIZE flag.
23324ae1
FM
117 This function allows to set decorated static label text on platforms which
118 support it (currently only GTK+ 2). For the other platforms, the markup is
119 ignored.
23324ae1 120 The supported tags are:
3c4f71cc 121
23324ae1 122 b
3c4f71cc 123
23324ae1 124 bold text
3c4f71cc 125
23324ae1 126 big
3c4f71cc 127
23324ae1 128 bigger text
3c4f71cc 129
23324ae1 130 i
3c4f71cc 131
23324ae1 132 italic text
3c4f71cc 133
23324ae1 134 s
3c4f71cc 135
23324ae1 136 strike-through text
3c4f71cc 137
23324ae1 138 sub
3c4f71cc 139
23324ae1 140 subscript text
3c4f71cc 141
23324ae1 142 sup
3c4f71cc 143
23324ae1 144 superscript text
3c4f71cc 145
23324ae1 146 small
3c4f71cc 147
23324ae1 148 smaller text
3c4f71cc 149
23324ae1 150 tt
3c4f71cc 151
23324ae1 152 monospaced text
3c4f71cc 153
23324ae1 154 u
3c4f71cc 155
23324ae1 156 underlined text
3c4f71cc 157
23324ae1 158 span
3c4f71cc 159
23324ae1 160 generic formatter tag; see Pango Markup for more information.
3c4f71cc 161
23324ae1
FM
162 Note that the string must be well-formed (e.g. all tags must be correctly
163 closed)
164 otherwise it can be not shown correctly or at all.
23324ae1 165 Also note that you need to escape the following special characters:
3c4f71cc 166
23324ae1 167 @b Special character
3c4f71cc 168
23324ae1 169 @b Escape as
3c4f71cc 170
7c913512 171 @c
3c4f71cc 172
7c913512 173 @c amp; or as @c
3c4f71cc 174
23324ae1 175 @c '
3c4f71cc 176
23324ae1 177 @c apos;
3c4f71cc 178
23324ae1 179 @c "
3c4f71cc 180
23324ae1 181 @c quot;
3c4f71cc 182
7c913512 183 @c
3c4f71cc 184
23324ae1 185 @c lt;
3c4f71cc 186
7c913512 187 @c
3c4f71cc 188
23324ae1 189 @c gt;
3c4f71cc 190
23324ae1
FM
191 The non-escaped ampersand @c characters are interpreted as
192 mnemonics; see wxControl::SetLabel.
3c4f71cc 193
23324ae1 194 Example:
3c4f71cc 195
7c913512 196 @param label
4cc4bfaf 197 The new label to set. It may contain newline characters and the markup tags
23324ae1
FM
198 described above.
199 */
200 virtual void SetLabel(const wxString& label);
201
202 /**
203 This functions wraps the controls label so that each of its lines becomes at
4cc4bfaf 204 most @a width pixels wide if possible (the lines are broken at words
23324ae1 205 boundaries so it might not be the case if words are too long). If @e width
cd3eb0f7
SN
206 is negative, no wrapping is done. Note that this width is not
207 necessarily the total width of the control, since a few pixels for the
208 border (depending on the controls border style) may be added.
3c4f71cc 209
1e24c2af 210 @since 2.6.2
23324ae1
FM
211 */
212 void Wrap(int width);
213};
e54c96f1 214