diff --git a/include/wx/osx/app.h b/include/wx/osx/app.h index 08632e4477..89f7ec8d6a 100644 --- a/include/wx/osx/app.h +++ b/include/wx/osx/app.h @@ -139,6 +139,9 @@ public: // override this to return false from a non-bundled console app in order to stay in background ... virtual bool OSXIsGUIApplication() { return true; } + // Allow the user to disable the tab bar support in the application + void OSXEnableAutomaticTabbing(bool enable); + #if wxOSX_USE_COCOA_OR_IPHONE // immediately before the native event loop launches virtual void OSXOnWillFinishLaunching(); diff --git a/interface/wx/app.h b/interface/wx/app.h index 0f9a0f344c..dae434792a 100644 --- a/interface/wx/app.h +++ b/interface/wx/app.h @@ -1068,6 +1068,21 @@ public: */ virtual bool OSXIsGUIApplication(); + /** + Enable the automatic tabbing features of macOS. + + This feature is native to the operating system. When it is enabled, macOS + will automatically place windows inside tabs and show a tab bar in the + application. Entries are also added to the View menu to show/hide the tab bar. + + @onlyfor{wxosx} + + @remarks Requires macOS 10.12+, does nothing under earlier OS versions. + + @since 3.1.4 + */ + bool OSXEnableAutomaticTabbing(bool enable); + //@} }; diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index de24c5484e..507a2672b9 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -475,6 +475,15 @@ void wxApp::DoCleanUp() } } +void wxApp::OSXEnableAutomaticTabbing(bool enable) +{ + // Automatic tabbing was first introduced in 10.12 + if ( WX_IS_MACOS_AVAILABLE(10, 12) ) + { + [NSWindow setAllowsAutomaticWindowTabbing:enable]; + } +} + extern // used from src/osx/core/display.cpp wxRect wxOSXGetMainDisplayClientArea() {