1 \section{\class{wxStatusBar
}}\label{wxstatusbar
}
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.
7 \helpref{wxWindow
}{wxwindow
}\\
8 \helpref{wxEvtHandler
}{wxevthandler
}\\
9 \helpref{wxObject
}{wxobject
}
11 \wxheading{Derived from
}
13 \helpref{wxWindow
}{wxwindow
}\\
14 \helpref{wxEvtHandler
}{wxevthandler
}\\
15 \helpref{wxObject
}{wxobject
}
17 \wxheading{Include files
}
21 \wxheading{Window styles
}
24 \begin{twocollist
}\itemsep=
0pt
25 \twocolitem{\windowstyle{wxST
\_SIZEGRIP}}{On Windows
95, displays a gripper at right-hand side of
29 See also
\helpref{window styles overview
}{windowstyles
}.
33 It is possible to create controls and other windows on the status bar. Position these windows
34 from an
{\bf OnSize
} event handler.
38 \helpref{wxFrame
}{wxframe
},
\helpref{Status bar sample
}{samplestatbar
}
40 \latexignore{\rtfignore{\wxheading{Members
}}}
42 \membersection{wxStatusBar::wxStatusBar
}\label{wxstatusbarconstr
}
44 \func{}{wxStatusBar
}{\void}
48 \func{}{wxStatusBar
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\rtfsp
49 \param{long
}{ style = wxST
\_SIZEGRIP},
\rtfsp
50 \param{const wxString\&
}{name = ``statusBar"
}}
52 Constructor, creating the window.
54 \wxheading{Parameters
}
56 \docparam{parent
}{The window parent, usually a frame.
}
58 \docparam{id
}{The window identifier. It may take a value of -
1 to indicate a default value.
}
60 \docparam{style
}{The window style. See
\helpref{wxStatusBar
}{wxstatusbar
}.
}
62 \docparam{name
}{The name of the window. This parameter is used to associate a name with the item,
63 allowing the application user to set Motif resource values for
68 \helpref{wxStatusBar::Create
}{wxstatusbarcreate
}
70 \membersection{wxStatusBar::
\destruct{wxStatusBar
}}
72 \func{void
}{\destruct{wxStatusBar
}}{\void}
76 \membersection{wxStatusBar::Create
}\label{wxstatusbarcreate
}
78 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\rtfsp
79 \param{long
}{ style = wxST
\_SIZEGRIP},
\rtfsp
80 \param{const wxString\&
}{name = ``statusBar"
}}
82 Creates the window, for two-step construction.
84 See
\helpref{wxStatusBar::wxStatusBar
}{wxstatusbarconstr
} for details.
86 \membersection{wxStatusBar::GetFieldRect
}\label{wxstatusbargetfieldrect
}
88 \constfunc{virtual bool
}{GetFieldRect
}{\param{int
}{ i
},
\param{wxRect\&
}{ rect
}}
90 Returns the size and position of a fields internal bounding rectangle.
92 \wxheading{Parameters
}
94 \docparam{i
}{The field in question.
}
96 \docparam{rect
}{The rectangle values are placed in this variable.
}
98 \wxheading{Return value
}
100 TRUE if the field index is valid, FALSE otherwise.
104 \helpref{wxRect
}{wxrect
}
106 \perlnote{In wxPerl this function returns a
{\tt Wx::Rect
} if the field
107 index is valid,
{\tt undef
} otherwise.
}
109 \membersection{wxStatusBar::GetFieldsCount
}\label{wxstatusbargetfieldscount
}
111 \constfunc{int
}{GetFieldsCount
}{\void}
113 Returns the number of fields in the status bar.
115 \membersection{wxStatusBar::GetStatusText
}\label{wxstatusbargetstatustext
}
117 \constfunc{virtual wxString
}{GetStatusText
}{\param{int
}{ ir =
0}}
119 Returns the string associated with a status bar field.
121 \wxheading{Parameters
}
123 \docparam{i
}{The number of the status field to retrieve, starting from zero.
}
125 \wxheading{Return value
}
127 The status field string if the field is valid, otherwise the empty string.
131 \helpref{wxStatusBar::SetStatusText
}{wxstatusbarsetstatustext
}
133 \membersection{wxStatusBar::PopStatusText
}\label{wxstatusbarpushstatustext
}
135 \func{void
}{PopStatusText
}{\param{int
}{ field =
0}}
137 Sets the field text to the top of the stack, and pops the stack of saved
142 \helpref{wxStatusBar::PushStatusText
}{wxstatusbarpushstatustext
}
144 \membersection{wxStatusBar::PushStatusText
}\label{wxstatusbarpushstatustext
}
146 \func{void
}{PushStatusText
}{\param{const wxString&
}{ string
},
\param{int
}{ field =
0}}
148 Saves the current field text in a per field stack, and sets the field text
149 to the string passed as argument.
151 %% VZ: these functions are not in wxStatusBar API, these are just
152 %% implementation details of wxStatusBarGeneric
154 %% \membersection{wxStatusBar::DrawField}\label{wxstatusbardrawfield}
156 %% \func{virtual void}{DrawField}{\param{wxDC\& }{dc}, \param{int }{i}}
158 %% Draws a field, including shaded borders and text.
160 %% \wxheading{Parameters}
162 %% \docparam{dc}{The device context to draw onto.}
164 %% \docparam{i}{The field to be drawn.}
166 %% \wxheading{See also}
168 %% \helpref{wxStatusBar::DrawFieldText}{wxstatusbardrawfieldtext}
170 %% \membersection{wxStatusBar::DrawFieldText}\label{wxstatusbardrawfieldtext}
172 %% \func{virtual void}{DrawFieldText}{\param{wxDC\& }{dc}, \param{int }{i}}
174 %% Draws a field's text.
176 %% \wxheading{Parameters}
178 %% \docparam{dc}{The device context to draw onto.}
180 %% \docparam{i}{The field whose text is to be drawn.}
182 %% \wxheading{See also}
184 %% \helpref{wxStatusBar::DrawField}{wxstatusbardrawfield}
186 %% \membersection{wxStatusBar::InitColours}\label{wxstatusbarinitcolours}
188 %% \func{virtual void}{InitColours}{\void}
190 %% Sets up the background colour and shading pens using suitable system colours (Windows) or tasteful shades
191 %% of grey (other platforms).
193 %% \wxheading{Remarks}
195 %% This function is called when the window is created, and also
196 %% from \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} on Windows.
198 %% \wxheading{See also}
200 %% \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged}
202 %% \membersection{wxStatusBar::OnSysColourChanged}\label{wxstatusbaronsyscolourchanged}
204 %% \func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}}
206 %% Handles a system colour change by calling \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours},
207 %% and refreshes the window.
209 %% \wxheading{Parameters}
211 %% \docparam{event}{The colour change event.}
213 %% \wxheading{See also}
215 %% \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours}
217 \membersection{wxStatusBar::SetFieldsCount
}\label{wxstatusbarsetfieldscount
}
219 \func{virtual void
}{SetFieldsCount
}{\param{int
}{ number =
1},
\param{int*
}{widths = NULL
}}
221 Sets the number of fields, and optionally the field widths.
223 \pythonnote{Only the first parameter is accepted. Use SetStatusWidths
224 to set the widths of the fields.
}
226 \perlnote{In wxPerl this function accepts only the
{\tt n
} parameter.
227 Use SetStatusWidths to set the field widths.
}
229 \wxheading{Parameters
}
231 \docparam{number
}{The number of fields.
}
233 \docparam{widths
}{An array of
{\it n
} integers, each of which is a status field width
234 in pixels. A value of -
1 indicates that the field is variable width; at least one
237 \membersection{wxStatusBar::SetMinHeight
}\label{wxstatusbarsetminheight
}
239 \func{void
}{SetMinHeight
}{\param{int
}{ height
}}
241 Sets the minimal possible hight for the status bar. The real height may be
242 bigger than the height specified here depending on the size of the font used by
245 \membersection{wxStatusBar::SetStatusText
}\label{wxstatusbarsetstatustext
}
247 \func{virtual void
}{SetStatusText
}{\param{const wxString\&
}{text
},
\param{int
}{ i =
0}}
249 Sets the text for one field.
251 \wxheading{Parameters
}
253 \docparam{text
}{The text to be set. Use an empty string (``") to clear the field.
}
255 \docparam{i
}{The field to set, starting from zero.
}
259 \helpref{wxStatusBar::GetStatusText
}{wxstatusbargetstatustext
},
\helpref{wxFrame::SetStatusText
}{wxframesetstatustext
}
261 \membersection{wxStatusBar::SetStatusWidths
}\label{wxstatusbarsetstatuswidths
}
263 \func{virtual void
}{SetStatusWidths
}{\param{int
}{ n
},
\param{int *
}{widths
}}
265 Sets the widths of the fields in the status line. There are two types of
266 fields: fixed widths one and variable width fields. For the fixed width fields
267 you should specify their (constant) width in pixels. For the variable width
268 fields, specify a negative number which indicates how should the field expand:
269 the space left for all variable width fields is divided between them according
270 to the absolute value of this number. A variable width field with width of $-
2$
271 gets twice as much of it as a field with width $-
1$ and so on.
273 For example, to create one fixed width field of width $
50$ in the right part of
274 the status bar and two more fields which get $
66$\% and $
33$\% of the remaining
275 space correspondingly, you should use an array containing $-
2$, $-
1$ and $
100$.
277 \wxheading{Parameters
}
279 \docparam{n
}{The number of fields in the status bar. Must be equal to the
280 number passed to
\helpref{SetFieldsCount
}{wxstatusbarsetfieldscount
} the last
283 \docparam{widths
}{Contains an array of
{\it n
} integers, each of which is
284 either an absolute status field width in pixels if positive or indicates a
285 variable width field if negative
}
289 The widths of the variable fields are calculated from the total width of all fields,
290 minus the sum of widths of the non-variable fields, divided by the number of
295 \helpref{wxStatusBar::SetFieldsCount
}{wxstatusbarsetfieldscount
},
\helpref{wxFrame::SetStatusWidths
}{wxframesetstatuswidths
}
297 \pythonnote{Only a single parameter is required, a Python list of
300 \perlnote{In wxPerl this method takes as parameters the field widths.
}