]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/nonownedwnd_osx.cpp
Fix crash in wxMSW wxProgressDialog without wxPD_APP_MODAL style.
[wxWidgets.git] / src / osx / nonownedwnd_osx.cpp
index 638af1d7ac52c1e5f5717eb744fa92061297452e..5ed8b5993fc4f30ab834ac02a5790b28d1a3328e 100644 (file)
@@ -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;
 
-    // create frame.
-    int x = (int)pos.x;
-    int y = (int)pos.y;
-
-    wxRect display = wxGetClientDisplayRect() ;
-
-    if ( x == wxDefaultPosition.x )
-        x = display.x ;
+    // use the appropriate defaults for the position and size if necessary
+    wxPoint pos(posOrig);
+    if ( !pos.IsFullySpecified() )
+        pos.SetDefaults(wxGetClientDisplayRect().GetPosition());
 
-    if ( y == wxDefaultPosition.y )
-        y = display.y ;
+    wxSize size(sizeOrig);
+    if ( !size.IsFullySpecified() )
+        size.SetDefaults(wxTopLevelWindow::GetDefaultSize());
 
-    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 );
+    // create frame.
+    m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow
+                (
+                    this, parent,
+                    pos , size,
+                    style, GetExtraStyle(),
+                    name
+                );
     wxNonOwnedWindowImpl::Associate( m_nowpeer->GetWXWindow() , m_nowpeer ) ;
     m_peer = wxWidgetImpl::CreateContentView(this);