2017-02-25 05:44:02 +08:00
|
|
|
#ifndef DockWidgetH
|
|
|
|
#define DockWidgetH
|
2017-02-27 21:15:20 +08:00
|
|
|
/*******************************************************************************
|
|
|
|
** QtAdcancedDockingSystem
|
|
|
|
** Copyright (C) 2017 Uwe Kindler
|
|
|
|
**
|
|
|
|
** This program is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** This program 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 General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
2017-02-25 05:44:02 +08:00
|
|
|
//============================================================================
|
|
|
|
/// \file DockWidget.h
|
|
|
|
/// \author Uwe Kindler
|
2017-02-27 01:13:56 +08:00
|
|
|
/// \date 26.02.2017
|
|
|
|
/// \brief Declaration of CDockWidget class
|
2017-02-25 05:44:02 +08:00
|
|
|
//============================================================================
|
|
|
|
|
2017-02-27 21:15:20 +08:00
|
|
|
|
2017-02-25 05:44:02 +08:00
|
|
|
//============================================================================
|
|
|
|
// INCLUDES
|
|
|
|
//============================================================================
|
|
|
|
#include <QFrame>
|
|
|
|
|
|
|
|
namespace ads
|
|
|
|
{
|
2017-02-27 01:13:56 +08:00
|
|
|
struct DockWidgetPrivate;
|
2017-02-27 21:15:20 +08:00
|
|
|
class CDockWidgetTitleBar;
|
2017-03-01 21:09:56 +08:00
|
|
|
class CDockManager;
|
|
|
|
class CDockContainerWidget;
|
|
|
|
class CDockAreaWidget;
|
2017-02-25 05:44:02 +08:00
|
|
|
|
|
|
|
/**
|
2017-02-27 01:13:56 +08:00
|
|
|
* The QDockWidget class provides a widget that can be docked inside a
|
|
|
|
* CDockManager or floated as a top-level window on the desktop.
|
2017-02-25 05:44:02 +08:00
|
|
|
*/
|
|
|
|
class CDockWidget : public QFrame
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2017-02-27 01:13:56 +08:00
|
|
|
private:
|
|
|
|
DockWidgetPrivate* d; ///< private data (pimpl)
|
|
|
|
friend class DockWidgetPrivate;
|
2017-03-01 21:09:56 +08:00
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
protected:
|
2017-03-01 21:09:56 +08:00
|
|
|
friend class CDockContainerWidget;
|
2017-03-12 04:38:31 +08:00
|
|
|
friend class CDockAreaWidget;
|
|
|
|
friend class CFloatingDockContainer;
|
|
|
|
|
2017-03-01 21:09:56 +08:00
|
|
|
/**
|
|
|
|
* Assigns the dock manager that manages this dock widget
|
|
|
|
*/
|
|
|
|
void setDockManager(CDockManager* DockManager);
|
|
|
|
|
2017-03-12 04:38:31 +08:00
|
|
|
/**
|
|
|
|
* If this dock widget is inserted into a dock area, the dock area will
|
|
|
|
* be registered on this widget via this function. If a dock widget is
|
|
|
|
* removed from a dock area, this function will be called with nullptr
|
|
|
|
* value.
|
|
|
|
*/
|
|
|
|
void setDockArea(CDockAreaWidget* DockArea);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide dock widget.
|
|
|
|
*/
|
2017-03-22 23:08:44 +08:00
|
|
|
void hideDockWidget();
|
2017-03-12 04:38:31 +08:00
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
public:
|
2017-02-27 21:15:20 +08:00
|
|
|
enum DockWidgetFeature
|
|
|
|
{
|
|
|
|
DockWidgetClosable = 0x01,
|
|
|
|
DockWidgetMovable = 0x02,
|
|
|
|
DockWidgetFloatable = 0x04,
|
|
|
|
AllDockWidgetFeatures = DockWidgetClosable | DockWidgetMovable | DockWidgetFloatable,
|
|
|
|
NoDockWidgetFeatures = 0x00
|
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
|
|
|
|
|
2017-03-12 04:38:31 +08:00
|
|
|
|
|
|
|
enum eState
|
|
|
|
{
|
|
|
|
StateHidden,
|
|
|
|
StateDocked,
|
|
|
|
StateFloating
|
|
|
|
};
|
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
/**
|
|
|
|
* Default Constructor
|
|
|
|
*/
|
|
|
|
CDockWidget(const QString &title, QWidget* parent = 0);
|
2017-02-25 05:44:02 +08:00
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
/**
|
|
|
|
* Virtual Destructor
|
|
|
|
*/
|
|
|
|
virtual ~CDockWidget();
|
2017-02-25 05:44:02 +08:00
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
/**
|
|
|
|
* Sets the widget for the dock widget to widget.
|
|
|
|
*/
|
|
|
|
void setWidget(QWidget* widget);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the widget for the dock widget. This function returns zero if
|
|
|
|
* the widget has not been set.
|
|
|
|
*/
|
|
|
|
QWidget* widget() const;
|
2017-02-27 21:15:20 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the title bar widget of this dock widget
|
|
|
|
*/
|
|
|
|
CDockWidgetTitleBar* titleBar() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets, whether the dock widget is movable, closable, and floatable.
|
|
|
|
*/
|
|
|
|
void setFeatures(DockWidgetFeatures features);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds whether the dock widget is movable, closable, and
|
|
|
|
* floatable.
|
|
|
|
* By default, this property is set to a combination of DockWidgetClosable,
|
|
|
|
* DockWidgetMovable and DockWidgetFloatable.
|
|
|
|
*/
|
|
|
|
DockWidgetFeatures features() const;
|
2017-03-01 21:09:56 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the dock manager that manages the dock widget or 0 if the widget
|
|
|
|
* has not been assigned to any dock manager yet
|
|
|
|
*/
|
|
|
|
CDockManager* dockManager() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the dock container widget this dock area widget belongs to or 0
|
|
|
|
* if this dock widget has nt been docked yet
|
|
|
|
*/
|
|
|
|
CDockContainerWidget* dockContainer() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the dock area widget this dock widget belongs to or 0
|
|
|
|
* if this dock widget has not been docked yet
|
|
|
|
*/
|
|
|
|
CDockAreaWidget* dockAreaWidget() const;
|
2017-03-12 04:38:31 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This property holds whether the dock widget is floating.
|
|
|
|
*/
|
|
|
|
bool isFloating() const;
|
|
|
|
|
2017-03-22 23:08:44 +08:00
|
|
|
/**
|
|
|
|
* Returns true, if this dock widget is closed.
|
|
|
|
*/
|
|
|
|
bool isClosed() const;
|
|
|
|
|
2017-03-12 04:38:31 +08:00
|
|
|
/**
|
|
|
|
* Returns a checkable action that can be used to show or close this dock widget.
|
|
|
|
* The action's text is set to the dock widget's window title.
|
|
|
|
*/
|
|
|
|
QAction* toggleViewAction() const;
|
|
|
|
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
/**
|
|
|
|
* This property controls whether the dock widget is open or closed.
|
|
|
|
* The toogleViewAction triggers this slot
|
|
|
|
*/
|
|
|
|
void toggleView(bool Open);
|
2017-02-27 01:13:56 +08:00
|
|
|
}; // class DockWidget
|
|
|
|
}
|
|
|
|
// namespace ads
|
|
|
|
//-----------------------------------------------------------------------------
|
2017-02-25 05:44:02 +08:00
|
|
|
#endif // DockWidgetH
|