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;
56 /**--------------------------------------------------------------------------------------------------
57 \brief Provides a wrapper for a widget that can be docked inside a Container or floated as a
58 top-level window within the application.
59 **/
61 {
62 Q_OBJECT
63 public:
64 explicit QCustomDockWidget(RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr);
65 explicit QCustomDockWidget(QWidget* main_widget, RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr);
66 explicit QCustomDockWidget(QWidget* main_widget, ContainerWidgetBase* container = nullptr);
68 void setMainWidget(QWidget* widget);
69 QWidget* mainWidget() { return m_main_widget; }
70 QString windowTitle() const;
71 void setSize(QSize size);
72 SectionContent* content() const { return m_section_content; }
73 void showDock(bool show_dock);
74 void removeDock(bool delete_when_finished);
75 bool isVisible() const;
76 void setupButton(Button* button);
77 void showDockFullscreen(bool show_dock, const PopupInfo& start_location = PopupInfo());
78 void showDock(bool show_dock, DropArea area, SectionWidget* section);
79 void showDock(bool show_dock, const PopupInfo& start_location, SectionWidget* section = nullptr);
80 void showDock(bool show_dock, const PopupInfo& start_location, const PopupInfo& end_location, SectionWidget* section = nullptr);
81 QSize sizeHint() const;
82 void setSizeHint(const QSize& size);
83 bool isDockFullscreen() const;
84 virtual void setDockSelected(bool selected) override;
85 virtual void setIcon(const QIcon& icon) override;
86 QIcon icon() const;
87 virtual void setTitle(const TranslatedString& title) override;
88 virtual void setupDialogButton(Button* button);
89 virtual void removeButton(Button* button);
90 void setWindowFlags(Qt::WindowFlags type);
91 void setWindowFlag(Qt::WindowType type, bool on = true);
92 int width() const;
93 int height() const;
94 void setVisible(bool visible);
95 void setAllowAutoHideTitle(bool allow_auto_hide);
96 public slots:
97 void highlightDock(bool highlight);
98 void setIconSlot(const QIcon& icon);
99 void setTitleSlot(const QString& title);
100 signals:
103 void fullscreenSignal(bool is_fullscreen);
105 void windowTitleChanged(const TranslatedString& new_title);
106 void windowIconChanged(const QIcon& icon);
107 protected slots:
108 void onFullscreenButtonClicked(bool fullscreen);
110 protected:
111 virtual void createSectionContent() override;
112 protected:
113 QPointer<QWidget> m_main_widget;
117 };
118
119 template<class t_type>
121 {
122 public:
124 : QCustomDockWidget(new t_type(), container)
125 {}
126 DockWidget(t_type* child, ContainerWidgetBase* container = nullptr)
128 {}
129 DockWidget(t_type* child, RibbonArea ribbon_area, ContainerWidgetBase* container = nullptr)
130 : QCustomDockWidget(child, ribbon_area, container)
131 {}
132 t_type& widget() const
133 {
134 return *dynamic_cast<t_type*>(m_main_widget.data());
135 }
136 };
137}
#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
A core widget that allows the user to click one of many button types.
Definition Button.h:66
The root class that manages a series of SectionContent that can share the same space or lay out in va...
Definition ContainerWidget.h:66
The root class that allows iterface with the NDEVR API Widget Docking system.
Definition DockItem.h:54
ContainerWidgetBase * container() const
Definition QCustomDockWidget.h:121
DockWidget(t_type *child, RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
Definition QCustomDockWidget.h:129
t_type & widget() const
Definition QCustomDockWidget.h:132
DockWidget(ContainerWidgetBase *container=nullptr)
Definition QCustomDockWidget.h:123
DockWidget(t_type *child, ContainerWidgetBase *container=nullptr)
Definition QCustomDockWidget.h:126
Provides a wrapper for a widget that can be docked inside a Container or floated as a top-level windo...
Definition QCustomDockWidget.h:61
void setIconSlot(const QIcon &icon)
QCustomDockWidget(QWidget *main_widget, ContainerWidgetBase *container=nullptr)
virtual void removeButton(Button *button)
void showDock(bool show_dock, const PopupInfo &start_location, const PopupInfo &end_location, SectionWidget *section=nullptr)
void setVisible(bool visible)
void onFullscreenButtonClicked(bool fullscreen)
void highlightDock(bool highlight)
bool isDockFullscreen() const
QWidget * mainWidget()
Definition QCustomDockWidget.h:69
virtual void createSectionContent() override
QSize m_size_hint
Definition QCustomDockWidget.h:116
void setWindowFlags(Qt::WindowFlags type)
void windowIconChanged(const QIcon &icon)
virtual void setupDialogButton(Button *button)
QPointer< QWidget > m_main_widget
Definition QCustomDockWidget.h:113
void showDockFullscreen(bool show_dock, const PopupInfo &start_location=PopupInfo())
void setMainWidget(QWidget *widget)
QCustomDockWidget(RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
void setWindowFlag(Qt::WindowType type, bool on=true)
void setSizeHint(const QSize &size)
bool m_highlight_dock
Definition QCustomDockWidget.h:115
virtual void setTitle(const TranslatedString &title) override
void setSize(QSize size)
virtual void setIcon(const QIcon &icon) override
virtual void setDockSelected(bool selected) override
void showDock(bool show_dock)
void showDock(bool show_dock, DropArea area, SectionWidget *section)
void setAllowAutoHideTitle(bool allow_auto_hide)
void setupButton(Button *button)
SectionContent * content() const
Definition QCustomDockWidget.h:72
void showDock(bool show_dock, const PopupInfo &start_location, SectionWidget *section=nullptr)
QString windowTitle() const
void fullscreenSignal(bool is_fullscreen)
QCustomDockWidget(QWidget *main_widget, RibbonArea ribbon_area, ContainerWidgetBase *container=nullptr)
void setTitleSlot(const QString &title)
void windowTitleChanged(const TranslatedString &new_title)
void removeDock(bool delete_when_finished)
Buffer< Button * > m_buttons_to_add
Definition QCustomDockWidget.h:114
The core container for objects using the NDEVR API Widget Docking system. Contains information used t...
Definition SectionContent.h:51
SectionWidget manages multiple instances of SectionContent. It displays a title TAB,...
Definition SectionWidget.h:55
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Definition ACIColor.h:37
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71
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