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