don't link against X11 on OS X
[mussa.git] / qui / SequenceLocationModel.hpp
1 #ifndef _SEQUENCE_LOCATION_MODEL_HPP_
2 #define _SEQUENCE_LOCATION_MODEL_HPP_
3
4 #include <QAbstractTableModel>
5 #include "alg/sequence_location.hpp"
6 #include <vector>
7
8 class SequenceLocationModel : public QAbstractTableModel
9 {
10   Q_OBJECT
11
12   public:
13     SequenceLocationModel(QObject *parent = 0);
14
15     typedef std::vector<SequenceLocation> model_type;
16     typedef model_type::size_type size_type;
17     typedef model_type::iterator iterator; 
18     typedef model_type::const_iterator const_iterator; 
19     //! \defgroup VectorInterface
20     //! \addtogroup VectorInterface
21     //! \@{
22     //! assign num copies of val to our vector
23     void assign(size_type num, const SequenceLocation& val);
24     //! return a specific element
25     SequenceLocation& at(size_type index);
26     //! return the last element
27     SequenceLocation& back();
28     //! return an iterator to the beginning of the model
29     iterator begin();
30     //! return an iterator to the beginning of the model
31     const_iterator begin() const;
32     //! empty the model
33     void clear();
34     //! return an iterator to the end of the model
35     iterator end();
36     //! return an iterator to the end of the model
37     const_iterator end() const;
38     //! is the model empty?
39     bool empty() const;
40     //! return a specific element
41     SequenceLocation& operator[](size_type index);
42     //! remove the last element from our model
43     void pop_back();
44     //! add a sequence location to the end of our model
45     void push_back(SequenceLocation&);
46     //! how many elements are in our model.
47     size_type size() const;
48     //! \@}
49
50     //! \defgroup QtModelInterface
51     //! \addtogroup QtModel
52     //! \@{
53     int rowCount(const QModelIndex& parent=QModelIndex()) const;
54     int columnCount(const QModelIndex& parent=QModelIndex()) const;
55     QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const;
56
57     QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const;
58
59     bool setData(const QModelIndex& index, const QVariant &value, 
60                  int role=Qt::EditRole);
61     Qt::ItemFlags flags(const QModelIndex& index) const;
62
63     //bool insertRows(int row, int count, 
64     //                const QModelIndex& parent=QModelIndex());
65     //bool removeRows(int row, int count,
66     //                const QModelIndex& parent=QModelIndex());
67     //! \@}
68   private:
69     model_type sequence_locations;
70 };
71
72 #endif