]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/nonownedwnd_osx.cpp
fixing coordinate conversions for captured windows
[wxWidgets.git] / src / osx / nonownedwnd_osx.cpp
index 12d8d61aab9248148870d92e23550a44214521a6..741b6468776c7d8ef54faa642f7191d8c93a34c8 100644 (file)
@@ -98,6 +98,7 @@ wxNonOwnedWindow *wxNonOwnedWindow::s_macDeactivateWindow = NULL;
 void wxNonOwnedWindow::Init()
 {
     m_nowpeer = NULL;
+    m_isNativeWindowWrapper = false;
 }
 
 bool wxNonOwnedWindow::Create(wxWindow *parent,
@@ -107,9 +108,6 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
                                  long style,
                                  const wxString& name)
 {
-    // init our fields
-    Init();
-
     m_windowStyle = style;
 
     SetName( name );
@@ -147,9 +145,19 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
     if ( parent )
         parent->AddChild(this);
 
-    wxBIND_OR_CONNECT_HACK(this, wxEVT_DESTROY, wxWindowDestroyEventHandler,
-                           wxNonOwnedWindow::OnWindowDestroy, this);
+    return true;
+}
+
+bool wxNonOwnedWindow::Create(wxWindow *parent, WXWindow nativeWindow)
+{
+    m_nowpeer = wxNonOwnedWindowImpl::CreateNonOwnedWindow(this, parent, nativeWindow );
+    m_isNativeWindowWrapper = true;
+    wxAssociateWindowWithWXWindow( m_nowpeer->GetWXWindow() , this ) ;
+    m_peer = wxWidgetImpl::CreateContentView(this);
 
+    if ( parent )
+        parent->AddChild(this);
+    
     return true;
 }
 
@@ -169,10 +177,15 @@ wxNonOwnedWindow::~wxNonOwnedWindow()
         s_macDeactivateWindow = NULL;
 }
 
-void wxNonOwnedWindow::OnWindowDestroy( wxWindowDestroyEvent &event)
+bool wxNonOwnedWindow::Destroy()
 {
-    event.Skip();
+    WillBeDestroyed();
     
+    return wxWindow::Destroy();
+}
+
+void wxNonOwnedWindow::WillBeDestroyed()
+{
     if ( m_nowpeer )
         m_nowpeer->WillBeDestroyed();
 }
@@ -422,12 +435,7 @@ void wxNonOwnedWindow::DoGetClientSize( int *width, int *height ) const
         return;
 
     int left, top, w, h;
-    // perhaps we should do this for all ?
-#ifdef __WXOSX_IPHONE__
-    m_peer->GetContentArea(left, top, w, h);
-#else
     m_nowpeer->GetContentArea(left, top, w, h);
-#endif
     
     if (width)
        *width = w ;
@@ -456,6 +464,8 @@ bool wxNonOwnedWindow::DoSetShape(const wxRegion& region)
     wxCHECK_MSG( HasFlag(wxFRAME_SHAPED), false,
                  wxT("Shaped windows must be created with the wxFRAME_SHAPED style."));
 
+    m_shape = region;
+    
     // The empty region signifies that the shape
     // should be removed from the window.
     if ( region.IsEmpty() )