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