File indexing completed on 2024-12-08 04:27:17

0001 /*
0002     SPDX-FileCopyrightText: 2012 Jean-Baptiste Mardelle <jb@kdenlive.org>
0003     SPDX-FileCopyrightText: 2014 Till Theato <root@ttill.de>
0004 
0005     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include <QObject>
0011 class QAction;
0012 
0013 /**
0014  * @class DockTitleBarManager
0015  * @brief Helper for dock widget title bars eg. to change the visible state or add context menus.
0016  */
0017 class DockTitleBarManager : public QObject
0018 {
0019     Q_OBJECT
0020 
0021 public:
0022     explicit DockTitleBarManager(QObject *parent = nullptr);
0023 
0024 public Q_SLOTS:
0025     /** @brief Correctly hide/show dock widget title bars depending on position (floating, tabbed, docked) */
0026     void slotUpdateTitleBars(bool isTopLevel = true);
0027     /** @brief Connect/disconnect signals to update title bars on dock location changed */
0028     void connectDocks(bool doConnect);
0029 
0030 private:
0031     QAction *m_switchAction;
0032 
0033 private Q_SLOTS:
0034     void slotInstallRightClick();
0035     /** @brief Add/remove Dock tile bar depending on state (tabbed, floating, ...) */
0036     void slotUpdateDockLocation(Qt::DockWidgetArea dockLocationArea);
0037     /** @brief Set the global visible state of the DockWidget title bars and update them afterwards */
0038     void slotShowTitleBars(bool show);
0039     /** @brief Toggles the global visible state of the DockWidget title bars */
0040     void slotSwitchTitleBars();
0041 };