2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: statusbr.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxStatusBar
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
/**
|
|
|
|
@class wxStatusBarPane
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
A status bar pane data container used by wxStatusBar.
|
2009-03-15 15:45:34 -04:00
|
|
|
|
|
|
|
@library{wxcore}
|
2009-03-17 19:32:34 -04:00
|
|
|
@category{data}
|
2009-03-15 15:45:34 -04:00
|
|
|
|
|
|
|
@see wxStatusBar
|
2009-03-15 13:54:05 -04:00
|
|
|
*/
|
|
|
|
class wxStatusBarPane
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructs the pane with the given @a style and @a width.
|
|
|
|
*/
|
|
|
|
wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0);
|
2009-04-21 07:10:44 -04:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
/**
|
|
|
|
Returns the pane width; it maybe negative, indicating a variable-width field.
|
|
|
|
*/
|
|
|
|
int GetWidth() const;
|
2009-04-21 07:10:44 -04:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
/**
|
|
|
|
Returns the pane style.
|
|
|
|
*/
|
|
|
|
int GetStyle() const;
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
/**
|
2009-08-05 20:01:43 -04:00
|
|
|
Returns the text currently shown in this pane.
|
|
|
|
*/
|
|
|
|
wxString GetText() const;
|
2009-03-15 13:54:05 -04:00
|
|
|
};
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxStatusBar
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A status bar is a narrow window that can be placed along the bottom of a frame
|
2008-10-07 12:57:34 -04:00
|
|
|
to give small amounts of status information. It can contain one or more fields,
|
|
|
|
one or more of which can be variable length according to the size of the window.
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-04-24 17:14:59 -04:00
|
|
|
wxStatusBar also maintains an independent stack of status texts for each field
|
|
|
|
(see PushStatusText() and PopStatusText()).
|
|
|
|
|
2009-04-21 07:10:44 -04:00
|
|
|
Note that in wxStatusBar context, the terms @e pane and @e field are synonyms.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2009-04-25 08:59:09 -04:00
|
|
|
@style{wxSTB_SIZEGRIP}
|
2009-04-21 07:10:44 -04:00
|
|
|
Displays a gripper at the right-hand side of the status bar which can be used
|
|
|
|
to resize the parent window.
|
2009-04-25 08:59:09 -04:00
|
|
|
@style{wxSTB_SHOW_TIPS}
|
|
|
|
Displays tooltips for those panes whose status text has been ellipsized/truncated
|
|
|
|
because the status text doesn't fit the pane width.
|
2009-04-21 07:10:44 -04:00
|
|
|
Note that this style has effect only on wxGTK (with GTK+ >= 2.12) currently.
|
2009-04-25 08:59:09 -04:00
|
|
|
@style{wxSTB_ELLIPSIZE_START}
|
|
|
|
Replace the beginning of the status texts with an ellipsis when the status text
|
|
|
|
widths exceed the status bar pane's widths (uses wxControl::Ellipsize).
|
|
|
|
@style{wxSTB_ELLIPSIZE_MIDDLE}
|
|
|
|
Replace the middle of the status texts with an ellipsis when the status text
|
|
|
|
widths exceed the status bar pane's widths (uses wxControl::Ellipsize).
|
|
|
|
@style{wxSTB_ELLIPSIZE_END}
|
|
|
|
Replace the end of the status texts with an ellipsis when the status text
|
|
|
|
widths exceed the status bar pane's widths (uses wxControl::Ellipsize).
|
|
|
|
@style{wxSTB_DEFAULT_STYLE}
|
2009-08-05 20:00:32 -04:00
|
|
|
The default style: includes
|
|
|
|
@c wxSTB_SIZEGRIP|wxSTB_SHOW_TIPS|wxSTB_ELLIPSIZE_END|wxFULL_REPAINT_ON_RESIZE.
|
2008-03-08 08:52:38 -05:00
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-07 12:57:34 -04:00
|
|
|
@remarks
|
|
|
|
It is possible to create controls and other windows on the status bar.
|
2008-11-21 19:21:10 -05:00
|
|
|
Position these windows from an OnSize() event handler.
|
2008-10-07 12:57:34 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{miscwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
@see wxStatusBarPane, wxFrame, @ref page_samples_statbar
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxStatusBar : public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
2008-10-07 12:57:34 -04:00
|
|
|
/**
|
|
|
|
Default ctor.
|
|
|
|
*/
|
|
|
|
wxStatusBar();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating the window.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
The window parent, usually a frame.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-10-07 12:57:34 -04:00
|
|
|
The window identifier.
|
|
|
|
It may take a value of -1 to indicate a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The window style. See wxStatusBar.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The name of the window. This parameter is used to associate a name with the
|
2008-10-07 12:57:34 -04:00
|
|
|
item, allowing the application user to set Motif resource values for
|
2008-03-09 08:33:59 -04:00
|
|
|
individual windows.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxStatusBar(wxWindow* parent, wxWindowID id = wxID_ANY,
|
2009-04-25 08:59:09 -04:00
|
|
|
long style = wxSTB_DEFAULT_STYLE,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxString& name = wxStatusBarNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxStatusBar();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Creates the window, for two-step construction.
|
|
|
|
See wxStatusBar() for details.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
2009-04-25 08:59:09 -04:00
|
|
|
long style = wxSTB_DEFAULT_STYLE,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxString& name = wxStatusBarNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the size and position of a field's internal bounding rectangle.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param i
|
2008-03-09 08:33:59 -04:00
|
|
|
The field in question.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param rect
|
2008-03-09 08:33:59 -04:00
|
|
|
The rectangle values are placed in this variable.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return @true if the field index is valid, @false otherwise.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this function returns a @c Wx::Rect if the field
|
|
|
|
index is valid, @c undef otherwise.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see wxRect
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
virtual bool GetFieldRect(int i, wxRect& rect) const;
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-03-17 19:29:01 -04:00
|
|
|
/**
|
2009-08-05 20:00:32 -04:00
|
|
|
Returns the number of fields in the status bar.
|
2009-03-17 19:29:01 -04:00
|
|
|
*/
|
|
|
|
int GetFieldsCount() const;
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-03-15 13:54:05 -04:00
|
|
|
Returns the wxStatusBarPane representing the @a n-th field.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2009-03-19 10:17:56 -04:00
|
|
|
const wxStatusBarPane& GetField(int n) const;
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-04-21 07:10:44 -04:00
|
|
|
/**
|
|
|
|
Returns the horizontal and vertical borders used when rendering the field
|
|
|
|
text inside the field area.
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-04-21 07:10:44 -04:00
|
|
|
Note that the rect returned by GetFieldRect() already accounts for the
|
|
|
|
presence of horizontal and vertical border returned by this function.
|
|
|
|
*/
|
|
|
|
wxSize GetBorders() const;
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Returns the string associated with a status bar field.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param i
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of the status field to retrieve, starting from zero.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-10 21:38:53 -04:00
|
|
|
@return The status field string if the field is valid, otherwise the
|
2008-10-07 12:57:34 -04:00
|
|
|
empty string.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetStatusText()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
virtual wxString GetStatusText(int i = 0) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
/**
|
|
|
|
Returns the width of the @a n-th field.
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
See wxStatusBarPane::GetWidth() for more info.
|
|
|
|
*/
|
2009-03-19 10:17:56 -04:00
|
|
|
int GetStatusWidth(int n) const;
|
2009-03-15 13:54:05 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the style of the @a n-th field.
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-03-15 13:54:05 -04:00
|
|
|
See wxStatusBarPane::GetStyle() for more info.
|
|
|
|
*/
|
2009-03-19 10:17:56 -04:00
|
|
|
int GetStatusStyle(int n) const;
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2009-08-05 20:01:43 -04:00
|
|
|
Restores the text to the value it had before the last call to
|
|
|
|
PushStatusText().
|
|
|
|
|
|
|
|
Notice that if SetStatusText() had been called in the meanwhile,
|
|
|
|
PopStatusText() will not change the text, i.e. it does not override
|
|
|
|
explicit changes to status text but only restores the saved text if it
|
|
|
|
hadn't been changed since.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see PushStatusText()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void PopStatusText(int field = 0);
|
|
|
|
|
|
|
|
/**
|
2009-08-05 20:01:43 -04:00
|
|
|
Saves the current field text in a per-field stack, and sets the field
|
|
|
|
text to the string passed as argument.
|
2008-12-31 12:31:32 -05:00
|
|
|
|
|
|
|
@see PopStatusText()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void PushStatusText(const wxString& string, int field = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the number of fields, and optionally the field widths.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param number
|
2009-02-08 19:33:19 -05:00
|
|
|
The number of fields. If this is greater than the previous number,
|
|
|
|
then new fields with empty strings will be added to the status bar.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param widths
|
2008-03-09 08:33:59 -04:00
|
|
|
An array of n integers interpreted in the same way as
|
2008-10-07 12:57:34 -04:00
|
|
|
in SetStatusWidths().
|
2009-10-18 13:47:01 -04:00
|
|
|
|
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this function accepts only the @a number parameter.
|
|
|
|
Use SetStatusWidths to set the field widths.
|
|
|
|
@endWxPerlOnly
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void SetFieldsCount(int number = 1, const int* widths = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-07 12:57:34 -04:00
|
|
|
Sets the minimal possible height for the status bar.
|
|
|
|
|
|
|
|
The real height may be bigger than the height specified here depending
|
|
|
|
on the size of the font used by the status bar.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetMinHeight(int height);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the styles of the fields in the status line which can make fields appear
|
2008-10-07 12:57:34 -04:00
|
|
|
flat or raised instead of the standard sunken 3D border.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of fields in the status bar. Must be equal to the
|
2008-10-07 12:57:34 -04:00
|
|
|
number passed to SetFieldsCount() the last time it was called.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param styles
|
2009-08-05 20:00:32 -04:00
|
|
|
Contains an array of @a n integers with the styles for each field.
|
2009-04-25 08:59:09 -04:00
|
|
|
There are three possible styles:
|
|
|
|
- @c wxSB_NORMAL (default): The field appears sunken with a standard 3D border.
|
|
|
|
- @c wxSB_FLAT: No border is painted around the field so that it appears flat.
|
|
|
|
- @c wxSB_RAISED: A raised 3D border is painted around the field.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void SetStatusStyles(int n, const int* styles);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2009-04-24 17:14:59 -04:00
|
|
|
Sets the status text for the @a i-th field.
|
2009-08-05 20:00:32 -04:00
|
|
|
|
2009-08-05 20:01:43 -04:00
|
|
|
The given text will replace the current text.
|
|
|
|
|
|
|
|
Note that if PushStatusText() had been called before the new text will
|
|
|
|
also replace the last saved value to make sure that the next call to
|
|
|
|
PopStatusText() doesn't restore the old value, which was overwritten by
|
|
|
|
the call to this function.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param text
|
2008-03-09 08:33:59 -04:00
|
|
|
The text to be set. Use an empty string ("") to clear the field.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param i
|
2008-03-09 08:33:59 -04:00
|
|
|
The field to set, starting from zero.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetStatusText(), wxFrame::SetStatusText
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual void SetStatusText(const wxString& text, int i = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the widths of the fields in the status line. There are two types of
|
2008-12-31 12:07:30 -05:00
|
|
|
fields: @b fixed widths and @b variable width fields. For the fixed width fields
|
2008-03-08 08:52:38 -05:00
|
|
|
you should specify their (constant) width in pixels. For the variable width
|
|
|
|
fields, specify a negative number which indicates how the field should expand:
|
|
|
|
the space left for all variable width fields is divided between them according
|
|
|
|
to the absolute value of this number. A variable width field with width of -2
|
|
|
|
gets twice as much of it as a field with width -1 and so on.
|
2008-10-07 12:57:34 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
For example, to create one fixed width field of width 100 in the right part of
|
|
|
|
the status bar and two more fields which get 66% and 33% of the remaining
|
|
|
|
space correspondingly, you should use an array containing -2, -1 and 100.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of fields in the status bar. Must be equal to the
|
2008-10-07 12:57:34 -04:00
|
|
|
number passed to SetFieldsCount() the last time it was called.
|
2008-11-03 06:57:07 -05:00
|
|
|
@param widths_field
|
2008-10-07 12:57:34 -04:00
|
|
|
Contains an array of n integers, each of which is either an
|
|
|
|
absolute status field width in pixels if positive or indicates a
|
2008-03-09 08:33:59 -04:00
|
|
|
variable width field if negative.
|
2008-12-31 12:31:32 -05:00
|
|
|
The special value @NULL means that all fields should get the same width.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@remarks The widths of the variable fields are calculated from the total
|
2008-03-09 08:33:59 -04:00
|
|
|
width of all fields, minus the sum of widths of the
|
2008-10-07 12:57:34 -04:00
|
|
|
non-variable fields, divided by the number of variable fields.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method takes as parameters the field widths.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-10-07 12:57:34 -04:00
|
|
|
@see SetFieldsCount(), wxFrame::SetStatusWidths()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
virtual void SetStatusWidths(int n, const int* widths_field);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|