]> git.saurik.com Git - wxWidgets.git/commitdiff
correcting alpha and removing window shadow for overlay
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Apr 2010 20:39:51 +0000 (20:39 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Apr 2010 20:39:51 +0000 (20:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/nonownedwnd.h
src/osx/cocoa/nonownedwnd.mm
src/osx/cocoa/window.mm
src/osx/nonownedwnd_osx.cpp

index eee92a7ea6006f5bcc8794e05b447f12cebb6821..57de414d6cdc93e4f21bd372f820dbf6caea83b5 100644 (file)
@@ -75,6 +75,7 @@ public:
     // --------------------------
 
     virtual bool DoSetShape(const wxRegion& region);
+    const wxRegion& GetShape() const { return m_shape; }
 
     // activation hooks only necessary for MDI Implementation
     static void MacDelayedDeactivation(long timestamp);
@@ -126,7 +127,9 @@ protected:
 //    wxWindowMac* m_macFocus ;
 
     static wxNonOwnedWindow *s_macDeactivateWindow;
+    
 private :
+    wxRegion m_shape;
 };
 
 // list of all frames and modeless dialogs
index df2a8949529a08c708469e0fdc0a630a4eb85551..666864b9ad29ce734417562a69f01971b4375ab6 100644 (file)
@@ -485,6 +485,12 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
     [m_macWindow setDelegate:controller];
 
     [m_macWindow setAcceptsMouseMovedEvents: YES];
+    
+    if ( ( style & wxFRAME_SHAPED) )
+    {
+        [m_macWindow setOpaque:NO];
+        [m_macWindow setAlphaValue:1.0];
+    }
 }
 
 
index 8e579e45d0e6a1ef4f66dd7f5fefdf4ce00fbf9b..890ccf7c9934e2dac91b2b2d89563319fec936d5 100644 (file)
@@ -1092,15 +1092,23 @@ void wxWidgetCocoaImpl::drawRect(void* rect, WXWidget slf, void *WXUNUSED(_cmd))
     [slf getRectsBeingDrawn:&rects count:&count];
     for ( int i = 0 ; i < count ; ++i )
     {
-        updateRgn.Union(wxFromNSRect(slf, rects[i]) );
+        updateRgn.Union(wxFromNSRect(slf, rects[i]));
     }
 
     wxWindow* wxpeer = GetWXPeer();
+    if ( wxpeer->MacGetTopLevelWindow()->GetWindowStyle() & wxFRAME_SHAPED )
+    {
+        int xoffset = 0, yoffset = 0;
+        wxRegion rgn = wxpeer->MacGetTopLevelWindow()->GetShape();
+        wxpeer->MacRootWindowToWindow( &xoffset, &yoffset );
+        rgn.Offset( xoffset, yoffset );
+        updateRgn.Intersect(rgn);
+    }
+    
     wxpeer->GetUpdateRegion() = updateRgn;
     wxpeer->MacSetCGContextRef( context );
 
     bool handled = wxpeer->MacDoRedraw( 0 );
-
     CGContextRestoreGState( context );
 
     CGContextSaveGState( context );
@@ -2077,6 +2085,7 @@ wxWidgetImpl* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
 {
     NSWindow* tlw = now->GetWXWindow();
     wxNSView* v = [[wxNSView alloc] initWithFrame:[[tlw contentView] frame]];
+
     wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( now, v, true );
     c->InstallEventHandler();
     [tlw setContentView:v];
index 54ecb11f6d3e8b2125d557929a1f54d95c399ae2..a75e778ba84bc62f3bb3f098ddb6b4c107b40324 100644 (file)
@@ -453,6 +453,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() )