API Documentation
Loading...
Searching...
No Matches
ContainerWidget.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Widgets
28File: ContainerWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/RibbonArea.h>
35#include <NDEVR/QCustomStackedWidget.h>
36#include <NDEVR/Dictionary.h>
37#include <NDEVR/UUID.h>
38#include <QPointer>
39class QPoint;
40class QSplitter;
41class QMenu;
42class QBoxLayout;
43class QGridLayout;
44
45namespace NDEVR
46{
47 class SectionWidget;
48 class DropOverlay;
49 class InternalContentData;
50 class QCustomSplitter;
51 class FloatingWidget;
52 class SectionContent;
53 class SharedSectionContentArea;
54 /**--------------------------------------------------------------------------------------------------
55 \brief The root class that manages a series of SectionContent that can share the same space or lay out
56 in various patterns including as floating windows used within NDEVR API Widget Docking system.
57 While the NDEVR API Widget Docking system allows widgets to be floating, they must still subrscribe
58 to a ContainerWidgetBase which acts as a parent window and, if necessary, causes the widget
59 to rejoin the Container. When asked for being displayed full-screen, the widget will take over
60 the complete space of the ContainerWidgetBase.
61 A ContainerWidgetBase inherits from QCustomStackedWidgetBase which which is only used when a
62 widget wants to go fullscreen. Othewise it is always on index 0 which contains the section content
63 in the specified layout.
64 **/
66 {
67 Q_OBJECT
68 friend class SectionContent;
69 friend class SectionWidget;
70 friend class FloatingWidget;
71 friend class SectionTab;
72 friend class DockItem;
73 friend class QCustomDockWidget;
74 friend class CustomDockButton;
75 friend class MainWindow;
76 public:
77 explicit ContainerWidgetBase(QWidget *parent = nullptr);
79 protected:
80 virtual SectionWidget* addSectionContent(SectionContent* sc, SectionWidget* sw, DropArea area = e_drop_center);
87 void resizeEvent(QResizeEvent* event) override;
92 void setTabLock(bool tab_lock);
97 void swapSectionContent(SectionContent* section_a, SectionContent* section_b);
99 QRect outerTopDropRect() const;
100 QRect outerRightDropRect() const;
101 QRect outerBottomDropRect() const;
102 QRect outerLeftDropRect() const;
103 QSize sizeHint() const override;
105 virtual void setShouldAnimateAdd(bool animate);
108 protected:
109 QSize minimumSizeHint() const override;
110 bool event(QEvent* event) override;
111 private:
112 SharedSectionContentArea* createSection(Qt::Orientation orientation, QWidget* parent);
113 void exitCurrentFullscreen();
114 void pullFromFullScreenStack(FloatingWidget* widget);
115 SharedSectionContentArea* findParentSplitter(const QWidget* w, QWidget** parent_widget = nullptr);
116 void pullContent(SectionWidget* sw, SectionContent* data);
117 SectionWidget* dropContent(SectionContent* data, SectionWidget* targetSection, DropArea area);
118 void addSection(SectionWidget* section);
119 SectionWidget* sectionAt(const QPoint& pos) const;
120 SectionWidget* dropContentOuterHelper(QLayout* l, SectionContent* data, Qt::Orientation orientation, bool append);
121 bool splitterContainsSectionWidget(SharedSectionContentArea* splitter);
122 void deleteEmptySplitters();
123 void pushCurrentToFullscreenStack();
124 protected:
127 SharedSectionContentArea* m_top_splitter = nullptr;
129 SectionWidget* m_top_section_widget = nullptr;
134 bool m_animate_add = true;
135 bool m_reset_is_on_home = false;
136 };
137 /**--------------------------------------------------------------------------------------------------
138 \brief manages a series of SectionContent that can share the same space or lay out in various patterns
139 including as floating windows used within NDEVR API Widget Docking system.
140 While the NDEVR API Widget Docking system allows widgets to be floating, they must still subrscribe
141 to a ContainerWidgetBase which acts as a parent window and, if necessary, causes the widget
142 to rejoin the Container. When asked for being displayed full-screen, the widget will take over
143 the complete space of the ContainerWidgetBase.
144 A ContainerWidgetBase inherits from QCustomStackedWidgetBase which which is only used when a
145 widget wants to go fullscreen. Othewise it is always on index 0 which contains the section content
146 in the specified layout.
147 **/
149 {
150 public:
151 ContainerWidget(QWidget* parent = nullptr)
152 : ContainerWidgetBase(parent)
153 {}
155 {
156 ContainerWidgetBase::clearAllSectionContent();
157 };
158 void setShouldAnimateAdd(bool animate) override
159 {
160 ContainerWidgetBase::setShouldAnimateAdd(animate);
161 }
162 void setTabLock(bool tab_lock)
163 {
164 ContainerWidgetBase::setTabLock(tab_lock);
165 }
166 };
167}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:59
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:56
The root class that manages a series of SectionContent that can share the same space or lay out in va...
Definition ContainerWidget.h:66
Buffer< std::pair< QPointer< QWidget >, Buffer< QPointer< FloatingWidget > > > > m_fullscreen_stack
Definition ContainerWidget.h:131
bool isSectionContentVisible(SectionContent *sc)
QSize minimumSizeHint() const override
virtual void clearAllNonFloatingContent()
bool hasSectionContent(SectionContent *sc)
void setTabLock(bool tab_lock)
DropOverlay * dropOverlay()
QSize sizeHint() const override
FloatingWidget * makeFloating(SectionContent *sc, bool show, PopupInfo start=PopupInfo(), PopupInfo end=PopupInfo())
QRect outerTopDropRect() const
Buffer< std::pair< QPointer< QWidget >, Buffer< QPointer< FloatingWidget > > > > m_reset_fullscreen_stack
Definition ContainerWidget.h:132
virtual FloatingWidget * addSectionContent(SectionContent *sc)
QRect outerLeftDropRect() const
void removeFromResetShow(UUID id)
bool raiseSectionContent(SectionContent *sc)
bool event(QEvent *event) override
bool hideSectionContent(SectionContent *sc, PopupInfo end=PopupInfo())
Buffer< SharedSectionContentArea * > m_shared_content
Definition ContainerWidget.h:130
void swapSectionContent(SectionContent *section_a, SectionContent *section_b)
Buffer< UUID > m_reset_visible_sections
Definition ContainerWidget.h:133
Buffer< SectionContent * > contents() const
FloatingWidget * makeFullScreen(SectionContent *sc, PopupInfo start=PopupInfo())
virtual SectionWidget * addSectionContent(SectionContent *sc, SectionWidget *sw, DropArea area=e_drop_center)
Dictionary< UUID, SectionWidget * > m_sections
Definition ContainerWidget.h:125
DropOverlay * m_drop_overlay
Definition ContainerWidget.h:128
void resizeEvent(QResizeEvent *event) override
bool showSectionContent(SectionContent *sc, PopupInfo start=PopupInfo(), PopupInfo end=PopupInfo())
virtual void clearAllSectionContent()
Dictionary< UUID, SectionContent * > m_section_content
Definition ContainerWidget.h:126
QRect outerRightDropRect() const
virtual void setShouldAnimateAdd(bool animate)
QRect outerBottomDropRect() const
ContainerWidgetBase(QWidget *parent=nullptr)
bool removeSectionContent(SectionContent *sc)
manages a series of SectionContent that can share the same space or lay out in various patterns inclu...
Definition ContainerWidget.h:149
void clearAllSectionContent() override
Definition ContainerWidget.h:154
void setTabLock(bool tab_lock)
Definition ContainerWidget.h:162
void setShouldAnimateAdd(bool animate) override
Definition ContainerWidget.h:158
ContainerWidget(QWidget *parent=nullptr)
Definition ContainerWidget.h:151
A DockItem that represents a button. These can be placed on the Docking widget to add functionality....
Definition CustomDockButton.h:55
A hash-based key-value store, useful for quick associative lookups. Key features include:
Definition Dictionary.h:61
The root class that allows iterface with the NDEVR API Widget Docking system.
Definition DockItem.h:54
Paints a translucent rectangle over another widget. The geometry of the rectangle is based on the mou...
Definition DropOverlay.h:46
Used with the NDEVR API Widget Docking system for widgets that are floating. These widgets appear as ...
Definition FloatingWidget.h:49
Provides a wrapper for a widget that can be docked inside a Container or floated as a top-level windo...
Definition QCustomDockWidget.h:61
A base class for a series of widgets where all widgets occupy the same same and only one widget is sh...
Definition QCustomStackedWidget.h:50
The core container for objects using the NDEVR API Widget Docking system. Contains information used t...
Definition SectionContent.h:51
Provides a tab that is used for either a tab if the section content is attached to a Container,...
Definition SectionTab.h:48
SectionWidget manages multiple instances of SectionContent. It displays a title TAB,...
Definition SectionWidget.h:55
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:60
Definition ACIColor.h:37
DropArea
relates where a widget should be dropped relative to another.
Definition RibbonArea.h:46
Class which is used to pass arguments and requests for creating a popup dialog or widget....
Definition PopupInfo.h:15