X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d6f93922574f0733fde4817445c3575398e2bf7a..1b4b6080913e757f6900b9e0912ab9dab91561a6:/src/osx/toplevel_osx.cpp diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp index 1886e988c9..91ac80da69 100644 --- a/src/osx/toplevel_osx.cpp +++ b/src/osx/toplevel_osx.cpp @@ -73,7 +73,10 @@ bool wxTopLevelWindowMac::Create(wxWindow *parent, long style, const wxString& name) { - if ( !wxNonOwnedWindow::Create(parent, id, pos, size, style, name) ) + int w = WidthDefault(size.x); + int h = HeightDefault(size.y); + + if ( !wxNonOwnedWindow::Create(parent, id, pos, wxSize(w,h), style, name) ) return false; wxWindow::SetLabel( title ) ; @@ -87,6 +90,17 @@ wxTopLevelWindowMac::~wxTopLevelWindowMac() { } +bool wxTopLevelWindowMac::Destroy() +{ + // NB: this will get called during destruction if we don't do it now, + // and may fire a kill focus event on a control being destroyed +#if wxOSX_USE_CARBON + if (m_nowpeer->GetWXWindow()) + ClearKeyboardFocus( (WindowRef)m_nowpeer->GetWXWindow() ); +#endif + return wxTopLevelWindowBase::Destroy(); +} + // ---------------------------------------------------------------------------- // wxTopLevelWindowMac maximize/minimize @@ -134,7 +148,8 @@ wxPoint wxTopLevelWindowMac::GetClientAreaOrigin() const void wxTopLevelWindowMac::SetTitle(const wxString& title) { wxWindow::SetLabel( title ) ; - m_nowpeer->SetTitle(title, GetFont().GetEncoding() ); + if ( m_nowpeer ) + m_nowpeer->SetTitle(title, GetFont().GetEncoding() ); } wxString wxTopLevelWindowMac::GetTitle() const