X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a337f95d82671e8f94809a49687d2c18d316e39..74a3342702bf3a76a845f65f4510fd8612d3d802:/src/propgrid/advprops.cpp diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 32eff3b0a7..83d392b310 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -108,6 +108,14 @@ bool operator == (const wxArrayInt& array1, const wxArrayInt& array2) #if wxUSE_SPINBTN +#ifdef __WXMSW__ + #define IS_MOTION_SPIN_SUPPORTED 1 +#else + #define IS_MOTION_SPIN_SUPPORTED 0 +#endif + +#if IS_MOTION_SPIN_SUPPORTED + // // This class implements ability to rapidly change "spin" value // by moving mouse when one of the spin buttons is depressed. @@ -194,18 +202,23 @@ private: { if ( m_bLeftDown ) { - Capture(); int dy = m_ptPosition.y - event.GetPosition().y; - m_ptPosition = event.GetPosition(); - - wxSpinEvent evtscroll( (dy >= 0) ? wxEVT_SCROLL_LINEUP : - wxEVT_SCROLL_LINEDOWN, - GetId() ); - evtscroll.SetEventObject(this); - - m_spins = abs(dy); - GetEventHandler()->ProcessEvent(evtscroll); - m_spins = 1; + if ( dy ) + { + Capture(); + m_ptPosition = event.GetPosition(); + + wxSpinEvent evtscroll( (dy >= 0) ? wxEVT_SCROLL_LINEUP : + wxEVT_SCROLL_LINEDOWN, + GetId() ); + evtscroll.SetEventObject(this); + + wxASSERT( m_spins == 1 ); + + m_spins = abs(dy); + GetEventHandler()->ProcessEvent(evtscroll); + m_spins = 1; + } } } @@ -217,6 +230,8 @@ private: } }; +#endif // IS_MOTION_SPIN_SUPPORTED + WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(SpinCtrl, wxPGSpinCtrlEditor, @@ -240,7 +255,16 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP wxSpinButton* wnd2; - wnd2 = new wxPGSpinButton(); +#if IS_MOTION_SPIN_SUPPORTED + if ( property->GetAttributeAsLong(wxT("MotionSpin"), 0) ) + { + wnd2 = new wxPGSpinButton(); + } + else +#endif + { + wnd2 = new wxSpinButton(); + } #ifdef __WXMSW__ wnd2->Hide(); @@ -291,11 +315,16 @@ bool wxPGSpinCtrlEditor::OnEvent( wxPropertyGrid* propgrid, wxPGProperty* proper if ( evtType == wxEVT_SCROLL_LINEUP || evtType == wxEVT_SCROLL_LINEDOWN ) { - wxPGSpinButton* spinButton = - (wxPGSpinButton*) propgrid->GetEditorControlSecondary(); + #if IS_MOTION_SPIN_SUPPORTED + if ( property->GetAttributeAsLong(wxT("MotionSpin"), 0) ) + { + wxPGSpinButton* spinButton = + (wxPGSpinButton*) propgrid->GetEditorControlSecondary(); - if ( spinButton ) - spins = spinButton->GetSpins(); + if ( spinButton ) + spins = spinButton->GetSpins(); + } + #endif wxString s; // Can't use wnd since it might be clipper window @@ -1875,7 +1904,8 @@ void wxMultiChoiceProperty::GenerateValueAsString( wxVariant& value, wxArrayInt wxMultiChoiceProperty::GetValueAsIndices() const { - const wxArrayInt& valueArr = wxArrayIntRefFromVariant(GetValue()); + wxVariant variant = GetValue(); + const wxArrayInt& valueArr = wxArrayIntRefFromVariant(variant); unsigned int i; // Translate values to string indices.