]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/stattext.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStaticText
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
8 #define wxST_NO_AUTORESIZE 0x0001
9 #define wxST_ELLIPSIZE_START 0x0004
10 #define wxST_ELLIPSIZE_MIDDLE 0x0008
11 #define wxST_ELLIPSIZE_END 0x0010
16 A static text control displays one or more lines of read-only text.
17 wxStaticText supports the three classic text alignments, label
18 ellipsization i.e. replacing parts of the text with the ellipsis ("...") if
19 the label doesn't fit into the provided space and also formatting markup
20 with wxControl::SetLabelMarkup().
24 Align the text to the left.
26 Align the text to the right.
27 @style{wxALIGN_CENTRE_HORIZONTAL}
28 Center the text (horizontally).
29 @style{wxST_NO_AUTORESIZE}
30 By default, the control will adjust its size to exactly fit to the
31 size of the text when SetLabel() is called. If this style flag is
32 given, the control will not change its size (this style is
33 especially useful with controls which also have the @c wxALIGN_RIGHT or
34 the @c wxALIGN_CENTRE_HORIZONTAL style because otherwise they won't make sense any
35 longer after a call to SetLabel()).
36 @style{wxST_ELLIPSIZE_START}
37 If the labeltext width exceeds the control width, replace the beginning
38 of the label with an ellipsis; uses wxControl::Ellipsize.
39 @style{wxST_ELLIPSIZE_MIDDLE}
40 If the label text width exceeds the control width, replace the middle
41 of the label with an ellipsis; uses wxControl::Ellipsize.
42 @style{wxST_ELLIPSIZE_END}
43 If the label text width exceeds the control width, replace the end
44 of the label with an ellipsis; uses wxControl::Ellipsize.
49 @appearance{statictext}
51 @see wxStaticBitmap, wxStaticBox
53 class wxStaticText
: public wxControl
62 Constructor, creating and showing a text control.
65 Parent window. Should not be @NULL.
67 Control identifier. A value of -1 denotes a default value.
75 Window style. See wxStaticText.
81 wxStaticText(wxWindow
* parent
, wxWindowID id
,
82 const wxString
& label
,
83 const wxPoint
& pos
= wxDefaultPosition
,
84 const wxSize
& size
= wxDefaultSize
,
86 const wxString
& name
= wxStaticTextNameStr
);
89 Creation function, for two-step construction. For details see wxStaticText().
91 bool Create(wxWindow
* parent
, wxWindowID id
, const wxString
& label
,
92 const wxPoint
& pos
= wxDefaultPosition
,
93 const wxSize
& size
= wxDefaultSize
, long style
= 0,
94 const wxString
& name
= wxStaticTextNameStr
);
97 Returns @true if the window styles for this control contains one of the
98 @c wxST_ELLIPSIZE_START, @c wxST_ELLIPSIZE_MIDDLE or @c wxST_ELLIPSIZE_END styles.
100 bool IsEllipsized() const;
103 This functions wraps the controls label so that each of its lines becomes at
104 most @a width pixels wide if possible (the lines are broken at words
105 boundaries so it might not be the case if words are too long).
107 If @a width is negative, no wrapping is done. Note that this width is not
108 necessarily the total width of the control, since a few pixels for the
109 border (depending on the controls border style) may be added.
113 void Wrap(int width
);