#ifndef WX_PRECOMP
#include "wx/app.h"
+ #include "wx/log.h"
#endif // WX_PRECOMP
#include "wx/hashmap.h"
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 ) ;
wxNonOwnedWindow::~wxNonOwnedWindow()
{
+ SendDestroyEvent();
+
wxRemoveWXWindowAssociation( this ) ;
- if ( m_nowpeer )
- m_nowpeer->Destroy();
+
+ DestroyChildren();
+
+ delete m_nowpeer;
// avoid dangling refs
if ( s_macDeactivateWindow == this )
if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM )
{
- return m_nowpeer->SetBackgroundColour(c);
+ if ( m_nowpeer )
+ return m_nowpeer->SetBackgroundColour(c);
}
return true;
}
wxWindowMac::MacSuperChangedPosition() ; // like this only children will be notified
}
-void wxNonOwnedWindow::HandleResizing( double timestampsec, wxRect* rect )
+void wxNonOwnedWindow::HandleResizing( double WXUNUSED(timestampsec), wxRect* rect )
{
wxRect r = *rect ;
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);
void wxNonOwnedWindow::DoGetPosition( int *x, int *y ) const
{
+ if ( m_nowpeer == NULL )
+ return;
+
int x1,y1 ;
m_nowpeer->GetPosition(x1, y1);
void wxNonOwnedWindow::DoGetSize( int *width, int *height ) const
{
+ if ( m_nowpeer == NULL )
+ return;
+
int w,h;
m_nowpeer->GetSize(w, h);
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);
// ---------------------------------------------------------------------------
-bool wxNonOwnedWindow::SetShape(const wxRegion& region)
+bool wxNonOwnedWindow::DoSetShape(const wxRegion& region)
{
wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
_T("Shaped windows must be created with the wxFRAME_SHAPED style."));
if ( rgn.IsEmpty() )
return false ;
else
- return SetShape(rgn);
+ return DoSetShape(rgn);
}
return m_nowpeer->SetShape(region);