src/gui/widgets/qdockwidget.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.
00004 **
00005 ** This file is part of the QtGui module of the Qt Toolkit.
00006 **
00007 ** This file may be used under the terms of the GNU General Public
00008 ** License version 2.0 as published by the Free Software Foundation
00009 ** and appearing in the file LICENSE.GPL included in the packaging of
00010 ** this file.  Please review the following information to ensure GNU
00011 ** General Public Licensing requirements will be met:
00012 ** http://www.trolltech.com/products/qt/opensource.html
00013 **
00014 ** If you are unsure which license is appropriate for your use, please
00015 ** review the following information:
00016 ** http://www.trolltech.com/products/qt/licensing.html or contact the
00017 ** sales department at sales@trolltech.com.
00018 **
00019 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00020 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 **
00022 ****************************************************************************/
00023 
00024 #ifndef QDYNAMICDOCKWIDGET_H
00025 #define QDYNAMICDOCKWIDGET_H
00026 
00027 #include <QtGui/qwidget.h>
00028 
00029 QT_BEGIN_HEADER
00030 
00031 QT_MODULE(Gui)
00032 
00033 #ifndef QT_NO_DOCKWIDGET
00034 
00035 class QDockWidgetLayout;
00036 class QDockWidgetPrivate;
00037 class QMainWindow;
00038 
00039 class Q_GUI_EXPORT QDockWidget : public QWidget
00040 {
00041     Q_OBJECT
00042 
00043     Q_FLAGS(DockWidgetFeatures)
00044     Q_PROPERTY(bool floating READ isFloating WRITE setFloating)
00045     Q_PROPERTY(DockWidgetFeatures features READ features WRITE setFeatures NOTIFY featuresChanged)
00046     Q_PROPERTY(Qt::DockWidgetAreas allowedAreas READ allowedAreas
00047                WRITE setAllowedAreas NOTIFY allowedAreasChanged)
00048     Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true)
00049 
00050 public:
00051     explicit QDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
00052     explicit QDockWidget(QWidget *parent = 0, Qt::WindowFlags flags = 0);
00053     ~QDockWidget();
00054 
00055     QWidget *widget() const;
00056     void setWidget(QWidget *widget);
00057 
00058     enum DockWidgetFeature {
00059         DockWidgetClosable    = 0x01,
00060         DockWidgetMovable     = 0x02,
00061         DockWidgetFloatable   = 0x04,
00062 
00063         DockWidgetFeatureMask = 0x07,
00064         AllDockWidgetFeatures = DockWidgetFeatureMask,
00065         NoDockWidgetFeatures  = 0x00,
00066 
00067         Reserved              = 0xff
00068     };
00069     Q_DECLARE_FLAGS(DockWidgetFeatures, DockWidgetFeature)
00070 
00071     void setFeatures(DockWidgetFeatures features);
00072     DockWidgetFeatures features() const;
00073 
00074     void setFloating(bool floating);
00075     inline bool isFloating() const { return isWindow(); }
00076 
00077     void setAllowedAreas(Qt::DockWidgetAreas areas);
00078     Qt::DockWidgetAreas allowedAreas() const;
00079 
00080     inline bool isAreaAllowed(Qt::DockWidgetArea area) const
00081     { return (allowedAreas() & area) == area; }
00082 
00083 #ifndef QT_NO_ACTION
00084     QAction *toggleViewAction() const;
00085 #endif
00086 
00087 Q_SIGNALS:
00088     void featuresChanged(QDockWidget::DockWidgetFeatures features);
00089     void topLevelChanged(bool topLevel);
00090     void allowedAreasChanged(Qt::DockWidgetAreas allowedAreas);
00091 
00092 protected:
00093     void changeEvent(QEvent *event);
00094     void closeEvent(QCloseEvent *event);
00095     void paintEvent(QPaintEvent *event);
00096     bool event(QEvent *event);
00097 
00098 private:
00099     Q_DECLARE_PRIVATE(QDockWidget)
00100     Q_DISABLE_COPY(QDockWidget)
00101     Q_PRIVATE_SLOT(d_func(), void _q_toggleView(bool))
00102     Q_PRIVATE_SLOT(d_func(), void _q_toggleTopLevel())
00103     friend class QDockWidgetLayout;
00104     friend class QDockWidgetItem;
00105     friend class QMainWindowLayout;
00106 };
00107 
00108 Q_DECLARE_OPERATORS_FOR_FLAGS(QDockWidget::DockWidgetFeatures)
00109 
00110 #endif // QT_NO_DOCKWIDGET
00111 
00112 QT_END_HEADER
00113 
00114 #endif // QDYNAMICDOCKWIDGET_H

Generated on Thu Mar 15 11:56:51 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1