// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) wxWindows team
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
wxScrollHelper *m_scrollHelper;
bool m_hasDrawnWindow;
+
+ DECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler)
};
// ----------------------------------------------------------------------------
wxEventType m_eventType;
int m_pos,
m_orient;
+
+ DECLARE_NO_COPY_CLASS(wxAutoScrollTimer)
};
// ============================================================================
m_xScrollPosition = xPos;
m_yScrollPosition = yPos;
- m_targetWindow->SetVirtualSizeHints( noUnitsX * pixelsPerUnitX, noUnitsY * pixelsPerUnitY );
+ int w = noUnitsX * pixelsPerUnitX;
+ int h = noUnitsY * pixelsPerUnitY;
- AdjustScrollbars();
+ // For better backward compatibility we set persisting limits
+ // here not just the size. It makes SetScrollbars 'sticky'
+ // emulating the old non-autoscroll behaviour.
+
+ m_targetWindow->SetVirtualSizeHints( w, h );
+
+ // The above should arguably be deprecated, this however we still need.
+
+ m_targetWindow->SetVirtualSize( w, h );
if (do_refresh && !noRefresh)
m_targetWindow->Refresh(TRUE, GetRect());
+ // TODO: check if we can use AdjustScrollbars always.
+#ifdef __WXUNIVERSAL__
+ AdjustScrollbars();
+#else
+ // This is also done by AdjustScrollbars, above
#ifdef __WXMAC__
m_targetWindow->MacUpdateImmediately() ;
#endif
+#endif
}
// ----------------------------------------------------------------------------
// Default OnSize resets scrollbars, if any
void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event))
{
- if ( m_targetWindow != m_win )
- m_targetWindow->SetVirtualSize( m_targetWindow->GetClientSize() );
-
- m_win->SetVirtualSize( m_win->GetClientSize() );
+ if( m_win->GetAutoLayout() || m_targetWindow->GetAutoLayout() )
+ {
+ if ( m_targetWindow != m_win )
+ m_targetWindow->FitInside();
- AdjustScrollbars();
+ m_win->FitInside();
-#if wxUSE_CONSTRAINTS
- if (m_win->GetAutoLayout())
- m_win->Layout();
-#endif
+ // FIXME: Something is really weird here... This should be
+ // called by FitInside above (and apparently is), yet the
+ // scrollsub sample will get the scrollbar wrong if resized
+ // quickly. This masks the bug, but is surely not the right
+ // answer at all.
+ AdjustScrollbars();
+ }
+ else
+ AdjustScrollbars();
}
// This calls OnDraw, having adjusted the origin according to the current
yScrollOld = m_yScrollPosition;
int dsty;
- switch ( event.KeyCode() )
+ switch ( event.GetKeyCode() )
{
case WXK_PAGEUP:
case WXK_PRIOR:
return wxPanel::Layout();
}
+void wxGenericScrolledWindow::DoSetVirtualSize(int x, int y)
+{
+ wxPanel::DoSetVirtualSize( x, y );
+ AdjustScrollbars();
+
+#if wxUSE_CONSTRAINTS
+ if (GetAutoLayout())
+ Layout();
+#endif
+}
+
void wxGenericScrolledWindow::OnPaint(wxPaintEvent& event)
{
// the user code didn't really draw the window if we got here, so set this