emulate scrolling in wxMSW header control; document the need to call ScrollWindow() when using it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57133 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-05 22:11:27 +00:00
parent a000920547
commit f24f657913
3 changed files with 31 additions and 1 deletions

View File

@@ -86,6 +86,29 @@ wxHeaderCtrl::~wxHeaderCtrl()
delete m_imageList;
}
// ----------------------------------------------------------------------------
// wxHeaderCtrl scrolling
// ----------------------------------------------------------------------------
// as the native control doesn't support offsetting its contents, we use a hack
// here to make it appear correctly when the parent is scrolled: instead of
// scrolling or repainting we simply move the control window itself
void wxHeaderCtrl::ScrollWindow(int dx,
int WXUNUSED_UNLESS_DEBUG(dy),
const wxRect * WXUNUSED_UNLESS_DEBUG(rect))
{
// this doesn't make sense at all
wxASSERT_MSG( !dy, "header window can't be scrolled vertically" );
// this would actually be nice to support for "frozen" headers
wxASSERT_MSG( !rect, "header window can't be scrolled partially" );
// offset the window by the scroll increment to the left and increment its
// width to still extend to the right boundary to compensate for it (notice
// that dx is negative when scrolling to the right)
SetSize(GetPosition().x + dx, -1, GetSize().x - dx, -1, wxSIZE_USE_EXISTING);
}
// ----------------------------------------------------------------------------
// wxHeaderCtrl geometry calculation
// ----------------------------------------------------------------------------