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
= NULL
;
38 WindowGroupRef formerParentGroup
= NULL
;
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
) ;
50 wxEventLoopGuarantor ensureHasLoop
;
51 wxEventLoopBase
* const loop
= wxEventLoop::GetActive();
55 EndAppModalStateForWindow(windowRef
) ;
56 if ( resetGroupParent
)
58 SetWindowGroupParent( windowGroup
, formerParentGroup
);