// associated window), always (as wxALWAYS_SHOW_SB style does) or never (in
// which case you should provide some other way to scroll the window as the
// user wouldn't be able to do it at all)
- void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert);
+ void ShowScrollbars(wxScrollbarVisibility horz, wxScrollbarVisibility vert)
+ {
+ DoShowScrollbars(horz, vert);
+ }
// Enable/disable Windows scrolling in either direction. If true, wxWidgets
// scrolls the canvas and only a bit of the canvas is invalidated; no
int virtSize,
int& pixelsPerUnit,
int& scrollUnits,
- int& scrollPosition);
+ int& scrollPosition,
+ wxScrollbarVisibility visibility);
// this function should be overridden to return the size available for
// m_targetWindow inside m_win of the given size
wxScrollHelperEvtHandler *m_handler;
+ wxScrollbarVisibility m_xVisibility,
+ m_yVisibility;
DECLARE_NO_COPY_CLASS(wxScrollHelper)
};
m_xScrollingEnabled =
m_yScrollingEnabled = true;
+ m_xVisibility =
+ m_yVisibility = wxSHOW_SB_DEFAULT;
+
m_scaleX =
m_scaleY = 1.0;
#if wxUSE_MOUSEWHEEL
int virtSize,
int& pixelsPerUnit,
int& scrollUnits,
- int& scrollPosition)
+ int& scrollPosition,
+ wxScrollbarVisibility visibility)
{
+ if ( visibility == wxSHOW_SB_NEVER )
+ {
+ m_win->SetScrollbar(orient, 0, 0, 0);
+ return;
+ }
+
// scroll lines per page: if 0, no scrolling is needed
int unitsPerPage;
// check if we need scrollbar in this direction at all
- if ( pixelsPerUnit == 0 || clientSize >= virtSize )
+ if ( pixelsPerUnit == 0 ||
+ (clientSize >= virtSize && visibility != wxSHOW_SB_ALWAYS) )
{
// scrolling is disabled or unnecessary
scrollUnits =
virtSize.x,
m_xScrollPixelsPerLine,
m_xScrollLines,
- m_xScrollPosition);
+ m_xScrollPosition,
+ m_xVisibility);
AdjustScrollbar(wxVERTICAL,
clientSize.y,
virtSize.y,
m_yScrollPixelsPerLine,
m_yScrollLines,
- m_yScrollPosition);
+ m_yScrollPosition,
+ m_yVisibility);
// If a scrollbar (dis)appeared as a result of this, we need to adjust
m_yScrollingEnabled = y_scroll;
}
-void wxScrollHelper::ShowScrollbars(wxScrollbarVisibility horz,
- wxScrollbarVisibility vert)
-{
- DoShowScrollbars(horz, vert);
-}
-
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
wxScrollbarVisibility vert)
{
- // TODO
+ if ( horz != m_xVisibility || vert != m_yVisibility )
+ {
+ m_xVisibility = horz;
+ m_yVisibility = vert;
+
+ AdjustScrollbars();
+ }
}
// Where the current view starts from