1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the widgets module 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/qframe.h"
33
#include "QtGui/qsizepolicy.h"
35
#ifndef QT_NO_SPLITTER
37
class QSplitterPrivate;
39
template <typename T> class QList;
41
class QSplitterHandle;
43
class Q_GUI_EXPORT QSplitter : public QFrame
47
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
48
Q_PROPERTY(bool opaqueResize READ opaqueResize WRITE setOpaqueResize)
49
Q_PROPERTY(int handleWidth READ handleWidth WRITE setHandleWidth)
50
Q_PROPERTY(bool childrenCollapsible READ childrenCollapsible WRITE setChildrenCollapsible)
53
explicit QSplitter(QWidget* parent = 0);
54
explicit QSplitter(Qt::Orientation, QWidget* parent = 0);
57
void addWidget(QWidget *widget);
58
void insertWidget(int index, QWidget *widget);
60
void setOrientation(Qt::Orientation);
61
Qt::Orientation orientation() const;
63
void setChildrenCollapsible(bool);
64
bool childrenCollapsible() const;
66
void setCollapsible(int index, bool);
67
bool isCollapsible(int index) const;
68
void setOpaqueResize(bool opaque = true);
69
bool opaqueResize() const;
72
QSize sizeHint() const;
73
QSize minimumSizeHint() const;
75
QList<int> sizes() const;
76
void setSizes(const QList<int> &list);
78
QByteArray saveState() const;
79
bool restoreState(const QByteArray &state);
81
int handleWidth() const;
82
void setHandleWidth(int);
84
int indexOf(QWidget *w) const;
85
QWidget *widget(int index) const;
88
void getRange(int index, int *, int *) const;
89
QSplitterHandle *handle(int index) const;
91
void setStretchFactor(int index, int stretch);
94
void splitterMoved(int pos, int index);
97
virtual QSplitterHandle *createHandle();
99
void childEvent(QChildEvent *);
101
bool event(QEvent *);
102
void resizeEvent(QResizeEvent *);
104
void changeEvent(QEvent *);
105
void moveSplitter(int pos, int index);
106
void setRubberBand(int position);
107
int closestLegalPosition(int, int);
111
QT3_SUPPORT_CONSTRUCTOR QSplitter(QWidget* parent, const char* name);
112
QT3_SUPPORT_CONSTRUCTOR QSplitter(Qt::Orientation, QWidget* parent, const char* name);
113
enum ResizeMode { Stretch, KeepSize, FollowSizeHint, Auto };
114
QT3_SUPPORT void setResizeMode(QWidget *w, ResizeMode mode);
115
inline QT3_SUPPORT void moveToFirst(QWidget *w) { insertWidget(0,w); }
116
inline QT3_SUPPORT void moveToLast(QWidget *w) { addWidget(w); }
117
inline QT3_SUPPORT void setCollapsible(QWidget *w, bool collapse)
118
{ setCollapsible(indexOf(w), collapse); }
122
Q_DISABLE_COPY(QSplitter)
123
Q_DECLARE_PRIVATE(QSplitter)
125
friend class QSplitterHandle;
129
#ifndef QT_NO_TEXTSTREAM
130
Q_GUI_EXPORT QTextStream& operator<<(QTextStream&, const QSplitter&);
131
Q_GUI_EXPORT QTextStream& operator>>(QTextStream&, QSplitter&);
135
class QSplitterHandlePrivate;
136
class Q_GUI_EXPORT QSplitterHandle : public QWidget
140
QSplitterHandle(Qt::Orientation o, QSplitter *parent);
141
void setOrientation(Qt::Orientation o);
142
Qt::Orientation orientation() const;
143
bool opaqueResize() const;
144
QSplitter *splitter() const;
146
QSize sizeHint() const;
149
void paintEvent(QPaintEvent *);
150
void mouseMoveEvent(QMouseEvent *);
151
void mousePressEvent(QMouseEvent *);
152
void mouseReleaseEvent(QMouseEvent *);
153
bool event(QEvent *);
155
void moveSplitter(int p);
156
int closestLegalPosition(int p);
159
Q_DISABLE_COPY(QSplitterHandle)
160
Q_DECLARE_PRIVATE(QSplitterHandle)
163
#endif // QT_NO_SPLITTER
165
#endif // QSPLITTER_H