2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: gauge.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxGauge
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2011-09-16 13:03:01 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxGauge style flags
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define wxGA_HORIZONTAL wxHORIZONTAL
|
|
|
|
#define wxGA_VERTICAL wxVERTICAL
|
|
|
|
|
2020-06-27 14:19:59 -04:00
|
|
|
// Available since Windows 7 only. With this style, the value of gauge will
|
2014-09-10 10:57:20 -04:00
|
|
|
// reflect on the taskbar button.
|
|
|
|
#define wxGA_PROGRESS 0x0010
|
2011-09-16 13:03:01 -04:00
|
|
|
// Win32 only, is default (and only) on some other platforms
|
|
|
|
#define wxGA_SMOOTH 0x0020
|
2014-08-23 21:50:11 -04:00
|
|
|
// QT only, display current completed percentage (text default format "%p%")
|
|
|
|
#define wxGA_TEXT 0x0040
|
2011-09-16 13:03:01 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxGauge
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-02 00:12:39 -04:00
|
|
|
A gauge is a horizontal or vertical bar which shows a quantity (often
|
|
|
|
time).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxGauge supports two working modes: determinate and indeterminate progress.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-02 00:12:39 -04:00
|
|
|
The first is the usual working mode (see SetValue() and SetRange()) while
|
|
|
|
the second can be used when the program is doing some processing but you
|
|
|
|
don't know how much progress is being done. In this case, you can
|
|
|
|
periodically call the Pulse() function to make the progress bar switch to
|
|
|
|
indeterminate mode (graphically it's usually a set of blocks which move or
|
|
|
|
bounce in the bar control).
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxGauge supports dynamic switch between these two work modes.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
There are no user commands for the gauge.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxGA_HORIZONTAL}
|
2008-03-08 08:52:38 -05:00
|
|
|
Creates a horizontal gauge.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxGA_VERTICAL}
|
2008-03-08 08:52:38 -05:00
|
|
|
Creates a vertical gauge.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxGA_SMOOTH}
|
2008-03-08 08:52:38 -05:00
|
|
|
Creates smooth progress bar with one pixel wide update step (not
|
|
|
|
supported by all platforms).
|
2014-08-23 21:50:11 -04:00
|
|
|
@style{wxGA_TEXT}
|
2014-10-30 08:56:31 -04:00
|
|
|
Display the current value in percents in the gauge itself. This
|
|
|
|
style is only supported in wxQt and ignored under the other
|
|
|
|
platforms.
|
2020-06-07 12:55:11 -04:00
|
|
|
This flag is only available in wxWidgets 3.1.0 and later.
|
2014-09-10 10:57:20 -04:00
|
|
|
@style{wxGA_PROGRESS}
|
2014-10-30 08:56:31 -04:00
|
|
|
Reflect the value of gauge in the application taskbar button under
|
2020-07-04 16:08:24 -04:00
|
|
|
Windows 7 and later and the dock icon under macOS, ignored under
|
2015-02-15 15:09:10 -05:00
|
|
|
the other platforms.
|
2020-06-07 12:55:11 -04:00
|
|
|
This flag is only available in wxWidgets 3.1.0 and later.
|
2008-03-08 08:52:38 -05:00
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2012-11-03 14:32:50 -04:00
|
|
|
@appearance{gauge}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxSlider, wxScrollBar
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxGauge : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2008-05-02 00:12:39 -04:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxGauge();
|
2008-11-22 09:18:05 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a gauge.
|
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
|
|
|
Window parent.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Window identifier.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param range
|
2008-11-22 09:18:05 -05:00
|
|
|
Integer range (maximum value) of the gauge.
|
|
|
|
See SetRange() for more details about the meaning of this value
|
|
|
|
when using the gauge in indeterminate mode.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Window position.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Window size.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-05-02 00:12:39 -04:00
|
|
|
Gauge style.
|
2008-11-14 13:17:21 -05:00
|
|
|
@param validator
|
|
|
|
Window validator.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
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
|
|
|
wxGauge(wxWindow* parent, wxWindowID id, int range,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxGA_HORIZONTAL,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-09 11:46:52 -05:00
|
|
|
const wxString& name = wxGaugeNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the gauge.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxGauge();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-02 00:12:39 -04:00
|
|
|
Creates the gauge for two-step construction. See wxGauge() for further
|
|
|
|
details.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id, int range,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxSize& size = wxDefaultSize, long style = wxGA_HORIZONTAL,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-10-28 11:36:26 -04:00
|
|
|
const wxString& name = wxGaugeNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the maximum position of the gauge.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetRange()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetRange() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current position of the gauge.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetValue()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetValue() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-08 09:43:31 -05:00
|
|
|
Returns @true if the gauge is vertical (has @c wxGA_VERTICAL style) and
|
2008-03-08 08:52:38 -05:00
|
|
|
@false otherwise.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsVertical() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-02 00:12:39 -04:00
|
|
|
Switch the gauge to indeterminate mode (if required) and makes the
|
|
|
|
gauge move a bit to indicate the user that some progress has been made.
|
|
|
|
|
|
|
|
@note After calling this function the value returned by GetValue() is
|
2011-03-22 10:17:38 -04:00
|
|
|
undefined and thus you need to explicitly call SetValue() if you
|
2008-05-02 00:12:39 -04:00
|
|
|
want to restore the determinate mode.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Pulse();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-02 00:12:39 -04:00
|
|
|
Sets the range (maximum value) of the gauge. This function makes the
|
|
|
|
gauge switch to determinate mode, if it's not already.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-11-22 09:18:05 -05:00
|
|
|
When the gauge is in indeterminate mode, under wxMSW the gauge
|
|
|
|
repeatedly goes from zero to @a range and back; under other ports
|
|
|
|
when in indeterminate mode, the @a range setting is ignored.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetRange()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetRange(int range);
|
|
|
|
|
|
|
|
/**
|
2008-05-02 00:12:39 -04:00
|
|
|
Sets the position of the gauge. The @a pos must be between 0 and the
|
|
|
|
gauge range as returned by GetRange(), inclusive.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function makes the gauge switch to determinate mode, if it was in
|
|
|
|
indeterminate mode before.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Position for the gauge level.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetValue()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetValue(int pos);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|