]> git.saurik.com Git - wxWidgets.git/blame - src/osx/carbon/dialog.cpp
make GetPaperRect() and GetResolution() const functions
[wxWidgets.git] / src / osx / carbon / dialog.cpp
CommitLineData
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 26extern wxList wxModalDialogs;
489468fe
SC
27
28void 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();
489468fe
SC
37 WindowGroupRef windowGroup;
38 WindowGroupRef formerParentGroup;
39 bool resetGroupParent = false;
40
41 if ( GetParent() == NULL )
42 {
43 windowGroup = GetWindowGroup(windowRef) ;
44 formerParentGroup = GetWindowGroupParent( windowGroup );
45 SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
46 resetGroupParent = true;
47 }
48 BeginAppModalStateForWindow(windowRef) ;
49
524c47aa 50 wxEventLoop * const
5c33522f 51 loop = static_cast<wxEventLoop *>(wxEventLoop::GetActive());
524c47aa
SC
52
53
54 wxASSERT_MSG( loop , wxT("No Event Loop in place") );
55
56 if ( loop )
489468fe 57 {
524c47aa
SC
58 while ( IsModal() )
59 loop->Dispatch();
489468fe
SC
60 }
61
62 EndAppModalStateForWindow(windowRef) ;
63 if ( resetGroupParent )
64 {
65 SetWindowGroupParent( windowGroup , formerParentGroup );
66 }
524c47aa 67}