NDEVR
API Documentation
FloatingWidget.h
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: FloatingWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <QFrame>
35class QVBoxLayout;
36
37#include <NDEVR/RibbonArea.h>
38namespace NDEVR
39{
41 class InternalContentData;
42 class SectionContent;
43 class SectionTab;
49 class NDEVR_WIDGETS_API FloatingWidget : public QWidget
50 {
51 Q_OBJECT
52 friend class ContainerWidgetBase;
53 public:
62 FloatingWidget(ContainerWidgetBase* container, SectionContent* data, bool is_fullscreen, bool request_margins, QWidget* parent = nullptr);
63 virtual ~FloatingWidget();
68 SectionContent* content() const { return m_content; }
73 void setRibbonArea(RibbonArea drop_area);
78 void setRoundedCorners(int radius);
83 bool isDockedFullscreen() const;
88 void setDockedFullscreen(bool is_fullscreen);
93 QPoint getDragLocation() const;
109 SectionTab* titleWidget() { return m_title_widget; }
114 virtual QSize sizeHint() const override;
115 private slots:
117 void onCloseButtonClicked();
119 void updateTitleShownSlot();
120 protected:
122 virtual void paintEvent(QPaintEvent* e) override;
124 virtual bool event(QEvent* event) override;
126 virtual void showEvent(QShowEvent* event) override;
128 virtual void hideEvent(QHideEvent* event) override;
129#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
130 bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result) override;
131#else
132 bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
133#endif
134 private:
135 QVBoxLayout* m_main_layout;
136 RibbonArea m_ribbon_area;
137 ContainerWidgetBase* m_container;
138 SectionContent* m_content;
139 SectionTab* m_title_widget;
140 QWidget* m_content_widget;
141 QWidget* m_margin_widget = nullptr;
142 bool m_is_docked_full = false;
143 int m_corner_radius = 0;
144 };
145}
The root class that manages a series of SectionContent that can share the same space or lay out in va...
virtual void showEvent(QShowEvent *event) override
Handles the show event to update the widget state.
QPoint getDragLocation() const
Returns the current drag location of this floating widget.
bool isDockedFullscreen() const
Returns whether this widget is docked in fullscreen mode.
SectionContent * content() const
Returns the section content displayed in this floating widget.
void setContent(SectionContent *data)
Sets the section content displayed in this floating widget.
SectionTab * titleWidget()
Returns the title widget (tab) for this floating widget.
virtual void paintEvent(QPaintEvent *e) override
Paints the widget, including rounded corners if configured.
FloatingWidget(ContainerWidgetBase *container, SectionContent *data, bool is_fullscreen, bool request_margins, QWidget *parent=nullptr)
Constructs a FloatingWidget.
void setDockedFullscreen(bool is_fullscreen)
Sets whether this widget should be docked fullscreen.
virtual QSize sizeHint() const override
Returns the recommended size for this floating widget.
bool takeContent(SectionContent *data)
Takes ownership of the given section content, removing it from its previous owner.
virtual void hideEvent(QHideEvent *event) override
Handles the hide event to update the widget state.
virtual bool event(QEvent *event) override
Handles events including mouse interaction for dragging.
void setRoundedCorners(int radius)
Sets the corner rounding radius for the widget border.
void setRibbonArea(RibbonArea drop_area)
Sets the ribbon area where this widget should dock when dropped.
The core container for objects using the NDEVR API Widget Docking system.
Provides a tab that is used for either a tab if the section content is attached to a Container,...
Definition SectionTab.h:48
The primary namespace for the NDEVR SDK.
RibbonArea
Requests a ribbon or tab area to be in a certain location and orientation relative to another widget.
Definition RibbonArea.h:71