// override wxWindow methods which must be implemented by a new control
virtual wxSize DoGetBestSize() const;
+ virtual void DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags = wxSIZE_AUTO);
// override MSW-specific methods needed for new control
virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
// the image list: initially NULL, created on demand
wxImageList *m_imageList;
+ // the offset of the window used to emulate scrolling it
+ int m_scrollOffset;
+
DECLARE_NO_COPY_CLASS(wxHeaderCtrl)
};
void wxHeaderCtrl::Init()
{
m_imageList = NULL;
+ m_scrollOffset = 0;
}
bool wxHeaderCtrl::Create(wxWindow *parent,
// wxHeaderCtrl scrolling
// ----------------------------------------------------------------------------
+void wxHeaderCtrl::DoSetSize(int x, int y,
+ int w, int h,
+ int sizeFlags)
+{
+ wxHeaderCtrlBase::DoSetSize(x + m_scrollOffset, y, w - m_scrollOffset, h,
+ sizeFlags);
+}
+
void wxHeaderCtrl::DoScrollHorz(int dx)
{
// as the native control doesn't support offsetting its contents, we use a
// itself: to be precise, offset it 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);
+ m_scrollOffset += dx;
+
+ wxHeaderCtrlBase::DoSetSize(GetPosition().x + dx, -1,
+ GetSize().x - dx, -1,
+ wxSIZE_USE_EXISTING);
}
// ----------------------------------------------------------------------------