Wed, 07 Jan 2009 18:49:25 +0100
Bump copyright year number.
michael@1 | 1 | // |
michael@1 | 2 | // OSSP asgui - Accounting system graphical user interface |
michael@12 | 3 | // Copyright (c) 2002-2009 The OSSP Project (http://www.ossp.org/) |
michael@12 | 4 | // Copyright (c) 2002-2009 Ralf S. Engelschall <rse@engelschall.com> |
michael@12 | 5 | // Copyright (c) 2002-2009 Michael Schloh von Bennewitz <michael@schloh.com> |
michael@12 | 6 | // Copyright (c) 2002-2009 Cable & Wireless Telecommunications Services GmbH |
michael@1 | 7 | // |
michael@1 | 8 | // This file is part of OSSP asgui, an accounting system graphical user |
michael@3 | 9 | // interface which can be found at http://asgui.europalab.com/. |
michael@1 | 10 | // |
michael@1 | 11 | // Permission to use, copy, modify, and distribute this software for |
michael@1 | 12 | // any purpose with or without fee is hereby granted, provided that |
michael@1 | 13 | // the above copyright notice and this permission notice appear in all |
michael@1 | 14 | // copies. |
michael@1 | 15 | // |
michael@1 | 16 | // THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@1 | 17 | // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@1 | 18 | // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@1 | 19 | // IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@1 | 20 | // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@1 | 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@1 | 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@1 | 23 | // USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@1 | 24 | // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@1 | 25 | // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@1 | 26 | // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@1 | 27 | // SUCH DAMAGE. |
michael@1 | 28 | // |
michael@1 | 29 | // as_table.h: ISO C++ interface |
michael@1 | 30 | // |
michael@1 | 31 | |
michael@1 | 32 | #ifndef TITABLE_H |
michael@1 | 33 | #define TITABLE_H |
michael@1 | 34 | |
michael@3 | 35 | #include <q3table.h> |
michael@3 | 36 | |
michael@3 | 37 | //Added by qt3to4: |
michael@3 | 38 | #include <QEvent> |
michael@1 | 39 | |
michael@1 | 40 | #include "as_pref.h" |
michael@1 | 41 | |
michael@1 | 42 | |
michael@3 | 43 | class TiTable : public Q3Table |
michael@1 | 44 | { |
michael@1 | 45 | Q_OBJECT |
michael@1 | 46 | |
michael@1 | 47 | private: |
michael@1 | 48 | int m_nSortcol; // To track current sort column |
michael@1 | 49 | int m_bSortdir; // To track current sort direction |
michael@1 | 50 | bool m_bDirt; // To track dirty and clean states |
michael@1 | 51 | Preferences *m_pTiprefs; // To read current color values |
michael@1 | 52 | |
michael@1 | 53 | public: |
michael@1 | 54 | // Try to match QTable's default constructor with an initializer list |
michael@3 | 55 | TiTable(Preferences *pPrefs, QWidget *pParent = 0, const char *szName = 0) : Q3Table(pParent, szName) |
michael@1 | 56 | { |
michael@1 | 57 | this->setSortcol(0); |
michael@1 | 58 | this->setSortdir(true); |
michael@1 | 59 | this->setDirty(false); |
michael@1 | 60 | this->setEdition(); // Reset edition state |
michael@1 | 61 | m_pTiprefs = pPrefs; |
michael@1 | 62 | horizontalHeader()->installEventFilter(this); |
michael@1 | 63 | }; |
michael@1 | 64 | |
michael@1 | 65 | bool eventFilter(QObject *, QEvent *); |
michael@1 | 66 | |
michael@1 | 67 | // Standard members |
michael@1 | 68 | int m_nEdit; // To track edition state |
michael@1 | 69 | |
michael@1 | 70 | // Accessor methods |
michael@1 | 71 | const bool isDirty(void) {return m_bDirt;}; // Check for changed state danger |
michael@1 | 72 | void setDirty(bool bDirty = true) {m_bDirt = bDirty;}; // Clean or dirty |
michael@1 | 73 | const int getEdition(void) {return m_nEdit;}; // Which edited column was confirmed |
michael@1 | 74 | void setEdition(const int nEdit = -1) {m_nEdit = nEdit;}; // Set edition status |
michael@1 | 75 | const int getSortcol(void) {return m_nSortcol;}; |
michael@1 | 76 | void setSortcol(const int nColin) {m_nSortcol = nColin;}; |
michael@1 | 77 | const bool getSortdir(void) {return m_bSortdir;}; |
michael@1 | 78 | void setSortdir(const bool bDirection) {m_bSortdir = bDirection;}; |
michael@1 | 79 | |
michael@1 | 80 | // Overridden accessors |
michael@1 | 81 | void setText(int, int, const QString &); |
michael@1 | 82 | void sortColumn(int nCol, bool bAscend = true, bool bWhole = true); |
michael@1 | 83 | // virtual QTableItem *item(int nRow, int nCol) const {return QTable::item(nRow, nCol);}; |
michael@1 | 84 | |
michael@1 | 85 | // Deny a cell special handling of the focus rectangle |
michael@1 | 86 | // by overriding class QTable's paintFocus method |
michael@1 | 87 | virtual void paintFocus(QPainter *, const QRect &) {}; |
michael@1 | 88 | |
michael@1 | 89 | // Override for special linewise shading according to sort key |
michael@1 | 90 | virtual void paintCell(QPainter *, int, int, const QRect &, bool, const QColorGroup &); |
michael@1 | 91 | |
michael@1 | 92 | // Override to properly handle read only attribute during edition |
michael@1 | 93 | virtual void endEdit(int, int, bool, bool); |
michael@1 | 94 | |
michael@1 | 95 | // For special focus handling on return key in edit mode |
michael@1 | 96 | virtual void activateNextCell(void); |
michael@1 | 97 | |
michael@1 | 98 | signals: |
michael@1 | 99 | void textEdited(int, int); // A cell was edited and data was modified |
michael@1 | 100 | }; |
michael@1 | 101 | |
michael@1 | 102 | #endif // TITABLE_H |