- Added EVT_DATAVIEW_CACHE_HINT() event (Trigve).
- Added wxLB_NO_SB style (implemented for MSW only; Dario Senic).
- 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:
// acceptable size using which it will still look "nice" in
// most situations)
wxSize GetBestSize() const;
-
+
void GetBestSize(int *w, int *h) const
{
wxSize s = GetBestSize();
// scrollbars
// ----------
- // does the window have the scrollbar for this orientation?
- bool HasScrollbar(int orient) const
+ // can the window have the scrollbar in this orientation?
+ bool CanScroll(int orient) const
{
return (m_windowStyle &
(orient == wxHORIZONTAL ? wxHSCROLL : wxVSCROLL)) != 0;
}
+ // does the window have the scrollbar in this orientation?
+ bool HasScrollbar(int orient) const;
+
// configure the window scrollbars
virtual void SetScrollbar( int orient,
int pos,
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
Orientation to check, either wxHORIZONTAL or wxVERTICAL.
node = node->GetNext() )
{
wxWindow *win = node->GetData();
- if ( !win->IsTopLevel() && win->IsShown()
+ if ( !win->IsTopLevel() && win->IsShown()
#if wxUSE_SCROLLBAR
&& !win->IsKindOf(CLASSINFO(wxScrollBar))
#endif
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
// ----------------------------------------------------------------------------