1 /**********************************************************************
2 ** $Id: qgridview.h,v 1.2 2002/12/01 22:59:19 larsbj Exp $
4 ** Definition of QGridView class
8 ** Copyright (C) 1992-2001 Trolltech AS. All rights reserved.
10 ** This file is part of the widgets module of the Qt GUI Toolkit.
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.
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.
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
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.
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.
33 ** Contact info@trolltech.com if any conditions of this licensing are
36 **********************************************************************/
41 #include <qscrollview.h>
43 #ifndef QT_NO_GRIDVIEW
45 class QGridViewPrivate;
47 class Q_EXPORT QGridView : public QScrollView
50 Q_PROPERTY( int numRows READ numRows WRITE setNumRows )
51 Q_PROPERTY( int numCols READ numCols WRITE setNumCols )
52 Q_PROPERTY( int cellWidth READ cellWidth WRITE setCellWidth )
53 Q_PROPERTY( int cellHeight READ cellHeight WRITE setCellHeight )
56 QGridView( QWidget *parent=0, const char *name=0, WFlags f=0 );
60 virtual void setNumRows( int );
62 virtual void setNumCols( int );
64 int cellWidth() const;
65 virtual void setCellWidth( int );
66 int cellHeight() const;
67 virtual void setCellHeight( int );
69 QRect cellRect() const;
70 QRect cellGeometry( int row, int column );
71 QSize gridSize() const;
73 int rowAt( int y ) const;
74 int columnAt( int x ) const;
76 void repaintCell( int row, int column, bool erase=TRUE );
77 void updateCell( int row, int column );
78 void ensureCellVisible( int row, int column );
81 virtual void paintCell( QPainter *, int row, int col ) = 0;
82 virtual void paintEmptyArea( QPainter *p, int cx, int cy, int cw, int ch );
84 void drawContents( QPainter *p, int cx, int cy, int cw, int ch );
86 virtual void dimensionChange( int, int );
89 void drawContents( QPainter* );
98 private: // Disabled copy constructor and operator=
99 #if defined(Q_DISABLE_COPY)
100 QGridView( const QGridView & );
101 QGridView &operator=( const QGridView & );
105 inline int QGridView::cellWidth() const
108 inline int QGridView::cellHeight() const
111 inline int QGridView::rowAt( int y ) const
112 { return y / cellh; }
114 inline int QGridView::columnAt( int x ) const
115 { return x / cellw; }
117 inline int QGridView::numRows() const
120 inline int QGridView::numCols() const
123 inline QRect QGridView::cellRect() const
124 { return QRect( 0, 0, cellw, cellh ); }
126 inline QSize QGridView::gridSize() const
127 { return QSize( ncols * cellw, nrows * cellh ); }
131 #endif // QT_NO_GRIDVIEW
134 #endif // QTABLEVIEW_H