]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
use const for xpm icons
[wxWidgets.git] / src / mac / carbon / window.cpp
index 84e595f19fa843d72579c2d5354ad9d03c03d487..b13a595ec9c62f21697579a5780abdd464a2fc9d 100644 (file)
@@ -268,7 +268,7 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                         float alpha = 1.0 ;
                         {
                             wxWindow* iter = thisWindow ;
                         float alpha = 1.0 ;
                         {
                             wxWindow* iter = thisWindow ;
-                            while ( iter ) 
+                            while ( iter )
                             {
                                 alpha *= (float) iter->GetTransparent()/255.0 ;
                                 if ( iter->IsTopLevel() )
                             {
                                 alpha *= (float) iter->GetTransparent()/255.0 ;
                                 if ( iter->IsTopLevel() )
@@ -278,6 +278,15 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                             }
                         }
                         CGContextSetAlpha( cgContext , alpha ) ;
                             }
                         }
                         CGContextSetAlpha( cgContext , alpha ) ;
+
+                        if ( thisWindow->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
+                        {
+                            HIRect bounds;
+                            HIViewGetBounds( controlRef, &bounds );
+                            CGContextClearRect( cgContext, bounds );
+                        }
+
+
 #endif
                         if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) )
                             result = noErr ;
 #endif
                         if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) )
                             result = noErr ;
@@ -307,17 +316,20 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
         case kEventControlHiliteChanged :
             thisWindow->MacHiliteChanged() ;
             break ;
         case kEventControlHiliteChanged :
             thisWindow->MacHiliteChanged() ;
             break ;
-            
+
         case kEventControlActivate :
         case kEventControlDeactivate :
         case kEventControlActivate :
         case kEventControlDeactivate :
-            if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) ) 
-                    || thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) ) 
-                )
+            // FIXME: we should have a virtual function for this!
+#if wxUSE_TREECTRL
+            if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) ) )
+                thisWindow->Refresh();
+#endif
+#if wxUSE_LISTCTRL
+            if ( thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) ) )
                 thisWindow->Refresh();
                 thisWindow->Refresh();
-            
-            //thisWindow->MacActivateStateChanged() ;
-            break ;
 #endif
 #endif
+            break ;
+#endif // TARGET_API_MAC_OSX
 
         // we emulate this event under Carbon CFM
         case kEventControlSetFocusPart :
 
         // we emulate this event under Carbon CFM
         case kEventControlSetFocusPart :
@@ -331,6 +343,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                 }
 #endif
 
                 }
 #endif
 
+                if ( thisWindow->MacIsUserPane() )
+                    result = noErr ;
+
                 if ( controlPart == kControlFocusNoPart )
                 {
 #if wxUSE_CARET
                 if ( controlPart == kControlFocusNoPart )
                 {
 #if wxUSE_CARET
@@ -364,9 +379,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                     event.SetEventObject(thisWindow);
                     thisWindow->GetEventHandler()->ProcessEvent(event) ;
                 }
                     event.SetEventObject(thisWindow);
                     thisWindow->GetEventHandler()->ProcessEvent(event) ;
                 }
-
-                if ( thisWindow->MacIsUserPane() )
-                    result = noErr ;
             }
             break ;
 
             }
             break ;
 
@@ -393,7 +405,10 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
     return result ;
 }
 
     return result ;
 }
 
