virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
+ // lay out the window and its children
+ virtual bool Layout();
+
protected:
// this is needed for wxEVT_PAINT processing hack described in
// wxScrollHelperEvtHandler::ProcessEvent()
// automatically change the origin according to the scroll position.
virtual void PrepareDC(wxDC& dc);
+ // lay out the window and its children
+ virtual bool Layout();
+
// Adjust the scrollbars
virtual void AdjustScrollbars();
// automatically change the origin according to the scroll position.
virtual void PrepareDC(wxDC& dc);
+ // lay out the window and its children
+ virtual bool Layout();
+
// Adjust the scrollbars
virtual void AdjustScrollbars();
// Default OnSize resets scrollbars, if any
void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event))
{
-#if wxUSE_CONSTRAINTS
- if ( m_win->GetAutoLayout() )
- m_win->Layout();
-#endif
-
AdjustScrollbars();
}
{
}
+bool wxGenericScrolledWindow::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
+}
+
void wxGenericScrolledWindow::OnPaint(wxPaintEvent& event)
{
// the user code didn't really draw the window if we got here, so set this
#include "wx/scrolwin.h"
#include "wx/panel.h"
+#include "wx/sizer.h"
#include "wx/gtk/private.h"
#include "wx/gtk/win_gtk.h"
if (m_parent)
m_parent->DoAddChild( this );
-
+
m_focusWidget = m_wxwindow;
PostCreation();
{
int old_x = m_xScrollPixelsPerLine * m_xScrollPosition;
int old_y = m_yScrollPixelsPerLine * m_yScrollPosition;
-
+
m_xScrollPixelsPerLine = pixelsPerUnitX;
m_yScrollPixelsPerLine = pixelsPerUnitY;
m_xScrollLines = noUnitsX;
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 );
}
}
(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
// ----------------------------------------------------------------------------
#include "wx/scrolwin.h"
#include "wx/panel.h"
+#include "wx/sizer.h"
#include "wx/gtk/private.h"
#include "wx/gtk/win_gtk.h"
if (m_parent)
m_parent->DoAddChild( this );
-
+
m_focusWidget = m_wxwindow;
PostCreation();
{
int old_x = m_xScrollPixelsPerLine * m_xScrollPosition;
int old_y = m_yScrollPixelsPerLine * m_yScrollPosition;
-
+
m_xScrollPixelsPerLine = pixelsPerUnitX;
m_yScrollPixelsPerLine = pixelsPerUnitY;
m_xScrollLines = noUnitsX;
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 );
}
}
(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
// ----------------------------------------------------------------------------