2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

mdidockarea.h 4.73 KB
 Artur Grunau committed Sep 21, 2013 1 2 3 4 5 6 7 // ================================================================================================ // // This file is part of the CAMPVis Software Framework. // // If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved, // Christian Schulte zu Berge // Chair for Computer Aided Medical Procedures  Sebastian Pölsterl committed Oct 15, 2013 8 9 // Technische Universität München // Boltzmannstr. 3, 85748 Garching b. München, Germany  Artur Grunau committed Sep 21, 2013 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 // For a full list of authors and contributors, please refer to the file "AUTHORS.txt". // // The licensing of this softare is not yet resolved. Until then, redistribution in source or // binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form. // However, the names of the original authors and the above copyright notice must retain in its // original state in any case. // // Legal disclaimer provided by the BSD license: // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // ================================================================================================  Artur Grunau committed Oct 13, 2013 30 31 #ifndef MDIDOCKAREA_H__ #define MDIDOCKAREA_H__  Artur Grunau committed Sep 21, 2013 32   Artur Grunau committed Oct 13, 2013 33 #include "mdidockedwindow.h"  Artur Grunau committed Oct 13, 2013 34 #include "mdifloatingwindow.h"  Artur Grunau committed Sep 21, 2013 35 36 37  #include  Artur Grunau committed Nov 02, 2013 38 39 class QSignalMapper;  Artur Grunau committed Sep 21, 2013 40 41 42 namespace campvis { /**  Artur Grunau committed Oct 13, 2013 43  * MDI area whose subwindows can be docked and undocked.  Artur Grunau committed Sep 21, 2013 44  *  Artur Grunau committed Oct 13, 2013 45 46 47  * MdiDockArea takes care of creating all necessary representations (docked and floating window) * of the widgets passed to \ref addSubWindow and seamlessly switching between them in response * to the user's actions (window dragging, key presses, etc).  Artur Grunau committed Sep 21, 2013 48  */  Artur Grunau committed Oct 13, 2013 49  class MdiDockArea : public QMdiArea {  Artur Grunau committed Sep 21, 2013 50   Artur Grunau committed Sep 21, 2013 51  Q_OBJECT  Artur Grunau committed Sep 21, 2013 52 53  public:  Artur Grunau committed Nov 02, 2013 54 55 56 57 58 59 60  /** * Constructs an empty MDI area. * * \param parent the area's parent widget (passed to QMdiArea's constructor) */ explicit MdiDockArea(QWidget* parent = 0);  Artur Grunau committed Sep 21, 2013 61  /**  Artur Grunau committed Oct 13, 2013 62  * Wrap \p widget in an MDI window and dock it in the MDI area.  Artur Grunau committed Sep 21, 2013 63  *  Artur Grunau committed Oct 13, 2013 64  * This method creates a MdiDockedWindow wrapping the widget, and adds it to the MDI area.  Artur Grunau committed Sep 21, 2013 65  *  Artur Grunau committed Oct 13, 2013 66 67 68  * \param widget the widget to add to the MDI area * \param windowFlags flags used to customize the frame of the created subwindow * \return the PipelineMdiSubWindow instance that was added to the MDI area  Artur Grunau committed Sep 21, 2013 69  */  Artur Grunau committed Oct 13, 2013 70  MdiDockedWindow* addSubWindow(QWidget* widget, Qt::WindowFlags windowFlags = 0);  Artur Grunau committed Sep 21, 2013 71   Artur Grunau committed Nov 02, 2013 72 73  QMenu* menu();  Artur Grunau committed Sep 21, 2013 74 75  private slots: /**  Artur Grunau committed Oct 13, 2013 76  * Track the position of a floating MDI window and dock it if necessary.  Artur Grunau committed Sep 21, 2013 77  *  Artur Grunau committed Oct 13, 2013 78  * This slot is invoked when the position of a floating MDI window changes.  Artur Grunau committed Sep 21, 2013 79  */  Artur Grunau committed Oct 13, 2013 80  void trackFloatingWindowsPosition(MdiFloatingWindow* floatingWindow, const QPoint& newPos);  Artur Grunau committed Sep 21, 2013 81 82  /**  Artur Grunau committed Oct 13, 2013 83  * Track the position of a docked MDI window and detach it if necessary.  Artur Grunau committed Sep 21, 2013 84  *  Artur Grunau committed Oct 13, 2013 85  * This slot is invoked when the position of an MDI subwindow changes.  Artur Grunau committed Sep 21, 2013 86  */  Artur Grunau committed Oct 13, 2013 87  void trackMdiSubWindowsPosition(MdiDockedWindow* mdiSubWindow, const QPoint& newPos);  Artur Grunau committed Sep 21, 2013 88   Artur Grunau committed Nov 02, 2013 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116  /** * Display docked windows as sub-windows with window frames. */ void switchToTiledDisplay(); /** * Display docked windows with tabs in a tab bar. */ void switchToTabbedDisplay(); /** * Depending on the state of \p actionObject, show or hide its associated sub-window. * * \param actionObject the visibility action whose corresponding sub-window should be shown or hidden */ void toggleSubWindowVisibility(QObject* actionObject); private: /** * Add the given MdiDockedWindow to the MDI area. * * \param dockedWindow the docked window to add */ void addDockedWindow(MdiDockedWindow* dockedWindow); QMenu* _menu; ///< Menu with actions for controlling the MDI area and its subwindows. QSignalMapper* _signalMapper; ///< Helper used to pass extra information to toggleSubWindowVisibility.  Artur Grunau committed Sep 21, 2013 117 118 119  }; }  Artur Grunau committed Oct 13, 2013 120 #endif // MDIDOCKAREA_H__