Implement shaped windows closer to other platforms
wxFRAME_SHAPED is not needed anymore under OSX and a shaped window can just have a background color, does not need a paint handler.
This commit is contained in:
@@ -770,12 +770,6 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
|
||||
[m_macWindow setDelegate:controller];
|
||||
[controller addObservers:m_macWindow];
|
||||
|
||||
if ( ( style & wxFRAME_SHAPED) )
|
||||
{
|
||||
[m_macWindow setOpaque:NO];
|
||||
[m_macWindow setAlphaValue:1.0];
|
||||
}
|
||||
|
||||
if ( !(style & wxFRAME_TOOL_WINDOW) )
|
||||
[m_macWindow setHidesOnDeactivate:NO];
|
||||
|
||||
|
@@ -3136,7 +3136,14 @@ void wxWidgetCocoaImpl::SetBackgroundColour( const wxColour &col )
|
||||
|
||||
if ( [targetView respondsToSelector:@selector(setBackgroundColor:) ] )
|
||||
{
|
||||
[targetView setBackgroundColor: col.OSXGetNSColor()];
|
||||
wxWindow* peer = GetWXPeer();
|
||||
if ( peer->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
|
||||
{
|
||||
wxTopLevelWindow* toplevel = wxDynamicCast(peer,wxTopLevelWindow);
|
||||
|
||||
if ( toplevel == NULL || toplevel->GetShape().IsEmpty() )
|
||||
[targetView setBackgroundColor: col.OSXGetNSColor()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3147,6 +3154,8 @@ bool wxWidgetCocoaImpl::SetBackgroundStyle( wxBackgroundStyle style )
|
||||
if ( [m_osxView respondsToSelector:@selector(setOpaque:) ] )
|
||||
{
|
||||
[m_osxView setOpaque: opaque];
|
||||
if ( style == wxBG_STYLE_TRANSPARENT )
|
||||
[m_osxView setBackgroundColor:[NSColor clearColor]];
|
||||
}
|
||||
|
||||
return true ;
|
||||
|
@@ -254,17 +254,13 @@ wxPoint wxNonOwnedWindow::GetClientAreaOrigin() const
|
||||
|
||||
bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c )
|
||||
{
|
||||
// only set the native background color if the toplevel window's
|
||||
// background is not supposed to be transparent, otherwise the
|
||||
// transparency is lost
|
||||
if( GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT ||
|
||||
(GetWindowStyle() & wxFRAME_SHAPED) )
|
||||
return false;
|
||||
|
||||
if ( !wxWindow::SetBackgroundColour(c) && m_hasBgCol )
|
||||
return false ;
|
||||
|
||||
if ( GetBackgroundStyle() != wxBG_STYLE_CUSTOM )
|
||||
// only set the native background color if the toplevel window's
|
||||
// background is not supposed to be transparent, otherwise the
|
||||
// transparency is lost
|
||||
if ( GetBackgroundStyle() != wxBG_STYLE_PAINT && GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT)
|
||||
{
|
||||
if ( m_nowpeer )
|
||||
return m_nowpeer->SetBackgroundColour(c);
|
||||
@@ -522,6 +518,10 @@ bool wxNonOwnedWindow::DoSetRegionShape(const wxRegion& region)
|
||||
{
|
||||
m_shape = region;
|
||||
|
||||
// set the native content view to transparency, this is an implementation detail
|
||||
// no reflected in the wx BackgroundStyle
|
||||
GetPeer()->SetBackgroundStyle(wxBG_STYLE_TRANSPARENT);
|
||||
|
||||
return m_nowpeer->SetShape(region);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user