Mac(Create|Reposition)ScrollBars doesn't pay attention to resize box on Carbon

Julian Scheid julians37 at googlemail.com
Sun Jul 1 02:24:55 PDT 2007


In both wxWidgets 2.8.4 and on trunk, in file src/mac/carbon/window.cpp,
functions wxWindowMac::MacCreateScrollBars and
wxWindowMac::MacRepositionScrollBars don't pay attention to the
presence of the OS X resize handle in the lower right corner. The height
and width of the vertical and horizontal scroll bars, resp., is made to
be the full window height/width unless both scroll bars are present:

   bool hasBoth = (m_hScrollBar && m_hScrollBar->IsShown()) && ( 
m_vScrollBar && m_vScrollBar->IsShown()) ;
   //[...]
   int adjust = hasBoth ? scrlsize - 1: 0 ;
   //[...]
   wxSize vSize(scrlsize, height - adjust) ;
   //[...]
   wxSize hSize(width - adjust, scrlsize) ;

However, if only one of the scroll bars is present and the window is
resizable, the scroll bar should be shortened as well since the corner
will have the Mac OS resize handle which will obscure part of the scroll
bar if it is left at full length.

I guess it should look something along the lines of:

   bool hasCorner =
    ((m_hScrollBar && m_hScrollBar->IsShown())
      && ( m_vScrollBar && m_vScrollBar->IsShown()))
    || (style & (wxRESIZE_BORDER | wxRESIZE_BOX));
   int adjust = hasCorner ? scrlsize - 1: 0 ;

This probably would also have to take the presence of the status bar
into account, but you get the general idea.

Please let me know your thoughts. I could prepare a patch for this if
there are no objections.

Julian




More information about the wx-dev mailing list