diff --git a/src/osx/carbon/frame.cpp b/src/osx/carbon/frame.cpp index d0033a3d5d..5d6a0bd47d 100644 --- a/src/osx/carbon/frame.cpp +++ b/src/osx/carbon/frame.cpp @@ -62,11 +62,11 @@ wxPoint wxFrame::GetClientAreaOrigin() const int w, h; toolbar->GetSize(&w, &h); - if ( toolbar->HasFlag(wxTB_LEFT) ) + if ( toolbar->HasFlag(wxTB_LEFT) && !toolbar->HasFlag(wxTB_RIGHT) ) { pt.x += w; } - else if ( toolbar->HasFlag(wxTB_TOP) ) + else if ( toolbar->HasFlag(wxTB_TOP) && !toolbar->HasFlag(wxTB_BOTTOM) ) { #if !wxOSX_USE_NATIVE_TOOLBAR pt.y += h; @@ -342,14 +342,12 @@ void wxFrame::PositionToolBar() tx = ty = 0 ; GetToolBar()->GetSize(&tw, &th); - if (GetToolBar()->HasFlag(wxTB_LEFT)) - { - // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS - // means, pretend we don't have toolbar/status bar, so we - // have the original client size. - GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS ); - } - else if (GetToolBar()->HasFlag(wxTB_RIGHT)) + + // Note: we need to test for wxTB_RIGHT before wxTB_LEFT, as the latter + // is the same as wxTB_VERTICAL and it's possible to combine wxTB_RIGHT + // with wxTB_VERTICAL, so testing for wxTB_LEFT could be true for a + // right-aligned toolbar (while the reverse is, luckily, impossible). + if (GetToolBar()->HasFlag(wxTB_RIGHT)) { // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS // means, pretend we don't have toolbar/status bar, so we @@ -357,6 +355,13 @@ void wxFrame::PositionToolBar() tx = cw - tw; GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS ); } + else if (GetToolBar()->HasFlag(wxTB_LEFT)) + { + // Use the 'real' position. wxSIZE_NO_ADJUSTMENTS + // means, pretend we don't have toolbar/status bar, so we + // have the original client size. + GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS ); + } else if (GetToolBar()->HasFlag(wxTB_BOTTOM)) { tx = 0; diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index a0bb728b03..89bbbf200e 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -1688,10 +1688,14 @@ void wxToolBar::OnPaint(wxPaintEvent& event) } dc.SetPen( wxPen( wxColour( 0x51,0x51,0x51 ) ) ); - if ( HasFlag(wxTB_LEFT) ) - dc.DrawLine(w-1, 0, w-1, h); - else if ( HasFlag(wxTB_RIGHT) ) + + // Note that testing this is in the "reverse" order, i.e. right before + // left and bottom before top because these flags can actually be + // combined because left/top are the same as vertical/horizontal + if ( HasFlag(wxTB_RIGHT) ) dc.DrawLine(0, 0, 0, h); + else if ( HasFlag(wxTB_LEFT) ) + dc.DrawLine(w-1, 0, w-1, h); else if ( HasFlag(wxTB_BOTTOM) ) dc.DrawLine(0, 0, w, 0); else if ( HasFlag(wxTB_TOP) )