Supporting newer transparent background API

This commit is contained in:
Stefan Csomor
2018-10-22 22:36:42 +02:00
parent 7dfbe50fc0
commit 651e1cd1b5
4 changed files with 16 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ public:
virtual bool SetForegroundColour( const wxColour &colour ) wxOVERRIDE;
virtual bool SetBackgroundStyle(wxBackgroundStyle style) wxOVERRIDE;
virtual bool IsTransparentBackgroundSupported(wxString* reason = NULL) const wxOVERRIDE;
virtual int GetCharHeight() const wxOVERRIDE;
virtual int GetCharWidth() const wxOVERRIDE;

View File

@@ -778,6 +778,13 @@ long style, long extraStyle, const wxString& WXUNUSED(name) )
if ( !(style & wxFRAME_TOOL_WINDOW) )
[m_macWindow setHidesOnDeactivate:NO];
if ( GetWXPeer()->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
{
[m_macWindow setOpaque:NO];
[m_macWindow setAlphaValue:1.0];
[m_macWindow setBackgroundColor:[NSColor clearColor]];
}
}
void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), WXWindow nativeWindow )

View File

@@ -152,7 +152,8 @@ bool wxNonOwnedWindow::Create(wxWindow *parent,
wxWindowCreateEvent event(this);
HandleWindowEvent(event);
SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ));
if ( GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
SetBackgroundColour(wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ));
if ( parent )
parent->AddChild(this);

View File

@@ -518,6 +518,11 @@ bool wxWindowMac::SetBackgroundStyle(wxBackgroundStyle style)
return true;
}
bool wxWindowMac::IsTransparentBackgroundSupported(wxString* WXUNUSED(reason)) const
{
return true;
}
bool wxWindowMac::SetBackgroundColour(const wxColour& col )
{
if (m_growBox)