3 // Copyright by Johannes Sixt
4 // This file is under GPL, the GNU General Public Licence
13 class TableView
: public QWidget
17 TableView(QWidget
* parent
, const char* name
, WFlags f
);
20 void setNumCols(int cols
);
21 int numCols() const { return m_numCols
; }
22 void setNumRows(int rows
);
23 int numRows() const { return m_numRows
; }
24 void setAutoUpdate(bool update
) { m_autoUpdate
= update
; }
25 bool autoUpdate() const { return m_autoUpdate
; }
26 void updateTableSize();
27 int totalWidth() const { return m_totalSize
.width(); }
28 int totalHeight() const { return m_totalSize
.height(); }
29 int lastRowVisible() const;
30 void setTopCell(int row
);
33 void setXOffset(int x
) { setOffset(x
, yOffset()); }
34 int xOffset() const { return m_xOffset
; }
35 int maxXOffset() const;
36 void setYOffset(int y
) { setOffset(xOffset(), y
); }
37 int yOffset() const { return m_yOffset
; }
38 int maxYOffset() const;
39 void setOffset(int x
, int y
);
40 int viewWidth() const;
41 int viewHeight() const;
42 bool rowIsVisible(int row
) const;
43 int findRow(int y
) const;
44 bool rowYPos(int row
, int* top
) const;
45 int findCol(int x
) const;
46 bool colXPos(int col
, int* left
) const;
47 void updateCell(int row
, int col
, bool erase
= true);
49 // override in derived classes
50 virtual int cellWidth(int col
) const = 0;
51 virtual int cellHeight(int row
) const = 0;
52 virtual void paintCell(QPainter
* p
, int row
, int col
) = 0;
53 virtual void setupPainter(QPainter
* p
);
57 virtual void resizeEvent(QResizeEvent
* ev
);
58 virtual void paintEvent(QPaintEvent
* ev
);
59 virtual void wheelEvent(QWheelEvent
* ev
);
62 void sbVer(int value
);
63 void sbHor(int value
);
66 int m_numRows
, m_numCols
;
67 int m_xOffset
, m_yOffset
;
73 void updateScrollBars();