svcore
1.9
|
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 00002 00003 /* 00004 Sonic Visualiser 00005 An audio file viewer and annotation editor. 00006 Centre for Digital Music, Queen Mary, University of London. 00007 This file copyright 2008 QMUL. 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. See the file 00013 COPYING included with this distribution for more information. 00014 */ 00015 00016 #ifndef _TABULAR_MODEL_H_ 00017 #define _TABULAR_MODEL_H_ 00018 00019 #include <QVariant> 00020 #include <QString> 00021 00022 class Command; 00023 00034 class TabularModel 00035 { 00036 public: 00037 virtual ~TabularModel() { } 00038 00039 virtual int getRowCount() const = 0; 00040 virtual int getColumnCount() const = 0; 00041 00042 virtual QString getHeading(int column) const = 0; 00043 00044 enum { SortRole = Qt::UserRole }; 00045 enum SortType { SortNumeric, SortAlphabetical }; 00046 00047 virtual QVariant getData(int row, int column, int role) const = 0; 00048 virtual bool isColumnTimeValue(int col) const = 0; 00049 virtual SortType getSortType(int col) const = 0; 00050 00051 virtual long getFrameForRow(int row) const = 0; 00052 virtual int getRowForFrame(long frame) const = 0; 00053 00054 virtual bool isEditable() const { return false; } 00055 virtual Command *getSetDataCommand(int /* row */, int /* column */, const QVariant &, int /* role */) { return 0; } 00056 virtual Command *getInsertRowCommand(int /* beforeRow */) { return 0; } 00057 virtual Command *getRemoveRowCommand(int /* row */) { return 0; } 00058 }; 00059 00060 #endif