Add wxSpinCtrl::SetIncrement() and implement it for all ports
SetIncrement() was already available in wxSpinCtrlDouble and GTK version of wxSpinCtrl, now implement support for it in wxMSW and wxOSX as well. In fact, in wxMSW, implement it at wxSpinButton level, so that both this class and wxSpinCtrl inheriting from it (in wxMSW only) support setting custom increment now. Also add support for it to XRC, show it in the sample and add a unit test verifying that it works. Closes #2597.
This commit is contained in:
committed by
Vadim Zeitlin
parent
57b4a11f24
commit
995c6e6df5
@@ -288,4 +288,24 @@ bool wxSpinButton::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD WXUNUSED(id))
|
||||
return false;
|
||||
}
|
||||
|
||||
void wxSpinButton::SetIncrement(int value)
|
||||
{
|
||||
UDACCEL accel;
|
||||
accel.nSec = 0;
|
||||
accel.nInc = value;
|
||||
::SendMessage(GetHwnd(), UDM_SETACCEL, 1, (LPARAM) &accel);
|
||||
}
|
||||
|
||||
int wxSpinButton::GetIncrement() const
|
||||
{
|
||||
UDACCEL accel;
|
||||
|
||||
// If the message is unsupported, this default value won't be modified and
|
||||
// will be returned below.
|
||||
accel.nInc = 1;
|
||||
|
||||
::SendMessage(GetHwnd(), UDM_GETACCEL, 1, (LPARAM) &accel);
|
||||
|
||||
return accel.nInc;
|
||||
}
|
||||
#endif // wxUSE_SPINBTN
|
||||
|
||||
Reference in New Issue
Block a user