DockOverlay.h
Go to the documentation of this file.
1 #ifndef DockOverlayH
2 #define DockOverlayH
3 /*******************************************************************************
4 ** Qt Advanced Docking System
5 ** Copyright (C) 2017 Uwe Kindler
6 **
7 ** This library is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU Lesser General Public
9 ** License as published by the Free Software Foundation; either
10 ** version 2.1 of the License, or (at your option) any later version.
11 **
12 ** This library is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ** Lesser General Public License for more details.
16 **
17 ** You should have received a copy of the GNU Lesser General Public
18 ** License along with this library; If not, see <http://www.gnu.org/licenses/>.
19 ******************************************************************************/
20 
21 
22 //============================================================================
23 // INCLUDES
24 //============================================================================
25 #include <QPointer>
26 #include <QHash>
27 #include <QRect>
28 #include <QFrame>
29 
30 #include "ads_globals.h"
31 
32 QT_FORWARD_DECLARE_CLASS(QGridLayout)
33 
34 namespace ads
35 {
36 struct DockOverlayPrivate;
37 class CDockOverlayCross;
38 
43 class ADS_EXPORT CDockOverlay : public QFrame
44 {
45  Q_OBJECT
46 private:
47  DockOverlayPrivate* d; //< private data class
48  friend struct DockOverlayPrivate;
49  friend class DockOverlayCross;
50 
51 public:
52  using Super = QFrame;
53 
54  enum eMode
55  {
56  ModeDockAreaOverlay,
57  ModeContainerOverlay
58  };
59 
63  CDockOverlay(QWidget* parent, eMode Mode = ModeDockAreaOverlay);
64 
68  virtual ~CDockOverlay();
69 
73  void setAllowedAreas(DockWidgetAreas areas);
74 
78  DockWidgetAreas allowedAreas() const;
79 
83  DockWidgetArea dropAreaUnderCursor() const;
84 
90  DockWidgetArea visibleDropAreaUnderCursor() const;
91 
95  DockWidgetArea showOverlay(QWidget* target);
96 
100  void hideOverlay();
101 
106  void enableDropPreview(bool Enable);
107 
111  bool dropPreviewEnabled() const;
112 
116  QRect dropOverlayRect() const;
117 
121  virtual bool event(QEvent *e) override;
122 
123 protected:
124  virtual void paintEvent(QPaintEvent *e) override;
125  virtual void showEvent(QShowEvent* e) override;
126  virtual void hideEvent(QHideEvent* e) override;
127 };
128 
129 
130 struct DockOverlayCrossPrivate;
155 class CDockOverlayCross : public QWidget
156 {
157  Q_OBJECT
158  Q_PROPERTY(QString iconColors READ iconColors WRITE setIconColors)
159  Q_PROPERTY(QColor iconFrameColor READ iconColor WRITE setIconFrameColor)
160  Q_PROPERTY(QColor iconBackgroundColor READ iconColor WRITE setIconBackgroundColor)
161  Q_PROPERTY(QColor iconOverlayColor READ iconColor WRITE setIconOverlayColor)
162  Q_PROPERTY(QColor iconArrowColor READ iconColor WRITE setIconArrowColor)
163  Q_PROPERTY(QColor iconShadowColor READ iconColor WRITE setIconShadowColor)
164 
165 public:
166  enum eIconColor
167  {
168  FrameColor,
169  WindowBackgroundColor,
170  OverlayColor,
171  ArrowColor,
172  ShadowColor
173  };
174 
175 private:
176  DockOverlayCrossPrivate* d;
177  friend struct DockOverlayCrossPrivate;
178  friend class CDockOverlay;
179 
180 protected:
185  QString iconColors() const;
186 
190  QColor iconColor() const {return QColor();}
191  void setIconFrameColor(const QColor& Color) {setIconColor(FrameColor, Color);}
192  void setIconBackgroundColor(const QColor& Color) {setIconColor(WindowBackgroundColor, Color);}
193  void setIconOverlayColor(const QColor& Color) {setIconColor(OverlayColor, Color);}
194  void setIconArrowColor(const QColor& Color) {setIconColor(ArrowColor, Color);}
195  void setIconShadowColor(const QColor& Color) {setIconColor(ShadowColor, Color);}
196 
197 public:
201  CDockOverlayCross(CDockOverlay* overlay);
202 
206  virtual ~CDockOverlayCross();
207 
211  void setIconColor(eIconColor ColorIndex, const QColor& Color);
212 
216  QColor iconColor(eIconColor ColorIndex) const;
217 
223  DockWidgetArea cursorLocation() const;
224 
228  void setupOverlayCross(CDockOverlay::eMode Mode);
229 
233  void updateOverlayIcons();
234 
238  void reset();
239 
243  void updatePosition();
244 
256  void setIconColors(const QString& Colors);
257 
258 protected:
259  virtual void showEvent(QShowEvent* e) override;
260  void setAreaWidgets(const QHash<DockWidgetArea, QWidget*>& widgets);
261 }; // CDockOverlayCross
262 
263 } // namespace ads
264 #endif // DockOverlayH
DockWidgetArea
Definition: ads_globals.h:73
MQTTClient d
Definition: test10.c:1656
Declaration of.
#define ADS_EXPORT
Definition: ads_globals.h:50


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:47:34