author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 19 Feb 2010 23:40:16 +0200 | |
branch | RCL_3 |
changeset 4 | 3b1da2848fc7 |
parent 0 | 1918ee327afb |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the Qt3Support module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef Q3GRIDVIEW_H |
|
43 |
#define Q3GRIDVIEW_H |
|
44 |
||
45 |
#include <Qt3Support/q3scrollview.h> |
|
46 |
||
47 |
QT_BEGIN_HEADER |
|
48 |
||
49 |
QT_BEGIN_NAMESPACE |
|
50 |
||
51 |
QT_MODULE(Qt3SupportLight) |
|
52 |
||
53 |
class Q3GridViewPrivate; |
|
54 |
||
55 |
class Q_COMPAT_EXPORT Q3GridView : public Q3ScrollView |
|
56 |
{ |
|
57 |
Q_OBJECT |
|
58 |
Q_PROPERTY(int numRows READ numRows WRITE setNumRows) |
|
59 |
Q_PROPERTY(int numCols READ numCols WRITE setNumCols) |
|
60 |
Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth) |
|
61 |
Q_PROPERTY(int cellHeight READ cellHeight WRITE setCellHeight) |
|
62 |
public: |
|
63 |
||
64 |
Q3GridView(QWidget *parent=0, const char *name=0, Qt::WindowFlags f=0); |
|
65 |
~Q3GridView(); |
|
66 |
||
67 |
int numRows() const; |
|
68 |
virtual void setNumRows(int); |
|
69 |
int numCols() const; |
|
70 |
virtual void setNumCols(int); |
|
71 |
||
72 |
int cellWidth() const; |
|
73 |
virtual void setCellWidth(int); |
|
74 |
int cellHeight() const; |
|
75 |
virtual void setCellHeight(int); |
|
76 |
||
77 |
QRect cellRect() const; |
|
78 |
QRect cellGeometry(int row, int column); |
|
79 |
QSize gridSize() const; |
|
80 |
||
81 |
int rowAt(int y) const; |
|
82 |
int columnAt(int x) const; |
|
83 |
||
84 |
void repaintCell(int row, int column, bool erase=true); |
|
85 |
void updateCell(int row, int column); |
|
86 |
void ensureCellVisible(int row, int column); |
|
87 |
||
88 |
protected: |
|
89 |
virtual void paintCell(QPainter *, int row, int col) = 0; |
|
90 |
virtual void paintEmptyArea(QPainter *p, int cx, int cy, int cw, int ch); |
|
91 |
||
92 |
void drawContents(QPainter *p, int cx, int cy, int cw, int ch); |
|
93 |
||
94 |
virtual void dimensionChange(int, int); |
|
95 |
||
96 |
private: |
|
97 |
void drawContents(QPainter*); |
|
98 |
void updateGrid(); |
|
99 |
||
100 |
int nrows; |
|
101 |
int ncols; |
|
102 |
int cellw; |
|
103 |
int cellh; |
|
104 |
Q3GridViewPrivate* d; |
|
105 |
||
106 |
Q_DISABLE_COPY(Q3GridView) |
|
107 |
}; |
|
108 |
||
109 |
inline int Q3GridView::cellWidth() const |
|
110 |
{ return cellw; } |
|
111 |
||
112 |
inline int Q3GridView::cellHeight() const |
|
113 |
{ return cellh; } |
|
114 |
||
115 |
inline int Q3GridView::rowAt(int y) const |
|
116 |
{ return y / cellh; } |
|
117 |
||
118 |
inline int Q3GridView::columnAt(int x) const |
|
119 |
{ return x / cellw; } |
|
120 |
||
121 |
inline int Q3GridView::numRows() const |
|
122 |
{ return nrows; } |
|
123 |
||
124 |
inline int Q3GridView::numCols() const |
|
125 |
{return ncols; } |
|
126 |
||
127 |
inline QRect Q3GridView::cellRect() const |
|
128 |
{ return QRect(0, 0, cellw, cellh); } |
|
129 |
||
130 |
inline QSize Q3GridView::gridSize() const |
|
131 |
{ return QSize(ncols * cellw, nrows * cellh); } |
|
132 |
||
133 |
QT_END_NAMESPACE |
|
134 |
||
135 |
QT_END_HEADER |
|
136 |
||
137 |
#endif // Q3GRIDVIEW_H |