00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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