1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/dialog.cpp
3 // Purpose: wxDialog class
4 // Author: Stefan Csomor
7 // RCS-ID: $Id: dialog.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/dialog.h"
20 #include "wx/settings.h"
23 #include "wx/osx/private.h"
25 extern wxList wxModalDialogs;
27 void wxDialog::DoShowModal()
29 wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
31 wxModalDialogs.Append(this);
35 WindowGroupRef windowGroup;
36 WindowGroupRef formerParentGroup;
37 bool resetGroupParent = false;
39 if ( GetParent() == NULL )
41 windowGroup = GetWindowGroup(windowRef) ;
42 formerParentGroup = GetWindowGroupParent( windowGroup );
43 SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
44 resetGroupParent = true;
47 NSWindow* theWindow = GetWXWindow();
49 NSModalSession session = [NSApp beginModalSessionForWindow:theWindow];
52 wxMacAutoreleasePool autoreleasepool;
53 // we cannot break based on the return value, because nested
54 // alerts might set this to stopped as well, so it would be
56 [NSApp runModalSession:session];
58 // do some idle processing
60 wxTheApp->ProcessIdle();
62 [NSApp endModalSession:session];
65 if ( resetGroupParent )
67 SetWindowGroupParent( windowGroup , formerParentGroup );