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
54 class SharedSectionContentArea : public QWidget
55 {
56 Q_OBJECT
57 public:
58 explicit SharedSectionContentArea(Qt::Orientation orientation, QWidget* parent = nullptr);
59 void addWidgets(QWidget* a, QWidget* b);
60 void insertWidget(int index, QWidget* child);
61 void addWidget(QWidget* child);
62 void initSplitter();
63 QWidget* replaceWidget(int index, QWidget* child);
64 int count() const;
65 int indexOf(QWidget* child) const;
66 void setOrientation(Qt::Orientation orientation);
67 QWidget* widget(int index);
68 void setAnimating(bool animating);
69 Qt::Orientation orientation() const;
70 bool isHorizontal() const;
71 void refreshSizes();
73 void initLayout();
74 QSize sizeHint() const;
75 protected slots:
76 void updateLayout();
77 protected:
79 QBoxLayout* m_box_layout = nullptr;
80 Qt::Orientation m_orientation;
81 bool m_is_animating = false;
82 };
83
85 {
86 Q_OBJECT
87
88 friend class SectionContent;
89 friend class SectionWidget;
90 friend class FloatingWidget;
91 friend class SectionTab;
92 friend class DockItem;
93 friend class QCustomDockWidget;
94 friend class CustomDockButton;
95 friend class MainWindow;
96 public:
97 explicit ContainerWidgetBase(QWidget *parent = nullptr);
98 virtual ~ContainerWidgetBase();
99 protected:
100 virtual SectionWidget* addSectionContent(SectionContent* sc, SectionWidget* sw, DropArea area = e_drop_center);
101 virtual FloatingWidget* addSectionContent(SectionContent* sc);
102 FloatingWidget* makeFloating(SectionContent* sc, bool show, PopupInfo start = PopupInfo(), PopupInfo end = PopupInfo());
103 FloatingWidget* makeFullScreen(SectionContent* sc, PopupInfo start = PopupInfo());
104 bool popWindowStack();
105 bool hasSectionContent(SectionContent* sc);
106 bool removeSectionContent(SectionContent* sc);
107 void resizeEvent(QResizeEvent* event) override;
108 bool showSectionContent(SectionContent* sc, PopupInfo start = PopupInfo(), PopupInfo end = PopupInfo());
109 bool hideSectionContent(SectionContent* sc, PopupInfo end = PopupInfo());
110 bool raiseSectionContent(SectionContent* sc);
111 void bringFloatingWidgetsForward();
112 void setTabLock(bool tab_lock);
113 void beginResetAll();
114 void removeFromResetShow(UUID id);
115 void endResetAll();
116 bool isSectionContentVisible(SectionContent* sc);
117 void swapSectionContent(SectionContent* section_a, SectionContent* section_b);
118 Buffer<SectionContent*> contents() const;
119 QRect outerTopDropRect() const;
120 QRect outerRightDropRect() const;
121 QRect outerBottomDropRect() const;
122 QRect outerLeftDropRect() const;
123 QSize sizeHint() const override;
124 QSize minimumSizeHint() const override;
125 DropOverlay* dropOverlay();
126 virtual void setShouldAnimateAdd(bool animate);
127 virtual void clearAllSectionContent();
128 virtual void clearAllNonFloatingContent();
129 bool event(QEvent* event) override;
130 private:
131 SharedSectionContentArea* createSection(Qt::Orientation orientation, QWidget* parent);
132 void exitCurrentFullscreen();
133 void pullFromFullScreenStack(FloatingWidget* widget);
134 SharedSectionContentArea* findParentSplitter(const QWidget* w, QWidget** parent_widget = nullptr);
135 void pullContent(SectionWidget* sw, SectionContent* data);
136 SectionWidget* dropContent(SectionContent* data, SectionWidget* targetSection, DropArea area);
137 void addSection(SectionWidget* section);
138 SectionWidget* sectionAt(const QPoint& pos) const;
139 SectionWidget* dropContentOuterHelper(QLayout* l, SectionContent* data, Qt::Orientation orientation, bool append);
140 bool splitterContainsSectionWidget(SharedSectionContentArea* splitter);
141 void deleteEmptySplitters();
142 void pushCurrentToFullscreenStack();
143 protected:
146 SharedSectionContentArea* m_top_splitter = nullptr;
148 SectionWidget* m_top_section_widget = nullptr;
153 bool m_animate_add = true;
154 bool m_reset_is_on_home = false;
155 };
157 {
158 public:
159 ContainerWidget(QWidget* parent = nullptr)
160 : ContainerWidgetBase(parent)
161 {}
163 {
164 ContainerWidgetBase::clearAllSectionContent();
165 };
166 void setShouldAnimateAdd(bool animate) override
167 {
168 ContainerWidgetBase::setShouldAnimateAdd(animate);
169 }
170 void setTabLock(bool tab_lock)
171 {
172 ContainerWidgetBase::setTabLock(tab_lock);
173 }
174 };
175}
#define NDEVR_WIDGETS_API
Definition DLLInfo.h:81
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:64
Definition ContainerWidget.h:85
Buffer< std::pair< QPointer< QWidget >, Buffer< QPointer< FloatingWidget > > > > m_fullscreen_stack
Definition ContainerWidget.h:150
Buffer< std::pair< QPointer< QWidget >, Buffer< QPointer< FloatingWidget > > > > m_reset_fullscreen_stack
Definition ContainerWidget.h:151
Buffer< SharedSectionContentArea * > m_shared_content
Definition ContainerWidget.h:149
Buffer< UUID > m_reset_visible_sections
Definition ContainerWidget.h:152
Dictionary< UUID, SectionWidget * > m_sections
Definition ContainerWidget.h:144
DropOverlay * m_drop_overlay
Definition ContainerWidget.h:147
Dictionary< UUID, SectionContent * > m_section_content
Definition ContainerWidget.h:145
Definition ContainerWidget.h:157
void clearAllSectionContent() override
Definition ContainerWidget.h:162
void setTabLock(bool tab_lock)
Definition ContainerWidget.h:170
void setShouldAnimateAdd(bool animate) override
Definition ContainerWidget.h:166
ContainerWidget(QWidget *parent=nullptr)
Definition ContainerWidget.h:159
Definition CustomDockButton.h:52
Definition Dictionary.h:48
Definition DockItem.h:51
Definition DropOverlay.h:46
Definition FloatingWidget.h:45
Definition QCustomDockWidget.h:57
Definition QCustomSplitter.h:40
Definition QCustomStackedWidget.h:45
Definition SectionContent.h:47
Definition SectionTab.h:44
Definition SectionWidget.h:55
Definition ContainerWidget.h:55
int count() const
Definition ContainerWidget.cpp:121
QWidget * widget(int index)
Definition ContainerWidget.cpp:226
void updateLayout()
Definition ContainerWidget.cpp:169
Qt::Orientation m_orientation
Definition ContainerWidget.h:80
bool isHorizontal() const
Definition ContainerWidget.cpp:253
void initLayout()
Definition ContainerWidget.cpp:277
void addWidgets(QWidget *a, QWidget *b)
Definition ContainerWidget.cpp:33
QWidget * replaceWidget(int index, QWidget *child)
Definition ContainerWidget.cpp:97
int indexOf(QWidget *child) const
Definition ContainerWidget.cpp:140
QBoxLayout * m_box_layout
Definition ContainerWidget.h:79
void insertWidget(int index, QWidget *child)
Definition ContainerWidget.cpp:46
QCustomSplitter * splitter() const
Definition ContainerWidget.cpp:272
SharedSectionContentArea(Qt::Orientation orientation, QWidget *parent=nullptr)
Definition ContainerWidget.cpp:24
bool m_is_animating
Definition ContainerWidget.h:81
void refreshSizes()
Definition ContainerWidget.cpp:258
QSize sizeHint() const
Definition ContainerWidget.cpp:289
QCustomSplitter * m_splitter
Definition ContainerWidget.h:78
void setOrientation(Qt::Orientation orientation)
Definition ContainerWidget.cpp:158
void addWidget(QWidget *child)
Definition ContainerWidget.cpp:62
void setAnimating(bool animating)
Definition ContainerWidget.cpp:241
void initSplitter()
Definition ContainerWidget.cpp:77
Qt::Orientation orientation() const
Definition ContainerWidget.cpp:248
Definition UUID.h:66
Definition ACIColor.h:37
DropArea
Definition RibbonArea.h:47
Definition PopupInfo.h:10