1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/dialog.cpp
3 // Purpose: wxDialog class
4 // Author: Stefan Csomor
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"
24 #include "wx/evtloop.h"
26 extern wxList wxModalDialogs
;
28 void wxDialog::DoShowModal()
30 wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
32 wxModalDialogs
.Append(this);
36 WindowRef windowRef
= (WindowRef
) GetWXWindow();
37 WindowGroupRef windowGroup
;
38 WindowGroupRef formerParentGroup
;
39 bool resetGroupParent
= false;
41 if ( GetParent() == NULL
)
43 windowGroup
= GetWindowGroup(windowRef
) ;
44 formerParentGroup
= GetWindowGroupParent( windowGroup
);
45 SetWindowGroupParent( windowGroup
, GetWindowGroupOfClass( kMovableModalWindowClass
) );
46 resetGroupParent
= true;
48 BeginAppModalStateForWindow(windowRef
) ;
51 loop
= static_cast<wxEventLoop
*>(wxEventLoop::GetActive());
54 wxASSERT_MSG( loop
, wxT("No Event Loop in place") );
62 EndAppModalStateForWindow(windowRef
) ;
63 if ( resetGroupParent
)
65 SetWindowGroupParent( windowGroup
, formerParentGroup
);