X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/524c47aa3adf2af11a3069fd5da035a604f08f66..a830dc4832c351b0e13d444a12bcc415678e2559:/src/osx/scrolbar_osx.cpp?ds=sidebyside diff --git a/src/osx/scrolbar_osx.cpp b/src/osx/scrolbar_osx.cpp index f9e695b48b..9b8371a172 100644 --- a/src/osx/scrolbar_osx.cpp +++ b/src/osx/scrolbar_osx.cpp @@ -83,7 +83,7 @@ void wxScrollBar::Command( wxCommandEvent& event ) ProcessCommand( event ); } -bool wxScrollBar::HandleClicked( double timestampsec ) +bool wxScrollBar::OSXHandleClicked( double timestampsec ) { int new_pos = m_peer->GetValue(); @@ -124,3 +124,54 @@ wxSize wxScrollBar::DoGetBestSize() const CacheBestSize(best); return best; } + +void wxScrollBar::TriggerScrollEvent( wxEventType scrollEvent ) +{ + int position = m_peer->GetValue(); + int minPos = 0 ; + int maxPos = m_peer->GetMaximum(); + int nScrollInc = 0; + + if ( scrollEvent == wxEVT_SCROLL_LINEUP ) + { + nScrollInc = -1; + } + else if ( scrollEvent == wxEVT_SCROLL_LINEDOWN ) + { + nScrollInc = 1; + } + else if ( scrollEvent == wxEVT_SCROLL_PAGEUP ) + { + nScrollInc = -m_pageSize; + } + else if ( scrollEvent == wxEVT_SCROLL_PAGEDOWN ) + { + nScrollInc = m_pageSize; + } + + int new_pos = position + nScrollInc; + + if (new_pos < minPos) + new_pos = minPos; + else if (new_pos > maxPos) + new_pos = maxPos; + + if ( nScrollInc ) + SetThumbPosition( new_pos ); + + wxScrollEvent event( scrollEvent, m_windowId ); + if ( m_windowStyle & wxHORIZONTAL ) + event.SetOrientation( wxHORIZONTAL ); + else + event.SetOrientation( wxVERTICAL ); + + event.SetPosition( new_pos ); + event.SetEventObject( this ); + + wxWindow* window = GetParent(); + if (window && window->MacIsWindowScrollbar( this )) + // this is hardcoded + window->MacOnScroll( event ); + else + HandleWindowEvent( event ); +} \ No newline at end of file