]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/statusbr.h
A lot of documentation revision. Updated doctest code in propgrid sample to reflect...
[wxWidgets.git] / interface / wx / statusbr.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: statusbr.h
e54c96f1 3// Purpose: interface of wxStatusBar
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxStatusBar
7c913512 11
23324ae1
FM
12 A status bar is a narrow window that can be placed along the bottom of a frame
13 to give
14 small amounts of status information. It can contain one or more fields, one or
15 more of which can
16 be variable length according to the size of the window.
7c913512 17
23324ae1 18 wxWindow
7c913512 19
23324ae1 20 wxEvtHandler
7c913512 21
23324ae1 22 wxObject
7c913512 23
23324ae1 24 @beginStyleTable
8c6791e4 25 @style{wxST_SIZEGRIP}
23324ae1
FM
26 On Windows 95, displays a gripper at right-hand side of the status
27 bar.
28 @endStyleTable
7c913512 29
23324ae1
FM
30 @library{wxcore}
31 @category{miscwnd}
7c913512 32
e54c96f1 33 @see wxFrame, @ref overview_samplestatbar "Status bar sample"
23324ae1
FM
34*/
35class wxStatusBar : public wxWindow
36{
37public:
38 //@{
39 /**
40 Constructor, creating the window.
3c4f71cc 41
7c913512 42 @param parent
4cc4bfaf 43 The window parent, usually a frame.
7c913512 44 @param id
4cc4bfaf
FM
45 The window identifier. It may take a value of -1 to indicate a default
46 value.
7c913512 47 @param style
4cc4bfaf 48 The window style. See wxStatusBar.
7c913512 49 @param name
4cc4bfaf 50 The name of the window. This parameter is used to associate a name with the
23324ae1 51 item,
4cc4bfaf
FM
52 allowing the application user to set Motif resource values for
53 individual windows.
3c4f71cc 54
4cc4bfaf 55 @see Create()
23324ae1
FM
56 */
57 wxStatusBar();
7c913512
FM
58 wxStatusBar(wxWindow* parent, wxWindowID id = wxID_ANY,
59 long style = wxST_SIZEGRIP,
60 const wxString& name = "statusBar");
23324ae1
FM
61 //@}
62
63 /**
64 Destructor.
65 */
66 ~wxStatusBar();
67
68 /**
69 Creates the window, for two-step construction.
23324ae1
FM
70 See wxStatusBar() for details.
71 */
72 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
73 long style = wxST_SIZEGRIP,
74 const wxString& name = "statusBar");
75
76 /**
77 Returns the size and position of a field's internal bounding rectangle.
3c4f71cc 78
7c913512 79 @param i
4cc4bfaf 80 The field in question.
7c913512 81 @param rect
4cc4bfaf 82 The rectangle values are placed in this variable.
3c4f71cc 83
d29a9a8a 84 @return @true if the field index is valid, @false otherwise.
3c4f71cc 85
4cc4bfaf 86 @see wxRect
23324ae1 87 */
328f5751 88 virtual bool GetFieldRect(int i, wxRect& rect) const;
23324ae1
FM
89
90 /**
91 Returns the number of fields in the status bar.
92 */
328f5751 93 int GetFieldsCount() const;
23324ae1
FM
94
95 /**
96 Returns the string associated with a status bar field.
3c4f71cc 97
7c913512 98 @param i
4cc4bfaf 99 The number of the status field to retrieve, starting from zero.
3c4f71cc 100
d29a9a8a 101 @return The status field string if the field is valid, otherwise the
4cc4bfaf 102 empty string.
3c4f71cc 103
4cc4bfaf 104 @see SetStatusText()
23324ae1 105 */
328f5751 106 virtual wxString GetStatusText(int i = 0) const;
23324ae1
FM
107
108 /**
109 Sets the field text to the top of the stack, and pops the stack of saved
110 strings.
3c4f71cc 111
4cc4bfaf 112 @see PushStatusText()
23324ae1
FM
113 */
114 void PopStatusText(int field = 0);
115
116 /**
117 Saves the current field text in a per field stack, and sets the field text
118 to the string passed as argument.
119 */
120 void PushStatusText(const wxString& string, int field = 0);
121
122 /**
123 Sets the number of fields, and optionally the field widths.
3c4f71cc 124
7c913512 125 @param number
4cc4bfaf 126 The number of fields.
7c913512 127 @param widths
4cc4bfaf
FM
128 An array of n integers interpreted in the same way as
129 in SetStatusWidths
23324ae1 130 */
4cc4bfaf 131 virtual void SetFieldsCount(int number = 1, int* widths = NULL);
23324ae1
FM
132
133 /**
134 Sets the minimal possible height for the status bar. The real height may be
135 bigger than the height specified here depending on the size of the font used by
136 the status bar.
137 */
138 void SetMinHeight(int height);
139
140 /**
141 Sets the styles of the fields in the status line which can make fields appear
142 flat
143 or raised instead of the standard sunken 3D border.
3c4f71cc 144
7c913512 145 @param n
4cc4bfaf
FM
146 The number of fields in the status bar. Must be equal to the
147 number passed to SetFieldsCount the last
148 time it was called.
7c913512 149 @param styles
4cc4bfaf
FM
150 Contains an array of n integers with the styles for each field. There
151 are three possible styles:
3c4f71cc
VS
152
153
154
155
156
157
158
4cc4bfaf 159 wxSB_NORMAL
3c4f71cc
VS
160
161
162
163
4cc4bfaf 164 (default) The field appears sunken with a standard 3D border.
3c4f71cc
VS
165
166
167
168
169
4cc4bfaf 170 wxSB_FLAT
3c4f71cc
VS
171
172
173
174
4cc4bfaf 175 No border is painted around the field so that it appears flat.
3c4f71cc
VS
176
177
178
179
180
4cc4bfaf 181 wxSB_RAISED
3c4f71cc
VS
182
183
184
185
4cc4bfaf 186 A raised 3D border is painted around the field.
23324ae1 187 */
4cc4bfaf 188 virtual void SetStatusStyles(int n, int* styles);
23324ae1
FM
189
190 /**
191 Sets the text for one field.
3c4f71cc 192
7c913512 193 @param text
4cc4bfaf 194 The text to be set. Use an empty string ("") to clear the field.
7c913512 195 @param i
4cc4bfaf 196 The field to set, starting from zero.
3c4f71cc 197
4cc4bfaf 198 @see GetStatusText(), wxFrame::SetStatusText
23324ae1
FM
199 */
200 virtual void SetStatusText(const wxString& text, int i = 0);
201
202 /**
203 Sets the widths of the fields in the status line. There are two types of
204 fields: fixed widths one and variable width fields. For the fixed width fields
205 you should specify their (constant) width in pixels. For the variable width
206 fields, specify a negative number which indicates how the field should expand:
207 the space left for all variable width fields is divided between them according
208 to the absolute value of this number. A variable width field with width of -2
209 gets twice as much of it as a field with width -1 and so on.
23324ae1
FM
210 For example, to create one fixed width field of width 100 in the right part of
211 the status bar and two more fields which get 66% and 33% of the remaining
212 space correspondingly, you should use an array containing -2, -1 and 100.
3c4f71cc 213
7c913512 214 @param n
4cc4bfaf
FM
215 The number of fields in the status bar. Must be equal to the
216 number passed to SetFieldsCount the last
217 time it was called.
7c913512 218 @param widths
4cc4bfaf
FM
219 Contains an array of n integers, each of which is
220 either an absolute status field width in pixels if positive or indicates a
221 variable width field if negative.
3c4f71cc 222
23324ae1 223 @remarks The widths of the variable fields are calculated from the total
4cc4bfaf
FM
224 width of all fields, minus the sum of widths of the
225 non-variable fields, divided by the number of variable
226 fields.
3c4f71cc 227
4cc4bfaf 228 @see SetFieldsCount(), wxFrame::SetStatusWidths
23324ae1 229 */
4cc4bfaf 230 virtual void SetStatusWidths(int n, int* widths);
23324ae1 231};
e54c96f1 232