Generalize changes of the previous commits to wxMac too
Handle "impossible" flag combinations such as wxTB_LEFT|wxTB_RIGHT and wxTB_TOP|wxTB_BOTTOM that are actually possible under Mac too.
This commit is contained in:
@@ -62,11 +62,11 @@ wxPoint wxFrame::GetClientAreaOrigin() const
|
|||||||
int w, h;
|
int w, h;
|
||||||
toolbar->GetSize(&w, &h);
|
toolbar->GetSize(&w, &h);
|
||||||
|
|
||||||
if ( toolbar->HasFlag(wxTB_LEFT) )
|
if ( toolbar->HasFlag(wxTB_LEFT) && !toolbar->HasFlag(wxTB_RIGHT) )
|
||||||
{
|
{
|
||||||
pt.x += w;
|
pt.x += w;
|
||||||
}
|
}
|
||||||
else if ( toolbar->HasFlag(wxTB_TOP) )
|
else if ( toolbar->HasFlag(wxTB_TOP) && !toolbar->HasFlag(wxTB_BOTTOM) )
|
||||||
{
|
{
|
||||||
#if !wxOSX_USE_NATIVE_TOOLBAR
|
#if !wxOSX_USE_NATIVE_TOOLBAR
|
||||||
pt.y += h;
|
pt.y += h;
|
||||||
@@ -342,14 +342,12 @@ void wxFrame::PositionToolBar()
|
|||||||
|
|
||||||
tx = ty = 0 ;
|
tx = ty = 0 ;
|
||||||
GetToolBar()->GetSize(&tw, &th);
|
GetToolBar()->GetSize(&tw, &th);
|
||||||
if (GetToolBar()->HasFlag(wxTB_LEFT))
|
|
||||||
{
|
// Note: we need to test for wxTB_RIGHT before wxTB_LEFT, as the latter
|
||||||
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
// is the same as wxTB_VERTICAL and it's possible to combine wxTB_RIGHT
|
||||||
// means, pretend we don't have toolbar/status bar, so we
|
// with wxTB_VERTICAL, so testing for wxTB_LEFT could be true for a
|
||||||
// have the original client size.
|
// right-aligned toolbar (while the reverse is, luckily, impossible).
|
||||||
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
|
if (GetToolBar()->HasFlag(wxTB_RIGHT))
|
||||||
}
|
|
||||||
else if (GetToolBar()->HasFlag(wxTB_RIGHT))
|
|
||||||
{
|
{
|
||||||
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
||||||
// means, pretend we don't have toolbar/status bar, so we
|
// means, pretend we don't have toolbar/status bar, so we
|
||||||
@@ -357,6 +355,13 @@ void wxFrame::PositionToolBar()
|
|||||||
tx = cw - tw;
|
tx = cw - tw;
|
||||||
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
|
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))
|
else if (GetToolBar()->HasFlag(wxTB_BOTTOM))
|
||||||
{
|
{
|
||||||
tx = 0;
|
tx = 0;
|
||||||
|
@@ -1688,10 +1688,14 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dc.SetPen( wxPen( wxColour( 0x51,0x51,0x51 ) ) );
|
dc.SetPen( wxPen( wxColour( 0x51,0x51,0x51 ) ) );
|
||||||
if ( HasFlag(wxTB_LEFT) )
|
|
||||||
dc.DrawLine(w-1, 0, w-1, h);
|
// Note that testing this is in the "reverse" order, i.e. right before
|
||||||
else if ( HasFlag(wxTB_RIGHT) )
|
// 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);
|
dc.DrawLine(0, 0, 0, h);
|
||||||
|
else if ( HasFlag(wxTB_LEFT) )
|
||||||
|
dc.DrawLine(w-1, 0, w-1, h);
|
||||||
else if ( HasFlag(wxTB_BOTTOM) )
|
else if ( HasFlag(wxTB_BOTTOM) )
|
||||||
dc.DrawLine(0, 0, w, 0);
|
dc.DrawLine(0, 0, w, 0);
|
||||||
else if ( HasFlag(wxTB_TOP) )
|
else if ( HasFlag(wxTB_TOP) )
|
||||||
|
Reference in New Issue
Block a user