diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index 638af1d7ac..5ed8b5993f 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -101,8 +101,8 @@ void wxNonOwnedWindow::Init() bool wxNonOwnedWindow::Create(wxWindow *parent, wxWindowID id, - const wxPoint& pos, - const wxSize& size, + const wxPoint& posOrig, + const wxSize& sizeOrig, long style, const wxString& name) { @@ -114,22 +114,23 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, m_windowStyle = style; m_isShown = false; + // use the appropriate defaults for the position and size if necessary + wxPoint pos(posOrig); + if ( !pos.IsFullySpecified() ) + pos.SetDefaults(wxGetClientDisplayRect().GetPosition()); + + wxSize size(sizeOrig); + if ( !size.IsFullySpecified() ) + size.SetDefaults(wxTopLevelWindow::GetDefaultSize()); + // create frame. - int x = (int)pos.x; - int y = (int)pos.y; - - wxRect display = wxGetClientDisplayRect() ; - - if ( x == wxDefaultPosition.x ) - x = display.x ; - - if ( y == wxDefaultPosition.y ) - y = display.y ; - - int w = WidthDefault(size.x); - int h = HeightDefault(size.y); - - m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, parent, wxPoint(x,y) , wxSize(w,h) , style , GetExtraStyle(), name ); + m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow + ( + this, parent, + pos , size, + style, GetExtraStyle(), + name + ); wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ; m_peer = wxWidgetImpl::CreateContentView(this); diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp index 3c1c8ae4d3..b96d3a0ecc 100644 --- a/src/osx/toplevel_osx.cpp +++ b/src/osx/toplevel_osx.cpp @@ -73,10 +73,7 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent, long style, const wxString& name) { - int w = WidthDefault(size.x); - int h = HeightDefault(size.y); - - if ( !wxNonOwnedWindow::Create(parent, id, pos, wxSize(w,h), style, name) ) + if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) ) return false; wxWindow::SetLabel( title ) ;