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