]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/stattext.h
synchronize GTK2 minimum version in docs
[wxWidgets.git] / interface / wx / stattext.h
CommitLineData
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
86381d42
RD
9#define wxST_NO_AUTORESIZE 0x0001
10#define wxST_ELLIPSIZE_START 0x0004
11#define wxST_ELLIPSIZE_MIDDLE 0x0008
12#define wxST_ELLIPSIZE_END 0x0010
13
23324ae1
FM
14/**
15 @class wxStaticText
7c913512 16
23324ae1 17 A static text control displays one or more lines of read-only text.
3da9cffc
VZ
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().
7c913512 22
23324ae1 23 @beginStyleTable
8c6791e4 24 @style{wxALIGN_LEFT}
5c87527c 25 Align the text to the left.
8c6791e4 26 @style{wxALIGN_RIGHT}
5c87527c 27 Align the text to the right.
8c6791e4 28 @style{wxALIGN_CENTRE}
5c87527c 29 Center the text (horizontally).
8c6791e4 30 @style{wxST_NO_AUTORESIZE}
23324ae1 31 By default, the control will adjust its size to exactly fit to the
32ee98eb 32 size of the text when SetLabel() is called. If this style flag is
23324ae1 33 given, the control will not change its size (this style is
32ee98eb 34 especially useful with controls which also have the @c wxALIGN_RIGHT or
3da9cffc 35 the @c wxALIGN_CENTRE style because otherwise they won't make sense any
32ee98eb 36 longer after a call to SetLabel()).
8c6791e4 37 @style{wxST_ELLIPSIZE_START}
4520d583 38 If the labeltext width exceeds the control width, replace the beginning
5c87527c 39 of the label with an ellipsis; uses wxControl::Ellipsize.
8c6791e4 40 @style{wxST_ELLIPSIZE_MIDDLE}
4520d583 41 If the label text width exceeds the control width, replace the middle
5c87527c 42 of the label with an ellipsis; uses wxControl::Ellipsize.
8c6791e4 43 @style{wxST_ELLIPSIZE_END}
4520d583 44 If the label text width exceeds the control width, replace the end
5c87527c 45 of the label with an ellipsis; uses wxControl::Ellipsize.
23324ae1 46 @endStyleTable
7c913512 47
23324ae1
FM
48 @library{wxcore}
49 @category{ctrl}
7e59b885 50 @appearance{statictext.png}
7c913512 51
e54c96f1 52 @see wxStaticBitmap, wxStaticBox
23324ae1
FM
53*/
54class wxStaticText : public wxControl
55{
56public:
671600d8
RR
57 /**
58 Default constructor.
59 */
60 wxStaticText();
4701dc09 61
23324ae1
FM
62 /**
63 Constructor, creating and showing a text control.
3c4f71cc 64
7c913512 65 @param parent
4cc4bfaf 66 Parent window. Should not be @NULL.
7c913512 67 @param id
4cc4bfaf 68 Control identifier. A value of -1 denotes a default value.
7c913512 69 @param label
4cc4bfaf 70 Text label.
7c913512 71 @param pos
4cc4bfaf 72 Window position.
7c913512 73 @param size
4cc4bfaf 74 Window size.
7c913512 75 @param style
4cc4bfaf 76 Window style. See wxStaticText.
7c913512 77 @param name
4cc4bfaf 78 Window name.
3c4f71cc 79
4cc4bfaf 80 @see Create()
23324ae1 81 */
7c913512
FM
82 wxStaticText(wxWindow* parent, wxWindowID id,
83 const wxString& label,
84 const wxPoint& pos = wxDefaultPosition,
85 const wxSize& size = wxDefaultSize,
86 long style = 0,
11e3af6e 87 const wxString& name = wxStaticTextNameStr);
23324ae1
FM
88
89 /**
90 Creation function, for two-step construction. For details see wxStaticText().
91 */
43c48e1e 92 bool Create(wxWindow* parent, wxWindowID id, const wxString& label,
23324ae1 93 const wxPoint& pos = wxDefaultPosition,
43c48e1e
FM
94 const wxSize& size = wxDefaultSize, long style = 0,
95 const wxString& name = wxStaticTextNameStr);
23324ae1 96
4520d583
FM
97 /**
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.
100 */
101 bool IsEllipsized() const;
102
23324ae1
FM
103 /**
104 This functions wraps the controls label so that each of its lines becomes at
4cc4bfaf 105 most @a width pixels wide if possible (the lines are broken at words
4701dc09
FM
106 boundaries so it might not be the case if words are too long).
107
108 If @a width is negative, no wrapping is done. Note that this width is not
cd3eb0f7
SN
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.
3c4f71cc 111
1e24c2af 112 @since 2.6.2
23324ae1
FM
113 */
114 void Wrap(int width);
115};
e54c96f1 116