From: Kevin Ollivier Date: Sun, 15 Nov 2009 01:36:30 +0000 (+0000) Subject: ShowWithoutActivating fix for OS X Cocoa, and also add support for shaped windows... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/eabe8426ccfd2241128fce8831842be042b6c581 ShowWithoutActivating fix for OS X Cocoa, and also add support for shaped windows at least when the image being drawn has proper alpha/mask set. I'm not sure if we can support it by setting a region on the TLW, as the way to do this in Cocoa is just to make the TLW's background transparent and use alpha in whatever you draw. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index e5e031a604..066989265c 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -481,7 +481,8 @@ void wxNonOwnedWindowCocoaImpl::Lower() void wxNonOwnedWindowCocoaImpl::ShowWithoutActivating() { - [[m_macWindow contentView] setNeedsDisplay:YES]; + [m_macWindow orderBack:nil]; + [[m_macWindow contentView] setNeedsDisplay: YES]; } bool wxNonOwnedWindowCocoaImpl::Show(bool show) @@ -493,7 +494,7 @@ bool wxNonOwnedWindowCocoaImpl::Show(bool show) [m_macWindow makeKeyAndOrderFront:nil]; else [m_macWindow orderFront:nil]; - ShowWithoutActivating(); + [[m_macWindow contentView] setNeedsDisplay: YES]; } else [m_macWindow orderOut:nil]; @@ -556,8 +557,14 @@ void wxNonOwnedWindowCocoaImpl::SetWindowStyleFlag( long style ) } } -bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) +bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle style) { + if ( style == wxBG_STYLE_TRANSPARENT ) + { + [m_macWindow setOpaque:NO]; + [m_macWindow setBackgroundColor:[NSColor clearColor]]; + } + return true; } @@ -600,7 +607,10 @@ void wxNonOwnedWindowCocoaImpl::GetContentArea( int& left, int &top, int &width, bool wxNonOwnedWindowCocoaImpl::SetShape(const wxRegion& WXUNUSED(region)) { - return false; + [m_macWindow setOpaque:NO]; + [m_macWindow setBackgroundColor:[NSColor clearColor]]; + + return true; } void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding encoding )