diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index 3473aadca9..9a3e131a81 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -210,6 +210,7 @@ public : bool SetTransparent(wxByte alpha); bool SetBackgroundColour(const wxColour& col ); void SetExtraStyle( long exStyle ); + void SetWindowStyleFlag( long style ); bool SetBackgroundStyle(wxBackgroundStyle style); bool CanSetTransparent(); diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 9d3fbdb52f..47c9179bf3 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -685,7 +685,11 @@ public : virtual void SetExtraStyle( long WXUNUSED(exStyle) ) { } - + + virtual void SetWindowStyleFlag( long WXUNUSED(style) ) + { + } + virtual bool SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) { return false ; diff --git a/include/wx/osx/nonownedwnd.h b/include/wx/osx/nonownedwnd.h index e650d7e094..cf537e15ec 100644 --- a/include/wx/osx/nonownedwnd.h +++ b/include/wx/osx/nonownedwnd.h @@ -80,6 +80,7 @@ public: static void MacDelayedDeactivation(long timestamp); virtual void MacActivate( long timestamp , bool inIsActivating ) ; + virtual void SetWindowStyleFlag(long flags); virtual void Raise(); virtual void Lower(); diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index c19341742e..b0af31cc07 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -533,6 +533,21 @@ void wxNonOwnedWindowCocoaImpl::SetExtraStyle( long exStyle ) } } +void wxNonOwnedWindowCocoaImpl::SetWindowStyleFlag( long style ) +{ + if (m_macWindow) + { + CGWindowLevel level = kCGNormalWindowLevel; + + if (style & wxSTAY_ON_TOP) + level = kCGUtilityWindowLevel; + else if (( style & wxFRAME_FLOAT_ON_PARENT ) || ( style & wxFRAME_TOOL_WINDOW )) + level = kCGFloatingWindowLevel; + + [m_macWindow setLevel: level]; + } +} + bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style)) { return true; diff --git a/src/osx/nonownedwnd_osx.cpp b/src/osx/nonownedwnd_osx.cpp index bdc9be1d32..9adc5647d5 100644 --- a/src/osx/nonownedwnd_osx.cpp +++ b/src/osx/nonownedwnd_osx.cpp @@ -217,6 +217,17 @@ bool wxNonOwnedWindow::SetBackgroundColour(const wxColour& c ) return true; } +void wxNonOwnedWindow::SetWindowStyleFlag(long flags) +{ + if (flags == GetWindowStyleFlag()) + return; + + wxWindow::SetWindowStyleFlag(flags); + + if (m_nowpeer) + m_nowpeer->SetWindowStyleFlag(flags); +} + // Raise the window to the top of the Z order void wxNonOwnedWindow::Raise() {