toolbar support in all orientations
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
|
||||
EVT_ACTIVATE(wxFrame::OnActivate)
|
||||
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
|
||||
EVT_SIZE(wxFrame::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#define WX_MAC_STATUSBAR_HEIGHT 18
|
||||
@@ -216,14 +217,12 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
||||
}
|
||||
}
|
||||
|
||||
void wxFrame::HandleResized( double timestampsec )
|
||||
|
||||
void wxFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
// according to the other ports we handle this within the OS level
|
||||
// resize event, not within a wxSizeEvent
|
||||
|
||||
PositionBars();
|
||||
|
||||
wxNonOwnedWindow::HandleResized( timestampsec );
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
#if wxUSE_MENUS
|
||||
@@ -274,11 +273,16 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
|
||||
int w, h;
|
||||
toolbar->GetSize(&w, &h);
|
||||
|
||||
if ( toolbar->GetWindowStyleFlag() & wxTB_VERTICAL )
|
||||
if ( toolbar->IsVertical() )
|
||||
{
|
||||
if ( x )
|
||||
*x -= w;
|
||||
}
|
||||
else if ( toolbar->HasFlag( wxTB_BOTTOM ) )
|
||||
{
|
||||
if ( y )
|
||||
*y -= h;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !wxOSX_USE_NATIVE_TOOLBAR
|
||||
@@ -359,7 +363,7 @@ void wxFrame::PositionToolBar()
|
||||
{
|
||||
int cw, ch;
|
||||
|
||||
GetSize( &cw , &ch ) ;
|
||||
wxTopLevelWindow::DoGetClientSize( &cw , &ch );
|
||||
|
||||
int statusX = 0 ;
|
||||
int statusY = 0 ;
|
||||
@@ -367,7 +371,7 @@ void wxFrame::PositionToolBar()
|
||||
#if wxUSE_STATUSBAR
|
||||
if (GetStatusBar() && GetStatusBar()->IsShown())
|
||||
{
|
||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||
GetStatusBar()->GetSize(&statusX, &statusY);
|
||||
ch -= statusY;
|
||||
}
|
||||
#endif
|
||||
@@ -384,20 +388,25 @@ void wxFrame::PositionToolBar()
|
||||
|
||||
tx = ty = 0 ;
|
||||
GetToolBar()->GetSize(&tw, &th);
|
||||
if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
|
||||
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()->GetWindowStyleFlag() & wxTB_BOTTOM)
|
||||
else if (GetToolBar()->HasFlag(wxTB_RIGHT))
|
||||
{
|
||||
// Use the 'real' position. wxSIZE_NO_ADJUSTMENTS
|
||||
// means, pretend we don't have toolbar/status bar, so we
|
||||
// have the original client size.
|
||||
tx = cw - tw;
|
||||
GetToolBar()->SetSize(tx , ty , tw, ch , wxSIZE_NO_ADJUSTMENTS );
|
||||
}
|
||||
else if (GetToolBar()->HasFlag(wxTB_BOTTOM))
|
||||
{
|
||||
//FIXME: this positions the tool bar almost correctly, but still it doesn't work right yet,
|
||||
//as 1) the space for the 'old' top toolbar is still taken up, and 2) the toolbar
|
||||
//doesn't extend it's width to the width of the frame.
|
||||
tx = 0;
|
||||
ty = ch - (th + statusY);
|
||||
ty = ch - th;
|
||||
GetToolBar()->SetSize(tx, ty, cw, th, wxSIZE_NO_ADJUSTMENTS );
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user