API Documentation
Loading...
Searching...
No Matches
QCustomDockWidget.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: QCustomDockWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/UUID.h>
35#include <NDEVR/Buffer.h>
36#include <NDEVR/DockItem.h>
37#include <NDEVR/ContainerWidget.h>
38#include <NDEVR/PopupInfo.h>
39#include <QFrame>
40#include <QPointer>
41class QIcon;
42class QString;
43class QLabel;
44
45
46namespace NDEVR
47{
48 enum DropArea;
49 enum class RibbonArea;
50 class ContainerWidgetBase;
51 class SectionWidget;
52 class SectionContent;
53 class SectionIconTab;
54 class FloatingWidget;
55 class Button;
57 {
58 Q_OBJECT
59 public:
60 explicit QCustomDockWidget(RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr);
61 explicit QCustomDockWidget(QWidget* main_widget, RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr);
62 explicit QCustomDockWidget(QWidget* main_widget, ContainerWidgetBase* container = nullptr);
63 virtual ~QCustomDockWidget();
64 void setMainWidget(QWidget* widget);
65 QWidget* mainWidget() { return m_main_widget; }
66 QString windowTitle() const;
67 void setSize(QSize size);
68 SectionContent* content() const { return m_section_content; }
69 void showDock(bool show_dock);
70 void removeDock(bool delete_when_finished);
71 bool isVisible() const;
72 void setupButton(Button* button);
73 void showDockFullscreen(bool show_dock, const PopupInfo& start_location = PopupInfo());
74 void showDock(bool show_dock, DropArea area, SectionWidget* section);
75 void showDock(bool show_dock, const PopupInfo& start_location, SectionWidget* section = nullptr);
76 void showDock(bool show_dock, const PopupInfo& start_location, const PopupInfo& end_location, SectionWidget* section = nullptr);
77 QSize sizeHint() const;
78 void setSizeHint(const QSize& size);
79 bool isDockFullscreen() const;
80 virtual void setDockSelected(bool selected) override;
81 virtual void setIcon(const QIcon& icon) override;
82 QIcon icon() const;
83 virtual void setTitle(const TranslatedString& title) override;
84 virtual void setupDialogButton(Button* button);
85 virtual void removeButton(Button* button);
86 void setWindowFlags(Qt::WindowFlags type);
87 void setWindowFlag(Qt::WindowType type, bool on = true);
88 int width() const;
89 int height() const;
90 void setVisible(bool visible);
91 void setAllowAutoHideTitle(bool allow_auto_hide);
92 public slots:
93 void highlightDock(bool highlight);
94 void setIconSlot(const QIcon& icon);
95 void setTitleSlot(const QString& title);
96 signals:
99 void fullscreenSignal(bool is_fullscreen);
101 void windowTitleChanged(const TranslatedString& new_title);
102 void windowIconChanged(const QIcon& icon);
103 protected slots:
104 void onFullscreenButtonClicked(bool fullscreen);
105 void onCloseButtonClicked();
106 protected:
107 virtual void createSectionContent() override;
108 protected:
109 QPointer<QWidget> m_main_widget;
113 };
114
115 template<class t_type>
117 {
118 public:
120 : QCustomDockWidget(new t_type(), container)
121 {}
122 DockWidget(t_type* child, ContainerWidgetBase* container = nullptr)
124 {}
125 DockWidget(t_type* child, RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr)
126 : QCustomDockWidget(child, ribbon_area, container)
127 {}
128 t_type& widget() const
129 {
130 return *dynamic_cast<t_type*>(m_main_widget.data());
131 }
132 };
133}
#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 Button.h:60
Definition ContainerWidget.h:85
Definition DockItem.h:51
ContainerWidgetBase * container() const
Definition DockItem.cpp:154
Definition QCustomDockWidget.h:117
DockWidget(t_type *child, RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
Definition QCustomDockWidget.h:125
t_type & widget() const
Definition QCustomDockWidget.h:128
DockWidget(ContainerWidgetBase *container=nullptr)
Definition QCustomDockWidget.h:119
DockWidget(t_type *child, ContainerWidgetBase *container=nullptr)
Definition QCustomDockWidget.h:122
Definition QCustomDockWidget.h:57
QWidget * mainWidget()
Definition QCustomDockWidget.h:65
QSize m_size_hint
Definition QCustomDockWidget.h:112
void windowIconChanged(const QIcon &icon)
QPointer< QWidget > m_main_widget
Definition QCustomDockWidget.h:109
bool m_highlight_dock
Definition QCustomDockWidget.h:111
SectionContent * content() const
Definition QCustomDockWidget.h:68
void fullscreenSignal(bool is_fullscreen)
void windowTitleChanged(const TranslatedString &new_title)
Buffer< Button * > m_buttons_to_add
Definition QCustomDockWidget.h:110
Definition SectionContent.h:47
Definition SectionWidget.h:55
Definition TranslatedString.h:9
Definition ACIColor.h:37
RibbonArea
Definition RibbonArea.h:68
DropArea
Definition RibbonArea.h:47
Definition PopupInfo.h:10