-static pascal OSStatus wxMacWindowServiceEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+static pascal OSStatus
+wxMacWindowServiceEventHandler(EventHandlerCallRef WXUNUSED(handler),
+                               EventRef event,
+                               void *data)
 {
     OSStatus result = eventNotHandledErr ;
 
 {
     OSStatus result = eventNotHandledErr ;
 
@@ -508,7 +523,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even
         charBuf[ numChars - 1 ] = 0;
 #if SIZEOF_WCHAR_T == 2
         uniChars = (wchar_t*) charBuf ;
         charBuf[ numChars - 1 ] = 0;
 #if SIZEOF_WCHAR_T == 2
         uniChars = (wchar_t*) charBuf ;
-        memcpy( uniChars , charBuf , numChars * 2 ) ;
+/*        memcpy( uniChars , charBuf , numChars * 2 ) ;*/      // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...)
 #else
         // the resulting string will never have more chars than the utf16 version, so this is safe
         wxMBConvUTF16 converter ;
 #else
         // the resulting string will never have more chars than the utf16 version, so this is safe
         wxMBConvUTF16 converter ;
@@ -528,7 +543,32 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even
                     WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
                     wxTheApp->MacSetCurrentEvent( event , handler ) ;
 
                     WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
                     wxTheApp->MacSetCurrentEvent( event , handler ) ;
 
+                    UInt32 message = uniChars[pos] < 128 ? (char)uniChars[pos] : '?';
+/*
+       NB: faking a charcode here is problematic. The kEventTextInputUpdateActiveInputArea event is sent
+       multiple times to update the active range during inline input, so this handler will often receive
+       uncommited text, which should usually not trigger side effects. It might be a good idea to check the
+       kEventParamTextInputSendFixLen parameter and verify if input is being confirmed (see CarbonEvents.h).
+       On the other hand, it can be useful for some applications to react to uncommitted text (for example,
+       to update a status display), as long as it does not disrupt the inline input session. Ideally, wx
+       should add new event types to support advanced text input. For now, I would keep things as they are.
+
+       However, the code that was being used caused additional problems:
                     UInt32 message = (0  << 8) + ((char)uniChars[pos] );
                     UInt32 message = (0  << 8) + ((char)uniChars[pos] );
+       Since it simply truncated the unichar to the last byte, it ended up causing weird bugs with inline
+       input, such as switching to another field when one attempted to insert the character U+4E09 (the kanji
+       for "three"), because it was truncated to 09 (kTabCharCode), which was later "converted" to WXK_TAB
+       (still 09) in wxMacTranslateKey; or triggering the default button when one attempted to insert U+840D
+       (the kanji for "name"), which got truncated to 0D and interpreted as a carriage return keypress.
+       Note that even single-byte characters could have been misinterpreted, since MacRoman charcodes only
+       overlap with Unicode within the (7-bit) ASCII range.
+       But simply passing a NUL charcode would disable text updated events, because wxTextCtrl::OnChar checks
+       for codes within a specific range. Therefore I went for the solution seen above, which keeps ASCII
+       characters as they are and replaces the rest with '?', ensuring that update events are triggered.
+       It would be better to change wxTextCtrl::OnChar to look at the actual unicode character instead, but
+       I don't have time to look into that right now.
+               -- CL
+*/
                     if ( wxTheApp->MacSendCharEvent(
                                                     focus , message , 0 , when , 0 , 0 , uniChars[pos] ) )
                     {
                     if ( wxTheApp->MacSendCharEvent(
                                                     focus , message , 0 , when , 0 , 0 , uniChars[pos] ) )
                     {
@@ -583,7 +623,10 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even
     return result ;
 }
 
     return result ;
 }
 
-static pascal OSStatus wxMacWindowCommandEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+static pascal OSStatus
+wxMacWindowCommandEventHandler(EventHandlerCallRef WXUNUSED(handler),
+                               EventRef event,
+                               void *data)
 {
     OSStatus result = eventNotHandledErr ;
     wxWindowMac* focus = (wxWindowMac*) data ;
 {
     OSStatus result = eventNotHandledErr ;
     wxWindowMac* focus = (wxWindowMac*) data ;
@@ -934,10 +977,6 @@ void wxWindowMac::Init()
     m_frozenness = 0 ;
     m_macAlpha = 255 ;
 
     m_frozenness = 0 ;
     m_macAlpha = 255 ;
 
-#if WXWIN_COMPATIBILITY_2_4
-    m_backgroundTransparent = false;
-#endif
-
 #if wxMAC_USE_CORE_GRAPHICS
     m_cgContextRef = NULL ;
 #endif
 #if wxMAC_USE_CORE_GRAPHICS
     m_cgContextRef = NULL ;
 #endif
@@ -947,6 +986,9 @@ void wxWindowMac::Init()
 
     m_hScrollBar = NULL ;
     m_vScrollBar = NULL ;
 
     m_hScrollBar = NULL ;
     m_vScrollBar = NULL ;
+    m_hScrollBarAlwaysShown = false;
+    m_vScrollBarAlwaysShown = false;
+
     m_macBackgroundBrush = wxNullBrush ;
 
     m_macIsUserPane = true;
     m_macBackgroundBrush = wxNullBrush ;
 
     m_macIsUserPane = true;
@@ -1111,7 +1153,7 @@ void wxWindowMac::MacChildAdded()
         m_hScrollBar->Raise() ;
 }
 
         m_hScrollBar->Raise() ;
 }
 
-void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size)
+void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), const wxSize& size)
 {
     wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
 
 {
     wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
 
@@ -1358,7 +1400,7 @@ void wxWindowMac::SetDropTarget(wxDropTarget *pDropTarget)
 #endif
 
 // Old-style File Manager Drag & Drop
 #endif
 
 // Old-style File Manager Drag & Drop
-void wxWindowMac::DragAcceptFiles(bool accept)
+void wxWindowMac::DragAcceptFiles(bool WXUNUSED(accept))
 {
     // TODO:
 }
 {
     // TODO:
 }
@@ -1366,8 +1408,10 @@ void wxWindowMac::DragAcceptFiles(bool accept)
 // Returns the size of the native control. In the case of the toplevel window
 // this is the content area root control
 
 // Returns the size of the native control. In the case of the toplevel window
 // this is the content area root control
 
-void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
-                                           int& w, int& h) const
+void wxWindowMac::MacGetPositionAndSizeFromControl(int& WXUNUSED(x),
+                                                   int& WXUNUSED(y),
+                                                   int& WXUNUSED(w),
+                                                   int& WXUNUSED(h)) const
 {
     wxFAIL_MSG( wxT("Not currently supported") ) ;
 }
 {
     wxFAIL_MSG( wxT("Not currently supported") ) ;
 }
@@ -1727,7 +1771,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor)
         HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
         pt.h = hiPoint.x;
         pt.v = hiPoint.y;
         HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint);
         pt.h = hiPoint.x;
         pt.v = hiPoint.y;
