]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: stattext.h | |
e54c96f1 | 3 | // Purpose: interface of wxStaticText |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
526954c5 | 6 | // Licence: wxWindows licence |
23324ae1 FM |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxStaticText | |
7c913512 | 11 | |
23324ae1 | 12 | A static text control displays one or more lines of read-only text. |
3da9cffc VZ |
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(). | |
7c913512 | 17 | |
23324ae1 | 18 | @beginStyleTable |
8c6791e4 | 19 | @style{wxALIGN_LEFT} |
5c87527c | 20 | Align the text to the left. |
8c6791e4 | 21 | @style{wxALIGN_RIGHT} |
5c87527c | 22 | Align the text to the right. |
8c6791e4 | 23 | @style{wxALIGN_CENTRE} |
5c87527c | 24 | Center the text (horizontally). |
8c6791e4 | 25 | @style{wxST_NO_AUTORESIZE} |
23324ae1 | 26 | By default, the control will adjust its size to exactly fit to the |
32ee98eb | 27 | size of the text when SetLabel() is called. If this style flag is |
23324ae1 | 28 | given, the control will not change its size (this style is |
32ee98eb | 29 | especially useful with controls which also have the @c wxALIGN_RIGHT or |
3da9cffc | 30 | the @c wxALIGN_CENTRE style because otherwise they won't make sense any |
32ee98eb | 31 | longer after a call to SetLabel()). |
8c6791e4 | 32 | @style{wxST_ELLIPSIZE_START} |
4520d583 | 33 | If the labeltext width exceeds the control width, replace the beginning |
5c87527c | 34 | of the label with an ellipsis; uses wxControl::Ellipsize. |
8c6791e4 | 35 | @style{wxST_ELLIPSIZE_MIDDLE} |
4520d583 | 36 | If the label text width exceeds the control width, replace the middle |
5c87527c | 37 | of the label with an ellipsis; uses wxControl::Ellipsize. |
8c6791e4 | 38 | @style{wxST_ELLIPSIZE_END} |
4520d583 | 39 | If the label text width exceeds the control width, replace the end |
5c87527c | 40 | of the label with an ellipsis; uses wxControl::Ellipsize. |
23324ae1 | 41 | @endStyleTable |
7c913512 | 42 | |
23324ae1 FM |
43 | @library{wxcore} |
44 | @category{ctrl} | |
7e59b885 | 45 | @appearance{statictext.png} |
7c913512 | 46 | |
e54c96f1 | 47 | @see wxStaticBitmap, wxStaticBox |
23324ae1 FM |
48 | */ |
49 | class wxStaticText : public wxControl | |
50 | { | |
51 | public: | |
671600d8 RR |
52 | /** |
53 | Default constructor. | |
54 | */ | |
55 | wxStaticText(); | |
4701dc09 | 56 | |
23324ae1 FM |
57 | /** |
58 | Constructor, creating and showing a text control. | |
3c4f71cc | 59 | |
7c913512 | 60 | @param parent |
4cc4bfaf | 61 | Parent window. Should not be @NULL. |
7c913512 | 62 | @param id |
4cc4bfaf | 63 | Control identifier. A value of -1 denotes a default value. |
7c913512 | 64 | @param label |
4cc4bfaf | 65 | Text label. |
7c913512 | 66 | @param pos |
4cc4bfaf | 67 | Window position. |
7c913512 | 68 | @param size |
4cc4bfaf | 69 | Window size. |
7c913512 | 70 | @param style |
4cc4bfaf | 71 | Window style. See wxStaticText. |
7c913512 | 72 | @param name |
4cc4bfaf | 73 | Window name. |
3c4f71cc | 74 | |
4cc4bfaf | 75 | @see Create() |
23324ae1 | 76 | */ |
7c913512 FM |
77 | wxStaticText(wxWindow* parent, wxWindowID id, |
78 | const wxString& label, | |
79 | const wxPoint& pos = wxDefaultPosition, | |
80 | const wxSize& size = wxDefaultSize, | |
81 | long style = 0, | |
11e3af6e | 82 | const wxString& name = wxStaticTextNameStr); |
23324ae1 FM |
83 | |
84 | /** | |
85 | Creation function, for two-step construction. For details see wxStaticText(). | |
86 | */ | |
43c48e1e | 87 | bool Create(wxWindow* parent, wxWindowID id, const wxString& label, |
23324ae1 | 88 | const wxPoint& pos = wxDefaultPosition, |
43c48e1e FM |
89 | const wxSize& size = wxDefaultSize, long style = 0, |
90 | const wxString& name = wxStaticTextNameStr); | |
23324ae1 | 91 | |
4520d583 FM |
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 | ||
23324ae1 FM |
98 | /** |
99 | This functions wraps the controls label so that each of its lines becomes at | |
4cc4bfaf | 100 | most @a width pixels wide if possible (the lines are broken at words |
4701dc09 FM |
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 | |
cd3eb0f7 SN |
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. | |
3c4f71cc | 106 | |
1e24c2af | 107 | @since 2.6.2 |
23324ae1 FM |
108 | */ |
109 | void Wrap(int width); | |
110 | }; | |
e54c96f1 | 111 |