]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/window.cpp
Look for and remove any "-NSKey" "value" types of options from argv just like
[wxWidgets.git] / src / mac / carbon / window.cpp
index e141745c0c4a4092eb4628fa9cb9b4ca251c9c87..bd25da73e0c7b0279acddf8c678de461a1dd648d 100644 (file)
@@ -278,6 +278,15 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                             }
                         }
                         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 ;
@@ -334,6 +343,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                 }
 #endif
 
+                if ( thisWindow->MacIsUserPane() )
+                    result = noErr ;
+
                 if ( controlPart == kControlFocusNoPart )
                 {
 #if wxUSE_CARET
@@ -367,9 +379,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl
                     event.SetEventObject(thisWindow);
                     thisWindow->GetEventHandler()->ProcessEvent(event) ;
                 }
-
-                if ( thisWindow->MacIsUserPane() )
-                    result = noErr ;
             }
             break ;
 
@@ -2139,19 +2148,9 @@ bool wxWindowMac::Show(bool show)
     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 ) ;
-
-    if ( former != MacIsReallyEnabled() )
-        MacPropagateEnabledStateChanged() ;
-
-    return true;
 }
 
 //
@@ -2176,21 +2175,10 @@ void wxWindowMac::MacPropagateVisibilityChanged()
 #endif
 }
 
-void wxWindowMac::MacPropagateEnabledStateChanged()
+void wxWindowMac::OnEnabled(bool enabled)
 {
 #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
 }
 
@@ -2296,7 +2284,7 @@ void wxWindowMac::GetTextExtent(const wxString& string, int *x, int *y,
         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 ;
@@ -2384,7 +2372,8 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
         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() ;
     }
@@ -2631,6 +2620,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:
+            // 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
@@ -2651,14 +2641,8 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         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
-        // 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
-
         HIViewRender(m_peer->GetControlRef()) ;
 #endif
     }
@@ -2683,11 +2667,11 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         {
             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
         {
-            child->SetSize( x + dx, y + dy, w, h );
+            child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
         }
     }
 }
@@ -2752,7 +2736,7 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event )
         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();
@@ -2858,7 +2842,9 @@ void wxWindowMac::ClearBackground()
 void wxWindowMac::Update()
 {
 #if TARGET_API_MAC_OSX
-    MacGetTopLevelWindow()->MacPerformUpdates() ;
+    wxTopLevelWindowMac* top = MacGetTopLevelWindow();
+    if (top)
+        top->MacPerformUpdates() ;
 #else
     ::Draw1Control( m_peer->GetControlRef() ) ;
 #endif
@@ -3367,7 +3353,8 @@ void wxWindowMac::OnMouseEvent( wxMouseEvent &event )
 
 void wxWindowMac::OnPaint( wxPaintEvent & 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() ) ;
@@ -3411,6 +3398,8 @@ bool wxWindowMac::Reparent(wxWindowBase *newParentBase)
 bool wxWindowMac::SetTransparent(wxByte alpha)
 {
 #if wxMAC_USE_CORE_GRAPHICS
+    SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
+
     if ( alpha != m_macAlpha )
     {
         m_macAlpha = alpha ;