Add config to make close button collapse auto hide dock

This commit is contained in:
Syarif Fakhri 2023-04-28 15:27:22 +08:00
parent f2d8e17981
commit b46768537a
2 changed files with 7 additions and 1 deletions

View File

@ -415,7 +415,12 @@ void CDockAreaTitleBar::onTabsMenuAboutToShow()
void CDockAreaTitleBar::onCloseButtonClicked()
{
ADS_PRINT("CDockAreaTitleBar::onCloseButtonClicked");
if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
if (CDockManager::testAutoHideConfigFlag(CDockManager::AutoHideCloseButtonCollapsesDock) &&
d->DockArea->autoHideDockContainer())
{
d->DockArea->autoHideDockContainer()->collapseView(true);
}
else if (d->testConfigFlag(CDockManager::DockAreaCloseButtonClosesTab))
{
d->TabBar->closeTab(d->TabBar->currentIndex());
}

View File

@ -239,6 +239,7 @@ public:
AutoHideButtonCheckable = 0x08, //!< If the flag is set, the auto hide button will be checked and unchecked depending on the auto hide state. Mainly for styling purposes.
AutoHideSideBarsIconOnly = 0x10,///< show only icons in auto hide side tab - if a tab has no icon, then the text will be shown
AutoHideShowOnMouseOver = 0x20, ///< show the auto hide window on mouse over tab and hide it if mouse leaves auto hide container
AutoHideCloseButtonCollapsesDock = 0x40, ///< Close button of an auto hide container closes the dock instead of hiding it completely
DefaultAutoHideConfig = AutoHideFeatureEnabled
| DockAreaHasAutoHideButton ///< the default configuration for left and right side bars