]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/statusbr.tex
added null pointer check and assert
[wxWidgets.git] / docs / latex / wx / statusbr.tex
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
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
21 \wxheading{Library}
22
23 \helpref{wxCore}{librarieslist}
24
25 \wxheading{Window styles}
26
27 \twocolwidtha{5cm}
28 \begin{twocollist}\itemsep=0pt
29 \twocolitem{\windowstyle{wxST\_SIZEGRIP}}{On Windows 95, displays a gripper at right-hand side of
30 the status bar.}
31 \end{twocollist}
32
33 See also \helpref{window styles overview}{windowstyles}.
34
35 \wxheading{Remarks}
36
37 It is possible to create controls and other windows on the status bar. Position these windows
38 from an {\bf OnSize} event handler.
39
40 \wxheading{See also}
41
42 \helpref{wxFrame}{wxframe}, \helpref{Status bar sample}{samplestatbar}
43
44 \latexignore{\rtfignore{\wxheading{Members}}}
45
46 \membersection{wxStatusBar::wxStatusBar}\label{wxstatusbarctor}
47
48 \func{}{wxStatusBar}{\void}
49
50 Default constructor.
51
52 \func{}{wxStatusBar}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY},\rtfsp
53 \param{long}{ style = wxST\_SIZEGRIP},\rtfsp
54 \param{const wxString\& }{name = ``statusBar"}}
55
56 Constructor, creating the window.
57
58 \wxheading{Parameters}
59
60 \docparam{parent}{The window parent, usually a frame.}
61
62 \docparam{id}{The window identifier. It may take a value of -1 to indicate a default value.}
63
64 \docparam{style}{The window style. See \helpref{wxStatusBar}{wxstatusbar}.}
65
66 \docparam{name}{The name of the window. This parameter is used to associate a name with the item,
67 allowing the application user to set Motif resource values for
68 individual windows.}
69
70 \wxheading{See also}
71
72 \helpref{wxStatusBar::Create}{wxstatusbarcreate}
73
74 \membersection{wxStatusBar::\destruct{wxStatusBar}}\label{wxstatusbardtor}
75
76 \func{void}{\destruct{wxStatusBar}}{\void}
77
78 Destructor.
79
80 \membersection{wxStatusBar::Create}\label{wxstatusbarcreate}
81
82 \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id = wxID\_ANY},\rtfsp
83 \param{long}{ style = wxST\_SIZEGRIP},\rtfsp
84 \param{const wxString\& }{name = ``statusBar"}}
85
86 Creates the window, for two-step construction.
87
88 See \helpref{wxStatusBar::wxStatusBar}{wxstatusbarctor} for details.
89
90 \membersection{wxStatusBar::GetFieldRect}\label{wxstatusbargetfieldrect}
91
92 \constfunc{virtual bool}{GetFieldRect}{\param{int}{ i}, \param{wxRect\&}{ rect}}
93
94 Returns the size and position of a field's internal bounding rectangle.
95
96 \wxheading{Parameters}
97
98 \docparam{i}{The field in question.}
99
100 \docparam{rect}{The rectangle values are placed in this variable.}
101
102 \wxheading{Return value}
103
104 true if the field index is valid, false otherwise.
105
106 \wxheading{See also}
107
108 \helpref{wxRect}{wxrect}
109
110 \perlnote{In wxPerl this function returns a {\tt Wx::Rect} if the field
111 index is valid, {\tt undef} otherwise.}
112
113 \membersection{wxStatusBar::GetFieldsCount}\label{wxstatusbargetfieldscount}
114
115 \constfunc{int}{GetFieldsCount}{\void}
116
117 Returns the number of fields in the status bar.
118
119 \membersection{wxStatusBar::GetStatusText}\label{wxstatusbargetstatustext}
120
121 \constfunc{virtual wxString}{GetStatusText}{\param{int}{ i = 0}}
122
123 Returns the string associated with a status bar field.
124
125 \wxheading{Parameters}
126
127 \docparam{i}{The number of the status field to retrieve, starting from zero.}
128
129 \wxheading{Return value}
130
131 The status field string if the field is valid, otherwise the empty string.
132
133 \wxheading{See also}
134
135 \helpref{wxStatusBar::SetStatusText}{wxstatusbarsetstatustext}
136
137 \membersection{wxStatusBar::PopStatusText}\label{wxstatusbarpopstatustext}
138
139 \func{void}{PopStatusText}{\param{int}{ field = 0}}
140
141 Sets the field text to the top of the stack, and pops the stack of saved
142 strings.
143
144 \wxheading{See also}
145
146 \helpref{wxStatusBar::PushStatusText}{wxstatusbarpushstatustext}
147
148 \membersection{wxStatusBar::PushStatusText}\label{wxstatusbarpushstatustext}
149
150 \func{void}{PushStatusText}{\param{const wxString\&}{ string}, \param{int}{ field = 0}}
151
152 Saves the current field text in a per field stack, and sets the field text
153 to the string passed as argument.
154
155 \membersection{wxStatusBar::SetFieldsCount}\label{wxstatusbarsetfieldscount}
156
157 \func{virtual void}{SetFieldsCount}{\param{int}{ number = 1}, \param{int* }{widths = NULL}}
158
159 Sets the number of fields, and optionally the field widths.
160
161 \pythonnote{Only the first parameter is accepted. Use SetStatusWidths
162 to set the widths of the fields.}
163
164 \perlnote{In wxPerl this function accepts only the {\tt n} parameter.
165 Use SetStatusWidths to set the field widths.}
166
167 \wxheading{Parameters}
168
169 \docparam{number}{The number of fields.}
170
171 \docparam{widths}{An array of {\it n} integers interpreted in the same way as
172 in \helpref{SetStatusWidths}{wxstatusbarsetstatuswidths}}
173
174 \membersection{wxStatusBar::SetMinHeight}\label{wxstatusbarsetminheight}
175
176 \func{void}{SetMinHeight}{\param{int}{ height}}
177
178 Sets the minimal possible height for the status bar. The real height may be
179 bigger than the height specified here depending on the size of the font used by
180 the status bar.
181
182 \membersection{wxStatusBar::SetStatusText}\label{wxstatusbarsetstatustext}
183
184 \func{virtual void}{SetStatusText}{\param{const wxString\& }{text}, \param{int}{ i = 0}}
185
186 Sets the text for one field.
187
188 \wxheading{Parameters}
189
190 \docparam{text}{The text to be set. Use an empty string (``") to clear the field.}
191
192 \docparam{i}{The field to set, starting from zero.}
193
194 \wxheading{See also}
195
196 \helpref{wxStatusBar::GetStatusText}{wxstatusbargetstatustext}, \helpref{wxFrame::SetStatusText}{wxframesetstatustext}
197
198 \membersection{wxStatusBar::SetStatusWidths}\label{wxstatusbarsetstatuswidths}
199
200 \func{virtual void}{SetStatusWidths}{\param{int}{ n}, \param{int *}{widths}}
201
202 Sets the widths of the fields in the status line. There are two types of
203 fields: fixed widths one and variable width fields. For the fixed width fields
204 you should specify their (constant) width in pixels. For the variable width
205 fields, specify a negative number which indicates how the field should expand:
206 the space left for all variable width fields is divided between them according
207 to the absolute value of this number. A variable width field with width of $-2$
208 gets twice as much of it as a field with width $-1$ and so on.
209
210 For example, to create one fixed width field of width $100$ in the right part of
211 the status bar and two more fields which get $66$\% and $33$\% of the remaining
212 space correspondingly, you should use an array containing $-2$, $-1$ and $100$.
213
214 \wxheading{Parameters}
215
216 \docparam{n}{The number of fields in the status bar. Must be equal to the
217 number passed to \helpref{SetFieldsCount}{wxstatusbarsetfieldscount} the last
218 time it was called.}
219
220 \docparam{widths}{Contains an array of {\it 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 \wxheading{Remarks}
225
226 The widths of the variable fields are calculated from the total width of all fields,
227 minus the sum of widths of the non-variable fields, divided by the number of
228 variable fields.
229
230 \wxheading{See also}
231
232 \helpref{wxStatusBar::SetFieldsCount}{wxstatusbarsetfieldscount}, \helpref{wxFrame::SetStatusWidths}{wxframesetstatuswidths}
233
234 \pythonnote{Only a single parameter is required, a Python list of
235 integers.}
236
237 \perlnote{In wxPerl this method takes as parameters the field widths.}
238
239 \membersection{wxStatusBar::SetStatusStyles}\label{wxstatusbarsetstatusstyles}
240
241 \func{virtual void}{SetStatusStyles}{\param{int}{ n}, \param{int *}{styles}}
242
243 Sets the styles of the fields in the status line which can make fields appear flat
244 or raised instead of the standard sunken 3D border.
245
246 \wxheading{Parameters}
247
248 \docparam{n}{The number of fields in the status bar. Must be equal to the
249 number passed to \helpref{SetFieldsCount}{wxstatusbarsetfieldscount} the last
250 time it was called.}
251
252 \docparam{styles}{Contains an array of {\it n} integers with the styles for each field. There
253 are three possible styles:
254
255 \twocolwidtha{5cm}
256 \begin{twocollist}\itemsep=0pt
257 \twocolitem{\windowstyle{wxSB\_NORMAL}}{(default) The field appears sunken with a standard 3D border.}
258 \twocolitem{\windowstyle{wxSB\_FLAT}}{No border is painted around the field so that it appears flat.}
259 \twocolitem{\windowstyle{wxSB\_RAISED}}{A raised 3D border is painted around the field.}
260 \end{twocollist}
261 }
262
263