- #else 
+ #else
         CGrafPtr savePort ;
         Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ;
 
         CGrafPtr savePort ;
         Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ;
 
@@ -2115,19 +2159,9 @@ bool wxWindowMac::Show(bool show)
     return true;
 }
 
     return true;
 }
 
-bool wxWindowMac::Enable(bool enable)
+void wxWindowMac::DoEnable(bool enable)
 {
 {
-    wxASSERT( m_peer->Ok() ) ;
-    bool former = MacIsReallyEnabled() ;
-    if ( !wxWindowBase::Enable(enable) )
-        return false;
-
     m_peer->Enable( enable ) ;
     m_peer->Enable( enable ) ;
-
-    if ( former != MacIsReallyEnabled() )
-        MacPropagateEnabledStateChanged() ;
-
-    return true;
 }
 
 //
 }
 
 //
@@ -2152,21 +2186,10 @@ void wxWindowMac::MacPropagateVisibilityChanged()
 #endif
 }
 
 #endif
 }
 
-void wxWindowMac::MacPropagateEnabledStateChanged()
+void wxWindowMac::OnEnabled(bool WXUNUSED(enabled))
 {
 #if !TARGET_API_MAC_OSX
     MacEnabledStateChanged() ;
 {
 #if !TARGET_API_MAC_OSX
     MacEnabledStateChanged() ;
-
-    wxWindowMac *child;
-    wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
-    while ( node )
-    {
-        child = node->GetData();
-        if ( child->IsEnabled() )
-            child->MacPropagateEnabledStateChanged() ;
-
-        node = node->GetNext();
-    }
 #endif
 }
 
 #endif
 }
 
