]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/stattext.h
Merge in from trunk r64802 - r68625
[wxWidgets.git] / interface / wx / stattext.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: stattext.h
3 // Purpose: interface of wxStaticText
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxStaticText
11
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().
17
18 @beginStyleTable
19 @style{wxALIGN_LEFT}
20 Align the text to the left.
21 @style{wxALIGN_RIGHT}
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.
41 @endStyleTable
42
43 @library{wxcore}
44 @category{ctrl}
45 @appearance{statictext.png}
46
47 @see wxStaticBitmap, wxStaticBox
48 */
49 class wxStaticText : public wxControl
50 {
51 public:
52 /**
53 Default constructor.
54 */
55 wxStaticText();
56
57 /**
58 Constructor, creating and showing a text control.
59
60 @param parent
61 Parent window. Should not be @NULL.
62 @param id
63 Control identifier. A value of -1 denotes a default value.
64 @param label
65 Text label.
66 @param pos
67 Window position.
68 @param size
69 Window size.
70 @param style
71 Window style. See wxStaticText.
72 @param name
73 Window name.
74
75 @see Create()
76 */
77 wxStaticText(wxWindow* parent, wxWindowID id,
78 const wxString& label,
79 const wxPoint& pos = wxDefaultPosition,
80 const wxSize& size = wxDefaultSize,
81 long style = 0,
82 const wxString& name = wxStaticTextNameStr);
83
84 /**
85 Creation function, for two-step construction. For details see wxStaticText().
86 */
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);
91
92 /**
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.
95 */
96 bool IsEllipsized() const;
97
98 /**
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).
102
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.
106
107 @since 2.6.2
108 */
109 void Wrap(int width);
110 };
111