]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxStatusBar}}\label{wxstatusbar} |
2 | ||
3 | A status bar is a narrow window that can be placed along the bottom of a frame to give | |
4 | small amounts of status information. It can contain one or more fields, one or more of which can | |
5 | be variable length according to the size of the window. | |
6 | ||
7 | \helpref{wxWindow}{wxwindow}\\ | |
8 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
9 | \helpref{wxObject}{wxobject} | |
10 | ||
954b8ae6 JS |
11 | \wxheading{Derived from} |
12 | ||
13 | \helpref{wxWindow}{wxwindow}\\ | |
14 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
15 | \helpref{wxObject}{wxobject} | |
16 | ||
17 | \wxheading{Include files} | |
18 | ||
19 | <wx/statusbr.h> | |
20 | ||
a660d684 KB |
21 | \wxheading{Window styles} |
22 | ||
81d66cf3 JS |
23 | \twocolwidtha{5cm} |
24 | \begin{twocollist}\itemsep=0pt | |
25 | \twocolitem{\windowstyle{wxSB\_SIZEGRIP}}{On Windows 95, displays a gripper at right-hand side of | |
26 | the status bar.} | |
27 | \end{twocollist} | |
a660d684 KB |
28 | |
29 | See also \helpref{window styles overview}{windowstyles}. | |
30 | ||
31 | \wxheading{Remarks} | |
32 | ||
33 | It is possible to create controls and other windows on the status bar. Position these windows | |
34 | from an {\bf OnSize} event handler. | |
35 | ||
36 | \wxheading{See also} | |
37 | ||
2286341c | 38 | \helpref{wxFrame}{wxframe}, \helpref{Status bar sample}{samplestatbar} |
a660d684 KB |
39 | |
40 | \latexignore{\rtfignore{\wxheading{Members}}} | |
41 | ||
42 | \membersection{wxStatusBar::wxStatusBar}\label{wxstatusbarconstr} | |
43 | ||
44 | \func{}{wxStatusBar}{\void} | |
45 | ||
46 | Default constructor. | |
47 | ||
eaaa6a06 | 48 | \func{}{wxStatusBar}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp |
a660d684 KB |
49 | \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp |
50 | \param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
51 | \param{const wxString\& }{name = ``statusBar"}} | |
52 | ||
53 | Constructor, creating the window. | |
54 | ||
55 | \wxheading{Parameters} | |
56 | ||
57 | \docparam{parent}{The window parent, usually a frame.} | |
58 | ||
59 | \docparam{id}{The window identifier. It may take a value of -1 to indicate a default value.} | |
60 | ||
61 | \docparam{pos}{The window position. A value of (-1, -1) indicates a default position, chosen by | |
62 | either the windowing system or wxWindows, depending on platform.} | |
63 | ||
64 | \docparam{size}{The window size. A value of (-1, -1) indicates a default size, chosen by | |
65 | either the windowing system or wxWindows, depending on platform.} | |
66 | ||
67 | \docparam{style}{The window style. See \helpref{wxStatusBar}{wxstatusbar}.} | |
68 | ||
69 | \docparam{name}{The name of the window. This parameter is used to associate a name with the item, | |
70 | allowing the application user to set Motif resource values for | |
71 | individual windows.} | |
72 | ||
73 | \wxheading{See also} | |
74 | ||
75 | \helpref{wxStatusBar::Create}{wxstatusbarcreate} | |
76 | ||
77 | \membersection{wxStatusBar::\destruct{wxStatusBar}} | |
78 | ||
79 | \func{void}{\destruct{wxStatusBar}}{\void} | |
80 | ||
81 | Destructor. | |
82 | ||
83 | \membersection{wxStatusBar::Create}\label{wxstatusbarcreate} | |
84 | ||
eaaa6a06 | 85 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp |
a660d684 KB |
86 | \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp |
87 | \param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = 0},\rtfsp | |
88 | \param{const wxString\& }{name = ``statusBar"}} | |
89 | ||
90 | Creates the window, for two-step construction. | |
91 | ||
92 | See \helpref{wxStatusBar::wxStatusBar}{wxstatusbarconstr} for details. | |
93 | ||
94 | \membersection{wxStatusBar::GetFieldRect}\label{wxstatusbargetfieldrect} | |
95 | ||
eaaa6a06 | 96 | \constfunc{virtual bool}{GetFieldRect}{\param{int}{ i}, \param{wxRect\&}{ rect}} |
a660d684 KB |
97 | |
98 | Returns the size and position of a fields internal bounding rectangle. | |
99 | ||
100 | \wxheading{Parameters} | |
101 | ||
102 | \docparam{i}{The field in question.} | |
103 | ||
104 | \docparam{rect}{The rectangle values are placed in this variable.} | |
105 | ||
106 | \wxheading{Return value} | |
107 | ||
108 | TRUE if the field index is valid, FALSE otherwise. | |
109 | ||
110 | \wxheading{See also} | |
111 | ||
112 | \helpref{wxRect}{wxrect} | |
113 | ||
114 | \membersection{wxStatusBar::GetFieldsCount}\label{wxstatusbargetfieldscount} | |
115 | ||
116 | \constfunc{int}{GetFieldsCount}{\void} | |
117 | ||
118 | Returns the number of fields in the status bar. | |
119 | ||
120 | \membersection{wxStatusBar::GetStatusText}\label{wxstatusbargetstatustext} | |
121 | ||
eaaa6a06 | 122 | \constfunc{virtual wxString}{GetStatusText}{\param{int}{ ir = 0}} |
a660d684 KB |
123 | |
124 | Returns the string associated with a status bar field. | |
125 | ||
126 | \wxheading{Parameters} | |
127 | ||
128 | \docparam{i}{The number of the status field to retrieve, starting from zero.} | |
129 | ||
130 | \wxheading{Return value} | |
131 | ||
132 | The status field string if the field is valid, otherwise the empty string. | |
133 | ||
134 | \wxheading{See also} | |
135 | ||
136 | \helpref{wxStatusBar::SetStatusText}{wxstatusbarsetstatustext} | |
137 | ||
71e03035 VZ |
138 | %% VZ: these functions are not in wxStatusBar API, these are just |
139 | %% implementation details of wxStatusBarGeneric | |
140 | %% | |
141 | %% \membersection{wxStatusBar::DrawField}\label{wxstatusbardrawfield} | |
142 | %% | |
143 | %% \func{virtual void}{DrawField}{\param{wxDC\& }{dc}, \param{int }{i}} | |
144 | %% | |
145 | %% Draws a field, including shaded borders and text. | |
146 | %% | |
147 | %% \wxheading{Parameters} | |
148 | %% | |
149 | %% \docparam{dc}{The device context to draw onto.} | |
150 | %% | |
151 | %% \docparam{i}{The field to be drawn.} | |
152 | %% | |
153 | %% \wxheading{See also} | |
154 | %% | |
155 | %% \helpref{wxStatusBar::DrawFieldText}{wxstatusbardrawfieldtext} | |
156 | %% | |
157 | %% \membersection{wxStatusBar::DrawFieldText}\label{wxstatusbardrawfieldtext} | |
158 | %% | |
159 | %% \func{virtual void}{DrawFieldText}{\param{wxDC\& }{dc}, \param{int }{i}} | |
160 | %% | |
161 | %% Draws a field's text. | |
162 | %% | |
163 | %% \wxheading{Parameters} | |
164 | %% | |
165 | %% \docparam{dc}{The device context to draw onto.} | |
166 | %% | |
167 | %% \docparam{i}{The field whose text is to be drawn.} | |
168 | %% | |
169 | %% \wxheading{See also} | |
170 | %% | |
171 | %% \helpref{wxStatusBar::DrawField}{wxstatusbardrawfield} | |
172 | %% | |
173 | %% \membersection{wxStatusBar::InitColours}\label{wxstatusbarinitcolours} | |
174 | %% | |
175 | %% \func{virtual void}{InitColours}{\void} | |
176 | %% | |
177 | %% Sets up the background colour and shading pens using suitable system colours (Windows) or tasteful shades | |
178 | %% of grey (other platforms). | |
179 | %% | |
180 | %% \wxheading{Remarks} | |
181 | %% | |
182 | %% This function is called when the window is created, and also | |
183 | %% from \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} on Windows. | |
184 | %% | |
185 | %% \wxheading{See also} | |
186 | %% | |
187 | %% \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} | |
188 | %% | |
189 | %% \membersection{wxStatusBar::OnSysColourChanged}\label{wxstatusbaronsyscolourchanged} | |
190 | %% | |
191 | %% \func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}} | |
192 | %% | |
193 | %% Handles a system colour change by calling \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours}, | |
194 | %% and refreshes the window. | |
195 | %% | |
196 | %% \wxheading{Parameters} | |
197 | %% | |
198 | %% \docparam{event}{The colour change event.} | |
199 | %% | |
200 | %% \wxheading{See also} | |
201 | %% | |
202 | %% \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours} | |
a660d684 KB |
203 | |
204 | \membersection{wxStatusBar::SetFieldsCount}\label{wxstatusbarsetfieldscount} | |
205 | ||
eaaa6a06 | 206 | \func{virtual void}{SetFieldsCount}{\param{int}{ number = 1}, \param{int* }{widths = NULL}} |
a660d684 KB |
207 | |
208 | Sets the number of fields, and optionally the field widths. | |
209 | ||
f6bcfd97 BP |
210 | \pythonnote{Only the first parameter is accepted. Use SetStatusWidths |
211 | to set the widths of the fields.} | |
212 | ||
5873607e VZ |
213 | \perlnote{In wxPerl this function acceps only the {\tt n} parameter. |
214 | Use SetStatusWidths to set the field widths.} | |
215 | ||
a660d684 KB |
216 | \wxheading{Parameters} |
217 | ||
218 | \docparam{number}{The number of fields.} | |
219 | ||
220 | \docparam{widths}{An array of {\it n} integers, each of which is a status field width | |
221 | in pixels. A value of -1 indicates that the field is variable width; at least one | |
222 | field must be -1.} | |
223 | ||
2531c7e3 VZ |
224 | \membersection{wxStatusBar::SetMinHeight}\label{wxstatusbarsetminheight} |
225 | ||
226 | \func{void}{SetMinHeight}{\param{int}{ height}} | |
227 | ||
228 | Sets the minimal possible hight for the status bar. The real height may be | |
229 | bigger than the height specified here depending on the size of the font used by | |
230 | the status bar. | |
231 | ||
a660d684 KB |
232 | \membersection{wxStatusBar::SetStatusText}\label{wxstatusbarsetstatustext} |
233 | ||
eaaa6a06 | 234 | \func{virtual void}{SetStatusText}{\param{const wxString\& }{text}, \param{int}{ i = 0}} |
a660d684 KB |
235 | |
236 | Sets the text for one field. | |
237 | ||
238 | \wxheading{Parameters} | |
239 | ||
240 | \docparam{text}{The text to be set. Use an empty string (``") to clear the field.} | |
241 | ||
242 | \docparam{i}{The field to set, starting from zero.} | |
243 | ||
244 | \wxheading{See also} | |
245 | ||
246 | \helpref{wxStatusBar::GetStatusText}{wxstatusbargetstatustext}, \helpref{wxFrame::SetStatusText}{wxframesetstatustext} | |
247 | ||
248 | \membersection{wxStatusBar::SetStatusWidths}\label{wxstatusbarsetstatuswidths} | |
249 | ||
eaaa6a06 | 250 | \func{virtual void}{SetStatusWidths}{\param{int}{ n}, \param{int *}{widths}} |
a660d684 | 251 | |
71e03035 VZ |
252 | Sets the widths of the fields in the status line. There are two types of |
253 | fields: fixed widths one and variable width fields. For the fixed width fields | |
254 | you should specify their (constant) width in pixels. For the variable width | |
255 | fields, specify a negative number which indicates how should the field expand: | |
256 | the space left for all variable width fields is divided between them according | |
257 | to the absolute value of this number. A variable width field with width of $-2$ | |
258 | gets twice as much of it as a field with width $-1$ and so on. | |
259 | ||
260 | For example, to create one fixed width field of width $50$ in the right part of | |
261 | the status bar and two more fields which get $66$\% and $33$\% of the remaining | |
262 | space correspondingly, you should use an array containing $-2$, $-1$ and $100$. | |
a660d684 KB |
263 | |
264 | \wxheading{Parameters} | |
265 | ||
71e03035 VZ |
266 | \docparam{n}{The number of fields in the status bar. Must be equal to the |
267 | number passed to \helpref{SetFieldsCount}{wxstatusbarsetfieldscount} the last | |
268 | time it was called.} | |
a660d684 | 269 | |
71e03035 VZ |
270 | \docparam{widths}{Contains an array of {\it n} integers, each of which is |
271 | either an absolute status field width in pixels if positive or indicates a | |
272 | variable width field if negative} | |
a660d684 KB |
273 | |
274 | \wxheading{Remarks} | |
275 | ||
276 | The widths of the variable fields are calculated from the total width of all fields, | |
564747ee | 277 | minus the sum of widths of the non-variable fields, divided by the number of |
a660d684 KB |
278 | variable fields. |
279 | ||
280 | \wxheading{See also} | |
281 | ||
282 | \helpref{wxStatusBar::SetFieldsCount}{wxstatusbarsetfieldscount}, \helpref{wxFrame::SetStatusWidths}{wxframesetstatuswidths} | |
283 | ||
564747ee RD |
284 | \pythonnote{Only a single parameter is required, a Python list of |
285 | integers.} | |
286 | ||
5873607e | 287 | \perlnote{In wxPerl this method takes as parameters the field widths.} |
a98f98ac | 288 |