X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/29cc4cc9bcfd25f9b586e3f1b52a2168802616fc..9c34a216817028bc533e07873d047208a96b05a2:/src/generic/spinctlg.cpp diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 0e13113779..90d087da87 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -284,7 +284,7 @@ wxSize wxSpinCtrlGenericBase::DoGetSizeFromTextSize(int xlen, int ylen) const wxSize tsize(xlen + sizeBtn.x + MARGIN, totalS.y); #if defined(__WXMSW__) - tsize.IncBy(0.4 * totalS.y + 4, 0); + tsize.IncBy(4*totalS.y/10 + 4, 0); #elif defined(__WXGTK__) tsize.IncBy(totalS.y + 10, 0); #endif // MSW GTK @@ -533,9 +533,11 @@ bool wxSpinCtrlGenericBase::DoSetValue(double val) { wxCHECK_MSG( m_textCtrl, false, wxT("invalid call to wxSpinCtrl::SetValue") ); - if (!InRange(val)) - return false; - + if ( val < m_min ) + val = m_min; + if ( val > m_max ) + val = m_max; + if ( m_snap_to_ticks && (m_increment != 0) ) { double snap_value = val / m_increment; @@ -577,7 +579,11 @@ double wxSpinCtrlGenericBase::AdjustToFitInRange(double value) const void wxSpinCtrlGenericBase::DoSetRange(double min, double max) { m_min = min; + if ( m_value < m_min ) + DoSetValue(m_min); m_max = max; + if ( m_value > m_max ) + DoSetValue(m_max); } void wxSpinCtrlGenericBase::DoSetIncrement(double inc) @@ -630,7 +636,7 @@ bool wxSpinCtrl::SetBase(int base) void wxSpinCtrl::DoSendEvent() { - wxSpinEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, GetId()); + wxSpinEvent event( wxEVT_SPINCTRL, GetId()); event.SetEventObject( this ); event.SetPosition((int)(m_value + 0.5)); // FIXME should be SetValue event.SetString(m_textCtrl->GetValue()); @@ -675,7 +681,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrlDouble, wxSpinCtrlGenericBase) void wxSpinCtrlDouble::DoSendEvent() { - wxSpinDoubleEvent event( wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED, GetId()); + wxSpinDoubleEvent event( wxEVT_SPINCTRLDOUBLE, GetId()); event.SetEventObject( this ); event.SetValue(m_value); event.SetString(m_textCtrl->GetValue());