API Documentation
Loading...
Searching...
No Matches
DropOverlay.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: DropOverlay
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33class QGridLayout;
34
35#include <NDEVR/RibbonArea.h>
36#include <QFrame>
37namespace NDEVR
38{
39 class DropOverlayCross;
40 /**--------------------------------------------------------------------------------------------------
41 \brief Paints a translucent rectangle over another widget. The geometry of the rectangle is based
42 on the mouse location. Used with the NDEVR API Widget Docking system to show where a dock
43 can be placed.
44 **/
45 class DropOverlay : public QFrame
46 {
47 Q_OBJECT
48 friend class DropOverlayCross;
49 public:
50 DropOverlay(QWidget* parent);
51 virtual ~DropOverlay();
52 void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
54 DropArea showDropOverlay(QWidget* target, QWidget* payload);
55 void showDropOverlay(QWidget* target, const QRect& targetAreaRect);
57 protected:
58 virtual void paintEvent(QPaintEvent* e) override;
59 virtual void showEvent(QShowEvent* e) override;
60 virtual void hideEvent(QHideEvent* e) override;
61 virtual void resizeEvent(QResizeEvent* e) override;
62 virtual void moveEvent(QMoveEvent* e) override;
63 private:
64 DropOverlayCross* _cross;
65 QWidget* m_payload = nullptr;
66 bool _fullAreaDrop;
67 QWidget* _target;
68 QRect _targetRect;
69 DropArea _lastLocation;
70 };
71 /**--------------------------------------------------------------------------------------------------
72 \brief Shows a cross with 5 different drop area possibilities.
73 **/
74 class DropOverlayCross : public QWidget
75 {
76 Q_OBJECT
77 friend class DropOverlay;
78 public:
81 void setAreaWidgets(const QHash<DropArea, QWidget*>& widgets);
83 protected:
84 virtual void showEvent(QShowEvent* e);
85 private:
86 void reset();
87 private:
88 DropOverlay* _overlay;
89 QHash<DropArea, QWidget*> _widgets;
90 QGridLayout* _grid;
91 };
92}
93
Shows a cross with 5 different drop area possibilities.
Definition DropOverlay.h:75
DropArea cursorLocation() const
DropOverlayCross(DropOverlay *overlay)
virtual void showEvent(QShowEvent *e)
void setAreaWidgets(const QHash< DropArea, QWidget * > &widgets)
Paints a translucent rectangle over another widget. The geometry of the rectangle is based on the mou...
Definition DropOverlay.h:46
virtual void resizeEvent(QResizeEvent *e) override
virtual void hideEvent(QHideEvent *e) override
virtual void moveEvent(QMoveEvent *e) override
void showDropOverlay(QWidget *target, const QRect &targetAreaRect)
DropArea cursorLocation() const
DropArea showDropOverlay(QWidget *target, QWidget *payload)
virtual void paintEvent(QPaintEvent *e) override
DropOverlay(QWidget *parent)
virtual ~DropOverlay()
virtual void showEvent(QShowEvent *e) override
void setAreaWidgets(const QHash< DropArea, QWidget * > &widgets)
Definition ACIColor.h:37
DropArea
relates where a widget should be dropped relative to another.
Definition RibbonArea.h:46