X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/385e8575dd1f9219fb0e3f7fa26ffe4c24d2fdbb..11a23db53128bf244a089123b7fd27deb577a889:/src/gtk/scrolwin.cpp?ds=sidebyside diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 291b30a49d..9b39077a3d 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -5,7 +5,6 @@ // Modified by: Ron Lee // Vadim Zeitlin: removed 90% of duplicated common code // Created: 01/02/97 -// RCS-ID: $Id$ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -31,15 +30,12 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY, int xPos, int yPos, bool noRefresh) { + // prevent programmatic position changes from causing scroll events + m_win->SetScrollPos(wxHORIZONTAL, xPos); + m_win->SetScrollPos(wxVERTICAL, yPos); + base_type::SetScrollbars( pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos, yPos, noRefresh); - - gtk_range_set_value(m_win->m_scrollBar[wxWindow::ScrollDir_Horz], m_xScrollPosition); - gtk_range_set_value(m_win->m_scrollBar[wxWindow::ScrollDir_Vert], m_yScrollPosition); - m_win->m_scrollPos[wxWindow::ScrollDir_Horz] = - gtk_range_get_value(m_win->m_scrollBar[wxWindow::ScrollDir_Horz]); - m_win->m_scrollPos[wxWindow::ScrollDir_Vert] = - gtk_range_get_value(m_win->m_scrollBar[wxWindow::ScrollDir_Vert]); } void wxScrollHelper::DoAdjustScrollbar(GtkRange* range, @@ -185,6 +181,23 @@ GtkPolicyType GtkPolicyFromWX(wxScrollbarVisibility visibility) } // anonymous namespace +bool wxScrollHelper::IsScrollbarShown(int orient) const +{ + GtkScrolledWindow * const scrolled = GTK_SCROLLED_WINDOW(m_win->m_widget); + if ( !scrolled ) + { + // By default, all windows are scrollable. + return true; + } + + GtkPolicyType hpolicy, vpolicy; + gtk_scrolled_window_get_policy(scrolled, &hpolicy, &vpolicy); + + GtkPolicyType policy = orient == wxHORIZONTAL ? hpolicy : vpolicy; + + return policy != GTK_POLICY_NEVER; +} + void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert) {