macOS: Allow setting some fullscreen style options
When using the native fullscreen API by enabling EnableFullScrenView() allow using hiding (or showing) menu and/or toolbar. An additional style parameter has been added to EnableFullScrenView() to allow customizing which style is applied when the user presses the fullscreen button instead of a call to ShowFullScreen(). Closes #22180.
This commit is contained in:
committed by
Vadim Zeitlin
parent
9b2f55833e
commit
0a8bba971c
@@ -314,7 +314,7 @@ public :
|
|||||||
|
|
||||||
virtual bool IsFullScreen() const wxOVERRIDE;
|
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;
|
virtual bool ShowFullScreen(bool show, long style) wxOVERRIDE;
|
||||||
|
|
||||||
@@ -341,6 +341,7 @@ public :
|
|||||||
void RestoreWindowLevel() wxOVERRIDE;
|
void RestoreWindowLevel() wxOVERRIDE;
|
||||||
|
|
||||||
bool m_macIgnoreNextFullscreenChange = false;
|
bool m_macIgnoreNextFullscreenChange = false;
|
||||||
|
long m_macFullscreenStyle = wxFULLSCREEN_ALL;
|
||||||
|
|
||||||
static WX_NSResponder GetNextFirstResponder() ;
|
static WX_NSResponder GetNextFirstResponder() ;
|
||||||
static WX_NSResponder GetFormerFirstResponder() ;
|
static WX_NSResponder GetFormerFirstResponder() ;
|
||||||
|
|||||||
@@ -962,7 +962,7 @@ public :
|
|||||||
|
|
||||||
virtual void ShowWithoutActivating() { Show(true); }
|
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;
|
virtual bool ShowFullScreen(bool show, long style)= 0;
|
||||||
|
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public :
|
|||||||
|
|
||||||
virtual bool IsFullScreen() const;
|
virtual bool IsFullScreen() const;
|
||||||
|
|
||||||
virtual bool EnableFullScreenView(bool enable);
|
virtual bool EnableFullScreenView(bool enable, long style);
|
||||||
|
|
||||||
virtual bool ShowFullScreen(bool show, long style);
|
virtual bool ShowFullScreen(bool show, long style);
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
virtual bool IsActive() wxOVERRIDE;
|
virtual bool IsActive() wxOVERRIDE;
|
||||||
|
|
||||||
virtual void ShowWithoutActivating() 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 ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) wxOVERRIDE;
|
||||||
virtual bool IsFullScreen() const wxOVERRIDE;
|
virtual bool IsFullScreen() const wxOVERRIDE;
|
||||||
|
|
||||||
|
|||||||
@@ -171,7 +171,8 @@ public:
|
|||||||
// set the frame icons
|
// set the frame icons
|
||||||
virtual void SetIcons(const wxIconBundle& icons) { m_icons = 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -649,6 +649,10 @@ public:
|
|||||||
@param enable
|
@param enable
|
||||||
If @true (default) make the zoom button toggle full screen;
|
If @true (default) make the zoom button toggle full screen;
|
||||||
if @false the button does only toggle zoom.
|
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
|
@return @true if the button behaviour has been changed, @false if running
|
||||||
under another OS.
|
under another OS.
|
||||||
@@ -658,6 +662,8 @@ public:
|
|||||||
and entering and exiting the mode is animated.
|
and entering and exiting the mode is animated.
|
||||||
If the button is not present the old way of switching to full screen
|
If the button is not present the old way of switching to full screen
|
||||||
is used.
|
is used.
|
||||||
|
Only @c ::wxFULLSCREEN_NOTOOLBAR and @c ::wxFULLSCREEN_NOMENUBAR will be
|
||||||
|
used when using the fullscreen API (other values are ignored).
|
||||||
|
|
||||||
@onlyfor{wxosx}
|
@onlyfor{wxosx}
|
||||||
|
|
||||||
@@ -665,7 +671,7 @@ public:
|
|||||||
|
|
||||||
@since 3.1.0
|
@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
|
Depending on the value of @a show parameter the window is either shown
|
||||||
|
|||||||
@@ -322,6 +322,8 @@ static void *EffectiveAppearanceContext = &EffectiveAppearanceContext;
|
|||||||
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
|
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
|
||||||
- (void)windowWillEnterFullScreen:(NSNotification *)notification;
|
- (void)windowWillEnterFullScreen:(NSNotification *)notification;
|
||||||
- (void)windowDidChangeBackingProperties:(NSNotification *)notification;
|
- (void)windowDidChangeBackingProperties:(NSNotification *)notification;
|
||||||
|
- (NSApplicationPresentationOptions)window:(NSWindow *)window
|
||||||
|
willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -335,6 +337,27 @@ extern int wxOSXGetIdFromSelector(SEL action );
|
|||||||
return self;
|
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
|
- (BOOL) triggerMenu:(SEL) action sender:(id)sender
|
||||||
{
|
{
|
||||||
// feed back into menu item, if it is ours
|
// feed back into menu item, if it is ours
|
||||||
@@ -1188,8 +1211,9 @@ bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const
|
|||||||
return m_macFullScreenData != NULL ;
|
return m_macFullScreenData != NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable)
|
bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable, long style)
|
||||||
{
|
{
|
||||||
|
m_macFullscreenStyle = style;
|
||||||
NSUInteger collectionBehavior = [m_macWindow collectionBehavior];
|
NSUInteger collectionBehavior = [m_macWindow collectionBehavior];
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
@@ -1212,12 +1236,13 @@ bool wxNonOwnedWindowCocoaImpl::EnableFullScreenView(bool enable)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style))
|
bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long style)
|
||||||
{
|
{
|
||||||
if ( IsUsingFullScreenApi(m_macWindow) )
|
if ( IsUsingFullScreenApi(m_macWindow) )
|
||||||
{
|
{
|
||||||
if ( show != IsFullScreen() )
|
if ( show != IsFullScreen() )
|
||||||
{
|
{
|
||||||
|
m_macFullscreenStyle = style;
|
||||||
m_macIgnoreNextFullscreenChange = true;
|
m_macIgnoreNextFullscreenChange = true;
|
||||||
[m_macWindow toggleFullScreen: nil];
|
[m_macWindow toggleFullScreen: nil];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ bool wxNonOwnedWindowIPhoneImpl::IsFullScreen() const
|
|||||||
return m_macFullScreenData != NULL ;
|
return m_macFullScreenData != NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxNonOwnedWindowIPhoneImpl::EnableFullScreenView(bool WXUNUSED(enable))
|
bool wxNonOwnedWindowIPhoneImpl::EnableFullScreenView(bool WXUNUSED(enable), long WXUNUSED(style))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,9 +181,9 @@ void wxTopLevelWindowMac::ShowWithoutActivating()
|
|||||||
SendSizeEvent();
|
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)
|
bool wxTopLevelWindowMac::ShowFullScreen(bool show, long style)
|
||||||
|
|||||||
Reference in New Issue
Block a user