]> git.saurik.com Git - wxWidgets.git/commitdiff
wxFrame::Create now sets (arbitrary) values for position and size if default values...
authorMichael Bedward <mbedward@ozemail.com.au>
Mon, 9 Aug 1999 07:23:59 +0000 (07:23 +0000)
committerMichael Bedward <mbedward@ozemail.com.au>
Mon, 9 Aug 1999 07:23:59 +0000 (07:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/motif/frame.cpp

index 121e0bae0484dbb7cd2ba4ebdcc64c993e5c7279..82725c86d7a28be165b856219c7f228c4e16ad2e 100644 (file)
@@ -144,9 +144,31 @@ bool wxFrame::Create(wxWindow *parent,
 
     wxModelessWindows.Append(this);
 
-    int x = pos.x; int y = pos.y;
-    int width = size.x; int height = size.y;
-
+    int x = pos.x, y = pos.y;
+    int width = size.x, height = size.y;
+    
+    // Set reasonable values for position and size if defaults have
+    // been requested 
+    // 
+    // MB TODO: something better than these arbitrary values ?
+    //
+    if ( width == -1 ) width = 400;
+    if ( height = -1 ) height = 400;
+
+    int displayW, displayH;
+    wxDisplaySize( &displayW, &displayH );
+
+    if ( x == -1 )
+    {
+        x = (displayW - width) / 2;
+        if (x < 10) x = 10;
+    }
+    if ( y == -1 )
+    {
+        y = (displayH - height) / 2;
+        if (y < 10) y = 10;        
+    }
+        
     if (wxTopLevelUsed)
     {
         // Change suggested by Matthew Flatt