Made wxWindow::HasScrollbar() do what it says.
Added wxWindow::CanScroll() with the old HasScrollbar() meaning but changed HasScrollbar() to check for the scrollbar existence instead of just checking if it might exist. Closes #10897. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -391,6 +391,8 @@ All (GUI):
|
|||||||
- Added EVT_DATAVIEW_CACHE_HINT() event (Trigve).
|
- Added EVT_DATAVIEW_CACHE_HINT() event (Trigve).
|
||||||
- Added wxLB_NO_SB style (implemented for MSW only; Dario Senic).
|
- Added wxLB_NO_SB style (implemented for MSW only; Dario Senic).
|
||||||
- Added long version field to wxAboutDialogInfo (Jeff Tupper).
|
- Added long version field to wxAboutDialogInfo (Jeff Tupper).
|
||||||
|
- Added wxWindow::CanScroll() behaving like the old HasScrollbar() and made
|
||||||
|
HasScrollbar() really check for the scrollbar existence.
|
||||||
|
|
||||||
GTK:
|
GTK:
|
||||||
|
|
||||||
|
@@ -1160,13 +1160,16 @@ public:
|
|||||||
// scrollbars
|
// scrollbars
|
||||||
// ----------
|
// ----------
|
||||||
|
|
||||||
// does the window have the scrollbar for this orientation?
|
// can the window have the scrollbar in this orientation?
|
||||||
bool HasScrollbar(int orient) const
|
bool CanScroll(int orient) const
|
||||||
{
|
{
|
||||||
return (m_windowStyle &
|
return (m_windowStyle &
|
||||||
(orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0;
|
(orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// does the window have the scrollbar in this orientation?
|
||||||
|
bool HasScrollbar(int orient) const;
|
||||||
|
|
||||||
// configure the window scrollbars
|
// configure the window scrollbars
|
||||||
virtual void SetScrollbar( int orient,
|
virtual void SetScrollbar( int orient,
|
||||||
int pos,
|
int pos,
|
||||||
|
@@ -513,7 +513,23 @@ public:
|
|||||||
virtual int GetScrollThumb(int orientation) const;
|
virtual int GetScrollThumb(int orientation) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if this window has a scroll bar for this orientation.
|
Returns @true if this window can have a scroll bar in this orientation.
|
||||||
|
|
||||||
|
@param orient
|
||||||
|
Orientation to check, either wxHORIZONTAL or wxVERTICAL.
|
||||||
|
|
||||||
|
@since 2.9.1
|
||||||
|
*/
|
||||||
|
bool CanScroll(int orient) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Returns @true if this window currently has a scroll bar for this
|
||||||
|
orientation.
|
||||||
|
|
||||||
|
This method may return @false even when CanScroll() for the same
|
||||||
|
orientation returns @true, but if CanScroll() returns @false, i.e.
|
||||||
|
scrolling in this direction is not enabled at all, HasScrollbar()
|
||||||
|
always returns @false as well.
|
||||||
|
|
||||||
@param orient
|
@param orient
|
||||||
Orientation to check, either wxHORIZONTAL or wxVERTICAL.
|
Orientation to check, either wxHORIZONTAL or wxVERTICAL.
|
||||||
|
@@ -896,6 +896,20 @@ void wxWindowBase::SendSizeEventToParent(int flags)
|
|||||||
parent->SendSizeEvent(flags);
|
parent->SendSizeEvent(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxWindowBase::HasScrollbar(int orient) const
|
||||||
|
{
|
||||||
|
// if scrolling in the given direction is disabled, we can't have the
|
||||||
|
// corresponding scrollbar no matter what
|
||||||
|
if ( !CanScroll(orient) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const wxSize sizeVirt = GetVirtualSize();
|
||||||
|
const wxSize sizeClient = GetClientSize();
|
||||||
|
|
||||||
|
return orient == wxHORIZONTAL ? sizeVirt.x > sizeClient.x
|
||||||
|
: sizeVirt.y > sizeClient.y;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// show/hide/enable/disable the window
|
// show/hide/enable/disable the window
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user