1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStatusBar
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxStatusBarPane
12 A status bar pane data container used by wxStatusBar.
23 Constructs the pane with the given @a style and @a width.
25 wxStatusBarPane(int style
= wxSB_NORMAL
, size_t width
= 0);
28 Returns the pane width; it maybe negative, indicating a variable-width field.
33 Returns the pane style.
38 Returns the stack of strings pushed on this pane.
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.
43 Also note that GetStack().Last() is the top of the stack (i.e. the string shown
46 const wxArrayString
& GetStack() const
47 { return m_arrStack
; }
53 A status bar is a narrow window that can be placed along the bottom of a frame
54 to give small amounts of status information. It can contain one or more fields,
55 one or more of which can be variable length according to the size of the window.
59 Displays a gripper at the right-hand side of the status bar.
63 It is possible to create controls and other windows on the status bar.
64 Position these windows from an OnSize() event handler.
69 @see wxStatusBarPane, wxFrame, @ref page_samples_statbar
71 class wxStatusBar
: public wxWindow
80 Constructor, creating the window.
83 The window parent, usually a frame.
85 The window identifier.
86 It may take a value of -1 to indicate a default value.
88 The window style. See wxStatusBar.
90 The name of the window. This parameter is used to associate a name with the
91 item, allowing the application user to set Motif resource values for
96 wxStatusBar(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
97 long style
= wxST_SIZEGRIP
,
98 const wxString
& name
= wxStatusBarNameStr
);
103 virtual ~wxStatusBar();
106 Creates the window, for two-step construction.
107 See wxStatusBar() for details.
109 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
110 long style
= wxST_SIZEGRIP
,
111 const wxString
& name
= wxStatusBarNameStr
);
114 Returns the size and position of a field's internal bounding rectangle.
117 The field in question.
119 The rectangle values are placed in this variable.
121 @return @true if the field index is valid, @false otherwise.
125 virtual bool GetFieldRect(int i
, wxRect
& rect
) const;
128 Returns the wxStatusBarPane representing the @a n-th field.
130 const wxStatusBarPane
& GetField(int n
) const
131 { return m_panes
[n
]; }
134 Returns the string associated with a status bar field.
137 The number of the status field to retrieve, starting from zero.
139 @return The status field string if the field is valid, otherwise the
144 virtual wxString
GetStatusText(int i
= 0) const;
147 Returns the stack of strings pushed (see PushStatusText()) on the
150 See wxStatusBarPane::GetStack() for more info.
152 const wxArrayString
& GetStatusStack(int n
) const
153 { return m_panes
[n
].GetStack(); }
156 Returns the width of the @a n-th field.
158 See wxStatusBarPane::GetWidth() for more info.
160 int GetStatusWidth(int n
) const
161 { return m_panes
[n
].GetWidth(); }
164 Returns the style of the @a n-th field.
166 See wxStatusBarPane::GetStyle() for more info.
168 int GetStatusStyle(int n
) const
169 { return m_panes
[n
].GetStyle(); }
172 Sets the field text to the top of the stack, and pops the stack of saved
175 @see PushStatusText()
177 void PopStatusText(int field
= 0);
180 Saves the current field text in a per field stack, and sets the field text
181 to the string passed as argument.
185 void PushStatusText(const wxString
& string
, int field
= 0);
188 Sets the number of fields, and optionally the field widths.
191 The number of fields. If this is greater than the previous number,
192 then new fields with empty strings will be added to the status bar.
194 An array of n integers interpreted in the same way as
195 in SetStatusWidths().
197 virtual void SetFieldsCount(int number
= 1, const int* widths
= NULL
);
200 Sets the minimal possible height for the status bar.
202 The real height may be bigger than the height specified here depending
203 on the size of the font used by the status bar.
205 virtual void SetMinHeight(int height
);
208 Sets the styles of the fields in the status line which can make fields appear
209 flat or raised instead of the standard sunken 3D border.
212 The number of fields in the status bar. Must be equal to the
213 number passed to SetFieldsCount() the last time it was called.
215 Contains an array of n integers with the styles for each field. There
216 are three possible styles:
217 - wxSB_NORMAL (default): The field appears sunken with a standard 3D border.
218 - wxSB_FLAT: No border is painted around the field so that it appears flat.
219 - wxSB_RAISED: A raised 3D border is painted around the field.
221 virtual void SetStatusStyles(int n
, const int* styles
);
224 Sets the text for one field.
227 The text to be set. Use an empty string ("") to clear the field.
229 The field to set, starting from zero.
231 @see GetStatusText(), wxFrame::SetStatusText
233 virtual void SetStatusText(const wxString
& text
, int i
= 0);
236 Sets the widths of the fields in the status line. There are two types of
237 fields: @b fixed widths and @b variable width fields. For the fixed width fields
238 you should specify their (constant) width in pixels. For the variable width
239 fields, specify a negative number which indicates how the field should expand:
240 the space left for all variable width fields is divided between them according
241 to the absolute value of this number. A variable width field with width of -2
242 gets twice as much of it as a field with width -1 and so on.
244 For example, to create one fixed width field of width 100 in the right part of
245 the status bar and two more fields which get 66% and 33% of the remaining
246 space correspondingly, you should use an array containing -2, -1 and 100.
249 The number of fields in the status bar. Must be equal to the
250 number passed to SetFieldsCount() the last time it was called.
252 Contains an array of n integers, each of which is either an
253 absolute status field width in pixels if positive or indicates a
254 variable width field if negative.
255 The special value @NULL means that all fields should get the same width.
257 @remarks The widths of the variable fields are calculated from the total
258 width of all fields, minus the sum of widths of the
259 non-variable fields, divided by the number of variable fields.
261 @see SetFieldsCount(), wxFrame::SetStatusWidths()
263 virtual void SetStatusWidths(int n
, const int* widths_field
);