2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: spinbutt.h
|
2008-10-05 07:24:00 -04:00
|
|
|
// Purpose: interface of wxSpinEvent, wxSpinButton
|
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
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxSpinEvent
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-05 07:24:00 -04:00
|
|
|
This event class is used for the events generated by wxSpinButton and wxSpinCtrl.
|
|
|
|
|
|
|
|
@beginEventTable{wxSpinEvent}
|
|
|
|
@event{EVT_SPIN(id, func)}
|
|
|
|
Generated whenever an arrow is pressed.
|
|
|
|
@event{EVT_SPIN_UP(id, func)}
|
|
|
|
Generated when left/up arrow is pressed.
|
|
|
|
@event{EVT_SPIN_DOWN(id, func)}
|
|
|
|
Generated when right/down arrow is pressed.
|
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
Note that if you handle both SPIN and UP or DOWN events, you will be notified
|
|
|
|
about each of them twice: first the UP/DOWN event will be received and then,
|
|
|
|
if it wasn't vetoed, the SPIN event will be sent.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{events}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxSpinButton and wxSpinCtrl
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxSpinEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
The constructor is not normally used by the user code.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Retrieve the current spin button or control value.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetPosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Set the value associated with the event.
|
|
|
|
*/
|
|
|
|
void SetPosition(int pos);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxSpinButton
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-05 07:24:00 -04:00
|
|
|
A wxSpinButton has two small up and down (or left and right) arrow buttons.
|
|
|
|
|
|
|
|
It is often used next to a text control for increment and decrementing a value.
|
|
|
|
Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not
|
|
|
|
implemented for all platforms but wxSpinCtrl is as it degenerates to a simple
|
|
|
|
wxTextCtrl on such platforms.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-28 12:19:12 -04:00
|
|
|
@note the range supported by this control (and wxSpinCtrl) depends on the
|
2008-10-05 07:24:00 -04:00
|
|
|
platform but is at least @c -0x8000 to @c 0x7fff. Under GTK and
|
|
|
|
Win32 with sufficiently new version of @c comctrl32.dll (at least 4.71
|
|
|
|
is required, 5.80 is recommended) the full 32 bit range is supported.
|
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{wxSP_HORIZONTAL}
|
2008-03-08 08:52:38 -05:00
|
|
|
Specifies a horizontal spin button (note that this style is not
|
|
|
|
supported in wxGTK).
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxSP_VERTICAL}
|
2008-03-08 08:52:38 -05:00
|
|
|
Specifies a vertical spin button.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxSP_ARROW_KEYS}
|
2008-03-08 08:52:38 -05:00
|
|
|
The user can use arrow keys to change the value.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxSP_WRAP}
|
2008-03-08 08:52:38 -05:00
|
|
|
The value wraps at the minimum and maximum.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2009-02-18 12:58:51 -05:00
|
|
|
@beginEventEmissionTable{wxSpinEvent}
|
2008-10-05 07:24:00 -04:00
|
|
|
@event{EVT_SPIN(id, func)}
|
|
|
|
Generated whenever an arrow is pressed.
|
|
|
|
@event{EVT_SPIN_UP(id, func)}
|
|
|
|
Generated when left/up arrow is pressed.
|
|
|
|
@event{EVT_SPIN_DOWN(id, func)}
|
|
|
|
Generated when right/down arrow is pressed.
|
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
Note that if you handle both SPIN and UP or DOWN events, you will be notified
|
|
|
|
about each of them twice: first the UP/DOWN event will be received and then,
|
|
|
|
if it wasn't vetoed, the SPIN event will be sent.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2012-11-03 14:32:50 -04:00
|
|
|
@appearance{spinbutton}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxSpinCtrl
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxSpinButton : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2008-05-24 15:37:12 -04:00
|
|
|
/**
|
|
|
|
Default constructor.
|
|
|
|
*/
|
|
|
|
wxSpinButton();
|
2008-10-05 07:24:00 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a spin button.
|
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
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
Window identifier. The value wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-10-05 07:24:00 -04:00
|
|
|
Window position.
|
2009-04-21 07:21:36 -04:00
|
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-10-05 07:24:00 -04:00
|
|
|
Window size.
|
2009-04-21 07:21:36 -04:00
|
|
|
If ::wxDefaultSize is specified then a default size is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-10-05 07:24:00 -04:00
|
|
|
Window style. See wxSpinButton class description.
|
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-11-13 16:32:53 -05:00
|
|
|
wxSpinButton(wxWindow* parent, wxWindowID id = -1,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-11-13 16:32:53 -05:00
|
|
|
long style = wxSP_VERTICAL,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxString& name = "spinButton");
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroys the spin button control.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxSpinButton();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Scrollbar creation function called by the spin button constructor.
|
|
|
|
See wxSpinButton() for details.
|
|
|
|
*/
|
2008-10-29 11:34:31 -04:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id = -1,
|
2008-03-08 08:52:38 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
2008-11-13 16:32:53 -05:00
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSP_VERTICAL,
|
2008-10-29 11:34:31 -04:00
|
|
|
const wxString& name = "wxSpinButton");
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the maximum permissible value.
|
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-09-27 07:21:10 -04:00
|
|
|
virtual int GetMax() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the minimum permissible value.
|
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-09-27 07:21:10 -04:00
|
|
|
virtual int GetMin() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current spin button value.
|
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-09-27 07:21:10 -04:00
|
|
|
virtual int GetValue() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the range of the spin button.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param min
|
2008-03-09 08:33:59 -04:00
|
|
|
The minimum value for the spin button.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param max
|
2008-03-09 08:33:59 -04:00
|
|
|
The maximum value for the spin button.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetMin(), GetMax()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetRange(int min, int max);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the value of the spin button.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param value
|
2008-03-09 08:33:59 -04:00
|
|
|
The value for the spin button.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetValue(int value);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|