@@ -2272,7 +2295,7 @@ void wxWindowMac::GetTextExtent(const wxString& string, int *x, int *y,
         fontToUse = &m_font;
 
     wxClientDC dc( (wxWindowMac*) this ) ;
         fontToUse = &m_font;
 
     wxClientDC dc( (wxWindowMac*) this ) ;
-    long lx,ly,ld,le ;
+    wxCoord lx,ly,ld,le ;
     dc.GetTextExtent( string , &lx , &ly , &ld, &le, (wxFont *)fontToUse ) ;
     if ( externalLeading )
         *externalLeading = le ;
     dc.GetTextExtent( string , &lx , &ly , &ld, &le, (wxFont *)fontToUse ) ;
     if ( externalLeading )
         *externalLeading = le ;
@@ -2289,7 +2312,7 @@ void wxWindowMac::GetTextExtent(const wxString& string, int *x, int *y,
  * we always intersect with the entire window, not only with the client area
  */
 
  * we always intersect with the entire window, not only with the client area
  */
 
-void wxWindowMac::Refresh(bool eraseBack, const wxRect *rect)
+void wxWindowMac::Refresh(bool WXUNUSED(eraseBack), const wxRect *rect)
 {
     if ( m_peer == NULL )
         return ;
 {
     if ( m_peer == NULL )
         return ;
@@ -2349,7 +2372,7 @@ wxWindowMac *wxGetActiveWindow()
 }
 
 // Coordinates relative to the window
 }
 
 // Coordinates relative to the window
-void wxWindowMac::WarpPointer(int x_pos, int y_pos)
+void wxWindowMac::WarpPointer(int WXUNUSED(x_pos), int WXUNUSED(y_pos))
 {
     // We really don't move the mouse programmatically under Mac.
 }
 {
     // We really don't move the mouse programmatically under Mac.
 }
@@ -2360,7 +2383,8 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
         return ;
 
 #if TARGET_API_MAC_OSX
         return ;
 
 #if TARGET_API_MAC_OSX
-    if ( !m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT )
+    if ( !m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT
+         || GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
     {
         event.Skip() ;
     }
     {
         event.Skip() ;
     }
@@ -2426,7 +2450,7 @@ int wxWindowMac::GetScrollThumb(int orient) const
     return 0;
 }
 
     return 0;
 }
 
-void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
+void wxWindowMac::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
 {
     if ( orient == wxHORIZONTAL )
     {
 {
     if ( orient == wxHORIZONTAL )
     {
@@ -2440,12 +2464,32 @@ void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
     }
 }
 
     }
 }
 
+void
+wxWindowMac::AlwaysShowScrollbars(bool hflag, bool vflag)
+{
+    bool needVisibilityUpdate = false;
+
+    if ( m_hScrollBarAlwaysShown != hflag )
+    {
+        m_hScrollBarAlwaysShown = hflag;
+        needVisibilityUpdate = true;
+    }
+
+    if ( m_vScrollBarAlwaysShown != vflag )
+    {
+        m_vScrollBarAlwaysShown = vflag;
+        needVisibilityUpdate = true;
+    }
+
+    if ( needVisibilityUpdate )
+        DoUpdateScrollbarVisibility();
+}
 //
 // we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
 // our own window origin is at leftOrigin/rightOrigin
 //
 
 //
 // we draw borders and grow boxes, are already set up and clipped in the current port / cgContextRef
 // our own window origin is at leftOrigin/rightOrigin
 //
 
-void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin )
+void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(rightOrigin) )
 {
     if ( IsTopLevel() )
         return ;
 {
     if ( IsTopLevel() )
         return ;
@@ -2458,7 +2502,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin )
     m_peer->GetRect( &rect ) ;
     InsetRect( &rect, -1 , -1 ) ;
 
     m_peer->GetRect( &rect ) ;
     InsetRect( &rect, -1 , -1 ) ;
 
-#if wxMAC_USE_CORE_GRAPHICS 
+#if wxMAC_USE_CORE_GRAPHICS
     {
         CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left ,
             rect.bottom - rect.top ) ;
     {
         CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left ,
             rect.bottom - rect.top ) ;
@@ -2542,39 +2586,29 @@ void wxWindowMac::RemoveChild( wxWindowBase *child )
     wxWindowBase::RemoveChild( child ) ;
 }
 
     wxWindowBase::RemoveChild( child ) ;
 }
 
