source: trunk/include/qdockarea.h@ 138

Last change on this file since 138 was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 5.9 KB
Line 
1/****************************************************************************
2** $Id: qdockarea.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Definition of the QDockArea class
5**
6** Created : 001010
7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9**
10** This file is part of the workspace module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition licenses may use this
22** file in accordance with the Qt Commercial License Agreement provided
23** with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#ifndef QDOCKAREA_H
39#define QDOCKAREA_H
40
41#ifndef QT_H
42#include "qwidget.h"
43#include "qptrlist.h"
44#include "qdockwindow.h"
45#include "qlayout.h"
46#include "qvaluelist.h"
47#include "qguardedptr.h"
48#include "qtextstream.h"
49#endif // QT_H
50
51#ifndef QT_NO_MAINWINDOW
52
53class QSplitter;
54class QBoxLayout;
55class QDockAreaLayout;
56class QMouseEvent;
57class QDockWindowResizeHandle;
58class QDockAreaPrivate;
59
60class Q_EXPORT QDockAreaLayout : public QLayout
61{
62 Q_OBJECT
63 friend class QDockArea;
64
65public:
66 QDockAreaLayout( QWidget* parent, Qt::Orientation o, QPtrList<QDockWindow> *wl, int space = -1, int margin = -1, const char *name = 0 )
67 : QLayout( parent, space, margin, name ), orient( o ), dockWindows( wl ), parentWidget( parent ) { init(); }
68 ~QDockAreaLayout() {}
69
70 void addItem( QLayoutItem * ) {}
71 bool hasHeightForWidth() const;
72 int heightForWidth( int ) const;
73 int widthForHeight( int ) const;
74 QSize sizeHint() const;
75 QSize minimumSize() const;
76 QLayoutIterator iterator();
77 QSizePolicy::ExpandData expanding() const { return QSizePolicy::NoDirection; }
78 void invalidate();
79 Qt::Orientation orientation() const { return orient; }
80 QValueList<QRect> lineList() const { return lines; }
81 QPtrList<QDockWindow> lineStarts() const { return ls; }
82
83protected:
84 void setGeometry( const QRect& );
85
86private:
87 void init();
88 int layoutItems( const QRect&, bool testonly = FALSE );
89 Qt::Orientation orient;
90 bool dirty;
91 int cached_width, cached_height;
92 int cached_hfw, cached_wfh;
93 QPtrList<QDockWindow> *dockWindows;
94 QWidget *parentWidget;
95 QValueList<QRect> lines;
96 QPtrList<QDockWindow> ls;
97#if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator=
98 QDockAreaLayout( const QDockAreaLayout & );
99 QDockAreaLayout &operator=( const QDockAreaLayout & );
100#endif
101};
102
103class Q_EXPORT QDockArea : public QWidget
104{
105 Q_OBJECT
106 Q_ENUMS( HandlePosition )
107 Q_PROPERTY( Orientation orientation READ orientation )
108 Q_PROPERTY( int count READ count )
109 Q_PROPERTY( bool empty READ isEmpty )
110 Q_PROPERTY( HandlePosition handlePosition READ handlePosition )
111
112 friend class QDockWindow;
113 friend class QDockWindowResizeHandle;
114 friend class QDockAreaLayout;
115
116public:
117 enum HandlePosition { Normal, Reverse };
118
119 QDockArea( Orientation o, HandlePosition h = Normal, QWidget* parent=0, const char* name=0 );
120 ~QDockArea();
121
122 void moveDockWindow( QDockWindow *w, const QPoint &globalPos, const QRect &rect, bool swap );
123 void removeDockWindow( QDockWindow *w, bool makeFloating, bool swap, bool fixNewLines = TRUE );
124 void moveDockWindow( QDockWindow *w, int index = -1 );
125 bool hasDockWindow( QDockWindow *w, int *index = 0 );
126
127 void invalidNextOffset( QDockWindow *dw );
128
129 Orientation orientation() const { return orient; }
130 HandlePosition handlePosition() const { return hPos; }
131
132 bool eventFilter( QObject *, QEvent * );
133 bool isEmpty() const;
134 int count() const;
135 QPtrList<QDockWindow> dockWindowList() const;
136
137 bool isDockWindowAccepted( QDockWindow *dw );
138 void setAcceptDockWindow( QDockWindow *dw, bool accept );
139
140public slots:
141 void lineUp( bool keepNewLines );
142
143private:
144 struct DockWindowData
145 {
146 int index;
147 int offset;
148 int line;
149 QSize fixedExtent;
150 QGuardedPtr<QDockArea> area;
151 };
152
153 int findDockWindow( QDockWindow *w );
154 int lineOf( int index );
155 DockWindowData *dockWindowData( QDockWindow *w );
156 void dockWindow( QDockWindow *dockWindow, DockWindowData *data );
157 void updateLayout();
158 void invalidateFixedSizes();
159 int maxSpace( int hint, QDockWindow *dw );
160 void setFixedExtent( int d, QDockWindow *dw );
161 bool isLastDockWindow( QDockWindow *dw );
162
163private:
164 Orientation orient;
165 QPtrList<QDockWindow> *dockWindows;
166 QDockAreaLayout *layout;
167 HandlePosition hPos;
168 QPtrList<QDockWindow> forbiddenWidgets;
169 QDockAreaPrivate *d;
170
171private: // Disabled copy constructor and operator=
172#if defined(Q_DISABLE_COPY)
173 QDockArea( const QDockArea & );
174 QDockArea& operator=( const QDockArea & );
175#endif
176
177};
178
179#ifndef QT_NO_TEXTSTREAM
180Q_EXPORT QTextStream &operator<<( QTextStream &, const QDockArea & );
181Q_EXPORT QTextStream &operator>>( QTextStream &, QDockArea & );
182#endif
183
184#define Q_DEFINED_QDOCKAREA
185#include "qwinexport.h"
186#endif
187
188#endif //QT_NO_MAINWINDOW
Note: See TracBrowser for help on using the repository browser.