]> git.saurik.com Git - wxWidgets.git/blob - src/mac/carbon/toplevel.cpp
Updated to new PyCrust
[wxWidgets.git] / src / mac / carbon / toplevel.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: mac/toplevel.cpp
3 // Purpose: implements wxTopLevelWindow for MSW
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 24.09.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "toplevel.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/app.h"
33 #include "wx/toplevel.h"
34 #include "wx/string.h"
35 #include "wx/log.h"
36 #include "wx/intl.h"
37 #endif //WX_PRECOMP
38
39 // ----------------------------------------------------------------------------
40 // globals
41 // ----------------------------------------------------------------------------
42
43 // list of all frames and modeless dialogs
44 wxWindowList wxModelessWindows;
45
46 // ============================================================================
47 // wxTopLevelWindowMac implementation
48 // ============================================================================
49
50 // ----------------------------------------------------------------------------
51 // wxTopLevelWindowMac creation
52 // ----------------------------------------------------------------------------
53
54 void wxTopLevelWindowMac::Init()
55 {
56 m_iconized =
57 m_maximizeOnShow = FALSE;
58 }
59
60 bool wxTopLevelWindowMac::Create(wxWindow *parent,
61 wxWindowID id,
62 const wxString& title,
63 const wxPoint& pos,
64 const wxSize& size,
65 long style,
66 const wxString& name)
67 {
68 // init our fields
69 Init();
70
71 m_windowStyle = style;
72
73 SetName(name);
74
75 m_windowId = id == -1 ? NewControlId() : id;
76
77 wxTopLevelWindows.Append(this);
78
79 if ( parent )
80 parent->AddChild(this);
81
82 return TRUE;
83 }
84
85 wxTopLevelWindowMac::~wxTopLevelWindowMac()
86 {
87 wxTopLevelWindows.DeleteObject(this);
88
89 if ( wxModelessWindows.Find(this) )
90 wxModelessWindows.DeleteObject(this);
91
92 // If this is the last top-level window, exit.
93 if ( wxTheApp && (wxTopLevelWindows.Number() == 0) )
94 {
95 wxTheApp->SetTopWindow(NULL);
96
97 if ( wxTheApp->GetExitOnFrameDelete() )
98 {
99 wxTheApp->ExitMainLoop() ;
100 }
101 }
102 }
103
104
105 // ----------------------------------------------------------------------------
106 // wxTopLevelWindowMac maximize/minimize
107 // ----------------------------------------------------------------------------
108
109 void wxTopLevelWindowMac::Maximize(bool maximize)
110 {
111 // not available on mac
112 }
113
114 bool wxTopLevelWindowMac::IsMaximized() const
115 {
116 return false ;
117 }
118
119 void wxTopLevelWindowMac::Iconize(bool iconize)
120 {
121 // not available on mac
122 }
123
124 bool wxTopLevelWindowMac::IsIconized() const
125 {
126 // mac dialogs cannot be iconized
127 return FALSE;
128 }
129
130 void wxTopLevelWindowMac::Restore()
131 {
132 // not available on mac
133 }
134
135 // ----------------------------------------------------------------------------
136 // wxTopLevelWindowMac misc
137 // ----------------------------------------------------------------------------
138
139 void wxTopLevelWindowMac::SetIcon(const wxIcon& icon)
140 {
141 // this sets m_icon
142 wxTopLevelWindowBase::SetIcon(icon);
143 }