X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a91b47e800c78dbf8e91191ce3977d148a13f1fe..e459f82d0110709444984bf739314f4a84de48d3:/src/generic/scrolwin.cpp diff --git a/src/generic/scrolwin.cpp b/src/generic/scrolwin.cpp index 139f45ed39..6786900ccd 100644 --- a/src/generic/scrolwin.cpp +++ b/src/generic/scrolwin.cpp @@ -28,7 +28,7 @@ #if !USE_SHARED_LIBRARY BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow) - EVT_SCROLL(wxScrolledWindow::OnScroll) + EVT_SCROLLWIN(wxScrolledWindow::OnScroll) EVT_SIZE(wxScrolledWindow::OnSize) EVT_PAINT(wxScrolledWindow::OnPaint) END_EVENT_TABLE() @@ -45,7 +45,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow) #include #endif -wxScrolledWindow::wxScrolledWindow(void) +wxScrolledWindow::wxScrolledWindow() { m_xScrollPixelsPerLine = 0; m_yScrollPixelsPerLine = 0; @@ -94,9 +94,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, bool do_refresh = ( (noUnitsX != 0 && m_xScrollLines == 0) || - (noUnitsX < m_xScrollPosition) || + (noUnitsX < m_xScrollLines) || (noUnitsY != 0 && m_yScrollLines == 0) || - (noUnitsY < m_yScrollPosition) || + (noUnitsY < m_yScrollLines) || (xPos != m_xScrollPosition) || (yPos != m_yScrollPosition) || (pixelsPerUnitX != m_xScrollPixelsPerLine) || @@ -145,7 +145,8 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, AdjustScrollbars(); - if (do_refresh && !noRefresh) Refresh(); + if (do_refresh && !noRefresh) + Refresh(); #ifdef __WXMSW__ // Necessary? @@ -153,7 +154,7 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, #endif } -void wxScrolledWindow::OnScroll(wxScrollEvent& event) +void wxScrolledWindow::OnScroll(wxScrollWinEvent& event) { int orient = event.GetOrientation(); @@ -196,7 +197,7 @@ void wxScrolledWindow::OnScroll(wxScrollEvent& event) } } -int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) +int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event) { int pos = event.GetPosition(); int orient = event.GetOrientation(); @@ -204,7 +205,7 @@ int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) int nScrollInc = 0; switch (event.GetEventType()) { - case wxEVT_SCROLL_TOP: + case wxEVT_SCROLLWIN_TOP: { if (orient == wxHORIZONTAL) nScrollInc = - m_xScrollPosition; @@ -212,7 +213,7 @@ int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) nScrollInc = - m_yScrollPosition; break; } - case wxEVT_SCROLL_BOTTOM: + case wxEVT_SCROLLWIN_BOTTOM: { if (orient == wxHORIZONTAL) nScrollInc = m_xScrollLines - m_xScrollPosition; @@ -220,17 +221,17 @@ int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) nScrollInc = m_yScrollLines - m_yScrollPosition; break; } - case wxEVT_SCROLL_LINEUP: + case wxEVT_SCROLLWIN_LINEUP: { nScrollInc = -1; break; } - case wxEVT_SCROLL_LINEDOWN: + case wxEVT_SCROLLWIN_LINEDOWN: { nScrollInc = 1; break; } - case wxEVT_SCROLL_PAGEUP: + case wxEVT_SCROLLWIN_PAGEUP: { if (orient == wxHORIZONTAL) nScrollInc = -GetScrollPageSize(wxHORIZONTAL); @@ -238,7 +239,7 @@ int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) nScrollInc = -GetScrollPageSize(wxVERTICAL); break; } - case wxEVT_SCROLL_PAGEDOWN: + case wxEVT_SCROLLWIN_PAGEDOWN: { if (orient == wxHORIZONTAL) nScrollInc = GetScrollPageSize(wxHORIZONTAL); @@ -246,7 +247,7 @@ int wxScrolledWindow::CalcScrollInc(wxScrollEvent& event) nScrollInc = GetScrollPageSize(wxVERTICAL); break; } - case wxEVT_SCROLL_THUMBTRACK: + case wxEVT_SCROLLWIN_THUMBTRACK: { if (orient == wxHORIZONTAL) nScrollInc = pos - m_xScrollPosition; @@ -456,7 +457,8 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos ) SetScrollPos( wxVERTICAL, m_yScrollPosition, TRUE ); } - Refresh(); + // BAD, BAD, can cause event loops if called from OnPaint(). KB. + // Refresh(); #ifdef __WXMSW__ // Necessary?