From 42af6685ae2fd859a0a424dc24bbae450542f907 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Mar 2009 14:27:06 +0000 Subject: [PATCH] support wxSP_WRAP in generic implementation (closes #10557) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/spinctlg.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 9940b7bff4..41c2e66288 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -497,6 +497,7 @@ All (GUI): Added also wxEventLoopBase::IsYielding to help cure re-entrancy problems with Yield(). - Render element contents in bold in wxHTML. - Added wxGrid::{Set,Get}{Row,Col}Sizes() methods (Andrey Putrin). +- Add support for wxSP_WRAP in the generic version of wxSpinCtrlDouble. wxGTK: diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 1235d9819c..8be2e5d720 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -339,9 +339,11 @@ void wxSpinCtrlGenericBase::OnSpinButton(wxSpinEvent& event) double value = m_value + step*m_increment; - // we can always reach the ends using the spinbutton - if (value < m_min) value = m_min; - if (value > m_max) value = m_max; + // Check for over/underflow wrapping around if necessary + if (value < m_min) + value = HasFlag(wxSP_WRAP) ? m_max : m_min; + if (value > m_max) + value = HasFlag(wxSP_WRAP) ? m_min : m_max; // Ignore the edges when it wraps since the up/down event may be opposite // They are in GTK and Mac -- 2.45.2