]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/statusbr.h
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;
52 A status bar is a narrow window that can be placed along the bottom of a frame
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.
56 wxStatusBar also maintains an independent stack of status texts for each field
57 (see PushStatusText() and PopStatusText()).
59 Note that in wxStatusBar context, the terms @e pane and @e field are synonyms.
62 @style{wxSTB_SIZEGRIP}
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{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.
68 Note that this style has effect only on wxGTK (with GTK+ >= 2.12) currently.
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.
84 It is possible to create controls and other windows on the status bar.
85 Position these windows from an OnSize() event handler.
90 @see wxStatusBarPane, wxFrame, @ref page_samples_statbar
92 class wxStatusBar
: public wxWindow
101 Constructor, creating the window.
104 The window parent, usually a frame.
106 The window identifier.
107 It may take a value of -1 to indicate a default value.
109 The window style. See wxStatusBar.
111 The name of the window. This parameter is used to associate a name with the
112 item, allowing the application user to set Motif resource values for
117 wxStatusBar(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
118 long style
= wxSTB_DEFAULT_STYLE
,
119 const wxString
& name
= wxStatusBarNameStr
);
124 virtual ~wxStatusBar();
127 Creates the window, for two-step construction.
128 See wxStatusBar() for details.
130 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
131 long style
= wxSTB_DEFAULT_STYLE
,
132 const wxString
& name
= wxStatusBarNameStr
);
135 Returns the size and position of a field's internal bounding rectangle.
138 The field in question.
140 The rectangle values are placed in this variable.
142 @return @true if the field index is valid, @false otherwise.
146 virtual bool GetFieldRect(int i
, wxRect
& rect
) const;
149 Returns the number of fields in the status bar.
151 int GetFieldsCount() const;
154 Returns the wxStatusBarPane representing the @a n-th field.
156 const wxStatusBarPane
& GetField(int n
) const;
159 Returns the horizontal and vertical borders used when rendering the field
160 text inside the field area.
162 Note that the rect returned by GetFieldRect() already accounts for the
163 presence of horizontal and vertical border returned by this function.
165 wxSize
GetBorders() const;
168 Returns the string associated with a status bar field.
171 The number of the status field to retrieve, starting from zero.
173 @return The status field string if the field is valid, otherwise the
178 virtual wxString
GetStatusText(int i
= 0) const;
181 Returns the stack of strings pushed (see PushStatusText()) on the
184 See wxStatusBarPane::GetStack() for more info.
186 const wxArrayString
& GetStatusStack(int n
) const;
189 Returns the width of the @a n-th field.
191 See wxStatusBarPane::GetWidth() for more info.
193 int GetStatusWidth(int n
) const;
196 Returns the style of the @a n-th field.
198 See wxStatusBarPane::GetStyle() for more info.
200 int GetStatusStyle(int n
) const;
203 Sets the field text to the top of the stack, and pops the stack of saved
206 @see PushStatusText()
208 void PopStatusText(int field
= 0);
211 Saves the current field text in a per-field stack, and sets the field text
212 to the string passed as argument.
216 void PushStatusText(const wxString
& string
, int field
= 0);
219 Sets the number of fields, and optionally the field widths.
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.
225 An array of n integers interpreted in the same way as
226 in SetStatusWidths().
228 virtual void SetFieldsCount(int number
= 1, const int* widths
= NULL
);
231 Sets the minimal possible height for the status bar.
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.
236 virtual void SetMinHeight(int height
);
239 Sets the styles of the fields in the status line which can make fields appear
240 flat or raised instead of the standard sunken 3D border.
243 The number of fields in the status bar. Must be equal to the
244 number passed to SetFieldsCount() the last time it was called.
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.
252 virtual void SetStatusStyles(int n
, const int* styles
);
255 Sets the status text for the @a i-th field.
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
262 The text to be set. Use an empty string ("") to clear the field.
264 The field to set, starting from zero.
266 @see GetStatusText(), wxFrame::SetStatusText
268 virtual void SetStatusText(const wxString
& text
, int i
= 0);
271 Sets the widths of the fields in the status line. There are two types of
272 fields: @b fixed widths and @b variable width fields. For the fixed width fields
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.
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.
284 The number of fields in the status bar. Must be equal to the
285 number passed to SetFieldsCount() the last time it was called.
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
289 variable width field if negative.
290 The special value @NULL means that all fields should get the same width.
292 @remarks The widths of the variable fields are calculated from the total
293 width of all fields, minus the sum of widths of the
294 non-variable fields, divided by the number of variable fields.
296 @see SetFieldsCount(), wxFrame::SetStatusWidths()
298 virtual void SetStatusWidths(int n
, const int* widths_field
);