#include <wx/stattext.h>

Styles:
![]() | ![]() | ![]() |
| wxMSW appearance | wxGTK appearance | wxMac appearance |
Public Member Functions | |
| wxStaticText () | |
| wxStaticText (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxStaticTextNameStr) | |
| bool | Create (wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxStaticTextNameStr) |
| wxString | GetLabel () const |
| wxString | GetLabelText () const |
| virtual void | SetLabel (const wxString &label) |
| void | Wrap (int width) |
Static Public Member Functions | |
| static wxString | GetLabelText (const wxString &label) |
| wxStaticText::wxStaticText | ( | ) |
Default constructor.
| wxStaticText::wxStaticText | ( | wxWindow * | parent, | |
| wxWindowID | id, | |||
| const wxString & | label, | |||
| const wxPoint & | pos = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = 0, |
|||
| const wxString & | name = wxStaticTextNameStr | |||
| ) |
Constructor, creating and showing a text control.
| parent | Parent window. Should not be NULL. | |
| id | Control identifier. A value of -1 denotes a default value. | |
| label | Text label. | |
| pos | Window position. | |
| size | Window size. | |
| style | Window style. See wxStaticText. | |
| name | Window name. |
| bool wxStaticText::Create | ( | wxWindow * | parent, | |
| wxWindowID | id, | |||
| const wxString & | label, | |||
| const wxPoint & | pos = wxDefaultPosition, |
|||
| const wxSize & | size = wxDefaultSize, |
|||
| long | style = 0, |
|||
| const wxString & | name = wxStaticTextNameStr | |||
| ) |
Creation function, for two-step construction. For details see wxStaticText().
| wxString wxStaticText::GetLabel | ( | ) | const [virtual] |
Returns the contents of the control.
Note that the returned string contains both the mnemonics (& characters), if any, and markup tags, if any. Use GetLabelText() if only the label text is needed.
Reimplemented from wxControl.
| wxString wxStaticText::GetLabelText | ( | ) | const |
This method returns the control's label without the mnemonics characters (if any) and without the markup (if the control has wxST_MARKUP style).
Reimplemented from wxControl.
This overload returns the given label string without the mnemonics characters (if any) and without the markup.
Reimplemented from wxControl.
| virtual void wxStaticText::SetLabel | ( | const wxString & | label | ) | [virtual] |
Sets the static text label and updates the controls size to exactly fit the label unless the control has wxST_NO_AUTORESIZE flag.
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:
| <b> | bold text |
| <big> | bigger text |
| <i> | italic text |
| <s> | strike-through text |
| <sub> | subscript text |
| <sup> | superscript text |
| <small> | smaller text |
| <tt> | monospaced text |
| <u> | underlined text |
| <span> | generic formatter tag; see Pango Markup (http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html) for more information. |
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:
| Special character | Escape as |
& | & or as && |
' | ' |
" | " |
< | < |
> | > |
The non-escaped ampersand & characters are interpreted as mnemonics; see wxControl::SetLabel.
Example:
| label | The new label to set. It may contain newline characters and the markup tags described above. |
Reimplemented from wxControl.
| void wxStaticText::Wrap | ( | int | width | ) |
This functions wraps the controls label so that each of its lines becomes at most 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 width is negative, no wrapping is done. Note that this width is not necessarily the total width of the control, since a few pixels for the border (depending on the controls border style) may be added.
|
[ top ] |