From ca6428611716f5d6e1864d2b4108f2d0707b00d6 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Thu, 23 Feb 2017 21:46:29 +0100 Subject: [PATCH] Moved include files from include to src directory --- .../{include/ads => src}/API.h | 180 ++++----- .../{include/ads => src}/ContainerWidget.h | 258 ++++++------- .../{include/ads => src}/DropOverlay.h | 238 ++++++------ .../{include/ads => src}/FloatingWidget.h | 228 +++++------ .../{include/ads => src}/Internal.h | 134 +++---- .../ads => src}/MainContainerWidget.h | 0 .../{include/ads => src}/SectionContent.h | 190 ++++----- .../ads => src}/SectionContentWidget.h | 170 ++++---- .../{include/ads => src}/SectionTitleWidget.h | 156 ++++---- .../{include/ads => src}/SectionWidget.h | 258 ++++++------- .../{include/ads => src}/Serialization.h | 362 +++++++++--------- 11 files changed, 1087 insertions(+), 1087 deletions(-) rename AdvancedDockingSystem/{include/ads => src}/API.h (96%) rename AdvancedDockingSystem/{include/ads => src}/ContainerWidget.h (97%) rename AdvancedDockingSystem/{include/ads => src}/DropOverlay.h (96%) rename AdvancedDockingSystem/{include/ads => src}/FloatingWidget.h (96%) rename AdvancedDockingSystem/{include/ads => src}/Internal.h (96%) rename AdvancedDockingSystem/{include/ads => src}/MainContainerWidget.h (100%) rename AdvancedDockingSystem/{include/ads => src}/SectionContent.h (96%) rename AdvancedDockingSystem/{include/ads => src}/SectionContentWidget.h (96%) rename AdvancedDockingSystem/{include/ads => src}/SectionTitleWidget.h (96%) rename AdvancedDockingSystem/{include/ads => src}/SectionWidget.h (96%) rename AdvancedDockingSystem/{include/ads => src}/Serialization.h (96%) diff --git a/AdvancedDockingSystem/include/ads/API.h b/AdvancedDockingSystem/src/API.h similarity index 96% rename from AdvancedDockingSystem/include/ads/API.h rename to AdvancedDockingSystem/src/API.h index 6b5d55d..fa73ad6 100644 --- a/AdvancedDockingSystem/include/ads/API.h +++ b/AdvancedDockingSystem/src/API.h @@ -1,90 +1,90 @@ -#ifndef ADS_API_H -#define ADS_API_H -/******************************************************************************* -** 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 . -******************************************************************************/ - -#include -class QWidget; -class QSplitter; - -// DLL Export API -#ifdef _WIN32 - #if defined(ADS_IMPORT) - #define ADS_EXPORT_API - #elif defined(ADS_EXPORT) - #define ADS_EXPORT_API __declspec(dllexport) - #else - #define ADS_EXPORT_API __declspec(dllimport) - #endif -#else - #define ADS_EXPORT_API -#endif - -// Use namespace -// Disabled with Qt4, it makes problems with signals and slots. -#ifdef ADS_NAMESPACE_ENABLED - #define ADS_NAMESPACE_BEGIN namespace ads { - #define ADS_NAMESPACE_END } - #define ADS_NS ::ads -#else - #define ADS_NAMESPACE_BEGIN - #define ADS_NAMESPACE_END - #define ADS_NS -#endif - -// Always enable "serialization" namespace. -// It is not required for signals and slots. -#define ADS_NAMESPACE_SER_BEGIN namespace ads { namespace serialization { -#define ADS_NAMESPACE_SER_END }} -#define ADS_NS_SER ::ads::serialization - -// Width of the native window frame border (based on OS). -#define ADS_WINDOW_FRAME_BORDER_WIDTH 7 - -// Beautiful C++ stuff. -#define ADS_Expects(cond) -#define ADS_Ensures(cond) - -// Indicates whether ADS should include animations. -//#define ADS_ANIMATIONS_ENABLED 1 -//#define ADS_ANIMATION_DURATION 150 - -ADS_NAMESPACE_BEGIN -class CMainContainerWidget; -class SectionWidget; - -enum DropArea -{ - InvalidDropArea = 0, - TopDropArea = 1, - RightDropArea = 2, - BottomDropArea = 4, - LeftDropArea = 8, - CenterDropArea = 16, - - OuterAreas = TopDropArea | RightDropArea | BottomDropArea | LeftDropArea, - AllAreas = OuterAreas | CenterDropArea -}; -Q_DECLARE_FLAGS(DropAreas, DropArea) - -void deleteEmptySplitter(CMainContainerWidget* container); -QSplitter* findParentSplitter(QWidget* w); -QSplitter* findImmediateSplitter(QWidget* w); - -ADS_NAMESPACE_END -#endif +#ifndef ADS_API_H +#define ADS_API_H +/******************************************************************************* +** 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 . +******************************************************************************/ + +#include +class QWidget; +class QSplitter; + +// DLL Export API +#ifdef _WIN32 + #if defined(ADS_IMPORT) + #define ADS_EXPORT_API + #elif defined(ADS_EXPORT) + #define ADS_EXPORT_API __declspec(dllexport) + #else + #define ADS_EXPORT_API __declspec(dllimport) + #endif +#else + #define ADS_EXPORT_API +#endif + +// Use namespace +// Disabled with Qt4, it makes problems with signals and slots. +#ifdef ADS_NAMESPACE_ENABLED + #define ADS_NAMESPACE_BEGIN namespace ads { + #define ADS_NAMESPACE_END } + #define ADS_NS ::ads +#else + #define ADS_NAMESPACE_BEGIN + #define ADS_NAMESPACE_END + #define ADS_NS +#endif + +// Always enable "serialization" namespace. +// It is not required for signals and slots. +#define ADS_NAMESPACE_SER_BEGIN namespace ads { namespace serialization { +#define ADS_NAMESPACE_SER_END }} +#define ADS_NS_SER ::ads::serialization + +// Width of the native window frame border (based on OS). +#define ADS_WINDOW_FRAME_BORDER_WIDTH 7 + +// Beautiful C++ stuff. +#define ADS_Expects(cond) +#define ADS_Ensures(cond) + +// Indicates whether ADS should include animations. +//#define ADS_ANIMATIONS_ENABLED 1 +//#define ADS_ANIMATION_DURATION 150 + +ADS_NAMESPACE_BEGIN +class CMainContainerWidget; +class SectionWidget; + +enum DropArea +{ + InvalidDropArea = 0, + TopDropArea = 1, + RightDropArea = 2, + BottomDropArea = 4, + LeftDropArea = 8, + CenterDropArea = 16, + + OuterAreas = TopDropArea | RightDropArea | BottomDropArea | LeftDropArea, + AllAreas = OuterAreas | CenterDropArea +}; +Q_DECLARE_FLAGS(DropAreas, DropArea) + +void deleteEmptySplitter(CMainContainerWidget* container); +QSplitter* findParentSplitter(QWidget* w); +QSplitter* findImmediateSplitter(QWidget* w); + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/ContainerWidget.h b/AdvancedDockingSystem/src/ContainerWidget.h similarity index 97% rename from AdvancedDockingSystem/include/ads/ContainerWidget.h rename to AdvancedDockingSystem/src/ContainerWidget.h index 7230179..0399505 100644 --- a/AdvancedDockingSystem/include/ads/ContainerWidget.h +++ b/AdvancedDockingSystem/src/ContainerWidget.h @@ -1,129 +1,129 @@ -#ifndef ContainerWidgetH -#define ContainerWidgetH -/******************************************************************************* -** 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 . -******************************************************************************/ - -//============================================================================ -// INCLUDES -//============================================================================ -#include - -#include "ads/API.h" -#include "ads/Internal.h" -#include "ads/SectionContent.h" -#include "ads/FloatingWidget.h" -#include "ads/Serialization.h" -#include "ads/DropOverlay.h" - -namespace ads -{ -class SectionWidget; -class DropOverlay; -class InternalContentData; -class CMainContainerWidget; - -/** - * @brief - */ -class CContainerWidget : public QFrame -{ - Q_OBJECT - - friend class SectionContent; - friend class SectionWidget; - friend class FloatingWidget; - friend class SectionTitleWidget; - friend class ContainerWidgetPrivate; - -public: - explicit CContainerWidget(CMainContainerWidget* MainContainerWidget, QWidget *parent = nullptr); - virtual ~CContainerWidget(); - - /** - * Returns the current zOrderIndex - */ - virtual unsigned int zOrderIndex() const; - - void dropFloatingWidget(FloatingWidget* FloatingWidget, - const QPoint& TargetPos); - - SectionWidget* sectionWidgetAt(const QPoint& GlobalPos) const; - - /** - * This function returns true if this container widgets z order index is - * higher than the index of the container widget given in Other parameter - */ - bool isInFrontOf(CContainerWidget* Other) const; - - SectionWidget* dropContent(const InternalContentData& data, SectionWidget* targetSection, DropArea area, bool autoActive = true); - - /*! - * Adds the section-content sc to this container-widget into the section-widget sw. - * If sw is not NULL, the area is used to indicate how the content should be arranged. - * Returns a pointer to the SectionWidget of the added SectionContent. Do not use it for anything else than adding more - * SectionContent elements with this method. - */ - SectionWidget* addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw = NULL, DropArea area = CenterDropArea); - - void dumpLayout(); - - CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} - - void addSectionWidget(SectionWidget* section); - - void takeSection(SectionWidget* Widget); - -signals: - /*! - * Emits whenever the "isActiveTab" state of a SectionContent changes. - * Whenever the users sets another tab as active, this signal gets invoked - * for the old tab and the new active tab (the order is unspecified). - */ - void activeTabChanged(const SectionContent::RefPtr& sc, bool active); - -protected: - void dropIntoContainer(FloatingWidget* FloatingWidget, DropArea area); - void dropIntoSection(FloatingWidget* FloatingWidget, SectionWidget* targetSection, DropArea area); - virtual bool event(QEvent *e) override; - SectionWidget* newSectionWidget(); - SectionWidget* dropContentOuterHelper(QLayout* l, const InternalContentData& data, Qt::Orientation orientation, bool append); - SectionWidget* insertNewSectionWidget(const InternalContentData& data, - SectionWidget* targetSection, SectionWidget* ret, Qt::Orientation Orientation, int InsertIndexOffset); - - QList m_Sections; - // Layout stuff - QGridLayout* m_MainLayout = nullptr; - Qt::Orientation m_Orientation = Qt::Horizontal; - QPointer m_Splitter; // $mfreiholz: I'd like to remove this variable entirely, - // because it changes during user interaction anyway. - - CMainContainerWidget* m_MainContainerWidget = 0; - unsigned int m_zOrderIndex = 0; - static unsigned int zOrderCounter; - -private: - void dropChildSections(QWidget* Parent); - -private slots: - void onActiveTabChanged(); -}; - -} // namespace ads - -//--------------------------------------------------------------------------- -#endif // ContainerWidgetH +#ifndef ContainerWidgetH +#define ContainerWidgetH +/******************************************************************************* +** 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 . +******************************************************************************/ + +//============================================================================ +// INCLUDES +//============================================================================ +#include + +#include "ads/API.h" +#include "ads/Internal.h" +#include "ads/SectionContent.h" +#include "ads/FloatingWidget.h" +#include "ads/Serialization.h" +#include "ads/DropOverlay.h" + +namespace ads +{ +class SectionWidget; +class DropOverlay; +class InternalContentData; +class CMainContainerWidget; + +/** + * @brief + */ +class CContainerWidget : public QFrame +{ + Q_OBJECT + + friend class SectionContent; + friend class SectionWidget; + friend class FloatingWidget; + friend class SectionTitleWidget; + friend class ContainerWidgetPrivate; + +public: + explicit CContainerWidget(CMainContainerWidget* MainContainerWidget, QWidget *parent = nullptr); + virtual ~CContainerWidget(); + + /** + * Returns the current zOrderIndex + */ + virtual unsigned int zOrderIndex() const; + + void dropFloatingWidget(FloatingWidget* FloatingWidget, + const QPoint& TargetPos); + + SectionWidget* sectionWidgetAt(const QPoint& GlobalPos) const; + + /** + * This function returns true if this container widgets z order index is + * higher than the index of the container widget given in Other parameter + */ + bool isInFrontOf(CContainerWidget* Other) const; + + SectionWidget* dropContent(const InternalContentData& data, SectionWidget* targetSection, DropArea area, bool autoActive = true); + + /*! + * Adds the section-content sc to this container-widget into the section-widget sw. + * If sw is not NULL, the area is used to indicate how the content should be arranged. + * Returns a pointer to the SectionWidget of the added SectionContent. Do not use it for anything else than adding more + * SectionContent elements with this method. + */ + SectionWidget* addSectionContent(const SectionContent::RefPtr& sc, SectionWidget* sw = NULL, DropArea area = CenterDropArea); + + void dumpLayout(); + + CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} + + void addSectionWidget(SectionWidget* section); + + void takeSection(SectionWidget* Widget); + +signals: + /*! + * Emits whenever the "isActiveTab" state of a SectionContent changes. + * Whenever the users sets another tab as active, this signal gets invoked + * for the old tab and the new active tab (the order is unspecified). + */ + void activeTabChanged(const SectionContent::RefPtr& sc, bool active); + +protected: + void dropIntoContainer(FloatingWidget* FloatingWidget, DropArea area); + void dropIntoSection(FloatingWidget* FloatingWidget, SectionWidget* targetSection, DropArea area); + virtual bool event(QEvent *e) override; + SectionWidget* newSectionWidget(); + SectionWidget* dropContentOuterHelper(QLayout* l, const InternalContentData& data, Qt::Orientation orientation, bool append); + SectionWidget* insertNewSectionWidget(const InternalContentData& data, + SectionWidget* targetSection, SectionWidget* ret, Qt::Orientation Orientation, int InsertIndexOffset); + + QList m_Sections; + // Layout stuff + QGridLayout* m_MainLayout = nullptr; + Qt::Orientation m_Orientation = Qt::Horizontal; + QPointer m_Splitter; // $mfreiholz: I'd like to remove this variable entirely, + // because it changes during user interaction anyway. + + CMainContainerWidget* m_MainContainerWidget = 0; + unsigned int m_zOrderIndex = 0; + static unsigned int zOrderCounter; + +private: + void dropChildSections(QWidget* Parent); + +private slots: + void onActiveTabChanged(); +}; + +} // namespace ads + +//--------------------------------------------------------------------------- +#endif // ContainerWidgetH diff --git a/AdvancedDockingSystem/include/ads/DropOverlay.h b/AdvancedDockingSystem/src/DropOverlay.h similarity index 96% rename from AdvancedDockingSystem/include/ads/DropOverlay.h rename to AdvancedDockingSystem/src/DropOverlay.h index 5da0d6e..02f2e89 100644 --- a/AdvancedDockingSystem/include/ads/DropOverlay.h +++ b/AdvancedDockingSystem/src/DropOverlay.h @@ -1,119 +1,119 @@ -#ifndef DROP_OVERLAY_H -#define DROP_OVERLAY_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include -#include -#include -class QGridLayout; - -#include "ads/API.h" - -ADS_NAMESPACE_BEGIN -class DropOverlayCross; - -/*! - * DropOverlay paints a translucent rectangle over another widget. The geometry - * of the rectangle is based on the mouse location. - */ -class ADS_EXPORT_API DropOverlay : public QFrame -{ - Q_OBJECT - friend class DropOverlayCross; - -public: - enum eMode - { - ModeSectionOverlay, - ModeContainerOverlay - }; - - DropOverlay(QWidget* parent, eMode Mode = ModeSectionOverlay); - virtual ~DropOverlay(); - - void setAllowedAreas(DropAreas areas); - - /** - * Returns flags with all allowed drop areas - */ - DropAreas allowedAreas() const; - - /** - * Returns the drop area under the current cursor location - */ - DropArea dropAreaUnderCursor() const; - - DropArea showDropOverlay(QWidget* target); - void showDropOverlay(QWidget* target, const QRect& targetAreaRect); - void hideDropOverlay(); - - /** - * Creates a drop indicator widget for the given drop area - */ - static QWidget* createDropIndicatorWidget(DropArea dropArea); - -protected: - virtual void paintEvent(QPaintEvent *e); - virtual void showEvent(QShowEvent* e); - virtual void hideEvent(QHideEvent* e); - virtual void resizeEvent(QResizeEvent* e); - virtual void moveEvent(QMoveEvent* e); - -private: - DropAreas _allowedAreas; - DropOverlayCross* _cross; - QPointer _target; - QRect _targetRect; - DropArea _lastLocation; -}; - -/*! - * DropOverlayCross shows a cross with 5 different drop area possibilities. - * I could have handled everything inside DropOverlay, but because of some - * styling issues it's better to have a separate class for the cross. - */ -class DropOverlayCross : public QWidget -{ - Q_OBJECT - friend class DropOverlay; - -public: - DropOverlayCross(DropOverlay* overlay); - virtual ~DropOverlayCross(); - - DropArea cursorLocation() const; - void setupOverlayCross(DropOverlay::eMode Mode); - -protected: - virtual void showEvent(QShowEvent* e); - void setAreaWidgets(const QHash& widgets); - -private: - void reset(); - QPoint areaGridPosition(const DropArea area); - -private: - DropOverlay::eMode m_Mode = DropOverlay::ModeSectionOverlay; - DropOverlay* m_DropOverlay; - QHash m_DropIndicatorWidgets; - QGridLayout* m_GridLayout; -}; - -ADS_NAMESPACE_END -#endif +#ifndef DROP_OVERLAY_H +#define DROP_OVERLAY_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include +#include +#include +class QGridLayout; + +#include "ads/API.h" + +ADS_NAMESPACE_BEGIN +class DropOverlayCross; + +/*! + * DropOverlay paints a translucent rectangle over another widget. The geometry + * of the rectangle is based on the mouse location. + */ +class ADS_EXPORT_API DropOverlay : public QFrame +{ + Q_OBJECT + friend class DropOverlayCross; + +public: + enum eMode + { + ModeSectionOverlay, + ModeContainerOverlay + }; + + DropOverlay(QWidget* parent, eMode Mode = ModeSectionOverlay); + virtual ~DropOverlay(); + + void setAllowedAreas(DropAreas areas); + + /** + * Returns flags with all allowed drop areas + */ + DropAreas allowedAreas() const; + + /** + * Returns the drop area under the current cursor location + */ + DropArea dropAreaUnderCursor() const; + + DropArea showDropOverlay(QWidget* target); + void showDropOverlay(QWidget* target, const QRect& targetAreaRect); + void hideDropOverlay(); + + /** + * Creates a drop indicator widget for the given drop area + */ + static QWidget* createDropIndicatorWidget(DropArea dropArea); + +protected: + virtual void paintEvent(QPaintEvent *e); + virtual void showEvent(QShowEvent* e); + virtual void hideEvent(QHideEvent* e); + virtual void resizeEvent(QResizeEvent* e); + virtual void moveEvent(QMoveEvent* e); + +private: + DropAreas _allowedAreas; + DropOverlayCross* _cross; + QPointer _target; + QRect _targetRect; + DropArea _lastLocation; +}; + +/*! + * DropOverlayCross shows a cross with 5 different drop area possibilities. + * I could have handled everything inside DropOverlay, but because of some + * styling issues it's better to have a separate class for the cross. + */ +class DropOverlayCross : public QWidget +{ + Q_OBJECT + friend class DropOverlay; + +public: + DropOverlayCross(DropOverlay* overlay); + virtual ~DropOverlayCross(); + + DropArea cursorLocation() const; + void setupOverlayCross(DropOverlay::eMode Mode); + +protected: + virtual void showEvent(QShowEvent* e); + void setAreaWidgets(const QHash& widgets); + +private: + void reset(); + QPoint areaGridPosition(const DropArea area); + +private: + DropOverlay::eMode m_Mode = DropOverlay::ModeSectionOverlay; + DropOverlay* m_DropOverlay; + QHash m_DropIndicatorWidgets; + QGridLayout* m_GridLayout; +}; + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/FloatingWidget.h b/AdvancedDockingSystem/src/FloatingWidget.h similarity index 96% rename from AdvancedDockingSystem/include/ads/FloatingWidget.h rename to AdvancedDockingSystem/src/FloatingWidget.h index 5b4656c..20d1718 100644 --- a/AdvancedDockingSystem/include/ads/FloatingWidget.h +++ b/AdvancedDockingSystem/src/FloatingWidget.h @@ -1,114 +1,114 @@ -#ifndef FLOATINGWIDGET_H -#define FLOATINGWIDGET_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include -class QBoxLayout; - -#include "ads/API.h" -#include "ads/SectionContent.h" - -ADS_NAMESPACE_BEGIN -class CMainContainerWidget; -class SectionTitleWidget; -class CSectionContentWidget; -class InternalContentData; -class SectionWidget; -class CContainerWidget; -class FloatingWidget; - -class CFloatingTitleWidget : public QFrame -{ - Q_OBJECT -private: - QPoint m_DragStartPosition; - QPoint m_DragStartMousePosition; - FloatingWidget* floatingWidget() const; - CMainContainerWidget* mainContainerWidget() const; - void moveFloatingWidget(QMouseEvent* ev); - -private slots: - void onMaximizeButtonClicked(); - -protected: - virtual void mousePressEvent(QMouseEvent* ev); - virtual void mouseReleaseEvent(QMouseEvent* ev); - virtual void mouseMoveEvent(QMouseEvent* ev); - -public: - CFloatingTitleWidget(SectionContent::Flags Flags, FloatingWidget* Parent); - -signals: - void closeButtonClicked(); -}; - - -// FloatingWidget holds and displays SectionContent as a floating window. -// It can be resized, moved and dropped back into a SectionWidget. -class FloatingWidget : public QWidget -{ - Q_OBJECT - - friend class CMainContainerWidget; - friend class CFloatingTitleWidget; - -public: - FloatingWidget(CMainContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, CSectionContentWidget* contentWidget, QWidget* parent = NULL); - FloatingWidget(CMainContainerWidget* container, SectionWidget* sectionWidget); - virtual ~FloatingWidget(); - - /** - * Returns the current zOrderIndex - */ - unsigned int zOrderIndex() const; - - CContainerWidget* containerWidget() const {return m_ContainerWidget;} - CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} - -public://private: - bool takeContent(InternalContentData& data); - - void startFloating(const QPoint& Pos); - -protected: - virtual void changeEvent(QEvent *event) override; - virtual void moveEvent(QMoveEvent *event) override; - virtual bool event(QEvent *e); - void titleMouseReleaseEvent(); - virtual bool eventFilter(QObject *watched, QEvent *event) override; - void updateDropOverlays(const QPoint& GlobalPos); - -private slots: - void onCloseButtonClicked(); - -private: - void setDraggingActive(bool Active); - - CMainContainerWidget* m_MainContainerWidget; - CContainerWidget* m_ContainerWidget; - CContainerWidget* m_DropContainer; - bool m_DraggingActive = false; - unsigned int m_zOrderIndex = 0; - QPoint m_DragStartPosition; - QPoint m_DragStartMousePosition; - static unsigned int zOrderCounter; -}; - -ADS_NAMESPACE_END -#endif +#ifndef FLOATINGWIDGET_H +#define FLOATINGWIDGET_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include +class QBoxLayout; + +#include "ads/API.h" +#include "ads/SectionContent.h" + +ADS_NAMESPACE_BEGIN +class CMainContainerWidget; +class SectionTitleWidget; +class CSectionContentWidget; +class InternalContentData; +class SectionWidget; +class CContainerWidget; +class FloatingWidget; + +class CFloatingTitleWidget : public QFrame +{ + Q_OBJECT +private: + QPoint m_DragStartPosition; + QPoint m_DragStartMousePosition; + FloatingWidget* floatingWidget() const; + CMainContainerWidget* mainContainerWidget() const; + void moveFloatingWidget(QMouseEvent* ev); + +private slots: + void onMaximizeButtonClicked(); + +protected: + virtual void mousePressEvent(QMouseEvent* ev); + virtual void mouseReleaseEvent(QMouseEvent* ev); + virtual void mouseMoveEvent(QMouseEvent* ev); + +public: + CFloatingTitleWidget(SectionContent::Flags Flags, FloatingWidget* Parent); + +signals: + void closeButtonClicked(); +}; + + +// FloatingWidget holds and displays SectionContent as a floating window. +// It can be resized, moved and dropped back into a SectionWidget. +class FloatingWidget : public QWidget +{ + Q_OBJECT + + friend class CMainContainerWidget; + friend class CFloatingTitleWidget; + +public: + FloatingWidget(CMainContainerWidget* container, SectionContent::RefPtr sc, SectionTitleWidget* titleWidget, CSectionContentWidget* contentWidget, QWidget* parent = NULL); + FloatingWidget(CMainContainerWidget* container, SectionWidget* sectionWidget); + virtual ~FloatingWidget(); + + /** + * Returns the current zOrderIndex + */ + unsigned int zOrderIndex() const; + + CContainerWidget* containerWidget() const {return m_ContainerWidget;} + CMainContainerWidget* mainContainerWidget() const {return m_MainContainerWidget;} + +public://private: + bool takeContent(InternalContentData& data); + + void startFloating(const QPoint& Pos); + +protected: + virtual void changeEvent(QEvent *event) override; + virtual void moveEvent(QMoveEvent *event) override; + virtual bool event(QEvent *e); + void titleMouseReleaseEvent(); + virtual bool eventFilter(QObject *watched, QEvent *event) override; + void updateDropOverlays(const QPoint& GlobalPos); + +private slots: + void onCloseButtonClicked(); + +private: + void setDraggingActive(bool Active); + + CMainContainerWidget* m_MainContainerWidget; + CContainerWidget* m_ContainerWidget; + CContainerWidget* m_DropContainer; + bool m_DraggingActive = false; + unsigned int m_zOrderIndex = 0; + QPoint m_DragStartPosition; + QPoint m_DragStartMousePosition; + static unsigned int zOrderCounter; +}; + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/Internal.h b/AdvancedDockingSystem/src/Internal.h similarity index 96% rename from AdvancedDockingSystem/include/ads/Internal.h rename to AdvancedDockingSystem/src/Internal.h index c73733a..5a19726 100644 --- a/AdvancedDockingSystem/include/ads/Internal.h +++ b/AdvancedDockingSystem/src/Internal.h @@ -1,67 +1,67 @@ -#ifndef ADS_INTERNAL_HEADER -#define ADS_INTERNAL_HEADER -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include - -#include "ads/API.h" - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#else -#include "ads/SectionContent.h" -#endif - - -ADS_NAMESPACE_BEGIN -class SectionContent; -class SectionTitleWidget; -class CSectionContentWidget; - - -class InternalContentData -{ -public: - typedef QSharedPointer RefPtr; - typedef QWeakPointer WeakPtr; - - InternalContentData(); - ~InternalContentData(); - - QSharedPointer content; - SectionTitleWidget* titleWidget; - CSectionContentWidget* contentWidget; -}; - - -class HiddenSectionItem -{ -public: - HiddenSectionItem() : - preferredSectionId(-1), - preferredSectionIndex(-1) - {} - - int preferredSectionId; - int preferredSectionIndex; - InternalContentData data; -}; - - -ADS_NAMESPACE_END -#endif +#ifndef ADS_INTERNAL_HEADER +#define ADS_INTERNAL_HEADER +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include + +#include "ads/API.h" + +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#else +#include "ads/SectionContent.h" +#endif + + +ADS_NAMESPACE_BEGIN +class SectionContent; +class SectionTitleWidget; +class CSectionContentWidget; + + +class InternalContentData +{ +public: + typedef QSharedPointer RefPtr; + typedef QWeakPointer WeakPtr; + + InternalContentData(); + ~InternalContentData(); + + QSharedPointer content; + SectionTitleWidget* titleWidget; + CSectionContentWidget* contentWidget; +}; + + +class HiddenSectionItem +{ +public: + HiddenSectionItem() : + preferredSectionId(-1), + preferredSectionIndex(-1) + {} + + int preferredSectionId; + int preferredSectionIndex; + InternalContentData data; +}; + + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/MainContainerWidget.h b/AdvancedDockingSystem/src/MainContainerWidget.h similarity index 100% rename from AdvancedDockingSystem/include/ads/MainContainerWidget.h rename to AdvancedDockingSystem/src/MainContainerWidget.h diff --git a/AdvancedDockingSystem/include/ads/SectionContent.h b/AdvancedDockingSystem/src/SectionContent.h similarity index 96% rename from AdvancedDockingSystem/include/ads/SectionContent.h rename to AdvancedDockingSystem/src/SectionContent.h index 83193c9..b7fdf60 100644 --- a/AdvancedDockingSystem/include/ads/SectionContent.h +++ b/AdvancedDockingSystem/src/SectionContent.h @@ -1,95 +1,95 @@ -#ifndef SECTIONCONTENT_H -#define SECTIONCONTENT_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include -#include -class QWidget; - -#include "ads/API.h" - -ADS_NAMESPACE_BEGIN -class CMainContainerWidget; - -class ADS_EXPORT_API SectionContent -{ - friend class CMainContainerWidget; - -private: - SectionContent(); - SectionContent(const SectionContent&); - SectionContent& operator=(const SectionContent&); - -public: - typedef QSharedPointer RefPtr; - typedef QWeakPointer WeakPtr; - - enum Flag - { - None = 0, - Closeable = 1, - Maximizable = 2, - AllFlags = Closeable | Maximizable - }; - Q_DECLARE_FLAGS(Flags, Flag) - - /*! - * Creates new content, associates it to container and takes ownership of - * title- and content- 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. - */ - static RefPtr newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content); - - virtual ~SectionContent(); - int uid() const; - QString uniqueName() const; - CMainContainerWidget* containerWidget() const; - QWidget* titleWidgetContent() const; - QWidget* contentWidget() const; - Flags flags() const; - - QString visibleTitle() const; - QString title() const; - void setTitle(const QString& title); - void setFlags(const Flags f); - -private: - const int _uid; - QString _uniqueName; - - QPointer m_MainContainerWidget; - QPointer m_TitleWidgetContent; - QPointer m_ContentWidget; - - // Optional attributes - QString _title; - Flags _flags; - - /* Note: This method could be a problem in static build environment - * since it may begin with 0 for every module which uses ADS. - */ - static int GetNextUid(); -}; - -ADS_NAMESPACE_END -#endif +#ifndef SECTIONCONTENT_H +#define SECTIONCONTENT_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include +#include +class QWidget; + +#include "ads/API.h" + +ADS_NAMESPACE_BEGIN +class CMainContainerWidget; + +class ADS_EXPORT_API SectionContent +{ + friend class CMainContainerWidget; + +private: + SectionContent(); + SectionContent(const SectionContent&); + SectionContent& operator=(const SectionContent&); + +public: + typedef QSharedPointer RefPtr; + typedef QWeakPointer WeakPtr; + + enum Flag + { + None = 0, + Closeable = 1, + Maximizable = 2, + AllFlags = Closeable | Maximizable + }; + Q_DECLARE_FLAGS(Flags, Flag) + + /*! + * Creates new content, associates it to container and takes ownership of + * title- and content- 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. + */ + static RefPtr newSectionContent(const QString& uniqueName, CMainContainerWidget* container, QWidget* title, QWidget* content); + + virtual ~SectionContent(); + int uid() const; + QString uniqueName() const; + CMainContainerWidget* containerWidget() const; + QWidget* titleWidgetContent() const; + QWidget* contentWidget() const; + Flags flags() const; + + QString visibleTitle() const; + QString title() const; + void setTitle(const QString& title); + void setFlags(const Flags f); + +private: + const int _uid; + QString _uniqueName; + + QPointer m_MainContainerWidget; + QPointer m_TitleWidgetContent; + QPointer m_ContentWidget; + + // Optional attributes + QString _title; + Flags _flags; + + /* Note: This method could be a problem in static build environment + * since it may begin with 0 for every module which uses ADS. + */ + static int GetNextUid(); +}; + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/SectionContentWidget.h b/AdvancedDockingSystem/src/SectionContentWidget.h similarity index 96% rename from AdvancedDockingSystem/include/ads/SectionContentWidget.h rename to AdvancedDockingSystem/src/SectionContentWidget.h index 718f653..0c859ab 100644 --- a/AdvancedDockingSystem/include/ads/SectionContentWidget.h +++ b/AdvancedDockingSystem/src/SectionContentWidget.h @@ -1,85 +1,85 @@ -#ifndef SECTION_CONTENT_WIDGET_H -#define SECTION_CONTENT_WIDGET_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include - -#include "ads/API.h" -#include "ads/SectionContent.h" - -namespace ads -{ -class CMainContainerWidget; -class SectionWidget; -class SectionTitleWidget; - - -struct SectionContentWidgetPrivate; - - -class CSectionContentWidget : public QFrame -{ - Q_OBJECT -private: - SectionContentWidgetPrivate* d; - friend class SectionContentWidgetPrivate; - friend class CMainContainerWidget; - -public: - enum Flag - { - None = 0, - Closeable = 1, - Maximizable = 2, - AllFlags = Closeable | Maximizable - }; - Q_DECLARE_FLAGS(Flags, Flag) - - CSectionContentWidget(SectionContent::RefPtr c = SectionContent::RefPtr(), QWidget* parent = 0); - virtual ~CSectionContentWidget(); - - /*! - * Creates new content, associates it to container and takes ownership of - * title- and content- 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. - */ - static CSectionContentWidget* newSectionContent(const QString& uniqueName, - CMainContainerWidget* container, QWidget* title, QWidget* content); - - int uid() const; - QString uniqueName() const; - CMainContainerWidget* containerWidget() const; - QWidget* titleWidgetContent() const; - QWidget* contentWidget() const; - Flags flags() const; - - QString visibleTitle() const; - QString title() const; - void setTitle(const QString& title); - void setFlags(const Flags f); - -private: - SectionContent::RefPtr _content; -}; - -} // namespace ads -#endif +#ifndef SECTION_CONTENT_WIDGET_H +#define SECTION_CONTENT_WIDGET_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include + +#include "ads/API.h" +#include "ads/SectionContent.h" + +namespace ads +{ +class CMainContainerWidget; +class SectionWidget; +class SectionTitleWidget; + + +struct SectionContentWidgetPrivate; + + +class CSectionContentWidget : public QFrame +{ + Q_OBJECT +private: + SectionContentWidgetPrivate* d; + friend class SectionContentWidgetPrivate; + friend class CMainContainerWidget; + +public: + enum Flag + { + None = 0, + Closeable = 1, + Maximizable = 2, + AllFlags = Closeable | Maximizable + }; + Q_DECLARE_FLAGS(Flags, Flag) + + CSectionContentWidget(SectionContent::RefPtr c = SectionContent::RefPtr(), QWidget* parent = 0); + virtual ~CSectionContentWidget(); + + /*! + * Creates new content, associates it to container and takes ownership of + * title- and content- 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. + */ + static CSectionContentWidget* newSectionContent(const QString& uniqueName, + CMainContainerWidget* container, QWidget* title, QWidget* content); + + int uid() const; + QString uniqueName() const; + CMainContainerWidget* containerWidget() const; + QWidget* titleWidgetContent() const; + QWidget* contentWidget() const; + Flags flags() const; + + QString visibleTitle() const; + QString title() const; + void setTitle(const QString& title); + void setFlags(const Flags f); + +private: + SectionContent::RefPtr _content; +}; + +} // namespace ads +#endif diff --git a/AdvancedDockingSystem/include/ads/SectionTitleWidget.h b/AdvancedDockingSystem/src/SectionTitleWidget.h similarity index 96% rename from AdvancedDockingSystem/include/ads/SectionTitleWidget.h rename to AdvancedDockingSystem/src/SectionTitleWidget.h index c4b1f35..780bfe1 100644 --- a/AdvancedDockingSystem/include/ads/SectionTitleWidget.h +++ b/AdvancedDockingSystem/src/SectionTitleWidget.h @@ -1,78 +1,78 @@ -#ifndef SECTION_TITLE_WIDGET_H -#define SECTION_TITLE_WIDGET_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include -#include - -#include "ads/API.h" -#include "ads/SectionContent.h" - -class QPushButton; - -ADS_NAMESPACE_BEGIN -class CMainContainerWidget; -class SectionWidget; -class FloatingWidget; - -class SectionTitleWidget : public QFrame -{ - Q_OBJECT - Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged) - - friend class CMainContainerWidget; - friend class SectionWidget; - friend class CContainerWidget; - - SectionContent::RefPtr m_Content; - - // Drag & Drop (Floating) - QPoint m_DragStartMousePosition; - QPoint m_DragStartGlobalMousePosition; - QPoint m_DragStartPosition; - - // Drag & Drop (Title/Tabs) - bool m_TabMoving; - - // Property values - bool m_IsActiveTab; - -public: - SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent); - virtual ~SectionTitleWidget(); - - bool isActiveTab() const; - void setActiveTab(bool active); - -protected: - virtual void mousePressEvent(QMouseEvent* ev); - virtual void mouseReleaseEvent(QMouseEvent* ev); - virtual void mouseMoveEvent(QMouseEvent* ev); - -private: - void startFloating(QMouseEvent* ev, CMainContainerWidget* cw, SectionWidget* sectionwidget); - void moveTab(QMouseEvent* ev); - -signals: - void activeTabChanged(); - void clicked(); -}; - -ADS_NAMESPACE_END -#endif +#ifndef SECTION_TITLE_WIDGET_H +#define SECTION_TITLE_WIDGET_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include +#include + +#include "ads/API.h" +#include "ads/SectionContent.h" + +class QPushButton; + +ADS_NAMESPACE_BEGIN +class CMainContainerWidget; +class SectionWidget; +class FloatingWidget; + +class SectionTitleWidget : public QFrame +{ + Q_OBJECT + Q_PROPERTY(bool activeTab READ isActiveTab WRITE setActiveTab NOTIFY activeTabChanged) + + friend class CMainContainerWidget; + friend class SectionWidget; + friend class CContainerWidget; + + SectionContent::RefPtr m_Content; + + // Drag & Drop (Floating) + QPoint m_DragStartMousePosition; + QPoint m_DragStartGlobalMousePosition; + QPoint m_DragStartPosition; + + // Drag & Drop (Title/Tabs) + bool m_TabMoving; + + // Property values + bool m_IsActiveTab; + +public: + SectionTitleWidget(SectionContent::RefPtr content, QWidget* parent); + virtual ~SectionTitleWidget(); + + bool isActiveTab() const; + void setActiveTab(bool active); + +protected: + virtual void mousePressEvent(QMouseEvent* ev); + virtual void mouseReleaseEvent(QMouseEvent* ev); + virtual void mouseMoveEvent(QMouseEvent* ev); + +private: + void startFloating(QMouseEvent* ev, CMainContainerWidget* cw, SectionWidget* sectionwidget); + void moveTab(QMouseEvent* ev); + +signals: + void activeTabChanged(); + void clicked(); +}; + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/SectionWidget.h b/AdvancedDockingSystem/src/SectionWidget.h similarity index 96% rename from AdvancedDockingSystem/include/ads/SectionWidget.h rename to AdvancedDockingSystem/src/SectionWidget.h index 9729968..b1ade76 100644 --- a/AdvancedDockingSystem/include/ads/SectionWidget.h +++ b/AdvancedDockingSystem/src/SectionWidget.h @@ -1,129 +1,129 @@ -#ifndef SECTION_WIDGET_H -#define SECTION_WIDGET_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include -#include -#include -#include -class QBoxLayout; -class QStackedLayout; -class QPushButton; -class QMenu; - -#include "ads/API.h" -#include "ads/Internal.h" -#include "ads/SectionContent.h" -#include "ads/FloatingWidget.h" - -ADS_NAMESPACE_BEGIN -class CMainContainerWidget; -class SectionTitleWidget; -class CSectionContentWidget; - -// SectionWidget manages multiple instances of SectionContent. -// It displays a title TAB, which is clickable and will switch to -// the contents associated to the title when clicked. -class ADS_EXPORT_API SectionWidget : public QFrame -{ - Q_OBJECT - friend class CMainContainerWidget; - friend class CContainerWidget; - - explicit SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent); - -public: - virtual ~SectionWidget(); - - int uid() const; - CContainerWidget* containerWidget() const; - - QRect titleAreaGeometry() const; - QRect contentAreaGeometry() const; - - const QList& contents() const { return m_Contents; } - void addContent(const SectionContent::RefPtr& c); - void addContent(const InternalContentData& data, bool autoActivate); - bool takeContent(int uid, InternalContentData& data); - bool takeContentAt(int Index, InternalContentData& data); - int indexOfContent(const SectionContent::RefPtr& c) const; - int indexOfContentByUid(int uid) const; - int indexOfContentByTitlePos(const QPoint& pos, QWidget* exclude = NULL) const; - - int currentIndex() const; - void moveContent(int from, int to); - - virtual bool eventFilter(QObject *watched, QEvent *event); - - inline int contentCount() const {return m_ContentWidgets.size();} - -protected: - virtual void showEvent(QShowEvent*); - -public slots: - void setCurrentIndex(int index); - -private slots: - void onSectionTitleClicked(); - void onCloseButtonClicked(); - void onTabsMenuActionTriggered(bool); - void updateTabsMenu(); - - -private: - const int _uid; - QPointer m_MainContainerWidget; - QList m_Contents; - QList m_TitleWidgets; - QList m_ContentWidgets; - - QBoxLayout* _topLayout; - QScrollArea* _tabsScrollArea; - QWidget* _tabsContainerWidget; - QBoxLayout* _tabsLayout; - QPushButton* _tabsMenuButton; - QPushButton* _closeButton; - int _tabsLayoutInitCount; // used for calculations on _tabsLayout modification calls. - - QStackedLayout *_contentsLayout; - - QPoint _mousePressPoint; - SectionContent::RefPtr _mousePressContent; - SectionTitleWidget* _mousePressTitleWidget; - - static int GetNextUid(); -}; - -/* Custom scrollable implementation for tabs */ -class SectionWidgetTabsScrollArea : public QScrollArea -{ -public: - SectionWidgetTabsScrollArea(SectionWidget* sectionWidget, QWidget* parent = NULL); - virtual ~SectionWidgetTabsScrollArea(); - -protected: - QPoint _dragStartPos; - QPointer _fw; - virtual void wheelEvent(QWheelEvent*); - virtual void mousePressEvent(QMouseEvent* ev); - virtual void mouseMoveEvent(QMouseEvent* ev); -}; - -ADS_NAMESPACE_END -#endif +#ifndef SECTION_WIDGET_H +#define SECTION_WIDGET_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include +#include +#include +#include +class QBoxLayout; +class QStackedLayout; +class QPushButton; +class QMenu; + +#include "ads/API.h" +#include "ads/Internal.h" +#include "ads/SectionContent.h" +#include "ads/FloatingWidget.h" + +ADS_NAMESPACE_BEGIN +class CMainContainerWidget; +class SectionTitleWidget; +class CSectionContentWidget; + +// SectionWidget manages multiple instances of SectionContent. +// It displays a title TAB, which is clickable and will switch to +// the contents associated to the title when clicked. +class ADS_EXPORT_API SectionWidget : public QFrame +{ + Q_OBJECT + friend class CMainContainerWidget; + friend class CContainerWidget; + + explicit SectionWidget(CMainContainerWidget* MainContainer, CContainerWidget* parent); + +public: + virtual ~SectionWidget(); + + int uid() const; + CContainerWidget* containerWidget() const; + + QRect titleAreaGeometry() const; + QRect contentAreaGeometry() const; + + const QList& contents() const { return m_Contents; } + void addContent(const SectionContent::RefPtr& c); + void addContent(const InternalContentData& data, bool autoActivate); + bool takeContent(int uid, InternalContentData& data); + bool takeContentAt(int Index, InternalContentData& data); + int indexOfContent(const SectionContent::RefPtr& c) const; + int indexOfContentByUid(int uid) const; + int indexOfContentByTitlePos(const QPoint& pos, QWidget* exclude = NULL) const; + + int currentIndex() const; + void moveContent(int from, int to); + + virtual bool eventFilter(QObject *watched, QEvent *event); + + inline int contentCount() const {return m_ContentWidgets.size();} + +protected: + virtual void showEvent(QShowEvent*); + +public slots: + void setCurrentIndex(int index); + +private slots: + void onSectionTitleClicked(); + void onCloseButtonClicked(); + void onTabsMenuActionTriggered(bool); + void updateTabsMenu(); + + +private: + const int _uid; + QPointer m_MainContainerWidget; + QList m_Contents; + QList m_TitleWidgets; + QList m_ContentWidgets; + + QBoxLayout* _topLayout; + QScrollArea* _tabsScrollArea; + QWidget* _tabsContainerWidget; + QBoxLayout* _tabsLayout; + QPushButton* _tabsMenuButton; + QPushButton* _closeButton; + int _tabsLayoutInitCount; // used for calculations on _tabsLayout modification calls. + + QStackedLayout *_contentsLayout; + + QPoint _mousePressPoint; + SectionContent::RefPtr _mousePressContent; + SectionTitleWidget* _mousePressTitleWidget; + + static int GetNextUid(); +}; + +/* Custom scrollable implementation for tabs */ +class SectionWidgetTabsScrollArea : public QScrollArea +{ +public: + SectionWidgetTabsScrollArea(SectionWidget* sectionWidget, QWidget* parent = NULL); + virtual ~SectionWidgetTabsScrollArea(); + +protected: + QPoint _dragStartPos; + QPointer _fw; + virtual void wheelEvent(QWheelEvent*); + virtual void mousePressEvent(QMouseEvent* ev); + virtual void mouseMoveEvent(QMouseEvent* ev); +}; + +ADS_NAMESPACE_END +#endif diff --git a/AdvancedDockingSystem/include/ads/Serialization.h b/AdvancedDockingSystem/src/Serialization.h similarity index 96% rename from AdvancedDockingSystem/include/ads/Serialization.h rename to AdvancedDockingSystem/src/Serialization.h index 4890afb..172f022 100644 --- a/AdvancedDockingSystem/include/ads/Serialization.h +++ b/AdvancedDockingSystem/src/Serialization.h @@ -1,181 +1,181 @@ -#ifndef ADS_SERIALIZATION_H -#define ADS_SERIALIZATION_H -/******************************************************************************* -** 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 . -******************************************************************************/ -#include -#include -#include -#include -#include - -#include "ads/API.h" - -ADS_NAMESPACE_SER_BEGIN - -enum EntryType -{ - ET_Unknown = 0x00000000, - ET_Hierarchy = 0x00000001, - ET_SectionIndex = 0x00000002, - - // Begin of custom entry types (e.g. CustomType + 42) - ET_Custom = 0x0000ffff -}; - -class ADS_EXPORT_API HeaderEntity -{ -public: - static qint32 MAGIC; - static qint32 MAJOR_VERSION; - static qint32 MINOR_VERSION; - - HeaderEntity(); - qint32 magic; - qint32 majorVersion; - qint32 minorVersion; -}; -QDataStream& operator<<(QDataStream& out, const HeaderEntity& data); -QDataStream& operator>>(QDataStream& in, HeaderEntity& data); - - -class ADS_EXPORT_API OffsetsHeaderEntity -{ -public: - OffsetsHeaderEntity(); - - qint64 entriesCount; - QList entries; -}; -QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntity& data); -QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntity& data); - - -class ADS_EXPORT_API OffsetsHeaderEntryEntity -{ -public: - OffsetsHeaderEntryEntity(); - qint32 type; - qint64 offset; - qint64 contentSize; -}; -QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntryEntity& data); -QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntryEntity& data); - - -class ADS_EXPORT_API SectionEntity -{ -public: - SectionEntity(); - qint32 x; - qint32 y; - qint32 width; - qint32 height; - qint32 currentIndex; - qint32 sectionContentsCount; - QList sectionContents; -}; -QDataStream& operator<<(QDataStream& out, const SectionEntity& data); -QDataStream& operator>>(QDataStream& in, SectionEntity& data); - - -class ADS_EXPORT_API SectionContentEntity -{ -public: - SectionContentEntity(); - QString uniqueName; - bool visible; - qint32 preferredIndex; -}; -QDataStream& operator<<(QDataStream& out, const SectionContentEntity& data); -QDataStream& operator>>(QDataStream& in, SectionContentEntity& data); - - -class ADS_EXPORT_API FloatingContentEntity -{ -public: - FloatingContentEntity(); - QString uniqueName; - qint32 xpos; - qint32 ypos; - qint32 width; - qint32 height; - bool visible; -}; -QDataStream& operator<<(QDataStream& out, const FloatingContentEntity& data); -QDataStream& operator>>(QDataStream& in, FloatingContentEntity& data); - - -// Type: OffsetHeaderEntry::Hierarchy -class ADS_EXPORT_API HierarchyData -{ -public: - HierarchyData(); - QByteArray data; -}; -QDataStream& operator<<(QDataStream& out, const HierarchyData& data); -QDataStream& operator>>(QDataStream& in, HierarchyData& data); - - -// Type: OffsetHeaderEntry::SectionIndex -class ADS_EXPORT_API SectionIndexData -{ -public: - SectionIndexData(); - qint32 sectionsCount; - QList sections; -}; -QDataStream& operator<<(QDataStream& out, const SectionIndexData& data); -QDataStream& operator>>(QDataStream& in, SectionIndexData& data); - - -/*! - * \brief The InMemoryWriter class writes into a QByteArray. - */ -class ADS_EXPORT_API InMemoryWriter -{ -public: - InMemoryWriter(); - bool write(qint32 entryType, const QByteArray& data); - bool write(const SectionIndexData& data); - QByteArray toByteArray() const; - qint32 offsetsCount() const { return _offsetsHeader.entriesCount; } - -private: - QBuffer _contentBuffer; - OffsetsHeaderEntity _offsetsHeader; -}; - -/*! - * \brief The InMemoryReader class - */ -class ADS_EXPORT_API InMemoryReader -{ -public: - InMemoryReader(const QByteArray& data); - bool initReadHeader(); - bool read(qint32 entryType, QByteArray &data); - bool read(SectionIndexData& sid); - qint32 offsetsCount() const { return _offsetsHeader.entriesCount; } - -private: - QByteArray _data; - OffsetsHeaderEntity _offsetsHeader; -}; - -ADS_NAMESPACE_SER_END -#endif +#ifndef ADS_SERIALIZATION_H +#define ADS_SERIALIZATION_H +/******************************************************************************* +** 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 . +******************************************************************************/ +#include +#include +#include +#include +#include + +#include "ads/API.h" + +ADS_NAMESPACE_SER_BEGIN + +enum EntryType +{ + ET_Unknown = 0x00000000, + ET_Hierarchy = 0x00000001, + ET_SectionIndex = 0x00000002, + + // Begin of custom entry types (e.g. CustomType + 42) + ET_Custom = 0x0000ffff +}; + +class ADS_EXPORT_API HeaderEntity +{ +public: + static qint32 MAGIC; + static qint32 MAJOR_VERSION; + static qint32 MINOR_VERSION; + + HeaderEntity(); + qint32 magic; + qint32 majorVersion; + qint32 minorVersion; +}; +QDataStream& operator<<(QDataStream& out, const HeaderEntity& data); +QDataStream& operator>>(QDataStream& in, HeaderEntity& data); + + +class ADS_EXPORT_API OffsetsHeaderEntity +{ +public: + OffsetsHeaderEntity(); + + qint64 entriesCount; + QList entries; +}; +QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntity& data); +QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntity& data); + + +class ADS_EXPORT_API OffsetsHeaderEntryEntity +{ +public: + OffsetsHeaderEntryEntity(); + qint32 type; + qint64 offset; + qint64 contentSize; +}; +QDataStream& operator<<(QDataStream& out, const OffsetsHeaderEntryEntity& data); +QDataStream& operator>>(QDataStream& in, OffsetsHeaderEntryEntity& data); + + +class ADS_EXPORT_API SectionEntity +{ +public: + SectionEntity(); + qint32 x; + qint32 y; + qint32 width; + qint32 height; + qint32 currentIndex; + qint32 sectionContentsCount; + QList sectionContents; +}; +QDataStream& operator<<(QDataStream& out, const SectionEntity& data); +QDataStream& operator>>(QDataStream& in, SectionEntity& data); + + +class ADS_EXPORT_API SectionContentEntity +{ +public: + SectionContentEntity(); + QString uniqueName; + bool visible; + qint32 preferredIndex; +}; +QDataStream& operator<<(QDataStream& out, const SectionContentEntity& data); +QDataStream& operator>>(QDataStream& in, SectionContentEntity& data); + + +class ADS_EXPORT_API FloatingContentEntity +{ +public: + FloatingContentEntity(); + QString uniqueName; + qint32 xpos; + qint32 ypos; + qint32 width; + qint32 height; + bool visible; +}; +QDataStream& operator<<(QDataStream& out, const FloatingContentEntity& data); +QDataStream& operator>>(QDataStream& in, FloatingContentEntity& data); + + +// Type: OffsetHeaderEntry::Hierarchy +class ADS_EXPORT_API HierarchyData +{ +public: + HierarchyData(); + QByteArray data; +}; +QDataStream& operator<<(QDataStream& out, const HierarchyData& data); +QDataStream& operator>>(QDataStream& in, HierarchyData& data); + + +// Type: OffsetHeaderEntry::SectionIndex +class ADS_EXPORT_API SectionIndexData +{ +public: + SectionIndexData(); + qint32 sectionsCount; + QList sections; +}; +QDataStream& operator<<(QDataStream& out, const SectionIndexData& data); +QDataStream& operator>>(QDataStream& in, SectionIndexData& data); + + +/*! + * \brief The InMemoryWriter class writes into a QByteArray. + */ +class ADS_EXPORT_API InMemoryWriter +{ +public: + InMemoryWriter(); + bool write(qint32 entryType, const QByteArray& data); + bool write(const SectionIndexData& data); + QByteArray toByteArray() const; + qint32 offsetsCount() const { return _offsetsHeader.entriesCount; } + +private: + QBuffer _contentBuffer; + OffsetsHeaderEntity _offsetsHeader; +}; + +/*! + * \brief The InMemoryReader class + */ +class ADS_EXPORT_API InMemoryReader +{ +public: + InMemoryReader(const QByteArray& data); + bool initReadHeader(); + bool read(qint32 entryType, QByteArray &data); + bool read(SectionIndexData& sid); + qint32 offsetsCount() const { return _offsetsHeader.entriesCount; } + +private: + QByteArray _data; + OffsetsHeaderEntity _offsetsHeader; +}; + +ADS_NAMESPACE_SER_END +#endif