provide generic implementation for ShowScrollbars() too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -93,7 +93,10 @@ public:
|
|||||||
// associated window), always (as wxALWAYS_SHOW_SB style does) or never (in
|
// 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
|
// which case you should provide some other way to scroll the window as the
|
||||||
// user wouldn't be able to do it at all)
|
// 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
|
// Enable/disable Windows scrolling in either direction. If true, wxWidgets
|
||||||
// scrolls the canvas and only a bit of the canvas is invalidated; no
|
// scrolls the canvas and only a bit of the canvas is invalidated; no
|
||||||
@@ -246,7 +249,8 @@ protected:
|
|||||||
int virtSize,
|
int virtSize,
|
||||||
int& pixelsPerUnit,
|
int& pixelsPerUnit,
|
||||||
int& scrollUnits,
|
int& scrollUnits,
|
||||||
int& scrollPosition);
|
int& scrollPosition,
|
||||||
|
wxScrollbarVisibility visibility);
|
||||||
|
|
||||||
// this function should be overridden to return the size available for
|
// this function should be overridden to return the size available for
|
||||||
// m_targetWindow inside m_win of the given size
|
// m_targetWindow inside m_win of the given size
|
||||||
@@ -293,6 +297,8 @@ protected:
|
|||||||
|
|
||||||
wxScrollHelperEvtHandler *m_handler;
|
wxScrollHelperEvtHandler *m_handler;
|
||||||
|
|
||||||
|
wxScrollbarVisibility m_xVisibility,
|
||||||
|
m_yVisibility;
|
||||||
|
|
||||||
DECLARE_NO_COPY_CLASS(wxScrollHelper)
|
DECLARE_NO_COPY_CLASS(wxScrollHelper)
|
||||||
};
|
};
|
||||||
|
@@ -323,6 +323,9 @@ wxScrollHelper::wxScrollHelper(wxWindow *win)
|
|||||||
m_xScrollingEnabled =
|
m_xScrollingEnabled =
|
||||||
m_yScrollingEnabled = true;
|
m_yScrollingEnabled = true;
|
||||||
|
|
||||||
|
m_xVisibility =
|
||||||
|
m_yVisibility = wxSHOW_SB_DEFAULT;
|
||||||
|
|
||||||
m_scaleX =
|
m_scaleX =
|
||||||
m_scaleY = 1.0;
|
m_scaleY = 1.0;
|
||||||
#if wxUSE_MOUSEWHEEL
|
#if wxUSE_MOUSEWHEEL
|
||||||
@@ -650,13 +653,21 @@ wxScrollHelper::AdjustScrollbar(int orient,
|
|||||||
int virtSize,
|
int virtSize,
|
||||||
int& pixelsPerUnit,
|
int& pixelsPerUnit,
|
||||||
int& scrollUnits,
|
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
|
// scroll lines per page: if 0, no scrolling is needed
|
||||||
int unitsPerPage;
|
int unitsPerPage;
|
||||||
|
|
||||||
// check if we need scrollbar in this direction at all
|
// 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
|
// scrolling is disabled or unnecessary
|
||||||
scrollUnits =
|
scrollUnits =
|
||||||
@@ -755,14 +766,16 @@ void wxScrollHelper::AdjustScrollbars()
|
|||||||
virtSize.x,
|
virtSize.x,
|
||||||
m_xScrollPixelsPerLine,
|
m_xScrollPixelsPerLine,
|
||||||
m_xScrollLines,
|
m_xScrollLines,
|
||||||
m_xScrollPosition);
|
m_xScrollPosition,
|
||||||
|
m_xVisibility);
|
||||||
|
|
||||||
AdjustScrollbar(wxVERTICAL,
|
AdjustScrollbar(wxVERTICAL,
|
||||||
clientSize.y,
|
clientSize.y,
|
||||||
virtSize.y,
|
virtSize.y,
|
||||||
m_yScrollPixelsPerLine,
|
m_yScrollPixelsPerLine,
|
||||||
m_yScrollLines,
|
m_yScrollLines,
|
||||||
m_yScrollPosition);
|
m_yScrollPosition,
|
||||||
|
m_yVisibility);
|
||||||
|
|
||||||
|
|
||||||
// If a scrollbar (dis)appeared as a result of this, we need to adjust
|
// If a scrollbar (dis)appeared as a result of this, we need to adjust
|
||||||
@@ -972,16 +985,16 @@ void wxScrollHelper::EnableScrolling (bool x_scroll, bool y_scroll)
|
|||||||
m_yScrollingEnabled = y_scroll;
|
m_yScrollingEnabled = y_scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxScrollHelper::ShowScrollbars(wxScrollbarVisibility horz,
|
|
||||||
wxScrollbarVisibility vert)
|
|
||||||
{
|
|
||||||
DoShowScrollbars(horz, vert);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
|
void wxScrollHelper::DoShowScrollbars(wxScrollbarVisibility horz,
|
||||||
wxScrollbarVisibility vert)
|
wxScrollbarVisibility vert)
|
||||||
{
|
{
|
||||||
// TODO
|
if ( horz != m_xVisibility || vert != m_yVisibility )
|
||||||
|
{
|
||||||
|
m_xVisibility = horz;
|
||||||
|
m_yVisibility = vert;
|
||||||
|
|
||||||
|
AdjustScrollbars();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Where the current view starts from
|
// Where the current view starts from
|
||||||
|
Reference in New Issue
Block a user