+bool wxWindowMac::MacHasScrollBarCorner() const
+{
+ /* Returns whether the scroll bars in a wxScrolledWindow should be
+ * shortened. Scroll bars should be shortened if either:
+ *
+ * - both scroll bars are visible, or
+ *
+ * - there is a resize box in the parent frame's corner and this
+ * window shares the bottom and right edge with the parent
+ * frame.
+ */
+
+ if ( m_hScrollBar == NULL && m_vScrollBar == NULL )
+ return false;
+
+ if ( ( m_hScrollBar && m_hScrollBar->IsShown() )
+ && ( m_vScrollBar && m_vScrollBar->IsShown() ) )
+ {
+ // Both scroll bars visible
+ return true;
+ }
+ else
+ {
+ wxPoint thisWindowBottomRight = GetScreenRect().GetBottomRight();
+
+ for ( const wxWindow *win = this; win; win = win->GetParent() )
+ {
+ const wxFrame *frame = wxDynamicCast( win, wxFrame ) ;
+ if ( frame )
+ {
+ if ( frame->GetWindowStyleFlag() & wxRESIZE_BORDER )
+ {
+ // Parent frame has resize handle
+ wxPoint frameBottomRight = frame->GetScreenRect().GetBottomRight();
+
+ // Note: allow for some wiggle room here as wxMac's
+ // window rect calculations seem to be imprecise
+ if ( abs( thisWindowBottomRight.x - frameBottomRight.x ) <= 2
+ && abs( thisWindowBottomRight.y - frameBottomRight.y ) <= 2 )
+ {
+ // Parent frame has resize handle and shares
+ // right bottom corner
+ return true ;
+ }
+ else
+ {
+ // Parent frame has resize handle but doesn't
+ // share right bottom corner
+ return false ;
+ }
+ }
+ else
+ {
+ // Parent frame doesn't have resize handle
+ return false ;
+ }
+ }
+ }
+
+ // No parent frame found
+ return false ;
+ }
+}
+