]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/toplevel_osx.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/toplevel_osx.cpp
3 // Purpose: implements wxTopLevelWindow for Mac
4 // Author: Stefan Csomor
7 // Copyright: (c) 2001-2004 Stefan Csomor
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
26 #include "wx/toplevel.h"
31 #include "wx/string.h"
34 #include "wx/settings.h"
35 #include "wx/strconv.h"
36 #include "wx/control.h"
39 #include "wx/tooltip.h"
42 #if wxUSE_SYSTEM_OPTIONS
43 #include "wx/sysopt.h"
47 #include "wx/osx/private.h"
49 // ============================================================================
50 // wxTopLevelWindowMac implementation
51 // ============================================================================
53 BEGIN_EVENT_TABLE(wxTopLevelWindowMac
, wxTopLevelWindowBase
)
56 // ----------------------------------------------------------------------------
57 // wxTopLevelWindowMac creation
58 // ----------------------------------------------------------------------------
61 void wxTopLevelWindowMac::Init()
64 m_maximizeOnShow
= false;
67 bool wxTopLevelWindowMac::Create(wxWindow
*parent
,
69 const wxString
& title
,
75 if ( !wxNonOwnedWindow::Create(parent
, id
, pos
, size
, style
, name
) )
78 wxWindow::SetLabel( title
) ;
79 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
80 wxTopLevelWindows
.Append(this);
85 bool wxTopLevelWindowMac::Create(wxWindow
*parent
,
86 WXWindow nativeWindow
)
88 if ( !wxNonOwnedWindow::Create(parent
, nativeWindow
) )
91 wxTopLevelWindows
.Append(this);
96 wxTopLevelWindowMac::~wxTopLevelWindowMac()
100 bool wxTopLevelWindowMac::Destroy()
102 // NB: this will get called during destruction if we don't do it now,
103 // and may fire a kill focus event on a control being destroyed
105 if (m_nowpeer
&& m_nowpeer
->GetWXWindow())
106 ClearKeyboardFocus( (WindowRef
)m_nowpeer
->GetWXWindow() );
108 // delayed destruction: the tlw will be deleted during the next idle
110 if ( !wxPendingDelete
.Member(this) )
111 wxPendingDelete
.Append(this);
118 // ----------------------------------------------------------------------------
119 // wxTopLevelWindowMac maximize/minimize
120 // ----------------------------------------------------------------------------
122 void wxTopLevelWindowMac::Maximize(bool maximize
)
124 if ( IsMaximized() != maximize
)
125 m_nowpeer
->Maximize(maximize
);
128 bool wxTopLevelWindowMac::IsMaximized() const
130 if ( m_nowpeer
== NULL
)
133 return m_nowpeer
->IsMaximized();
136 void wxTopLevelWindowMac::Iconize(bool iconize
)
138 if ( IsIconized() != iconize
)
139 m_nowpeer
->Iconize(iconize
);
142 bool wxTopLevelWindowMac::IsIconized() const
144 if ( m_nowpeer
== NULL
)
147 return m_nowpeer
->IsIconized();
150 void wxTopLevelWindowMac::Restore()
154 else if ( IsIconized() )
158 // ----------------------------------------------------------------------------
159 // wxTopLevelWindowMac misc
160 // ----------------------------------------------------------------------------
162 wxPoint
wxTopLevelWindowMac::GetClientAreaOrigin() const
164 return wxPoint(0, 0) ;
167 void wxTopLevelWindowMac::SetTitle(const wxString
& title
)
172 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
175 wxString
wxTopLevelWindowMac::GetTitle() const
177 return wxWindow::GetLabel();
180 void wxTopLevelWindowMac::ShowWithoutActivating()
182 // wxTopLevelWindowBase is derived from wxNonOwnedWindow, so don't
184 if ( !wxWindow::Show(true) )
187 m_nowpeer
->ShowWithoutActivating();
189 // because apps expect a size event to occur at this moment
193 bool wxTopLevelWindowMac::ShowFullScreen(bool show
, long style
)
195 return m_nowpeer
->ShowFullScreen(show
, style
);
198 bool wxTopLevelWindowMac::IsFullScreen() const
200 return m_nowpeer
->IsFullScreen();
203 void wxTopLevelWindowMac::RequestUserAttention(int flags
)
205 return m_nowpeer
->RequestUserAttention(flags
);
208 bool wxTopLevelWindowMac::IsActive()
210 return m_nowpeer
->IsActive();
213 void wxTopLevelWindowMac::OSXSetModified(bool modified
)
215 m_nowpeer
->SetModified(modified
);
218 bool wxTopLevelWindowMac::OSXIsModified() const
220 return m_nowpeer
->IsModified();
223 void wxTopLevelWindowMac::SetRepresentedFilename(const wxString
& filename
)
225 m_nowpeer
->SetRepresentedFilename(filename
);