]>
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
8 // Copyright: (c) 2001-2004 Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #include "wx/toplevel.h"
32 #include "wx/string.h"
35 #include "wx/settings.h"
36 #include "wx/strconv.h"
37 #include "wx/control.h"
40 #include "wx/tooltip.h"
43 #if wxUSE_SYSTEM_OPTIONS
44 #include "wx/sysopt.h"
48 #include "wx/osx/private.h"
50 // ============================================================================
51 // wxTopLevelWindowMac implementation
52 // ============================================================================
54 BEGIN_EVENT_TABLE(wxTopLevelWindowMac
, wxTopLevelWindowBase
)
57 // ----------------------------------------------------------------------------
58 // wxTopLevelWindowMac creation
59 // ----------------------------------------------------------------------------
62 void wxTopLevelWindowMac::Init()
65 m_maximizeOnShow
= false;
68 bool wxTopLevelWindowMac::Create(wxWindow
*parent
,
70 const wxString
& title
,
76 if ( !wxNonOwnedWindow::Create(parent
, id
, pos
, size
, style
, name
) )
79 wxWindow::SetLabel( title
) ;
80 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
81 wxTopLevelWindows
.Append(this);
86 bool wxTopLevelWindowMac::Create(wxWindow
*parent
,
87 WXWindow nativeWindow
)
89 if ( !wxNonOwnedWindow::Create(parent
, nativeWindow
) )
92 wxTopLevelWindows
.Append(this);
97 wxTopLevelWindowMac::~wxTopLevelWindowMac()
101 bool wxTopLevelWindowMac::Destroy()
103 // NB: this will get called during destruction if we don't do it now,
104 // and may fire a kill focus event on a control being destroyed
106 if (m_nowpeer
&& m_nowpeer
->GetWXWindow())
107 ClearKeyboardFocus( (WindowRef
)m_nowpeer
->GetWXWindow() );
109 // delayed destruction: the tlw will be deleted during the next idle
111 if ( !wxPendingDelete
.Member(this) )
112 wxPendingDelete
.Append(this);
119 // ----------------------------------------------------------------------------
120 // wxTopLevelWindowMac maximize/minimize
121 // ----------------------------------------------------------------------------
123 void wxTopLevelWindowMac::Maximize(bool maximize
)
125 if ( IsMaximized() != maximize
)
126 m_nowpeer
->Maximize(maximize
);
129 bool wxTopLevelWindowMac::IsMaximized() const
131 if ( m_nowpeer
== NULL
)
134 return m_nowpeer
->IsMaximized();
137 void wxTopLevelWindowMac::Iconize(bool iconize
)
139 if ( IsIconized() != iconize
)
140 m_nowpeer
->Iconize(iconize
);
143 bool wxTopLevelWindowMac::IsIconized() const
145 if ( m_nowpeer
== NULL
)
148 return m_nowpeer
->IsIconized();
151 void wxTopLevelWindowMac::Restore()
155 else if ( IsIconized() )
159 // ----------------------------------------------------------------------------
160 // wxTopLevelWindowMac misc
161 // ----------------------------------------------------------------------------
163 wxPoint
wxTopLevelWindowMac::GetClientAreaOrigin() const
165 return wxPoint(0, 0) ;
168 void wxTopLevelWindowMac::SetTitle(const wxString
& title
)
173 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
176 wxString
wxTopLevelWindowMac::GetTitle() const
178 return wxWindow::GetLabel();
181 void wxTopLevelWindowMac::ShowWithoutActivating()
183 // wxTopLevelWindowBase is derived from wxNonOwnedWindow, so don't
185 if ( !wxWindow::Show(true) )
188 m_nowpeer
->ShowWithoutActivating();
190 // because apps expect a size event to occur at this moment
194 bool wxTopLevelWindowMac::ShowFullScreen(bool show
, long style
)
196 return m_nowpeer
->ShowFullScreen(show
, style
);
199 bool wxTopLevelWindowMac::IsFullScreen() const
201 return m_nowpeer
->IsFullScreen();
204 void wxTopLevelWindowMac::RequestUserAttention(int flags
)
206 return m_nowpeer
->RequestUserAttention(flags
);
209 bool wxTopLevelWindowMac::IsActive()
211 return m_nowpeer
->IsActive();
214 void wxTopLevelWindowMac::OSXSetModified(bool modified
)
216 m_nowpeer
->SetModified(modified
);
219 bool wxTopLevelWindowMac::OSXIsModified() const
221 return m_nowpeer
->IsModified();
224 void wxTopLevelWindowMac::SetRepresentedFilename(const wxString
& filename
)
226 m_nowpeer
->SetRepresentedFilename(filename
);