diff --git a/include/wx/osx/cocoa/private.h b/include/wx/osx/cocoa/private.h index 83de3b8d64..3450249ed8 100644 --- a/include/wx/osx/cocoa/private.h +++ b/include/wx/osx/cocoa/private.h @@ -314,7 +314,7 @@ public : virtual bool IsFullScreen() const wxOVERRIDE; - bool EnableFullScreenView(bool enable) wxOVERRIDE; + bool EnableFullScreenView(bool enable, long style) wxOVERRIDE; virtual bool ShowFullScreen(bool show, long style) wxOVERRIDE; @@ -341,6 +341,7 @@ public : void RestoreWindowLevel() wxOVERRIDE; bool m_macIgnoreNextFullscreenChange = false; + long m_macFullscreenStyle = wxFULLSCREEN_ALL; static WX_NSResponder GetNextFirstResponder() ; static WX_NSResponder GetFormerFirstResponder() ; diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h index 53e5bdb687..4b5c3fe5ae 100644 --- a/include/wx/osx/core/private.h +++ b/include/wx/osx/core/private.h @@ -962,7 +962,7 @@ public : virtual void ShowWithoutActivating() { Show(true); } - virtual bool EnableFullScreenView(bool enable) = 0; + virtual bool EnableFullScreenView(bool enable, long style) = 0; virtual bool ShowFullScreen(bool show, long style)= 0; diff --git a/include/wx/osx/iphone/private.h b/include/wx/osx/iphone/private.h index 58e9b6e3ae..902b98fd7f 100644 --- a/include/wx/osx/iphone/private.h +++ b/include/wx/osx/iphone/private.h @@ -180,7 +180,7 @@ public : virtual bool IsFullScreen() const; - virtual bool EnableFullScreenView(bool enable); + virtual bool EnableFullScreenView(bool enable, long style); virtual bool ShowFullScreen(bool show, long style); diff --git a/include/wx/osx/toplevel.h b/include/wx/osx/toplevel.h index 4882037a23..1935ae2eca 100644 --- a/include/wx/osx/toplevel.h +++ b/include/wx/osx/toplevel.h @@ -64,7 +64,7 @@ public: virtual bool IsActive() wxOVERRIDE; virtual void ShowWithoutActivating() wxOVERRIDE; - bool EnableFullScreenView(bool enable = true) wxOVERRIDE; + bool EnableFullScreenView(bool enable = true, long style = wxFULLSCREEN_ALL) wxOVERRIDE; virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE; virtual bool IsFullScreen() const wxOVERRIDE; diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 3adeb8c998..6efbf8c894 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -171,7 +171,8 @@ public: // set the frame icons virtual void SetIcons(const wxIconBundle& icons) { m_icons = icons; } - virtual bool EnableFullScreenView(bool WXUNUSED(enable) = true) + virtual bool EnableFullScreenView(bool WXUNUSED(enable) = true, + long WXUNUSED(style) = wxFULLSCREEN_ALL) { return false; } diff --git a/interface/wx/toplevel.h b/interface/wx/toplevel.h index 76dad23d53..68ba34827e 100644 --- a/interface/wx/toplevel.h +++ b/interface/wx/toplevel.h @@ -649,6 +649,10 @@ public: @param enable If @true (default) make the zoom button toggle full screen; if @false the button does only toggle zoom. + @param style + This parameter sets which elements will be hidden when the + user presses the full screen button. See ShowFullScreen() + for possible values. It is available since wxWidgets 3.1.6. @return @true if the button behaviour has been changed, @false if running under another OS. @@ -658,6 +662,8 @@ public: and entering and exiting the mode is animated. If the button is not present the old way of switching to full screen is used. + Only @c ::wxFULLSCREEN_NOTOOLBAR and @c ::wxFULLSCREEN_NOMENUBAR will be + used when using the fullscreen API (other values are ignored). @onlyfor{wxosx} @@ -665,7 +671,7 @@ public: @since 3.1.0 */ - virtual bool EnableFullScreenView(bool enable = true); + virtual bool EnableFullScreenView(bool enable = true, long style = wxFULLSCREEN_ALL); /** Depending on the value of @a show parameter the window is either shown diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 75f4a315f9..5a0096287e 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -322,6 +322,8 @@ static void *EffectiveAppearanceContext = &EffectiveAppearanceContext; - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; - (void)windowWillEnterFullScreen:(NSNotification *)notification; - (void)windowDidChangeBackingProperties:(NSNotification *)notification; +- (NSApplicationPresentationOptions)window:(NSWindow *)window + willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions; @end @@ -335,6 +337,27 @@ extern int wxOSXGetIdFromSelector(SEL action ); return self; } +- (NSApplicationPresentationOptions)window:(NSWindow *)window + willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions +{ + NSApplicationPresentationOptions options = + NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock; + + wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation]; + if ( windowimpl ) + { + if (windowimpl->m_macFullscreenStyle & wxFULLSCREEN_NOMENUBAR) + options |= NSApplicationPresentationAutoHideMenuBar; + + // Auto hide toolbar requires auto hide menu + if (windowimpl->m_macFullscreenStyle & wxFULLSCREEN_NOTOOLBAR) + options |= NSApplicationPresentationAutoHideToolbar | + NSApplicationPresentationAutoHideMenuBar; + } + + return options; +} + - (BOOL) triggerMenu:(SEL) action sender:(id)sender { // feed back into menu item, if it is ours @@ -1188,8 +1211,9 @@ bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const return m_macFullScreenData != NULL ; } -bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable) +bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable, long style) { + m_macFullscreenStyle = style; NSUInteger collectionBehavior = [m_macWindow collectionBehavior]; if (enable) { @@ -1212,12 +1236,13 @@ bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable) return true; } -bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style)) +bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long style) { if ( IsUsingFullScreenApi(m_macWindow) ) { if ( show != IsFullScreen() ) { + m_macFullscreenStyle = style; m_macIgnoreNextFullscreenChange = true; [m_macWindow toggleFullScreen: nil]; } diff --git a/src/osx/iphone/nonownedwnd.mm b/src/osx/iphone/nonownedwnd.mm index 2b15df7144..de69b157c6 100644 --- a/src/osx/iphone/nonownedwnd.mm +++ b/src/osx/iphone/nonownedwnd.mm @@ -284,7 +284,7 @@ bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const return m_macFullScreenData != NULL ; } -bool wxNonOwnedWindowIPhoneImpl::EnableFullScreenView(bool WXUNUSED(enable)) +bool wxNonOwnedWindowIPhoneImpl::EnableFullScreenView(bool WXUNUSED(enable), long WXUNUSED(style)) { return true; } diff --git a/src/osx/toplevel_osx.cpp b/src/osx/toplevel_osx.cpp index 71df160a03..354d46c4de 100644 --- a/src/osx/toplevel_osx.cpp +++ b/src/osx/toplevel_osx.cpp @@ -181,9 +181,9 @@ void wxTopLevelWindowMac::ShowWithoutActivating() SendSizeEvent(); } -bool wxTopLevelWindowMac::EnableFullScreenView(bool enable) +bool wxTopLevelWindowMac::EnableFullScreenView(bool enable, long style) { - return m_nowpeer->EnableFullScreenView(enable); + return m_nowpeer->EnableFullScreenView(enable, style); } bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)