]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/statusbr.tex
Added missing brace in checkbox.tex
[wxWidgets.git] / docs / latex / wx / statusbr.tex
CommitLineData
a660d684
KB
1\section{\class{wxStatusBar}}\label{wxstatusbar}
2
3A status bar is a narrow window that can be placed along the bottom of a frame to give
4small amounts of status information. It can contain one or more fields, one or more of which can
5be 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
9ef63a4a 25\twocolitem{\windowstyle{wxST\_SIZEGRIP}}{On Windows 95, displays a gripper at right-hand side of
81d66cf3
JS
26the status bar.}
27\end{twocollist}
a660d684
KB
28
29See also \helpref{window styles overview}{windowstyles}.
30
31\wxheading{Remarks}
32
33It is possible to create controls and other windows on the status bar. Position these windows
34from 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
46Default 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
53Constructor, 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
62either 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
65either 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,
70allowing the application user to set Motif resource values for
71individual 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
81Destructor.
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
90Creates the window, for two-step construction.
91
92See \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
98Returns 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
108TRUE if the field index is valid, FALSE otherwise.
109
110\wxheading{See also}
111
112\helpref{wxRect}{wxrect}
113
0a67eeac
MB
114\perlnote{In wxPerl this function returns a {\tt Wx::Rect} if the field
115 index is valid, {\tt undef} otherwise.}
116
a660d684
KB
117\membersection{wxStatusBar::GetFieldsCount}\label{wxstatusbargetfieldscount}
118
119\constfunc{int}{GetFieldsCount}{\void}
120
121Returns the number of fields in the status bar.
122
123\membersection{wxStatusBar::GetStatusText}\label{wxstatusbargetstatustext}
124
eaaa6a06 125\constfunc{virtual wxString}{GetStatusText}{\param{int}{ ir = 0}}
a660d684
KB
126
127Returns the string associated with a status bar field.
128
129\wxheading{Parameters}
130
131\docparam{i}{The number of the status field to retrieve, starting from zero.}
132
133\wxheading{Return value}
134
135The status field string if the field is valid, otherwise the empty string.
136
137\wxheading{See also}
138
139\helpref{wxStatusBar::SetStatusText}{wxstatusbarsetstatustext}
140
d1f1e77a
MB
141\membersection{wxStatusBar::PopStatusText}\label{wxstatusbarpushstatustext}
142
143\func{void}{PopStatusText}{\param{int}{ field = 0}}
144
145Sets the field text to the top of the stack, and pops the stack of saved
146strings.
147
148\wxheading{See also}
149
150\helpref{wxStatusBar::PushStatusText}{wxstatusbarpushstatustext}
151
152\membersection{wxStatusBar::PushStatusText}\label{wxstatusbarpushstatustext}
153
154\func{void}{PushStatusText}{\param{const wxString&}{ string}, \param{int}{ field = 0}}
155
156Saves the current field text in a per field stack, and sets the field text
157to the string passed as argument.
158
71e03035
VZ
159%% VZ: these functions are not in wxStatusBar API, these are just
160%% implementation details of wxStatusBarGeneric
161%%
162%% \membersection{wxStatusBar::DrawField}\label{wxstatusbardrawfield}
163%%
164%% \func{virtual void}{DrawField}{\param{wxDC\& }{dc}, \param{int }{i}}
165%%
166%% Draws a field, including shaded borders and text.
167%%
168%% \wxheading{Parameters}
169%%
170%% \docparam{dc}{The device context to draw onto.}
171%%
172%% \docparam{i}{The field to be drawn.}
173%%
174%% \wxheading{See also}
175%%
176%% \helpref{wxStatusBar::DrawFieldText}{wxstatusbardrawfieldtext}
177%%
178%% \membersection{wxStatusBar::DrawFieldText}\label{wxstatusbardrawfieldtext}
179%%
180%% \func{virtual void}{DrawFieldText}{\param{wxDC\& }{dc}, \param{int }{i}}
181%%
182%% Draws a field's text.
183%%
184%% \wxheading{Parameters}
185%%
186%% \docparam{dc}{The device context to draw onto.}
187%%
188%% \docparam{i}{The field whose text is to be drawn.}
189%%
190%% \wxheading{See also}
191%%
192%% \helpref{wxStatusBar::DrawField}{wxstatusbardrawfield}
193%%
194%% \membersection{wxStatusBar::InitColours}\label{wxstatusbarinitcolours}
195%%
196%% \func{virtual void}{InitColours}{\void}
197%%
198%% Sets up the background colour and shading pens using suitable system colours (Windows) or tasteful shades
199%% of grey (other platforms).
200%%
201%% \wxheading{Remarks}
202%%
203%% This function is called when the window is created, and also
204%% from \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} on Windows.
205%%
206%% \wxheading{See also}
207%%
208%% \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged}
209%%
210%% \membersection{wxStatusBar::OnSysColourChanged}\label{wxstatusbaronsyscolourchanged}
211%%
212%% \func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}}
213%%
214%% Handles a system colour change by calling \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours},
215%% and refreshes the window.
216%%
217%% \wxheading{Parameters}
218%%
219%% \docparam{event}{The colour change event.}
220%%
221%% \wxheading{See also}
222%%
223%% \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours}
a660d684
KB
224
225\membersection{wxStatusBar::SetFieldsCount}\label{wxstatusbarsetfieldscount}
226
eaaa6a06 227\func{virtual void}{SetFieldsCount}{\param{int}{ number = 1}, \param{int* }{widths = NULL}}
a660d684
KB
228
229Sets the number of fields, and optionally the field widths.
230
f6bcfd97
BP
231\pythonnote{Only the first parameter is accepted. Use SetStatusWidths
232to set the widths of the fields.}
233
5873607e
VZ
234\perlnote{In wxPerl this function acceps only the {\tt n} parameter.
235Use SetStatusWidths to set the field widths.}
236
a660d684
KB
237\wxheading{Parameters}
238
239\docparam{number}{The number of fields.}
240
241\docparam{widths}{An array of {\it n} integers, each of which is a status field width
242in pixels. A value of -1 indicates that the field is variable width; at least one
243field must be -1.}
244
2531c7e3
VZ
245\membersection{wxStatusBar::SetMinHeight}\label{wxstatusbarsetminheight}
246
247\func{void}{SetMinHeight}{\param{int}{ height}}
248
249Sets the minimal possible hight for the status bar. The real height may be
250bigger than the height specified here depending on the size of the font used by
251the status bar.
252
a660d684
KB
253\membersection{wxStatusBar::SetStatusText}\label{wxstatusbarsetstatustext}
254
eaaa6a06 255\func{virtual void}{SetStatusText}{\param{const wxString\& }{text}, \param{int}{ i = 0}}
a660d684
KB
256
257Sets the text for one field.
258
259\wxheading{Parameters}
260
261\docparam{text}{The text to be set. Use an empty string (``") to clear the field.}
262
263\docparam{i}{The field to set, starting from zero.}
264
265\wxheading{See also}
266
267\helpref{wxStatusBar::GetStatusText}{wxstatusbargetstatustext}, \helpref{wxFrame::SetStatusText}{wxframesetstatustext}
268
269\membersection{wxStatusBar::SetStatusWidths}\label{wxstatusbarsetstatuswidths}
270
eaaa6a06 271\func{virtual void}{SetStatusWidths}{\param{int}{ n}, \param{int *}{widths}}
a660d684 272
71e03035
VZ
273Sets the widths of the fields in the status line. There are two types of
274fields: fixed widths one and variable width fields. For the fixed width fields
275you should specify their (constant) width in pixels. For the variable width
276fields, specify a negative number which indicates how should the field expand:
277the space left for all variable width fields is divided between them according
278to the absolute value of this number. A variable width field with width of $-2$
279gets twice as much of it as a field with width $-1$ and so on.
280
281For example, to create one fixed width field of width $50$ in the right part of
282the status bar and two more fields which get $66$\% and $33$\% of the remaining
283space correspondingly, you should use an array containing $-2$, $-1$ and $100$.
a660d684
KB
284
285\wxheading{Parameters}
286
71e03035
VZ
287\docparam{n}{The number of fields in the status bar. Must be equal to the
288number passed to \helpref{SetFieldsCount}{wxstatusbarsetfieldscount} the last
289time it was called.}
a660d684 290
71e03035
VZ
291\docparam{widths}{Contains an array of {\it n} integers, each of which is
292either an absolute status field width in pixels if positive or indicates a
293variable width field if negative}
a660d684
KB
294
295\wxheading{Remarks}
296
297The widths of the variable fields are calculated from the total width of all fields,
564747ee 298minus the sum of widths of the non-variable fields, divided by the number of
a660d684
KB
299variable fields.
300
301\wxheading{See also}
302
303\helpref{wxStatusBar::SetFieldsCount}{wxstatusbarsetfieldscount}, \helpref{wxFrame::SetStatusWidths}{wxframesetstatuswidths}
304
564747ee
RD
305\pythonnote{Only a single parameter is required, a Python list of
306integers.}
307
5873607e 308\perlnote{In wxPerl this method takes as parameters the field widths.}
a98f98ac 309