1
/**********************************************************************
2
** Copyright (C) 2000 Trolltech AS. All rights reserved.
4
** This file is part of Qt Designer.
6
** This file may be distributed and/or modified under the terms of the
7
** GNU General Public License version 2 as published by the Free Software
8
** Foundation and appearing in the file LICENSE.GPL included in the
9
** packaging of this file.
11
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
12
** licenses may use this file in accordance with the Qt Commercial License
13
** Agreement provided with the Software.
15
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18
** See http://www.trolltech.com/gpl/ for GPL licensing information.
19
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
20
** information about Qt Commercial License Agreements.
22
** Contact info@trolltech.com if any conditions of this licensing are
25
**********************************************************************/
32
#include <qguardedptr.h>
36
#include <qwidgetlist.h>
41
class Layout : public QObject
46
Layout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup = TRUE, bool splitter = FALSE );
49
virtual void doLayout() = 0;
50
virtual void undoLayout();
51
virtual void breakLayout();
52
virtual bool prepareLayout( bool &needMove, bool &needReparent );
53
virtual void finishLayout( bool needMove, QLayout *layout );
59
QMap<QGuardedPtr<QWidget>, QRect> geometries;
61
FormWindow *formWindow;
70
void widgetDestroyed();
74
class HorizontalLayout : public Layout
77
HorizontalLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup = TRUE, bool splitter = FALSE );
86
class VerticalLayout : public Layout
89
VerticalLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, bool doSetup = TRUE, bool splitter = FALSE );
100
class GridLayout : public Layout
103
GridLayout( const QWidgetList &wl, QWidget *p, FormWindow *fw, QWidget *lb, const QSize &res, bool doSetup = TRUE );
118
class Spacer : public QWidget
122
Q_OVERRIDE( QCString name )
123
Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
125
Q_PROPERTY( SizeType sizeType READ sizeType WRITE setSizeType )
126
Q_PROPERTY( QSize sizeHint READ sizeHint WRITE setSizeHint DESIGNABLE true STORED true )
127
Q_OVERRIDE( QRect geometry DESIGNABLE false )
130
enum { HSize = 6, HMask = 0x3f, VMask = HMask << HSize,
131
MayGrow = 1, ExpMask = 2, MayShrink = 4 };
134
enum SizeType { Fixed = 0,
137
Preferred = MayGrow|MayShrink ,
138
MinimumExpanding = Minimum|ExpMask,
139
Expanding = MinimumExpanding|MayShrink };
141
Spacer( QWidget *parent, const char *name );
143
QSize minimumSize() const;
144
QSize sizeHint() const;
145
void setSizeType( SizeType t );
146
SizeType sizeType() const;
147
int alignment() const;
148
Orientation orientation() const;
149
void setOrientation( Orientation o );
150
void setInteraciveMode( bool b ) { interactive = b; };
151
void setSizeHint( const QSize &s );
154
void paintEvent( QPaintEvent *e );
155
void resizeEvent( QResizeEvent* e );
157
Qt::Orientation orient;
162
class QDesignerGridLayout : public QGridLayout
166
QDesignerGridLayout( QWidget *parent ) : QGridLayout( parent ){};
167
QDesignerGridLayout( QLayout *parentLayout ) : QGridLayout( parentLayout ){};
169
void addWidget( QWidget *, int row, int col, int align = 0 );
170
void addMultiCellWidget( QWidget *, int fromRow, int toRow,
171
int fromCol, int toCol, int align = 0 );
175
Item(): row(0), column(0),rowspan(1),colspan(1){}
176
Item( int r, int c, int rs, int cs): row(r), column(c), rowspan(rs), colspan(cs){}
181
Q_DUMMY_COMPARISON_OPERATOR( Item )
184
QMap<QWidget*, Item> items;