]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
Patch from Andre Reitz to correct a couple of bugs
[wxWidgets.git] / src / mac / carbon / window.cpp
index 4bd0ab12be9e560e451039aa7224f2553f9defb7..64a8737ec2bf851bab1abb7a15b274bb5983af33 100644 (file)
@@ -2169,6 +2169,8 @@ void wxWindowMac::WarpPointer (int x_pos, int y_pos)
 
 void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
 {
+       if ( MacGetTopLevelWindow() == NULL )
+               return ;
 #if TARGET_API_MAC_OSX
     if ( MacGetTopLevelWindow()->MacUsesCompositing() && (m_macBackgroundBrush.Ok() == false || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) )
     {
@@ -3239,4 +3241,18 @@ wxInt32 wxWindowMac::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENT
     return eventNotHandledErr ;
 }
 
+bool wxWindowMac::Reparent(wxWindowBase *newParentBase)
+{
+    wxWindowMac *newParent = (wxWindowMac *)newParentBase;
+    
+    if ( !wxWindowBase::Reparent(newParent) )
+        return FALSE;
+    
+    //copied from MacPostControlCreate
+    ControlRef container = (ControlRef) GetParent()->GetHandle() ;
+    wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
+    ::EmbedControl( m_peer->GetControlRef() , container ) ;
+    
+    return TRUE;
+}