FloatingDockContainer.h
Go to the documentation of this file.
1 #ifndef FloatingDockContainerH
2 #define FloatingDockContainerH
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 //============================================================================
27 //============================================================================
28 
29 //============================================================================
30 // INCLUDES
31 //============================================================================
32 #include "ads_globals.h"
33 
34 #include <QRubberBand>
35 
36 #ifdef Q_OS_LINUX
37 #include <QDockWidget>
38 #define tFloatingWidgetBase QDockWidget
39 #else
40 #include <QWidget>
41 #define tFloatingWidgetBase QWidget
42 #endif
43 
44 class CDockingStateReader;
45 
46 namespace ads
47 {
48 struct FloatingDockContainerPrivate;
49 class CDockManager;
50 struct DockManagerPrivate;
51 class CDockAreaWidget;
52 class CDockContainerWidget;
53 class CDockWidget;
54 class CDockManager;
55 class CDockAreaTabBar;
56 class CDockWidgetTab;
57 struct DockWidgetTabPrivate;
58 class CDockAreaTitleBar;
59 struct DockAreaTitleBarPrivate;
60 class CFloatingWidgetTitleBar;
61 class CDockingStateReader;
62 
69 {
70 public:
71  virtual ~IFloatingWidget() = default;
72 
78  virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
79  eDragState DragState, QWidget* MouseEventHandler) = 0;
80 
87  virtual void moveFloating() = 0;
88 
94  virtual void finishDragging() = 0;
95 };
96 
97 
105 {
106  Q_OBJECT
107 private:
110  friend class CDockManager;
111  friend struct DockManagerPrivate;
112  friend class CDockAreaTabBar;
113  friend struct DockWidgetTabPrivate;
114  friend class CDockWidgetTab;
115  friend class CDockAreaTitleBar;
116  friend struct DockAreaTitleBarPrivate;
117  friend class CDockWidget;
118  friend class CDockAreaWidget;
120 
121 private slots:
122  void onDockAreasAddedOrRemoved();
123  void onDockAreaCurrentChanged(int Index);
124 
125 protected:
131  virtual void startFloating(const QPoint& DragStartMousePos, const QSize& Size,
132  eDragState DragState, QWidget* MouseEventHandler) override;
133 
137  void startDragging(const QPoint& DragStartMousePos, const QSize& Size,
138  QWidget* MouseEventHandler)
139  {
140  startFloating(DragStartMousePos, Size, DraggingFloatingWidget, MouseEventHandler);
141  }
142 
147  virtual void finishDragging() override;
148 
153  void initFloatingGeometry(const QPoint& DragStartMousePos, const QSize& Size)
154  {
155  startFloating(DragStartMousePos, Size, DraggingInactive, nullptr);
156  }
157 
162  void moveFloating() override;
163 
170  bool restoreState(CDockingStateReader& Stream, bool Testing);
171 
175  void updateWindowTitle();
176 
177 protected: // reimplements QWidget
178  virtual void changeEvent(QEvent *event) override;
179  virtual void closeEvent(QCloseEvent *event) override;
180  virtual void hideEvent(QHideEvent *event) override;
181  virtual void showEvent(QShowEvent *event) override;
182 
183 #ifdef Q_OS_MACOS
184  virtual bool event(QEvent *e) override;
185  virtual void moveEvent(QMoveEvent *event) override;
186 #endif
187 
188 #ifdef Q_OS_LINUX
189  virtual void moveEvent(QMoveEvent *event) override;
190  virtual void resizeEvent(QResizeEvent *event) override;
191 #endif
192 
193 #ifdef Q_OS_WIN
194 
197  virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
198 #endif
199 
200 
201 public:
203 
207  CFloatingDockContainer(CDockManager* DockManager);
208 
213 
218 
222  virtual ~CFloatingDockContainer();
223 
227  CDockContainerWidget* dockContainer() const;
228 
233  bool isClosable() const;
234 
241  bool hasTopLevelDockWidget() const;
242 
248  CDockWidget* topLevelDockWidget() const;
249 
255  QList<CDockWidget*> dockWidgets() const;
256 
257 #ifdef Q_OS_LINUX
258 
262  void onMaximizeRequest();
263 
270  void showNormal(bool fixGeometry=false);
271 
275  void showMaximized();
276 
280  bool isMaximized() const;
281 
285  void show();
286 
291  bool hasNativeTitleBar();
292 #endif
293 
294 }; // class FloatingDockContainer
295 }
296  // namespace ads
297 //-----------------------------------------------------------------------------
298 #endif // FloatingDockContainerH
#define tFloatingWidgetBase
DraggingFloatingWidget.
Definition: ads_globals.h:104
virtual void startFloating(const QPoint &DragStartMousePos, const QSize &Size, eDragState DragState, QWidget *MouseEventHandler)=0
virtual void finishDragging()=0
virtual void moveFloating()=0
Declaration of.
DraggingInactive.
Definition: ads_globals.h:101
virtual ~IFloatingWidget()=default
#define ADS_EXPORT
Definition: ads_globals.h:50
void initFloatingGeometry(const QPoint &DragStartMousePos, const QSize &Size)
FloatingDockContainerPrivate * d
private data (pimpl)
void startDragging(const QPoint &DragStartMousePos, const QSize &Size, QWidget *MouseEventHandler)
eDragState
Definition: ads_globals.h:99


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