correcting alpha and removing window shadow for overlay

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2010-04-12 20:39:51 +00:00
parent 583982c82f
commit b61b8371b0
4 changed files with 22 additions and 2 deletions

View 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

View 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];
}
}

View 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];

View 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() )