]>
Commit | Line | Data |
---|---|---|
489468fe | 1 | ///////////////////////////////////////////////////////////////////////////// |
524c47aa | 2 | // Name: src/osx/carbon/dialog.cpp |
489468fe SC |
3 | // Purpose: wxDialog class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #include "wx/dialog.h" | |
15 | ||
16 | #ifndef WX_PRECOMP | |
17 | #include "wx/app.h" | |
18 | #include "wx/utils.h" | |
19 | #include "wx/frame.h" | |
20 | #include "wx/settings.h" | |
21 | #endif // WX_PRECOMP | |
22 | ||
524c47aa SC |
23 | #include "wx/osx/private.h" |
24 | #include "wx/evtloop.h" | |
489468fe | 25 | |
524c47aa | 26 | extern wxList wxModalDialogs; |
489468fe SC |
27 | |
28 | void wxDialog::DoShowModal() | |
29 | { | |
30 | wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") ); | |
31 | ||
32 | wxModalDialogs.Append(this); | |
33 | ||
34 | SetFocus() ; | |
35 | ||
b2680ced | 36 | WindowRef windowRef = (WindowRef) GetWXWindow(); |
ca910e1a VZ |
37 | WindowGroupRef windowGroup = NULL; |
38 | WindowGroupRef formerParentGroup = NULL; | |
489468fe SC |
39 | bool resetGroupParent = false; |
40 | ||
41 | if ( GetParent() == NULL ) | |
42 | { | |
43 | windowGroup = GetWindowGroup(windowRef) ; | |
58d4ed8a JS |
44 | if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) ) |
45 | { | |
46 | formerParentGroup = GetWindowGroupParent( windowGroup ); | |
47 | SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) ); | |
48 | resetGroupParent = true; | |
49 | } | |
489468fe SC |
50 | } |
51 | BeginAppModalStateForWindow(windowRef) ; | |
52 | ||
d6d3b323 | 53 | #if wxUSE_CONSOLE_EVENTLOOP |
a2197925 | 54 | wxEventLoopGuarantor ensureHasLoop; |
d6d3b323 | 55 | #endif |
a2197925 VZ |
56 | wxEventLoopBase * const loop = wxEventLoop::GetActive(); |
57 | while ( IsModal() ) | |
58 | loop->Dispatch(); | |
489468fe SC |
59 | |
60 | EndAppModalStateForWindow(windowRef) ; | |
61 | if ( resetGroupParent ) | |
62 | { | |
63 | SetWindowGroupParent( windowGroup , formerParentGroup ); | |
64 | } | |
ca910e1a | 65 | } |