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