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
ads::CFloatingDockContainer::d
FloatingDockContainerPrivate * d
private data (pimpl)
Definition: FloatingDockContainer.h:108
ads_globals.h
Declaration of.
ads::DraggingFloatingWidget
@ DraggingFloatingWidget
DraggingFloatingWidget.
Definition: ads_globals.h:104
ads::CDockAreaTitleBar
Definition: DockAreaTitleBar.h:50
ads::DockAreaTitleBarPrivate
Definition: DockAreaTitleBar.cpp:63
QList
Definition: qwt_abstract_legend.h:17
ads::CDockAreaWidget
Definition: DockAreaWidget.h:55
ads::CDockManager
Definition: DockManager.h:69
ads
Definition: ads_globals.h:69
DockWidget
Definition: plot_docker.h:16
ads::IFloatingWidget::~IFloatingWidget
virtual ~IFloatingWidget()=default
ads::DockManagerPrivate
Definition: DockManager.cpp:97
ads::CDockAreaTabBar
Definition: DockAreaTabBar.h:53
ads::CDockWidget
Definition: DockWidget.h:54
ads::CFloatingWidgetTitleBar
Definition: FloatingWidgetTitleBar.h:49
ads::IFloatingWidget::startFloating
virtual void startFloating(const QPoint &DragStartMousePos, const QSize &Size, eDragState DragState, QWidget *MouseEventHandler)=0
ads::eDragState
eDragState
Definition: ads_globals.h:99
tFloatingWidgetBase
#define tFloatingWidgetBase
Definition: FloatingDockContainer.h:41
ads::IFloatingWidget::moveFloating
virtual void moveFloating()=0
ads::IFloatingWidget
Definition: FloatingDockContainer.h:68
ads::FloatingDockContainerPrivate
Definition: FloatingDockContainer.cpp:364
ads::IFloatingWidget::finishDragging
virtual void finishDragging()=0
ads::CFloatingDockContainer
Definition: FloatingDockContainer.h:104
ads::CFloatingDockContainer::initFloatingGeometry
void initFloatingGeometry(const QPoint &DragStartMousePos, const QSize &Size)
Definition: FloatingDockContainer.h:153
ads::CDockContainerWidget
Definition: DockContainerWidget.h:61
ads::CDockingStateReader
Definition: DockingStateReader.h:21
ads::DraggingInactive
@ DraggingInactive
DraggingInactive.
Definition: ads_globals.h:101
ads::DockWidgetTabPrivate
Definition: DockWidgetTab.cpp:63
ads::CFloatingDockContainer::startDragging
void startDragging(const QPoint &DragStartMousePos, const QSize &Size, QWidget *MouseEventHandler)
Definition: FloatingDockContainer.h:137
ads::CDockWidgetTab
Definition: DockWidgetTab.h:50
ADS_EXPORT
#define ADS_EXPORT
Definition: ads_globals.h:50
ads::CFloatingDockContainer::Super
tFloatingWidgetBase Super
Definition: FloatingDockContainer.h:202


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:44