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()
32 WindowGroupRef windowGroup;
33 WindowGroupRef formerParentGroup;
34 bool resetGroupParent = false;
36 if ( GetParent() == NULL )
38 windowGroup = GetWindowGroup(windowRef) ;
39 formerParentGroup = GetWindowGroupParent( windowGroup );
40 SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
41 resetGroupParent = true;
45 NSWindow* theWindow = GetWXWindow();
47 NSModalSession session = [NSApp beginModalSessionForWindow:theWindow];
50 if ([NSApp runModalSession:session] != NSRunContinuesResponse)
52 // TODO should we do some idle processing ?
54 [NSApp endModalSession:session];
57 if ( resetGroupParent )
59 SetWindowGroupParent( windowGroup , formerParentGroup );