2018-10-12 19:37:37 +08:00
|
|
|
#ifndef DockAreaTitleBarH
|
|
|
|
#define DockAreaTitleBarH
|
2018-10-12 21:29:41 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
** Qt Advanced Docking System
|
|
|
|
** Copyright (C) 2017 Uwe Kindler
|
|
|
|
**
|
|
|
|
** This library is free software; you can redistribute it and/or
|
|
|
|
** modify it under the terms of the GNU Lesser General Public
|
|
|
|
** License as published by the Free Software Foundation; either
|
|
|
|
** version 2.1 of the License, or (at your option) any later version.
|
|
|
|
**
|
|
|
|
** This library is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
** Lesser General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU Lesser General Public
|
|
|
|
** License along with this library; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
2018-10-12 19:37:37 +08:00
|
|
|
//============================================================================
|
|
|
|
/// \file DockAreaTitleBar.h
|
|
|
|
/// \author Uwe Kindler
|
|
|
|
/// \date 12.10.2018
|
|
|
|
/// \brief Declaration of CDockAreaTitleBar class
|
|
|
|
//============================================================================
|
|
|
|
|
2018-10-12 21:29:41 +08:00
|
|
|
|
2018-10-12 19:37:37 +08:00
|
|
|
//============================================================================
|
|
|
|
// INCLUDES
|
|
|
|
//============================================================================
|
|
|
|
#include <QFrame>
|
|
|
|
|
2018-11-04 03:51:02 +08:00
|
|
|
#include "ads_globals.h"
|
|
|
|
|
|
|
|
class QAbstractButton;
|
|
|
|
|
2018-10-12 19:37:37 +08:00
|
|
|
namespace ads
|
|
|
|
{
|
|
|
|
class CDockAreaTabBar;
|
|
|
|
class CDockAreaWidget;
|
|
|
|
struct DockAreaTitleBarPrivate;
|
|
|
|
|
|
|
|
/**
|
2019-08-26 13:58:56 +08:00
|
|
|
* Title bar of a dock area.
|
|
|
|
* The title bar contains a tabbar with all tabs for a dock widget group and
|
|
|
|
* with a tabs menu button, a undock button and a close button.
|
2018-10-12 19:37:37 +08:00
|
|
|
*/
|
2019-10-18 13:41:28 +08:00
|
|
|
class ADS_EXPORT CDockAreaTitleBar : public QFrame
|
2018-10-12 19:37:37 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private:
|
|
|
|
DockAreaTitleBarPrivate* d; ///< private data (pimpl)
|
2018-12-17 19:41:43 +08:00
|
|
|
friend struct DockAreaTitleBarPrivate;
|
2018-10-12 19:37:37 +08:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onTabsMenuAboutToShow();
|
|
|
|
void onCloseButtonClicked();
|
2018-11-04 03:51:02 +08:00
|
|
|
void onUndockButtonClicked();
|
2018-10-12 19:37:37 +08:00
|
|
|
void onTabsMenuActionTriggered(QAction* Action);
|
2018-10-12 20:51:57 +08:00
|
|
|
void onCurrentTabChanged(int Index);
|
2018-12-20 22:29:38 +08:00
|
|
|
void showContextMenu(const QPoint& pos);
|
2018-10-12 19:37:37 +08:00
|
|
|
|
2019-01-23 14:43:07 +08:00
|
|
|
public slots:
|
2019-08-26 13:58:56 +08:00
|
|
|
/**
|
|
|
|
* Call this slot to tell the title bar that it should update the tabs menu
|
|
|
|
* the next time it is shown.
|
|
|
|
*/
|
2019-01-23 14:43:07 +08:00
|
|
|
void markTabsMenuOutdated();
|
|
|
|
|
|
|
|
|
2018-10-12 19:37:37 +08:00
|
|
|
public:
|
|
|
|
using Super = QFrame;
|
|
|
|
/**
|
|
|
|
* Default Constructor
|
|
|
|
*/
|
|
|
|
CDockAreaTitleBar(CDockAreaWidget* parent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Virtual Destructor
|
|
|
|
*/
|
|
|
|
virtual ~CDockAreaTitleBar();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the pointer to the tabBar()
|
|
|
|
*/
|
|
|
|
CDockAreaTabBar* tabBar() const;
|
2018-10-15 21:09:59 +08:00
|
|
|
|
2018-11-04 03:51:02 +08:00
|
|
|
/**
|
|
|
|
* Returns the button corresponding to the given title bar button identifier
|
|
|
|
*/
|
|
|
|
QAbstractButton* button(TitleBarButton which) const;
|
|
|
|
|
2018-11-08 17:04:29 +08:00
|
|
|
/**
|
2019-08-26 13:58:56 +08:00
|
|
|
* Marks the tabs menu outdated before it calls its base class
|
|
|
|
* implementation
|
2018-11-08 17:04:29 +08:00
|
|
|
*/
|
2018-11-04 03:51:02 +08:00
|
|
|
virtual void setVisible(bool Visible) override;
|
|
|
|
|
2019-01-23 14:43:07 +08:00
|
|
|
|
2018-10-15 21:09:59 +08:00
|
|
|
signals:
|
|
|
|
/**
|
|
|
|
* This signal is emitted if a tab in the tab bar is clicked by the user
|
|
|
|
* or if the user clicks on a tab item in the title bar tab menu.
|
|
|
|
*/
|
|
|
|
void tabBarClicked(int index);
|
2018-10-12 19:37:37 +08:00
|
|
|
}; // class name
|
|
|
|
}
|
|
|
|
// namespace ads
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
#endif // DockAreaTitleBarH
|