Warning, file /sdk/cervisia/qttableview.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /********************************************************************** 0002 ** $Id$ 0003 ** 0004 ** Definition of QtTableView class 0005 ** 0006 ** Created : 941115 0007 ** 0008 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 0009 ** 0010 ** This file contains a class moved out of the Qt GUI Toolkit API. It 0011 ** may be used, distributed and modified without limitation. 0012 ** 0013 **********************************************************************/ 0014 0015 #ifndef QTTABLEVIEW_H 0016 #define QTTABLEVIEW_H 0017 0018 #ifndef QT_H 0019 #include "qframe.h" 0020 #endif // QT_H 0021 0022 #ifndef QT_NO_QTTABLEVIEW 0023 0024 class QScrollBar; 0025 class QCornerSquare; 0026 0027 class QtTableView : public QFrame 0028 { 0029 Q_OBJECT 0030 public: 0031 void repaint(bool erase = true); 0032 void repaint(int x, int y, int w, int h, bool erase = true); 0033 void repaint(const QRect &, bool erase = true); 0034 0035 protected: 0036 QtTableView(QWidget *parent = nullptr, const char *name = 0); 0037 ~QtTableView() override; 0038 0039 int numRows() const; 0040 virtual void setNumRows(int); 0041 int numCols() const; 0042 virtual void setNumCols(int); 0043 0044 int topCell() const; 0045 virtual void setTopCell(int row); 0046 int leftCell() const; 0047 virtual void setLeftCell(int col); 0048 virtual void setTopLeftCell(int row, int col); 0049 0050 int xOffset() const; 0051 virtual void setXOffset(int); 0052 int yOffset() const; 0053 virtual void setYOffset(int); 0054 virtual void setOffset(int x, int y, bool updateScrBars = true); 0055 0056 virtual int cellWidth(int col); 0057 virtual int cellHeight(int row); 0058 int cellWidth() const; 0059 int cellHeight() const; 0060 virtual void setCellWidth(int); 0061 virtual void setCellHeight(int); 0062 0063 virtual int totalWidth(); 0064 virtual int totalHeight(); 0065 0066 uint tableFlags() const; 0067 bool testTableFlags(uint f) const; 0068 virtual void setTableFlags(uint f); 0069 void clearTableFlags(uint f = ~0); 0070 0071 bool autoUpdate() const; 0072 virtual void setAutoUpdate(bool); 0073 0074 void updateCell(int row, int column, bool erase = true); 0075 0076 QRect cellUpdateRect() const; 0077 QRect viewRect() const; 0078 0079 int lastRowVisible() const; 0080 int lastColVisible() const; 0081 0082 bool rowIsVisible(int row) const; 0083 bool colIsVisible(int col) const; 0084 0085 QScrollBar *verticalScrollBar() const; 0086 QScrollBar *horizontalScrollBar() const; 0087 0088 private slots: 0089 void horSbValue(int); 0090 void horSbSliding(int); 0091 void horSbSlidingDone(); 0092 void verSbValue(int); 0093 void verSbSliding(int); 0094 void verSbSlidingDone(); 0095 0096 protected: 0097 virtual void paintCell(QPainter *, int row, int col) = 0; 0098 virtual void setupPainter(QPainter *); 0099 0100 void paintEvent(QPaintEvent *) override; 0101 void resizeEvent(QResizeEvent *) override; 0102 void showEvent(QShowEvent *) override; 0103 void wheelEvent(QWheelEvent *e) override; 0104 0105 int findRow(int yPos) const; 0106 int findCol(int xPos) const; 0107 0108 bool rowYPos(int row, int *yPos) const; 0109 bool colXPos(int col, int *xPos) const; 0110 0111 int maxXOffset(); 0112 int maxYOffset(); 0113 int maxColOffset(); 0114 int maxRowOffset(); 0115 0116 int minViewX() const; 0117 int minViewY() const; 0118 int maxViewX() const; 0119 int maxViewY() const; 0120 int viewWidth() const; 0121 int viewHeight() const; 0122 0123 void scroll(int xPixels, int yPixels); 0124 void updateScrollBars(); 0125 void updateTableSize(); 0126 0127 private: 0128 void coverCornerSquare(bool); 0129 void snapToGrid(bool horizontal, bool vertical); 0130 virtual void setHorScrollBar(bool on, bool update = true); 0131 virtual void setVerScrollBar(bool on, bool update = true); 0132 void updateView(); 0133 int findRawRow(int yPos, int *cellMaxY, int *cellMinY = 0, bool goOutsideView = false) const; 0134 int findRawCol(int xPos, int *cellMaxX, int *cellMinX = 0, bool goOutsideView = false) const; 0135 int maxColsVisible() const; 0136 0137 void updateScrollBars(uint); 0138 void updateFrameSize(); 0139 0140 void doAutoScrollBars(); 0141 void showOrHideScrollBars(); 0142 0143 int nRows; 0144 int nCols; 0145 int xOffs, yOffs; 0146 int xCellOffs, yCellOffs; 0147 short xCellDelta, yCellDelta; 0148 short cellH, cellW; 0149 0150 uint eraseInPaint : 1; 0151 uint verSliding : 1; 0152 uint verSnappingOff : 1; 0153 uint horSliding : 1; 0154 uint horSnappingOff : 1; 0155 uint coveringCornerSquare : 1; 0156 uint sbDirty : 8; 0157 uint inSbUpdate : 1; 0158 0159 uint tFlags; 0160 QRect cellUpdateR; 0161 0162 QScrollBar *vScrollBar; 0163 QScrollBar *hScrollBar; 0164 QCornerSquare *cornerSquare; 0165 0166 private: // Disabled copy constructor and operator= 0167 #if defined(Q_DISABLE_COPY) 0168 QtTableView(const QtTableView &); 0169 QtTableView &operator=(const QtTableView &); 0170 #endif 0171 }; 0172 0173 const uint Tbl_vScrollBar = 0x00000001; 0174 const uint Tbl_hScrollBar = 0x00000002; 0175 const uint Tbl_autoVScrollBar = 0x00000004; 0176 const uint Tbl_autoHScrollBar = 0x00000008; 0177 const uint Tbl_autoScrollBars = 0x0000000C; 0178 0179 const uint Tbl_clipCellPainting = 0x00000100; 0180 const uint Tbl_cutCellsV = 0x00000200; 0181 const uint Tbl_cutCellsH = 0x00000400; 0182 const uint Tbl_cutCells = 0x00000600; 0183 0184 const uint Tbl_scrollLastHCell = 0x00000800; 0185 const uint Tbl_scrollLastVCell = 0x00001000; 0186 const uint Tbl_scrollLastCell = 0x00001800; 0187 0188 const uint Tbl_smoothHScrolling = 0x00002000; 0189 const uint Tbl_smoothVScrolling = 0x00004000; 0190 const uint Tbl_smoothScrolling = 0x00006000; 0191 0192 const uint Tbl_snapToHGrid = 0x00008000; 0193 const uint Tbl_snapToVGrid = 0x00010000; 0194 const uint Tbl_snapToGrid = 0x00018000; 0195 0196 inline int QtTableView::numRows() const 0197 { 0198 return nRows; 0199 } 0200 0201 inline int QtTableView::numCols() const 0202 { 0203 return nCols; 0204 } 0205 0206 inline int QtTableView::topCell() const 0207 { 0208 return yCellOffs; 0209 } 0210 0211 inline int QtTableView::leftCell() const 0212 { 0213 return xCellOffs; 0214 } 0215 0216 inline int QtTableView::xOffset() const 0217 { 0218 return xOffs; 0219 } 0220 0221 inline int QtTableView::yOffset() const 0222 { 0223 return yOffs; 0224 } 0225 0226 inline int QtTableView::cellHeight() const 0227 { 0228 return cellH; 0229 } 0230 0231 inline int QtTableView::cellWidth() const 0232 { 0233 return cellW; 0234 } 0235 0236 inline uint QtTableView::tableFlags() const 0237 { 0238 return tFlags; 0239 } 0240 0241 inline bool QtTableView::testTableFlags(uint f) const 0242 { 0243 return (tFlags & f) != 0; 0244 } 0245 0246 inline QRect QtTableView::cellUpdateRect() const 0247 { 0248 return cellUpdateR; 0249 } 0250 0251 inline bool QtTableView::autoUpdate() const 0252 { 0253 return updatesEnabled(); 0254 } 0255 0256 inline void QtTableView::repaint(bool erase) 0257 { 0258 repaint(0, 0, width(), height(), erase); 0259 } 0260 0261 inline void QtTableView::repaint(const QRect &r, bool erase) 0262 { 0263 repaint(r.x(), r.y(), r.width(), r.height(), erase); 0264 } 0265 0266 inline void QtTableView::updateScrollBars() 0267 { 0268 updateScrollBars(0); 0269 } 0270 0271 #endif // QT_NO_QTTABLEVIEW 0272 0273 #endif // QTTABLEVIEW_H