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