1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the Qt 3 compatibility classes of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include "QtGui/qwidget.h"
33
#include "QtCore/qlist.h"
34
#include "Qt3Support/q3dockwindow.h"
35
#include "QtGui/qlayout.h"
36
#include "QtCore/qpointer.h"
38
#ifndef QT_NO_MAINWINDOW
42
class Q3DockAreaLayout;
44
class Q3DockWindowResizeHandle;
45
class Q3DockAreaPrivate;
48
class Q_COMPAT_EXPORT Q3DockAreaLayout : public QLayout
51
friend class Q3DockArea;
54
Q3DockAreaLayout(QWidget* parent, Qt::Orientation o, QList<Q3DockWindow *> *wl, int space = -1, int margin = -1, const char *name = 0)
55
: QLayout(parent), orient(o), dockWindows(wl), parentWidget(parent)
64
~Q3DockAreaLayout() {}
66
void addItem(QLayoutItem *) {}
67
bool hasHeightForWidth() const;
68
int heightForWidth(int) const;
69
int widthForHeight(int) const;
70
QSize sizeHint() const;
71
QSize minimumSize() const;
72
QLayoutItem *itemAt(int) const;
73
QLayoutItem *takeAt(int);
75
Qt::Orientations expandingDirections() const { return Qt::Orientations(0); }
77
Qt::Orientation orientation() const { return orient; }
78
QList<QRect> lineList() const { return lines; }
79
QList<Q3DockWindow *> lineStarts() const { return ls; }
82
void setGeometry(const QRect&);
85
Q_DISABLE_COPY(Q3DockAreaLayout)
88
int layoutItems(const QRect&, bool testonly = false);
89
Qt::Orientation orient;
91
int cached_width, cached_height;
92
int cached_hfw, cached_wfh;
93
QList<Q3DockWindow *> *dockWindows;
94
QWidget *parentWidget;
96
QList<Q3DockWindow *> ls;
99
class Q_COMPAT_EXPORT Q3DockArea : public QWidget
102
Q_ENUMS(HandlePosition)
103
Q_PROPERTY(Qt::Orientation orientation READ orientation)
104
Q_PROPERTY(int count READ count)
105
Q_PROPERTY(bool empty READ isEmpty)
106
Q_PROPERTY(HandlePosition handlePosition READ handlePosition)
108
friend class Q3DockWindow;
109
friend class Q3DockWindowResizeHandle;
110
friend class Q3DockAreaLayout;
113
enum HandlePosition { Normal, Reverse };
115
Q3DockArea(Qt::Orientation o, HandlePosition h = Normal, QWidget* parent=0, const char* name=0);
118
void moveDockWindow(Q3DockWindow *w, const QPoint &globalPos, const QRect &rect, bool swap);
119
void removeDockWindow(Q3DockWindow *w, bool makeFloating, bool swap, bool fixNewLines = true);
120
void moveDockWindow(Q3DockWindow *w, int index = -1);
121
bool hasDockWindow(Q3DockWindow *w, int *index = 0);
123
void invalidNextOffset(Q3DockWindow *dw);
125
Qt::Orientation orientation() const { return orient; }
126
HandlePosition handlePosition() const { return hPos; }
128
bool eventFilter(QObject *, QEvent *);
129
bool isEmpty() const;
131
QList<Q3DockWindow *> dockWindowList() const;
133
bool isDockWindowAccepted(Q3DockWindow *dw);
134
void setAcceptDockWindow(Q3DockWindow *dw, bool accept);
137
void lineUp(bool keepNewLines);
140
struct DockWindowData
146
QPointer<Q3DockArea> area;
149
int findDockWindow(Q3DockWindow *w);
150
int lineOf(int index);
151
DockWindowData *dockWindowData(Q3DockWindow *w);
152
void dockWindow(Q3DockWindow *dockWindow, DockWindowData *data);
154
void invalidateFixedSizes();
155
int maxSpace(int hint, Q3DockWindow *dw);
156
void setFixedExtent(int d, Q3DockWindow *dw);
157
bool isLastDockWindow(Q3DockWindow *dw);
160
Q_DISABLE_COPY(Q3DockArea)
162
Qt::Orientation orient;
163
QList<Q3DockWindow *> dockWindows;
164
Q3DockAreaLayout *layout;
166
QList<Q3DockWindow *> forbiddenWidgets;
167
Q3DockAreaPrivate *d;
170
#ifndef QT_NO_TEXTSTREAM
171
Q_COMPAT_EXPORT QTextStream &operator<<(QTextStream &, const Q3DockArea &);
172
Q_COMPAT_EXPORT QTextStream &operator>>(QTextStream &, Q3DockArea &);
175
#endif //QT_NO_MAINWINDOW
177
#endif //Q3DOCKAREA_H