X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3ccc5735bfb404f46639d417c613ff77f413c612..f51723055aa4334a355a19e87bb2b478b4204d15:/src/osx/nonownedwnd_osx.cpp diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index f586fcbaee..39d569c003 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -13,6 +13,7 @@ #ifndef WX_PRECOMP #include "wx/app.h" + #include "wx/log.h" #endif // WX_PRECOMP #include "wx/hashmap.h" @@ -132,23 +133,9 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, int w = WidthDefault(size.x); int h = HeightDefault(size.y); - // temporary define, TODO -#if wxOSX_USE_CARBON - m_nowpeer = new wxNonOwnedWindowCarbonImpl( this ); -#elif wxOSX_USE_COCOA - m_nowpeer = new wxNonOwnedWindowCocoaImpl( this ); -#elif wxOSX_USE_IPHONE - m_nowpeer = new wxNonOwnedWindowIPhoneImpl( this ); -#endif - - m_nowpeer->Create( parent, wxPoint(x,y) , wxSize(w,h) , style , GetExtraStyle(), name ) ; + m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, parent, wxPoint(x,y) , wxSize(w,h) , style , GetExtraStyle(), name ); wxAssociateWindowWithWXWindow( m_nowpeer->GetWXWindow() , this ) ; -#if wxOSX_USE_CARBON - // temporary cast, TODO - m_peer = (wxMacControl*) wxWidgetImpl::CreateContentView(this); -#else m_peer = wxWidgetImpl::CreateContentView(this); -#endif DoSetWindowVariant( m_windowVariant ) ; @@ -165,9 +152,13 @@ bool wxNonOwnedWindow::Create(wxWindow *parent, wxNonOwnedWindow::~wxNonOwnedWindow() { + SendDestroyEvent(); + wxRemoveWXWindowAssociation( this ) ; - if ( m_nowpeer ) - m_nowpeer->Destroy(); + + DestroyChildren(); + + delete m_nowpeer; // avoid dangling refs if ( s_macDeactivateWindow == this ) @@ -216,7 +207,8 @@ bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c ) if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM ) { - return m_nowpeer->SetBackgroundColour(c); + if ( m_nowpeer ) + return m_nowpeer->SetBackgroundColour(c); } return true; } @@ -359,6 +351,9 @@ bool wxNonOwnedWindow::SetBackgroundStyle(wxBackgroundStyle style) void wxNonOwnedWindow::DoMoveWindow(int x, int y, int width, int height) { + if ( m_nowpeer == NULL ) + return; + m_cachedClippedRectValid = false ; m_nowpeer->MoveWindow(x, y, width, height); @@ -367,6 +362,9 @@ void wxNonOwnedWindow::DoMoveWindow(int x, int y, int width, int height) void wxNonOwnedWindow::DoGetPosition( int *x, int *y ) const { + if ( m_nowpeer == NULL ) + return; + int x1,y1 ; m_nowpeer->GetPosition(x1, y1); @@ -378,6 +376,9 @@ void wxNonOwnedWindow::DoGetPosition( int *x, int *y ) const void wxNonOwnedWindow::DoGetSize( int *width, int *height ) const { + if ( m_nowpeer == NULL ) + return; + int w,h; m_nowpeer->GetSize(w, h); @@ -390,6 +391,9 @@ void wxNonOwnedWindow::DoGetSize( int *width, int *height ) const void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const { + if ( m_nowpeer == NULL ) + return; + int left, top, w, h; m_nowpeer->GetContentArea(left, top, w, h);