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-27 01:13:56 +08:00
|
|
|
|
2017-02-25 05:44:02 +08:00
|
|
|
//============================================================================
|
|
|
|
/// \file DockManager.cpp
|
|
|
|
/// \author Uwe Kindler
|
2017-02-27 01:13:56 +08:00
|
|
|
/// \date 26.02.2017
|
|
|
|
/// \brief Implementation of CDockManager 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 "DockManager.h"
|
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
#include <QMainWindow>
|
2017-03-01 21:09:56 +08:00
|
|
|
#include <QList>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "FloatingDockContainer.h"
|
2017-03-01 23:13:37 +08:00
|
|
|
#include "DockOverlay.h"
|
2017-02-27 01:13:56 +08:00
|
|
|
|
2017-02-25 05:44:02 +08:00
|
|
|
namespace ads
|
|
|
|
{
|
2017-02-27 01:13:56 +08:00
|
|
|
/**
|
|
|
|
* Private data class of CDockManager class (pimpl)
|
|
|
|
*/
|
|
|
|
struct DockManagerPrivate
|
|
|
|
{
|
|
|
|
CDockManager* _this;
|
2017-03-01 21:09:56 +08:00
|
|
|
QList<CFloatingDockContainer*> FloatingWidgets;
|
2017-03-01 23:13:37 +08:00
|
|
|
QList<CDockContainerWidget*> Containers;
|
|
|
|
CDockOverlay* ContainerOverlay;
|
|
|
|
CDockOverlay* DockAreaOverlay;
|
2017-02-27 01:13:56 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Private data constructor
|
|
|
|
*/
|
|
|
|
DockManagerPrivate(CDockManager* _public);
|
|
|
|
};
|
|
|
|
// struct DockManagerPrivate
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
DockManagerPrivate::DockManagerPrivate(CDockManager* _public) :
|
|
|
|
_this(_public)
|
|
|
|
{
|
2017-02-25 05:44:02 +08:00
|
|
|
|
2017-02-27 01:13:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockManager::CDockManager(QWidget *parent) :
|
|
|
|
CDockContainerWidget(this, parent),
|
|
|
|
d(new DockManagerPrivate(this))
|
|
|
|
{
|
|
|
|
QMainWindow* MainWindow = dynamic_cast<QMainWindow*>(parent);
|
|
|
|
if (MainWindow)
|
|
|
|
{
|
|
|
|
MainWindow->setCentralWidget(this);
|
|
|
|
}
|
2017-03-01 23:13:37 +08:00
|
|
|
|
2017-03-02 18:43:48 +08:00
|
|
|
d->DockAreaOverlay = new CDockOverlay(this, CDockOverlay::ModeDockAreaOverlay);
|
|
|
|
d->ContainerOverlay = new CDockOverlay(this, CDockOverlay::ModeContainerOverlay);
|
2017-03-01 23:13:37 +08:00
|
|
|
d->Containers.append(this);
|
2017-02-27 01:13:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockManager::~CDockManager()
|
|
|
|
{
|
|
|
|
delete d;
|
|
|
|
}
|
2017-03-01 21:09:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void CDockManager::registerFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
|
|
|
{
|
|
|
|
d->FloatingWidgets.append(FloatingWidget);
|
|
|
|
std::cout << "d->FloatingWidgets.count() " << d->FloatingWidgets.count()
|
|
|
|
<< std::endl;
|
|
|
|
}
|
2017-03-01 23:13:37 +08:00
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void CDockManager::removeFloatingWidget(CFloatingDockContainer* FloatingWidget)
|
|
|
|
{
|
|
|
|
d->FloatingWidgets.removeAll(FloatingWidget);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void CDockManager::registerDockContainer(CDockContainerWidget* DockContainer)
|
|
|
|
{
|
|
|
|
d->Containers.append(DockContainer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
void CDockManager::removeDockContainer(CDockContainerWidget* DockContainer)
|
|
|
|
{
|
|
|
|
if (this != DockContainer)
|
|
|
|
{
|
|
|
|
d->Containers.removeAll(DockContainer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockOverlay* CDockManager::containerOverlay() const
|
|
|
|
{
|
|
|
|
return d->ContainerOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
CDockOverlay* CDockManager::dockAreaOverlay() const
|
|
|
|
{
|
|
|
|
return d->DockAreaOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
const QList<CDockContainerWidget*> CDockManager::dockContainers() const
|
|
|
|
{
|
|
|
|
return d->Containers;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
const QList<CFloatingDockContainer*> CDockManager::floatingWidgets() const
|
|
|
|
{
|
|
|
|
return d->FloatingWidgets;
|
|
|
|
}
|
2017-02-25 05:44:02 +08:00
|
|
|
} // namespace ads
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// EOF DockManager.cpp
|