X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Ftreemodel.h;fp=src%2Ftreemodel.h;h=af8a937cc48b43ad45e00db8905f3b04394cd659;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=0000000000000000000000000000000000000000;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/src/treemodel.h b/src/treemodel.h new file mode 100644 index 0000000..af8a937 --- /dev/null +++ b/src/treemodel.h @@ -0,0 +1,53 @@ +#ifndef TREEMODEL_H +#define TREEMODEL_H + +#include +#include +#include + +class BranchItem; +class TreeItem; +class Link; +class LinkableMapObj; + +class TreeModel : public QAbstractItemModel { + Q_OBJECT + + public: + TreeModel(QObject *parent = 0); + ~TreeModel(); + + QVariant data(const QModelIndex &index, int role) const; + Qt::ItemFlags flags(const QModelIndex &index) const; + QVariant headerData(int section, Qt::Orientation orientation, + int role = Qt::DisplayRole) const; + QModelIndex index(TreeItem *ti); + QModelIndex index(int row, int column, + const QModelIndex &parent = QModelIndex()) const; + QModelIndex parent(const QModelIndex &index) const; + int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + + void nextBranch(BranchItem *¤t, BranchItem *&previous, + bool deepLevelsFirst = false, BranchItem *start = NULL); + + bool removeRows(int row, int count, + const QModelIndex &parent = QModelIndex()); + + TreeItem *getItem(const QModelIndex &index) const; + BranchItem *getRootItem(); + + virtual int xlinkCount(); + virtual Link *getXLinkNum(const int &n); + + protected: + BranchItem *rootItem; + + QList xlinks; + QList deleteLaterIDs; + + QColor backgroundColor; // Set in VymModel to optimize backgroundRole + QColor selectionColor; // Set in VymModel to optimize highlightedText palette +}; + +#endif