reflect correct position for native toolbar, fixes #14049
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -88,6 +88,9 @@ protected:
|
||||
#ifndef __WXOSX_IPHONE__
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
#endif
|
||||
#ifdef __WXOSX_COCOA__
|
||||
virtual void DoGetPosition(int*x, int *y) const;
|
||||
#endif
|
||||
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
||||
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
||||
|
@@ -761,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()
|
||||
|
Reference in New Issue
Block a user