]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/dialog.mm
Fit the generic preferences editor dialog to its pages size initially.
[wxWidgets.git] / src / cocoa / dialog.mm
index f8d3faeafbb1ba137ed124987f90dc8b09c38aca..fbc8bbe18d48749a162aa3a47b0247f45929e530 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2002/12/15
 // RCS-ID:      $Id$
 // Copyright:   2002 David Elliott
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -19,6 +19,7 @@
     #include "wx/settings.h"
 #endif //WX_PRECOMP
 
+#include "wx/testing.h"
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
 
@@ -57,13 +58,9 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID winid,
     if (parent)
         parent->AddChild(this);
 
-    NSRect cocoaRect = NSMakeRect(300,300,200,200);
+    unsigned int cocoaStyle = NSWindowStyleForWxStyle(style);
 
-    unsigned int cocoaStyle = 0;
-    cocoaStyle |= NSTitledWindowMask;
-    cocoaStyle |= NSClosableWindowMask;
-    cocoaStyle |= NSMiniaturizableWindowMask;
-    cocoaStyle |= NSResizableWindowMask;
+    NSRect cocoaRect = MakeInitialNSWindowContentRect(pos,size,cocoaStyle);
 
     m_cocoaNSWindow = NULL;
     SetNSPanel([[NSPanel alloc] initWithContentRect:cocoaRect styleMask:cocoaStyle backing:NSBackingStoreBuffered defer:NO]);
@@ -103,6 +100,10 @@ bool wxDialog::Show(bool show)
     if(show)
     {
         wxAutoNSAutoreleasePool pool;
+
+       if (CanDoLayoutAdaptation())
+               DoLayoutAdaptation();
+
         InitDialog();
         if(IsModal())
         {   // ShowModal() will show the dialog
@@ -127,6 +128,8 @@ bool wxDialog::Show(bool show)
 // is stopped (via EndModal()) it returns the exit code.
 int wxDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxCHECK_MSG(!IsModal(),GetReturnCode(),wxT("wxDialog::ShowModal called within its own modal loop"));
 
     // Show(true) will set m_isShown = true