2015-12-09 19:21:38 +08:00
|
|
|
#ifndef SECTIONCONTENT_H
|
|
|
|
#define SECTIONCONTENT_H
|
2017-02-20 17:06:55 +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/>.
|
|
|
|
******************************************************************************/
|
2015-12-09 19:21:38 +08:00
|
|
|
#include <QSharedPointer>
|
2016-02-11 21:33:02 +08:00
|
|
|
#include <QWeakPointer>
|
2016-02-26 19:43:14 +08:00
|
|
|
#include <QPointer>
|
|
|
|
class QWidget;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-02-02 22:01:48 +08:00
|
|
|
#include "ads/API.h"
|
2015-12-09 19:21:38 +08:00
|
|
|
|
|
|
|
ADS_NAMESPACE_BEGIN
|
2017-02-23 05:33:48 +08:00
|
|
|
class CMainContainerWidget;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-02-24 04:31:09 +08:00
|
|
|
class ADS_EXPORT_API SectionContent
|
2015-12-09 19:21:38 +08:00
|
|
|
{
|
2017-02-23 05:33:48 +08:00
|
|
|
friend class CMainContainerWidget;
|
2016-02-11 21:33:02 +08:00
|
|
|
|
|
|
|
private:
|
2016-02-17 21:42:46 +08:00
|
|
|
SectionContent();
|
|
|
|
SectionContent(const SectionContent&);
|
|
|
|
SectionContent& operator=(const SectionContent&);
|
2016-02-11 21:33:02 +08:00
|
|
|
|
2015-12-09 19:21:38 +08:00
|
|
|
public:
|
|
|
|
typedef QSharedPointer<SectionContent> RefPtr;
|
2016-02-11 21:33:02 +08:00
|
|
|
typedef QWeakPointer<SectionContent> WeakPtr;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-08-04 19:36:55 +08:00
|
|
|
enum Flag
|
|
|
|
{
|
|
|
|
None = 0,
|
|
|
|
Closeable = 1,
|
2017-02-09 06:03:13 +08:00
|
|
|
Maximizable = 2,
|
|
|
|
AllFlags = Closeable | Maximizable
|
2016-08-04 19:36:55 +08:00
|
|
|
};
|
|
|
|
Q_DECLARE_FLAGS(Flags, Flag)
|
|
|
|
|
2016-02-17 21:42:46 +08:00
|
|
|
/*!
|
|
|
|
* Creates new content, associates it to <em>container</em> and takes ownership of
|
|
|
|
* <em>title</em>- and <em>content</em>- widgets.
|
|
|
|
* \param uniqueName An unique identifier across the entire process.
|
|
|
|
* \param container The parent ContainerWidget in which this content will be active.
|
|
|
|
* \param title The widget to use as title.
|
|
|
|
* \param content The widget to use as content.
|
|
|
|
* \return May return a invalid ref-pointer in case of invalid parameters.
|
|
|
|
*/
|
2017-02-23 05:33:48 +08:00
|
|
|
static RefPtr newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content);
|
2016-02-17 21:42:46 +08:00
|
|
|
|
2015-12-09 19:21:38 +08:00
|
|
|
virtual ~SectionContent();
|
|
|
|
int uid() const;
|
|
|
|
QString uniqueName() const;
|
2017-02-23 05:33:48 +08:00
|
|
|
CMainContainerWidget* containerWidget() const;
|
|
|
|
QWidget* titleWidgetContent() const;
|
2015-12-09 19:21:38 +08:00
|
|
|
QWidget* contentWidget() const;
|
2016-08-04 19:36:55 +08:00
|
|
|
Flags flags() const;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-02-24 19:12:09 +08:00
|
|
|
QString visibleTitle() const;
|
|
|
|
QString title() const;
|
|
|
|
void setTitle(const QString& title);
|
2016-08-04 19:36:55 +08:00
|
|
|
void setFlags(const Flags f);
|
2016-02-24 19:12:09 +08:00
|
|
|
|
2016-02-11 21:33:02 +08:00
|
|
|
private:
|
2015-12-09 19:21:38 +08:00
|
|
|
const int _uid;
|
2016-02-17 21:42:46 +08:00
|
|
|
QString _uniqueName;
|
2016-02-24 19:12:09 +08:00
|
|
|
|
2017-02-23 05:33:48 +08:00
|
|
|
QPointer<CMainContainerWidget> m_MainContainerWidget;
|
|
|
|
QPointer<QWidget> m_TitleWidgetContent;
|
|
|
|
QPointer<QWidget> m_ContentWidget;
|
2016-02-24 19:12:09 +08:00
|
|
|
|
|
|
|
// Optional attributes
|
|
|
|
QString _title;
|
2016-08-04 19:36:55 +08:00
|
|
|
Flags _flags;
|
2015-12-09 19:21:38 +08:00
|
|
|
|
2016-03-14 22:12:34 +08:00
|
|
|
/* Note: This method could be a problem in static build environment
|
|
|
|
* since it may begin with 0 for every module which uses ADS.
|
|
|
|
*/
|
2016-02-24 03:51:19 +08:00
|
|
|
static int GetNextUid();
|
2015-12-09 19:21:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
ADS_NAMESPACE_END
|
2016-02-12 14:15:10 +08:00
|
|
|
#endif
|