]>
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 return wxTopLevelWindowBase::Destroy();
113 // ----------------------------------------------------------------------------
114 // wxTopLevelWindowMac maximize/minimize
115 // ----------------------------------------------------------------------------
117 void wxTopLevelWindowMac::Maximize(bool maximize
)
119 if ( IsMaximized() != maximize
)
120 m_nowpeer
->Maximize(maximize
);
123 bool wxTopLevelWindowMac::IsMaximized() const
125 if ( m_nowpeer
== NULL
)
128 return m_nowpeer
->IsMaximized();
131 void wxTopLevelWindowMac::Iconize(bool iconize
)
133 if ( IsIconized() != iconize
)
134 m_nowpeer
->Iconize(iconize
);
137 bool wxTopLevelWindowMac::IsIconized() const
139 if ( m_nowpeer
== NULL
)
142 return m_nowpeer
->IsIconized();
145 void wxTopLevelWindowMac::Restore()
149 else if ( IsIconized() )
153 // ----------------------------------------------------------------------------
154 // wxTopLevelWindowMac misc
155 // ----------------------------------------------------------------------------
157 wxPoint
wxTopLevelWindowMac::GetClientAreaOrigin() const
159 return wxPoint(0, 0) ;
162 void wxTopLevelWindowMac::SetTitle(const wxString
& title
)
167 m_nowpeer
->SetTitle(title
, GetFont().GetEncoding() );
170 wxString
wxTopLevelWindowMac::GetTitle() const
172 return wxWindow::GetLabel();
175 void wxTopLevelWindowMac::ShowWithoutActivating()
177 // wxTopLevelWindowBase is derived from wxNonOwnedWindow, so don't
179 if ( !wxWindow::Show(true) )
182 m_nowpeer
->ShowWithoutActivating();
184 // TODO: Should we call EVT_SIZE here?
187 bool wxTopLevelWindowMac::ShowFullScreen(bool show
, long style
)
189 return m_nowpeer
->ShowFullScreen(show
, style
);
192 bool wxTopLevelWindowMac::IsFullScreen() const
194 return m_nowpeer
->IsFullScreen();
197 void wxTopLevelWindowMac::RequestUserAttention(int flags
)
199 return m_nowpeer
->RequestUserAttention(flags
);
202 bool wxTopLevelWindowMac::IsActive()
204 return m_nowpeer
->IsActive();
207 void wxTopLevelWindowMac::OSXSetModified(bool modified
)
209 m_nowpeer
->SetModified(modified
);
212 bool wxTopLevelWindowMac::OSXIsModified() const
214 return m_nowpeer
->IsModified();
217 void wxTopLevelWindowMac::SetRepresentedFilename(const wxString
& filename
)
219 m_nowpeer
->SetRepresentedFilename(filename
);