]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/stattext.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStaticText
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 A static text control displays one or more lines of read-only text.
13 wxStaticText supports the three classic text alignments, label
14 ellipsization i.e. replacing parts of the text with the ellipsis ("...") if
15 the label doesn't fit into the provided space and also formatting markup
16 with wxControl::SetLabelMarkup().
20 Align the text to the left.
22 Align the text to the right.
23 @style{wxALIGN_CENTRE}
24 Center the text (horizontally).
25 @style{wxST_NO_AUTORESIZE}
26 By default, the control will adjust its size to exactly fit to the
27 size of the text when SetLabel() is called. If this style flag is
28 given, the control will not change its size (this style is
29 especially useful with controls which also have the @c wxALIGN_RIGHT or
30 the @c wxALIGN_CENTRE style because otherwise they won't make sense any
31 longer after a call to SetLabel()).
32 @style{wxST_ELLIPSIZE_START}
33 If the labeltext width exceeds the control width, replace the beginning
34 of the label with an ellipsis; uses wxControl::Ellipsize.
35 @style{wxST_ELLIPSIZE_MIDDLE}
36 If the label text width exceeds the control width, replace the middle
37 of the label with an ellipsis; uses wxControl::Ellipsize.
38 @style{wxST_ELLIPSIZE_END}
39 If the label text width exceeds the control width, replace the end
40 of the label with an ellipsis; uses wxControl::Ellipsize.
45 @appearance{statictext.png}
47 @see wxStaticBitmap, wxStaticBox
49 class wxStaticText
: public wxControl
58 Constructor, creating and showing a text control.
61 Parent window. Should not be @NULL.
63 Control identifier. A value of -1 denotes a default value.
71 Window style. See wxStaticText.
77 wxStaticText(wxWindow
* parent
, wxWindowID id
,
78 const wxString
& label
,
79 const wxPoint
& pos
= wxDefaultPosition
,
80 const wxSize
& size
= wxDefaultSize
,
82 const wxString
& name
= wxStaticTextNameStr
);
85 Creation function, for two-step construction. For details see wxStaticText().
87 bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& label
,
88 const wxPoint
& pos
= wxDefaultPosition
,
89 const wxSize
& size
= wxDefaultSize
, long style
= 0,
90 const wxString
& name
= wxStaticTextNameStr
);
93 Returns @true if the window styles for this control contains one of the
94 @c wxST_ELLIPSIZE_START, @c wxST_ELLIPSIZE_MIDDLE or @c wxST_ELLIPSIZE_END styles.
96 bool IsEllipsized() const;
99 This functions wraps the controls label so that each of its lines becomes at
100 most @a width pixels wide if possible (the lines are broken at words
101 boundaries so it might not be the case if words are too long).
103 If @a width is negative, no wrapping is done. Note that this width is not
104 necessarily the total width of the control, since a few pixels for the
105 border (depending on the controls border style) may be added.
109 void Wrap(int width
);