-// New function that will replace some of the above.
-void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
-    int range, bool refresh)
+void wxWindowMac::DoUpdateScrollbarVisibility()
 {
 {
-    bool showScroller;
     bool triggerSizeEvent = false;
 
     bool triggerSizeEvent = false;
 
-    if ( orient == wxHORIZONTAL )
+    if ( m_hScrollBar )
     {
     {
-        if ( m_hScrollBar )
-        {
-            showScroller = ((range != 0) && (range > thumbVisible));
-            if ( m_hScrollBar->IsShown() != showScroller )
-            {
-                m_hScrollBar->Show( showScroller );
-                triggerSizeEvent = true;
-            }
+        bool showHScrollBar = m_hScrollBarAlwaysShown || m_hScrollBar->IsNeeded();
 
 
-            m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
+        if ( m_hScrollBar->IsShown() != showHScrollBar )
+        {
+            m_hScrollBar->Show( showHScrollBar );
+            triggerSizeEvent = true;
         }
     }
         }
     }
-    else
+
+    if ( m_vScrollBar)
     {
     {
-        if ( m_vScrollBar )
-        {
-            showScroller = ((range != 0) && (range > thumbVisible));
-            if ( m_vScrollBar->IsShown() != showScroller )
-            {
-                m_vScrollBar->Show( showScroller ) ;
-                triggerSizeEvent = true;
-            }
+        bool showVScrollBar = m_vScrollBarAlwaysShown || m_vScrollBar->IsNeeded();
 
 
-            m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ;
+        if ( m_vScrollBar->IsShown() != showVScrollBar )
+        {
+            m_vScrollBar->Show( showVScrollBar ) ;
+            triggerSizeEvent = true;
         }
     }
 
         }
     }
 
@@ -2587,6 +2621,18 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
     }
 }
 
     }
 }
 
+// New function that will replace some of the above.
+void wxWindowMac::SetScrollbar(int orient, int pos, int thumb,
+                               int range, bool refresh)
+{
+    if ( orient == wxHORIZONTAL && m_hScrollBar )
+        m_hScrollBar->SetScrollbar(pos, thumb, range, thumb, refresh);
+    else if ( orient == wxVERTICAL && m_vScrollBar )
+        m_vScrollBar->SetScrollbar(pos, thumb, range, thumb, refresh);
+
+    DoUpdateScrollbarVisibility();
+}
+
 // Does a physical scroll
 void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
 // Does a physical scroll
 void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
@@ -2607,6 +2653,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         if ( m_peer->GetNeedsDisplay() )
         {
             // because HIViewScrollRect does not scroll the already invalidated area we have two options:
         if ( m_peer->GetNeedsDisplay() )
         {
             // because HIViewScrollRect does not scroll the already invalidated area we have two options:
+            // in case there is already a pending redraw on that area
             // either immediate redraw or full invalidate
 #if 1
             // is the better overall solution, as it does not slow down scrolling
             // either immediate redraw or full invalidate
 #if 1
             // is the better overall solution, as it does not slow down scrolling
@@ -2627,14 +2674,8 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         scrollrect.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
         m_peer->ScrollRect( &scrollrect , dx , dy ) ;
 
         scrollrect.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
         m_peer->ScrollRect( &scrollrect , dx , dy ) ;
 
-        // becuase HIViewScrollRect does not scroll the already invalidated area we have two options
-        // either immediate redraw or full invalidate
 #if 0
 #if 0
-        // is the better overall solution, as it does not slow down scrolling
-        m_peer->SetNeedsDisplay() ;
-#else
         // this would be the preferred version for fast drawing controls
         // this would be the preferred version for fast drawing controls
-
         HIViewRender(m_peer->GetControlRef()) ;
 #endif
     }
         HIViewRender(m_peer->GetControlRef()) ;
 #endif
     }
@@ -2659,11 +2700,11 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         {
             wxRect rc( x, y, w, h );
             if (rect->Intersects( rc ))
         {
             wxRect rc( x, y, w, h );
             if (rect->Intersects( rc ))
-                child->SetSize( x + dx, y + dy, w, h );
+                child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
         }
         else
         {
         }
         else
         {
-            child->SetSize( x + dx, y + dy, w, h );
+            child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
         }
     }
 }
         }
     }
 }
@@ -2728,7 +2769,7 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event )
         Rect rect ;
 
         m_peer->GetRect( &rect ) ;
         Rect rect ;
 
         m_peer->GetRect( &rect ) ;
