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{wxSB
\_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{const wxPoint\&
}{ pos = wxDefaultPosition
},
\rtfsp
50 \param{const wxSize\&
}{ size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
51 \param{const wxString\&
}{name = ``statusBar"
}}
53 Constructor, creating the window.
55 \wxheading{Parameters
}
57 \docparam{parent
}{The window parent, usually a frame.
}
59 \docparam{id
}{The window identifier. It may take a value of -
1 to indicate a default value.
}
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.
}
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.
}
67 \docparam{style
}{The window style. See
\helpref{wxStatusBar
}{wxstatusbar
}.
}
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
75 \helpref{wxStatusBar::Create
}{wxstatusbarcreate
}
77 \membersection{wxStatusBar::
\destruct{wxStatusBar
}}
79 \func{void
}{\destruct{wxStatusBar
}}{\void}
83 \membersection{wxStatusBar::Create
}\label{wxstatusbarcreate
}
85 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id
},
\rtfsp
86 \param{const wxPoint\&
}{ pos = wxDefaultPosition
},
\rtfsp
87 \param{const wxSize\&
}{ size = wxDefaultSize
},
\param{long
}{ style =
0},
\rtfsp
88 \param{const wxString\&
}{name = ``statusBar"
}}
90 Creates the window, for two-step construction.
92 See
\helpref{wxStatusBar::wxStatusBar
}{wxstatusbarconstr
} for details.
94 \membersection{wxStatusBar::GetFieldRect
}\label{wxstatusbargetfieldrect
}
96 \constfunc{virtual bool
}{GetFieldRect
}{\param{int
}{ i
},
\param{wxRect\&
}{ rect
}}
98 Returns the size and position of a fields internal bounding rectangle.
100 \wxheading{Parameters
}
102 \docparam{i
}{The field in question.
}
104 \docparam{rect
}{The rectangle values are placed in this variable.
}
106 \wxheading{Return value
}
108 TRUE if the field index is valid, FALSE otherwise.
112 \helpref{wxRect
}{wxrect
}
114 \perlnote{In wxPerl this function returns a
{\tt Wx::Rect
} if the field
115 index is valid,
{\tt undef
} otherwise.
}
117 \membersection{wxStatusBar::GetFieldsCount
}\label{wxstatusbargetfieldscount
}
119 \constfunc{int
}{GetFieldsCount
}{\void}
121 Returns the number of fields in the status bar.
123 \membersection{wxStatusBar::GetStatusText
}\label{wxstatusbargetstatustext
}
125 \constfunc{virtual wxString
}{GetStatusText
}{\param{int
}{ ir =
0}}
127 Returns the string associated with a status bar field.
129 \wxheading{Parameters
}
131 \docparam{i
}{The number of the status field to retrieve, starting from zero.
}
133 \wxheading{Return value
}
135 The status field string if the field is valid, otherwise the empty string.
139 \helpref{wxStatusBar::SetStatusText
}{wxstatusbarsetstatustext
}
141 %% VZ: these functions are not in wxStatusBar API, these are just
142 %% implementation details of wxStatusBarGeneric
144 %% \membersection{wxStatusBar::DrawField}\label{wxstatusbardrawfield}
146 %% \func{virtual void}{DrawField}{\param{wxDC\& }{dc}, \param{int }{i}}
148 %% Draws a field, including shaded borders and text.
150 %% \wxheading{Parameters}
152 %% \docparam{dc}{The device context to draw onto.}
154 %% \docparam{i}{The field to be drawn.}
156 %% \wxheading{See also}
158 %% \helpref{wxStatusBar::DrawFieldText}{wxstatusbardrawfieldtext}
160 %% \membersection{wxStatusBar::DrawFieldText}\label{wxstatusbardrawfieldtext}
162 %% \func{virtual void}{DrawFieldText}{\param{wxDC\& }{dc}, \param{int }{i}}
164 %% Draws a field's text.
166 %% \wxheading{Parameters}
168 %% \docparam{dc}{The device context to draw onto.}
170 %% \docparam{i}{The field whose text is to be drawn.}
172 %% \wxheading{See also}
174 %% \helpref{wxStatusBar::DrawField}{wxstatusbardrawfield}
176 %% \membersection{wxStatusBar::InitColours}\label{wxstatusbarinitcolours}
178 %% \func{virtual void}{InitColours}{\void}
180 %% Sets up the background colour and shading pens using suitable system colours (Windows) or tasteful shades
181 %% of grey (other platforms).
183 %% \wxheading{Remarks}
185 %% This function is called when the window is created, and also
186 %% from \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged} on Windows.
188 %% \wxheading{See also}
190 %% \helpref{wxStatusBar::OnSysColourChanged}{wxstatusbaronsyscolourchanged}
192 %% \membersection{wxStatusBar::OnSysColourChanged}\label{wxstatusbaronsyscolourchanged}
194 %% \func{void}{OnSysColourChanged}{\param{wxSysColourChangedEvent\& }{event}}
196 %% Handles a system colour change by calling \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours},
197 %% and refreshes the window.
199 %% \wxheading{Parameters}
201 %% \docparam{event}{The colour change event.}
203 %% \wxheading{See also}
205 %% \helpref{wxStatusBar::InitColours}{wxstatusbarinitcolours}
207 \membersection{wxStatusBar::SetFieldsCount
}\label{wxstatusbarsetfieldscount
}
209 \func{virtual void
}{SetFieldsCount
}{\param{int
}{ number =
1},
\param{int*
}{widths = NULL
}}
211 Sets the number of fields, and optionally the field widths.
213 \pythonnote{Only the first parameter is accepted. Use SetStatusWidths
214 to set the widths of the fields.
}
216 \perlnote{In wxPerl this function acceps only the
{\tt n
} parameter.
217 Use SetStatusWidths to set the field widths.
}
219 \wxheading{Parameters
}
221 \docparam{number
}{The number of fields.
}
223 \docparam{widths
}{An array of
{\it n
} integers, each of which is a status field width
224 in pixels. A value of -
1 indicates that the field is variable width; at least one
227 \membersection{wxStatusBar::SetMinHeight
}\label{wxstatusbarsetminheight
}
229 \func{void
}{SetMinHeight
}{\param{int
}{ height
}}
231 Sets the minimal possible hight for the status bar. The real height may be
232 bigger than the height specified here depending on the size of the font used by
235 \membersection{wxStatusBar::SetStatusText
}\label{wxstatusbarsetstatustext
}
237 \func{virtual void
}{SetStatusText
}{\param{const wxString\&
}{text
},
\param{int
}{ i =
0}}
239 Sets the text for one field.
241 \wxheading{Parameters
}
243 \docparam{text
}{The text to be set. Use an empty string (``") to clear the field.
}
245 \docparam{i
}{The field to set, starting from zero.
}
249 \helpref{wxStatusBar::GetStatusText
}{wxstatusbargetstatustext
},
\helpref{wxFrame::SetStatusText
}{wxframesetstatustext
}
251 \membersection{wxStatusBar::SetStatusWidths
}\label{wxstatusbarsetstatuswidths
}
253 \func{virtual void
}{SetStatusWidths
}{\param{int
}{ n
},
\param{int *
}{widths
}}
255 Sets the widths of the fields in the status line. There are two types of
256 fields: fixed widths one and variable width fields. For the fixed width fields
257 you should specify their (constant) width in pixels. For the variable width
258 fields, specify a negative number which indicates how should the field expand:
259 the space left for all variable width fields is divided between them according
260 to the absolute value of this number. A variable width field with width of $-
2$
261 gets twice as much of it as a field with width $-
1$ and so on.
263 For example, to create one fixed width field of width $
50$ in the right part of
264 the status bar and two more fields which get $
66$\% and $
33$\% of the remaining
265 space correspondingly, you should use an array containing $-
2$, $-
1$ and $
100$.
267 \wxheading{Parameters
}
269 \docparam{n
}{The number of fields in the status bar. Must be equal to the
270 number passed to
\helpref{SetFieldsCount
}{wxstatusbarsetfieldscount
} the last
273 \docparam{widths
}{Contains an array of
{\it n
} integers, each of which is
274 either an absolute status field width in pixels if positive or indicates a
275 variable width field if negative
}
279 The widths of the variable fields are calculated from the total width of all fields,
280 minus the sum of widths of the non-variable fields, divided by the number of
285 \helpref{wxStatusBar::SetFieldsCount
}{wxstatusbarsetfieldscount
},
\helpref{wxFrame::SetStatusWidths
}{wxframesetstatuswidths
}
287 \pythonnote{Only a single parameter is required, a Python list of
290 \perlnote{In wxPerl this method takes as parameters the field widths.
}