]>
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 /////////////////////////////////////////////////////////////////////////////
9 #define wxST_NO_AUTORESIZE 0x0001
10 #define wxST_ELLIPSIZE_START 0x0004
11 #define wxST_ELLIPSIZE_MIDDLE 0x0008
12 #define wxST_ELLIPSIZE_END 0x0010
17 A static text control displays one or more lines of read-only text.
18 wxStaticText supports the three classic text alignments, label
19 ellipsization i.e. replacing parts of the text with the ellipsis ("...") if
20 the label doesn't fit into the provided space and also formatting markup
21 with wxControl::SetLabelMarkup().
25 Align the text to the left.
27 Align the text to the right.
28 @style{wxALIGN_CENTRE_HORIZONTAL}
29 Center the text (horizontally).
30 @style{wxST_NO_AUTORESIZE}
31 By default, the control will adjust its size to exactly fit to the
32 size of the text when SetLabel() is called. If this style flag is
33 given, the control will not change its size (this style is
34 especially useful with controls which also have the @c wxALIGN_RIGHT or
35 the @c wxALIGN_CENTRE_HORIZONTAL style because otherwise they won't make sense any
36 longer after a call to SetLabel()).
37 @style{wxST_ELLIPSIZE_START}
38 If the labeltext width exceeds the control width, replace the beginning
39 of the label with an ellipsis; uses wxControl::Ellipsize.
40 @style{wxST_ELLIPSIZE_MIDDLE}
41 If the label text width exceeds the control width, replace the middle
42 of the label with an ellipsis; uses wxControl::Ellipsize.
43 @style{wxST_ELLIPSIZE_END}
44 If the label text width exceeds the control width, replace the end
45 of the label with an ellipsis; uses wxControl::Ellipsize.
50 @appearance{statictext.png}
52 @see wxStaticBitmap, wxStaticBox
54 class wxStaticText
: public wxControl
63 Constructor, creating and showing a text control.
66 Parent window. Should not be @NULL.
68 Control identifier. A value of -1 denotes a default value.
76 Window style. See wxStaticText.
82 wxStaticText(wxWindow
* parent
, wxWindowID id
,
83 const wxString
& label
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
87 const wxString
& name
= wxStaticTextNameStr
);
90 Creation function, for two-step construction. For details see wxStaticText().
92 bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& label
,
93 const wxPoint
& pos
= wxDefaultPosition
,
94 const wxSize
& size
= wxDefaultSize
, long style
= 0,
95 const wxString
& name
= wxStaticTextNameStr
);
98 Returns @true if the window styles for this control contains one of the
99 @c wxST_ELLIPSIZE_START, @c wxST_ELLIPSIZE_MIDDLE or @c wxST_ELLIPSIZE_END styles.
101 bool IsEllipsized() const;
104 This functions wraps the controls label so that each of its lines becomes at
105 most @a width pixels wide if possible (the lines are broken at words
106 boundaries so it might not be the case if words are too long).
108 If @a width is negative, no wrapping is done. Note that this width is not
109 necessarily the total width of the control, since a few pixels for the
110 border (depending on the controls border style) may be added.
114 void Wrap(int width
);