-        // auf den umgebenden Rahmen zur\9fck
+        // auf den umgebenden Rahmen zur\81\9fck
         InsetRect( &rect, -1 , -1 ) ;
 
         wxTopLevelWindowMac* top = MacGetTopLevelWindow();
         InsetRect( &rect, -1 , -1 ) ;
 
         wxTopLevelWindowMac* top = MacGetTopLevelWindow();
@@ -2815,7 +2856,7 @@ bool wxWindowMac::MacSetupCursor( const wxPoint& pt )
     return cursor.Ok() ;
 }
 
     return cursor.Ok() ;
 }
 
-wxString wxWindowMac::MacGetToolTipString( wxPoint &pt )
+wxString wxWindowMac::MacGetToolTipString( wxPoint &WXUNUSED(pt) )
 {
 #if wxUSE_TOOLTIPS
     if ( m_tooltip )
 {
 #if wxUSE_TOOLTIPS
     if ( m_tooltip )
@@ -2834,7 +2875,9 @@ void wxWindowMac::ClearBackground()
 void wxWindowMac::Update()
 {
 #if TARGET_API_MAC_OSX
 void wxWindowMac::Update()
 {
 #if TARGET_API_MAC_OSX
-    MacGetTopLevelWindow()->MacPerformUpdates() ;
+    wxTopLevelWindowMac* top = MacGetTopLevelWindow();
+    if (top)
+        top->MacPerformUpdates() ;
 #else
     ::Draw1Control( m_peer->GetControlRef() ) ;
 #endif
 #else
     ::Draw1Control( m_peer->GetControlRef() ) ;
 #endif
@@ -3067,7 +3110,7 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time )
                 eventNc.SetEventObject( child );
                 if ( !child->GetEventHandler()->ProcessEvent( eventNc ) )
                 {
                 eventNc.SetEventObject( child );
                 if ( !child->GetEventHandler()->ProcessEvent( eventNc ) )
                 {
-#if wxMAC_USE_CORE_GRAPHICS 
+#if wxMAC_USE_CORE_GRAPHICS
                     child->MacPaintBorders(0, 0) ;
 #else
                     {
                     child->MacPaintBorders(0, 0) ;
 #else
                     {
@@ -3341,15 +3384,18 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
     }
 }
 
     }
 }
 
-void wxWindowMac::OnPaint( wxPaintEvent & event )
+void wxWindowMac::OnPaint( wxPaintEvent & WXUNUSED(event) )
 {
 {
-    if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL )
+    if ( wxTheApp->MacGetCurrentEvent() != NULL && wxTheApp->MacGetCurrentEventHandlerCallRef() != NULL
+         && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
         CallNextEventHandler(
             (EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() ,
             (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
 }
 
         CallNextEventHandler(
             (EventHandlerCallRef)wxTheApp->MacGetCurrentEventHandlerCallRef() ,
             (EventRef) wxTheApp->MacGetCurrentEvent() ) ;
 }
 
-void wxWindowMac::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
+void wxWindowMac::MacHandleControlClick(WXWidget WXUNUSED(control),
+                                        wxInt16 WXUNUSED(controlpart),
+                                        bool WXUNUSED(mouseStillDown))
 {
 }
 
 {
 }
 
@@ -3387,6 +3433,8 @@ bool wxWindowMac::Reparent(wxWindowBase *newParentBase)
 bool wxWindowMac::SetTransparent(wxByte alpha)
 {
 #if wxMAC_USE_CORE_GRAPHICS
 bool wxWindowMac::SetTransparent(wxByte alpha)
 {
 #if wxMAC_USE_CORE_GRAPHICS
+    SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
+
     if ( alpha != m_macAlpha )
     {
         m_macAlpha = alpha ;
     if ( alpha != m_macAlpha )
     {
         m_macAlpha = alpha ;
@@ -3408,7 +3456,7 @@ bool wxWindowMac::CanSetTransparent()
 #endif
 }
 
 #endif
 }
 
-wxByte wxWindowMac::GetTransparent() const 
+wxByte wxWindowMac::GetTransparent() const
 {
     return m_macAlpha ;
 }
 {
     return m_macAlpha ;
 }