]>
git.saurik.com Git - wxWidgets.git/blob - interface/stattext.h
3ada9ff8285120299dc4d21f3b3f11a4574b221e
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxStaticText class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A static text control displays one or more lines of read-only text.
17 Align the text to the left
18 @style{wxALIGN_RIGHT}:
19 Align the text to the right
20 @style{wxALIGN_CENTRE}:
21 Center the text (horizontally)
22 @style{wxST_NO_AUTORESIZE}:
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)
29 @style{wxST_ELLIPSIZE_START}:
30 If the text width exceeds the control width, replace the beginning
31 of the text with an ellipsis
32 @style{wxST_ELLIPSIZE_MIDDLE}:
33 Same as above, but replace the text in the middle of the control
35 @style{wxST_ELLIPSIZE_END}:
36 Same as above, but replace the end of the text with an ellipsis
38 Support markup in the label; see SetLabel for more information
43 @appearance{statictext.png}
46 wxStaticBitmap, wxStaticBox
48 class wxStaticText
: public wxControl
53 Constructor, creating and showing a text control.
56 Parent window. Should not be @NULL.
59 Control identifier. A value of -1 denotes a default value.
71 Window style. See wxStaticText.
79 wxStaticText(wxWindow
* parent
, wxWindowID id
,
80 const wxString
& label
,
81 const wxPoint
& pos
= wxDefaultPosition
,
82 const wxSize
& size
= wxDefaultSize
,
84 const wxString
& name
= "staticText");
88 Creation function, for two-step construction. For details see wxStaticText().
90 bool Create(wxWindow
* parent
, wxWindowID id
,
91 const wxString
& label
,
92 const wxPoint
& pos
= wxDefaultPosition
,
93 const wxSize
& size
= wxDefaultSize
,
95 const wxString
& name
= "staticText");
98 Returns the contents of the control.
100 Note that the returned string contains both the mnemonics (@c characters),
101 if any, and markup tags, if any.
103 Use GetLabelText() if only the
104 label text is needed.
110 The first form returns the control's label without the mnemonics characters (if
112 and without the markup (if the control has @c wxST_MARKUP style).
114 The second (static) version returns the given @e label string without the
116 characters (if any) and without the markup.
118 wxString
GetLabelText();
119 static wxString
GetLabelText(const wxString
& label
);
123 Sets the static text label and updates the controls size to exactly fit the
124 label unless the control has wxST_NO_AUTORESIZE flag.
126 This function allows to set decorated static label text on platforms which
127 support it (currently only GTK+ 2). For the other platforms, the markup is
130 The supported tags are:
181 generic formatter tag; see Pango Markup for more information.
183 Note that the string must be well-formed (e.g. all tags must be correctly
185 otherwise it can be not shown correctly or at all.
187 Also note that you need to escape the following special characters:
220 The non-escaped ampersand @c characters are interpreted as
221 mnemonics; see wxControl::SetLabel.
225 The new label to set. It may contain newline characters and the markup tags
228 virtual void SetLabel(const wxString
& label
);
231 This functions wraps the controls label so that each of its lines becomes at
232 most @e width pixels wide if possible (the lines are broken at words
233 boundaries so it might not be the case if words are too long). If @e width
234 is negative, no wrapping is done.
236 This function is new since wxWidgets version 2.6.2
238 void Wrap(int width
);