00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef QGRIDLAYOUT_H
00043 #define QGRIDLAYOUT_H
00044
00045 #include <QtGui/qlayout.h>
00046 #ifdef QT_INCLUDE_COMPAT
00047 #include <QtGui/qwidget.h>
00048 #endif
00049
00050 #include <limits.h>
00051
00052 QT_BEGIN_HEADER
00053
00054 QT_BEGIN_NAMESPACE
00055
00056 QT_MODULE(Gui)
00057
00058 class QGridLayoutPrivate;
00059
00060 class Q_GUI_EXPORT QGridLayout : public QLayout
00061 {
00062 Q_OBJECT
00063 Q_DECLARE_PRIVATE(QGridLayout)
00064 QDOC_PROPERTY(int horizontalSpacing READ horizontalSpacing WRITE setHorizontalSpacing)
00065 QDOC_PROPERTY(int verticalSpacing READ verticalSpacing WRITE setVerticalSpacing)
00066
00067 public:
00068 explicit QGridLayout(QWidget *parent);
00069 QGridLayout();
00070
00071 #ifdef QT3_SUPPORT
00072 QT3_SUPPORT_CONSTRUCTOR QGridLayout(QWidget *parent, int nRows , int nCols = 1, int border = 0,
00073 int spacing = -1, const char *name = 0);
00074 QT3_SUPPORT_CONSTRUCTOR QGridLayout(int nRows , int nCols = 1, int spacing = -1, const char *name = 0);
00075 QT3_SUPPORT_CONSTRUCTOR QGridLayout(QLayout *parentLayout, int nRows = 1, int nCols = 1, int spacing = -1,
00076 const char *name = 0);
00077 #endif
00078 ~QGridLayout();
00079
00080 QSize sizeHint() const;
00081 QSize minimumSize() const;
00082 QSize maximumSize() const;
00083
00084 void setHorizontalSpacing(int spacing);
00085 int horizontalSpacing() const;
00086 void setVerticalSpacing(int spacing);
00087 int verticalSpacing() const;
00088 void setSpacing(int spacing);
00089 int spacing() const;
00090
00091 void setRowStretch(int row, int stretch);
00092 void setColumnStretch(int column, int stretch);
00093 int rowStretch(int row) const;
00094 int columnStretch(int column) const;
00095
00096 void setRowMinimumHeight(int row, int minSize);
00097 void setColumnMinimumWidth(int column, int minSize);
00098 int rowMinimumHeight(int row) const;
00099 int columnMinimumWidth(int column) const;
00100
00101 int columnCount() const;
00102 int rowCount() const;
00103
00104 QRect cellRect(int row, int column) const;
00105 #ifdef QT3_SUPPORT
00106 inline QT3_SUPPORT QRect cellGeometry(int row, int column) const {return cellRect(row, column);}
00107 #endif
00108
00109 bool hasHeightForWidth() const;
00110 int heightForWidth(int) const;
00111 int minimumHeightForWidth(int) const;
00112
00113 Qt::Orientations expandingDirections() const;
00114 void invalidate();
00115
00116 inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
00117 void addWidget(QWidget *, int row, int column, Qt::Alignment = 0);
00118 void addWidget(QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = 0);
00119 void addLayout(QLayout *, int row, int column, Qt::Alignment = 0);
00120 void addLayout(QLayout *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = 0);
00121
00122 void setOriginCorner(Qt::Corner);
00123 Qt::Corner originCorner() const;
00124
00125 #ifdef QT3_SUPPORT
00126 inline QT3_SUPPORT void setOrigin(Qt::Corner corner) { setOriginCorner(corner); }
00127 inline QT3_SUPPORT Qt::Corner origin() const { return originCorner(); }
00128 #endif
00129 QLayoutItem *itemAt(int index) const;
00130 QLayoutItem *itemAtPosition(int row, int column) const;
00131 QLayoutItem *takeAt(int index);
00132 int count() const;
00133 void setGeometry(const QRect&);
00134
00135 void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = 0);
00136
00137 void setDefaultPositioning(int n, Qt::Orientation orient);
00138 void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan);
00139
00140 protected:
00141 #ifdef QT3_SUPPORT
00142 QT3_SUPPORT bool findWidget(QWidget* w, int *r, int *c);
00143 #endif
00144 void addItem(QLayoutItem *);
00145
00146 private:
00147 Q_DISABLE_COPY(QGridLayout)
00148
00149 #ifdef QT3_SUPPORT
00150 public:
00151 QT3_SUPPORT void expand(int rows, int cols);
00152 inline QT3_SUPPORT void addRowSpacing(int row, int minsize) { addItem(new QSpacerItem(0,minsize), row, 0); }
00153 inline QT3_SUPPORT void addColSpacing(int col, int minsize) { addItem(new QSpacerItem(minsize,0), 0, col); }
00154 inline QT3_SUPPORT void addMultiCellWidget(QWidget *w, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0)
00155 { addWidget(w, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
00156 inline QT3_SUPPORT void addMultiCell(QLayoutItem *l, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0)
00157 { addItem(l, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
00158 inline QT3_SUPPORT void addMultiCellLayout(QLayout *layout, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0)
00159 { addLayout(layout, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
00160
00161 inline QT3_SUPPORT int numRows() const { return rowCount(); }
00162 inline QT3_SUPPORT int numCols() const { return columnCount(); }
00163 inline QT3_SUPPORT void setColStretch(int col, int stretch) {setColumnStretch(col, stretch); }
00164 inline QT3_SUPPORT int colStretch(int col) const {return columnStretch(col); }
00165 inline QT3_SUPPORT void setColSpacing(int col, int minSize) { setColumnMinimumWidth(col, minSize); }
00166 inline QT3_SUPPORT int colSpacing(int col) const { return columnMinimumWidth(col); }
00167 inline QT3_SUPPORT void setRowSpacing(int row, int minSize) {setRowMinimumHeight(row, minSize); }
00168 inline QT3_SUPPORT int rowSpacing(int row) const {return rowMinimumHeight(row); }
00169 #endif
00170 };
00171
00172 QT_END_NAMESPACE
00173
00174 QT_END_HEADER
00175
00176 #endif // QGRIDLAYOUT_H