]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/statusbr.h
update for bakefile 0.2.6
[wxWidgets.git] / interface / wx / statusbr.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: statusbr.h
e54c96f1 3// Purpose: interface of wxStatusBar
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
b31eaa5c
FM
9/**
10 @class wxStatusBarPane
11
12 A status bar pane data container used by wxStatusBar.
7235c54d
FM
13
14 @library{wxcore}
50b75fe3 15 @category{data}
7235c54d
FM
16
17 @see wxStatusBar
b31eaa5c
FM
18*/
19class wxStatusBarPane
20{
21public:
22 /**
23 Constructs the pane with the given @a style and @a width.
24 */
25 wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0);
c94bdf2a 26
b31eaa5c
FM
27 /**
28 Returns the pane width; it maybe negative, indicating a variable-width field.
29 */
30 int GetWidth() const;
c94bdf2a 31
b31eaa5c
FM
32 /**
33 Returns the pane style.
34 */
35 int GetStyle() const;
36
37 /**
38 Returns the stack of strings pushed on this pane.
39
40 Note that this stack does include also the string currently displayed in this pane
41 as the version stored in the native status bar control is possibly ellipsized.
42
43 Also note that GetStack().Last() is the top of the stack (i.e. the string shown
44 in the status bar).
45 */
f18e1cf1 46 const wxArrayString& GetStack() const;
b31eaa5c
FM
47};
48
23324ae1
FM
49/**
50 @class wxStatusBar
7c913512 51
23324ae1 52 A status bar is a narrow window that can be placed along the bottom of a frame
4701dc09
FM
53 to give small amounts of status information. It can contain one or more fields,
54 one or more of which can be variable length according to the size of the window.
c94bdf2a 55
30800ba5
FM
56 wxStatusBar also maintains an independent stack of status texts for each field
57 (see PushStatusText() and PopStatusText()).
58
c94bdf2a 59 Note that in wxStatusBar context, the terms @e pane and @e field are synonyms.
7c913512 60
23324ae1 61 @beginStyleTable
c4c178c1 62 @style{wxSTB_SIZEGRIP}
c94bdf2a
FM
63 Displays a gripper at the right-hand side of the status bar which can be used
64 to resize the parent window.
c4c178c1
FM
65 @style{wxSTB_SHOW_TIPS}
66 Displays tooltips for those panes whose status text has been ellipsized/truncated
67 because the status text doesn't fit the pane width.
c94bdf2a 68 Note that this style has effect only on wxGTK (with GTK+ >= 2.12) currently.
c4c178c1
FM
69 @style{wxSTB_ELLIPSIZE_START}
70 Replace the beginning of the status texts with an ellipsis when the status text
71 widths exceed the status bar pane's widths (uses wxControl::Ellipsize).
72 @style{wxSTB_ELLIPSIZE_MIDDLE}
73 Replace the middle of the status texts with an ellipsis when the status text
74 widths exceed the status bar pane's widths (uses wxControl::Ellipsize).
75 @style{wxSTB_ELLIPSIZE_END}
76 Replace the end of the status texts with an ellipsis when the status text
77 widths exceed the status bar pane's widths (uses wxControl::Ellipsize).
78 @style{wxSTB_DEFAULT_STYLE}
79 The default style: includes
80 @c wxSTB_SIZEGRIP|wxSTB_SHOW_TIPS|wxSTB_ELLIPSIZE_END|wxFULL_REPAINT_ON_RESIZE.
23324ae1 81 @endStyleTable
7c913512 82
4701dc09
FM
83 @remarks
84 It is possible to create controls and other windows on the status bar.
bb69632a 85 Position these windows from an OnSize() event handler.
4701dc09 86
23324ae1
FM
87 @library{wxcore}
88 @category{miscwnd}
7c913512 89
b31eaa5c 90 @see wxStatusBarPane, wxFrame, @ref page_samples_statbar
23324ae1
FM
91*/
92class wxStatusBar : public wxWindow
93{
94public:
4701dc09
FM
95 /**
96 Default ctor.
97 */
98 wxStatusBar();
99
23324ae1
FM
100 /**
101 Constructor, creating the window.
3c4f71cc 102
7c913512 103 @param parent
4cc4bfaf 104 The window parent, usually a frame.
7c913512 105 @param id
4701dc09
FM
106 The window identifier.
107 It may take a value of -1 to indicate a default value.
7c913512 108 @param style
4cc4bfaf 109 The window style. See wxStatusBar.
7c913512 110 @param name
4cc4bfaf 111 The name of the window. This parameter is used to associate a name with the
4701dc09 112 item, allowing the application user to set Motif resource values for
4cc4bfaf 113 individual windows.
3c4f71cc 114
4cc4bfaf 115 @see Create()
23324ae1 116 */
7c913512 117 wxStatusBar(wxWindow* parent, wxWindowID id = wxID_ANY,
c4c178c1 118 long style = wxSTB_DEFAULT_STYLE,
11e3af6e 119 const wxString& name = wxStatusBarNameStr);
23324ae1
FM
120
121 /**
122 Destructor.
123 */
adaaa686 124 virtual ~wxStatusBar();
23324ae1
FM
125
126 /**
127 Creates the window, for two-step construction.
23324ae1
FM
128 See wxStatusBar() for details.
129 */
130 bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
c4c178c1 131 long style = wxSTB_DEFAULT_STYLE,
43c48e1e 132 const wxString& name = wxStatusBarNameStr);
23324ae1
FM
133
134 /**
135 Returns the size and position of a field's internal bounding rectangle.
3c4f71cc 136
7c913512 137 @param i
4cc4bfaf 138 The field in question.
7c913512 139 @param rect
4cc4bfaf 140 The rectangle values are placed in this variable.
3c4f71cc 141
d29a9a8a 142 @return @true if the field index is valid, @false otherwise.
3c4f71cc 143
4cc4bfaf 144 @see wxRect
23324ae1 145 */
328f5751 146 virtual bool GetFieldRect(int i, wxRect& rect) const;
4df02e42
FM
147
148 /**
149 Returns the number of fields in the status bar.
150 */
151 int GetFieldsCount() const;
152
23324ae1 153 /**
b31eaa5c 154 Returns the wxStatusBarPane representing the @a n-th field.
23324ae1 155 */
f18e1cf1 156 const wxStatusBarPane& GetField(int n) const;
b31eaa5c 157
c94bdf2a
FM
158 /**
159 Returns the horizontal and vertical borders used when rendering the field
160 text inside the field area.
161
162 Note that the rect returned by GetFieldRect() already accounts for the
163 presence of horizontal and vertical border returned by this function.
164 */
165 wxSize GetBorders() const;
166
23324ae1
FM
167 /**
168 Returns the string associated with a status bar field.
3c4f71cc 169
7c913512 170 @param i
4cc4bfaf 171 The number of the status field to retrieve, starting from zero.
3c4f71cc 172
d29a9a8a 173 @return The status field string if the field is valid, otherwise the
4701dc09 174 empty string.
3c4f71cc 175
4cc4bfaf 176 @see SetStatusText()
23324ae1 177 */
328f5751 178 virtual wxString GetStatusText(int i = 0) const;
23324ae1 179
b31eaa5c
FM
180 /**
181 Returns the stack of strings pushed (see PushStatusText()) on the
182 @a n-th field.
183
184 See wxStatusBarPane::GetStack() for more info.
185 */
f18e1cf1 186 const wxArrayString& GetStatusStack(int n) const;
b31eaa5c
FM
187
188 /**
189 Returns the width of the @a n-th field.
190
191 See wxStatusBarPane::GetWidth() for more info.
192 */
f18e1cf1 193 int GetStatusWidth(int n) const;
b31eaa5c
FM
194
195 /**
196 Returns the style of the @a n-th field.
197
198 See wxStatusBarPane::GetStyle() for more info.
199 */
f18e1cf1 200 int GetStatusStyle(int n) const;
b31eaa5c 201
23324ae1
FM
202 /**
203 Sets the field text to the top of the stack, and pops the stack of saved
204 strings.
3c4f71cc 205
4cc4bfaf 206 @see PushStatusText()
23324ae1
FM
207 */
208 void PopStatusText(int field = 0);
209
210 /**
30800ba5 211 Saves the current field text in a per-field stack, and sets the field text
23324ae1 212 to the string passed as argument.
fd3ece57
FM
213
214 @see PopStatusText()
23324ae1
FM
215 */
216 void PushStatusText(const wxString& string, int field = 0);
217
218 /**
219 Sets the number of fields, and optionally the field widths.
3c4f71cc 220
7c913512 221 @param number
0cd15959
FM
222 The number of fields. If this is greater than the previous number,
223 then new fields with empty strings will be added to the status bar.
7c913512 224 @param widths
4cc4bfaf 225 An array of n integers interpreted in the same way as
4701dc09 226 in SetStatusWidths().
23324ae1 227 */
43c48e1e 228 virtual void SetFieldsCount(int number = 1, const int* widths = NULL);
23324ae1
FM
229
230 /**
4701dc09
FM
231 Sets the minimal possible height for the status bar.
232
233 The real height may be bigger than the height specified here depending
234 on the size of the font used by the status bar.
23324ae1 235 */
adaaa686 236 virtual void SetMinHeight(int height);
23324ae1
FM
237
238 /**
239 Sets the styles of the fields in the status line which can make fields appear
4701dc09 240 flat or raised instead of the standard sunken 3D border.
3c4f71cc 241
7c913512 242 @param n
4cc4bfaf 243 The number of fields in the status bar. Must be equal to the
4701dc09 244 number passed to SetFieldsCount() the last time it was called.
7c913512 245 @param styles
c4c178c1
FM
246 Contains an array of @a n integers with the styles for each field.
247 There are three possible styles:
248 - @c wxSB_NORMAL (default): The field appears sunken with a standard 3D border.
249 - @c wxSB_FLAT: No border is painted around the field so that it appears flat.
250 - @c wxSB_RAISED: A raised 3D border is painted around the field.
23324ae1 251 */
43c48e1e 252 virtual void SetStatusStyles(int n, const int* styles);
23324ae1
FM
253
254 /**
30800ba5
FM
255 Sets the status text for the @a i-th field.
256
257 The given text will replace the current text. Note that unlike PushStatusText()
258 this function won't save the current text (and calling PopStatusText() won't
259 restore it!).
3c4f71cc 260
7c913512 261 @param text
4cc4bfaf 262 The text to be set. Use an empty string ("") to clear the field.
7c913512 263 @param i
4cc4bfaf 264 The field to set, starting from zero.
3c4f71cc 265
4cc4bfaf 266 @see GetStatusText(), wxFrame::SetStatusText
23324ae1
FM
267 */
268 virtual void SetStatusText(const wxString& text, int i = 0);
269
270 /**
271 Sets the widths of the fields in the status line. There are two types of
54e18afc 272 fields: @b fixed widths and @b variable width fields. For the fixed width fields
23324ae1
FM
273 you should specify their (constant) width in pixels. For the variable width
274 fields, specify a negative number which indicates how the field should expand:
275 the space left for all variable width fields is divided between them according
276 to the absolute value of this number. A variable width field with width of -2
277 gets twice as much of it as a field with width -1 and so on.
4701dc09 278
23324ae1
FM
279 For example, to create one fixed width field of width 100 in the right part of
280 the status bar and two more fields which get 66% and 33% of the remaining
281 space correspondingly, you should use an array containing -2, -1 and 100.
3c4f71cc 282
7c913512 283 @param n
4cc4bfaf 284 The number of fields in the status bar. Must be equal to the
4701dc09 285 number passed to SetFieldsCount() the last time it was called.
f21dd16b 286 @param widths_field
4701dc09
FM
287 Contains an array of n integers, each of which is either an
288 absolute status field width in pixels if positive or indicates a
4cc4bfaf 289 variable width field if negative.
fd3ece57 290 The special value @NULL means that all fields should get the same width.
3c4f71cc 291
23324ae1 292 @remarks The widths of the variable fields are calculated from the total
4cc4bfaf 293 width of all fields, minus the sum of widths of the
4701dc09 294 non-variable fields, divided by the number of variable fields.
3c4f71cc 295
4701dc09 296 @see SetFieldsCount(), wxFrame::SetStatusWidths()
23324ae1 297 */
43c48e1e 298 virtual void SetStatusWidths(int n, const int* widths_field);
23324ae1 299};
e54c96f1 300