X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e506592420f0f63bcfdd8bdf1fadf55ea4402e7..a51e79e87db3512823258d487849bb7e7947b700:/src/osx/cocoa/toolbar.mm diff --git a/src/osx/cocoa/toolbar.mm b/src/osx/cocoa/toolbar.mm index dd7894fa60..20ad47d304 100644 --- a/src/osx/cocoa/toolbar.mm +++ b/src/osx/cocoa/toolbar.mm @@ -13,12 +13,11 @@ #if wxUSE_TOOLBAR -#include "wx/toolbar.h" - #ifndef WX_PRECOMP #include "wx/wx.h" #endif +#include "wx/toolbar.h" #include "wx/app.h" #include "wx/osx/private.h" #include "wx/geometry.h" @@ -762,6 +761,41 @@ void wxToolBar::DoGetSize( int *width, int *height ) const #endif } +void wxToolBar::DoGetPosition(int*x, int *y) const +{ +#if wxOSX_USE_NATIVE_TOOLBAR + bool ownToolbarInstalled; + + MacTopLevelHasNativeToolbar( &ownToolbarInstalled ); + if ( ownToolbarInstalled ) + { + WXWindow tlw = MacGetTopLevelWindowRef(); + float toolbarHeight = 0.0; + NSRect windowFrame = NSMakeRect(0, 0, 0, 0); + + if(m_macToolbar && [(NSToolbar*)m_macToolbar isVisible]) + { + windowFrame = [NSWindow contentRectForFrameRect:[tlw frame] + styleMask:[tlw styleMask]]; + toolbarHeight = NSHeight(windowFrame) + - NSHeight([[tlw contentView] frame]); + } + + // it is extending to the north of the content area + + if ( x != NULL ) + *x = 0; + if ( y != NULL ) + *y = -toolbarHeight; + } + else + wxToolBarBase::DoGetPosition( x, y ); + +#else + wxToolBarBase::DoGetPosition( x, y ); +#endif +} + wxSize wxToolBar::DoGetBestSize() const { // was updated in Realize() @@ -1194,6 +1228,9 @@ bool wxToolBar::Realize() SetInitialSize( wxSize(m_minWidth, m_minHeight)); SendSizeEventToParent(); + wxWindow * const parent = GetParent(); + if ( parent && !parent->IsBeingDeleted() ) + parent->MacOnInternalSize(); return true; }