1998-05-20 10:25:30 -04:00
\section { \class { wxStaticText} } \label { wxstatictext}
A static text control displays one or more lines of read-only text.
\wxheading { Derived from}
\helpref { wxControl} { wxcontrol} \\
\helpref { wxWindow} { wxwindow} \\
\helpref { wxEvtHandler} { wxevthandler} \\
\helpref { wxObject} { wxobject}
1999-02-15 15:41:29 -05:00
\wxheading { Include files}
<wx/stattext.h>
1998-05-20 10:25:30 -04:00
\wxheading { Window styles}
1999-11-01 20:25:43 -05:00
\twocolwidtha { 5cm}
\begin { twocollist} \itemsep =0pt
\twocolitem { \windowstyle { wxALIGN\_ LEFT} } { Align the text to the left}
\twocolitem { \windowstyle { wxALIGN\_ RIGHT} } { Align the text to the right}
2002-06-07 16:15:28 -04:00
\twocolitem { \windowstyle { wxALIGN\_ CENTRE} } { Center the text (horizontally)}
1999-11-01 20:25:43 -05:00
\twocolitem { \windowstyle { wxST\_ NO\_ AUTORESIZE} } { By default, the control will
adjust its size to exactly fit to the size of the text when
\helpref { SetLabel} { wxstatictextsetlabel} is called. If this style flag is
given, the control will not change its size (this style is especially useful
with controls which also have wxALIGN\_ RIGHT or CENTER style because otherwise
they won't make sense any longer after a call to SetLabel)}
2007-04-01 10:13:15 -04:00
\twocolitem { \windowstyle { wxST\_ ELLIPSIZE\_ START} } { If the text width exceeds the
control width, replace the beginning of the text with an ellipsis}
\twocolitem { \windowstyle { wxST\_ ELLIPSIZE\_ MIDDLE} } { Same as above, but replace
the text in the middle of the control with an ellipsis}
\twocolitem { \windowstyle { wxST\_ ELLIPSIZE\_ END} } { Same as above, but replace the
end of the text with an ellipsis}
\twocolitem { \windowstyle { wxST_ MARKUP} } { Support markup in the label; see
\helpref { SetLabel} { wxstatictextsetlabel} for more information}
1999-11-01 20:25:43 -05:00
\end { twocollist}
1998-05-20 10:25:30 -04:00
See also \helpref { window styles overview} { windowstyles} .
\wxheading { See also}
\helpref { wxStaticBitmap} { wxstaticbitmap} , \helpref { wxStaticBox} { wxstaticbox}
\latexignore { \rtfignore { \wxheading { Members} } }
2005-08-16 19:14:34 -04:00
1998-05-20 10:25:30 -04:00
\membersection { wxStaticText::wxStaticText} \label { wxstatictextconstr}
\func { } { wxStaticText} { \void }
Default constructor.
1998-06-14 08:11:50 -04:00
\func { } { wxStaticText} { \param { wxWindow* } { parent} , \param { wxWindowID} { id} ,\rtfsp
2003-06-22 07:04:13 -04:00
\param { const wxString\& } { label} , \param { const wxPoint\& } { pos = wxDefaultPosition} , \param { const wxSize\& } { size = wxDefaultSize} ,\rtfsp
1998-06-14 08:11:50 -04:00
\param { long} { style = 0} , \param { const wxString\& } { name = ``staticText"} }
1998-05-20 10:25:30 -04:00
Constructor, creating and showing a text control.
\wxheading { Parameters}
\docparam { parent} { Parent window. Should not be NULL.}
\docparam { id} { Control identifier. A value of -1 denotes a default value.}
\docparam { label} { Text label.}
\docparam { pos} { Window position.}
\docparam { size} { Window size.}
\docparam { style} { Window style. See \helpref { wxStaticText} { wxstatictext} .}
\docparam { name} { Window name.}
\wxheading { See also}
\helpref { wxStaticText::Create} { wxstatictextcreate}
2005-08-16 19:14:34 -04:00
1998-05-20 10:25:30 -04:00
\membersection { wxStaticText::Create} \label { wxstatictextcreate}
1998-06-14 08:11:50 -04:00
\func { bool} { Create} { \param { wxWindow* } { parent} , \param { wxWindowID} { id} ,\rtfsp
2003-06-22 07:04:13 -04:00
\param { const wxString\& } { label} , \param { const wxPoint\& } { pos = wxDefaultPosition} , \param { const wxSize\& } { size = wxDefaultSize} ,\rtfsp
1998-06-14 08:11:50 -04:00
\param { long} { style = 0} , \param { const wxString\& } { name = ``staticText"} }
1998-05-20 10:25:30 -04:00
Creation function, for two-step construction. For details see \helpref { wxStaticText::wxStaticText} { wxstatictextconstr} .
2005-08-16 19:14:34 -04:00
1998-05-20 10:25:30 -04:00
\membersection { wxStaticText::GetLabel} \label { wxstatictextgetlabel}
\constfunc { wxString} { GetLabel} { \void }
Returns the contents of the control.
2007-04-01 10:13:15 -04:00
Note that the returned string contains both the mnemonics (\texttt { \& } characters),
if any, and markup tags, if any.
Use \helpref { wxStaticText::GetLabelText} { wxstatictextgetlabeltext} if only the
label text is needed.
\membersection { wxStaticText::GetLabelText} \label { wxstatictextgetlabeltext}
\constfunc { const wxString\& } { GetLabelText} { \void }
Returns the control's label or the given \arg { label} string for the static
version without the mnemonics characters (if any) and without the markup
(if the control has \texttt { wxST_ MARKUP} style).
2005-08-16 19:14:34 -04:00
1998-05-20 10:25:30 -04:00
\membersection { wxStaticText::SetLabel} \label { wxstatictextsetlabel}
\func { virtual void} { SetLabel} { \param { const wxString\& } { label} }
1999-11-01 20:25:43 -05:00
Sets the static text label and updates the controls size to exactly fit the
label unless the control has wxST\_ NO\_ AUTORESIZE flag.
1998-05-20 10:25:30 -04:00
2007-04-01 10:13:15 -04:00
This function allows to set decorated static label text on platforms which
support it (currently only GTK+ 2). For the other platforms, the markup is
ignored.
The supported tags are:
\twocolwidtha { 5cm}
\begin { twocollist} \itemsep =0pt
\twocolitem { <b>} { bold text}
\twocolitem { <big>} { bigger text}
\twocolitem { <i>} { italic text}
\twocolitem { <s>} { strike-through text}
\twocolitem { <sub>} { subscript text}
\twocolitem { <sup>} { superscript text}
\twocolitem { <small>} { smaller text}
\twocolitem { <tt>} { monospaced text}
\twocolitem { <u>} { underlined text}
\twocolitem { <span>} { generic formatter tag; see \urlref { Pango Markup} { http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html} for more information.}
\end { twocollist}
Note that the string must be well-formed (e.g. all tags must be correctly closed)
otherwise it can be not shown correctly or at all.
Also note that you need to escape the following special characters:
\twocolwidtha { 5cm}
\begin { twocollist} \itemsep =0pt
\twocolitem { \textbf { Special character} } { \textbf { Escape as} }
\twocolitem { \texttt { & } } { \texttt { & amp;} or as \texttt { & & } }
\twocolitem { \texttt { '} } { \texttt { & apos;} }
\twocolitem { \texttt { "} } { \texttt { & quot;} }
\twocolitem { \texttt { <} } { \texttt { & lt;} }
\twocolitem { \texttt { >} } { \texttt { & gt;} }
\end { twocollist}
The non-escaped ampersand \texttt { & } characters are interpreted as
mnemonics; see \helpref { wxControl::SetLabel} { wxcontrolsetlabel} .
Example:
%% TEX NOTE: in the following block we need to write the (ugly) &&amp;
%% string in order to force Tex2rtf to show the && string
\begin { verbatim}
// this will set the wxStaticText to show the "Hello world!" string
// with the "Hello" world in bold on platforms which support markup
pStaticText->SetLabelWithMarkup(wxT("<b>Hello</b> world!"));
// this will make wxStaticText show the string:
//
// Specials: & ' " < >"
//
// with "Specials" in smaller size font if markup is supported
pStaticText->SetLabelWithMarkup(
wxT("<small>Specials</small>: & amp;amp; & amp;apos; & amp;quot;; & amp;lt; & amp;gt;"));
\end { verbatim}
1998-05-20 10:25:30 -04:00
\wxheading { Parameters}
2007-04-01 10:13:15 -04:00
\docparam { label} { The new label to set. It may contain newline characters and the markup tags described above.}
1998-05-20 10:25:30 -04:00
2005-08-16 19:14:34 -04:00
2007-04-01 10:13:15 -04:00
\membersection { wxStaticText::Wrap} \label { wxstatictextwrap}
2005-08-16 19:14:34 -04:00
\func { void} { Wrap} { \param { int } { width} }
This functions wraps the controls label so that each of its lines becomes at
most \arg { width} pixels wide if possible (the lines are broken at words
boundaries so it might not be the case if words are too long). If \arg { width}
is negative, no wrapping is done.
2005-08-16 19:55:05 -04:00
\newsince { 2.6.2}
2005-09-17 08:53:07 -04:00