X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e691f46b2ec1b5dbbff2e51131e3c532e688a89..8912d7eb182ef5a5f95026a9ed239c9ad6c75915:/src/gtk1/scrolwin.cpp diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index 1d2378e79b..175fb3494d 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -33,6 +33,7 @@ #include "wx/scrolwin.h" #include "wx/panel.h" +#include "wx/sizer.h" #include "wx/gtk/private.h" #include "wx/gtk/win_gtk.h" @@ -308,7 +309,7 @@ bool wxScrolledWindow::Create(wxWindow *parent, if (m_parent) m_parent->DoAddChild( this ); - + m_focusWidget = m_wxwindow; PostCreation(); @@ -332,7 +333,7 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, { int old_x = m_xScrollPixelsPerLine * m_xScrollPosition; int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; - + m_xScrollPixelsPerLine = pixelsPerUnitX; m_yScrollPixelsPerLine = pixelsPerUnitY; m_xScrollLines = noUnitsX; @@ -351,14 +352,14 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, m_vAdjust->value = yPos; m_vAdjust->step_increment = 1.0; m_vAdjust->page_increment = 2.0; - + AdjustScrollbars(); - + if (!noRefresh) { int new_x = m_xScrollPixelsPerLine * m_xScrollPosition; int new_y = m_yScrollPixelsPerLine * m_yScrollPosition; - + m_targetWindow->ScrollWindow( old_x-new_x, old_y-new_y ); } } @@ -587,7 +588,7 @@ void wxScrolledWindow::GetViewStart (int *x, int *y) const *y = m_yScrollPosition; } -void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) const +void wxScrolledWindow::DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const { if ( xx ) *xx = x - m_xScrollPosition * m_xScrollPixelsPerLine; @@ -595,7 +596,7 @@ void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) cons *yy = y - m_yScrollPosition * m_yScrollPixelsPerLine; } -void wxScrolledWindow::CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const +void wxScrolledWindow::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const { if ( xx ) *xx = x + m_xScrollPosition * m_xScrollPixelsPerLine; @@ -760,6 +761,22 @@ void wxScrolledWindow::GtkVDisconnectEvent() (GtkSignalFunc) gtk_scrolled_window_vscroll_callback, (gpointer) this ); } + +bool wxScrolledWindow::Layout() +{ + if (GetSizer()) + { + // Take into account the virtual size and scrolled position of the window + int x, y, w, h; + CalcScrolledPosition(0,0, &x,&y); + GetVirtualSize(&w, &h); + GetSizer()->SetDimension(x, y, w, h); + return TRUE; + } + else + return wxPanel::Layout(); // fall back to default for LayoutConstraints +} + // ---------------------------------------------------------------------------- // event handlers // ----------------------------------------------------------------------------