22 enum Type {Undefined,MapCenter,Branch,Image};
23 enum HideTmpMode {HideNone, HideExport};
26 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
30 // General housekeeping
31 virtual void setModel (VymModel *m);
32 virtual VymModel* getModel();
35 /*! Return number of item, as it would be after it would have been appended.
36 This is used to notify view about layout changes before model is modified. */
37 virtual int getRowNumAppend (TreeItem *child);
39 virtual void appendChild (TreeItem *child);
40 virtual void removeChild (int row);
41 virtual void removeChildBranches ();
43 virtual TreeItem *child(int row);
44 virtual int childCount() const;
45 virtual int childNumber() const;
46 virtual int columnCount() const;
47 virtual int branchCount() const;
48 virtual int imageCount() const;
49 virtual int xlinkCount() const;
51 virtual int row() const;
52 virtual int column() const;
54 virtual TreeItem *parent();
56 /*! Return number of item in parent by type,
57 e.g. first branch has number 0 */
58 virtual int childNum(); //! Return number of item in list of all children
59 virtual int num(); //! Return number of item by type
60 virtual int num (TreeItem *item); //! Return number of item by type
65 virtual void setType (const Type t);
66 virtual Type getType ();
67 virtual bool isBranchLikeType() const;
68 virtual QString getTypeName ();
71 virtual QVariant data(int column) const;
77 virtual void setHeading (const QString s);
78 virtual QString getHeading() const;
79 virtual std::string getHeadingStd() const; //! convenience function used for debugging
80 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
81 virtual QColor getHeadingColor(); //! Returns color of heading
87 void setURL (const QString &url); //! Set URL
88 QString getURL (); //! Get URL
94 void setVymLink (const QString &url); //! Set URL
95 QString getVymLink (); //! Get URL
101 virtual void setNote(const QString &s);
102 virtual void clearNote();
103 virtual QString getNote();
104 virtual bool hasEmptyNote();
105 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true); //FIXME-1 setNoteObj is called for every select or so???
107 virtual NoteObj getNoteObj();
108 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
109 virtual QString getNoteASCII(); // returns note (ASCII)
110 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
114 FlagRow standardFlags;
117 virtual void activateStandardFlag(const QString &flag);
118 virtual void deactivateStandardFlag(const QString &flag);
119 virtual void deactivateAllStandardFlags();
121 /*! \brief Toggle a Flag
122 If master is not NULL,, only one Flag from FlagRow master may
123 be active simultanously, the others get deactivated.
125 virtual void toggleStandardFlag(const QString &flag, FlagRow *master=NULL);
126 virtual bool isActiveStandardFlag (const QString &flag);
127 virtual QStringList activeStandardFlagNames();
128 virtual FlagRow* getStandardFlagRow ();
130 virtual QStringList activeSystemFlagNames();
133 virtual bool canMoveDown();
134 virtual bool canMoveUp();
137 QString objID; //! id set during load/save currently used for xLinks
139 virtual void setID (const QString &s);
140 virtual QString getID ();
142 // Navigation and selection
143 virtual TreeItem* getChildNum(const int &n);
144 virtual BranchItem* getFirstBranch();
145 virtual BranchItem* getLastBranch();
147 /*! Get next branch after current branch. Return NULL if there is no
149 virtual BranchItem* getNextBranch(BranchItem* currentBranch);
151 virtual BranchItem* getBranchNum(const int &n);
152 virtual BranchObj* getBranchObjNum(const int &n);
153 virtual void setLastSelectedBranch(); //! Set myself as last selected in parent
154 virtual void setLastSelectedBranch(int i); //! Set last selected branch directly
155 virtual TreeItem* getLastSelectedBranch();
157 virtual ImageItem* getImageNum(const int &n);
158 virtual FloatImageObj* getImageObjNum(const int &n);
160 bool hideExport; //! Hide this item in export
162 virtual void setHideTmp (HideTmpMode);
163 virtual bool hasHiddenExportParent ();
164 virtual void setHideInExport(bool); // set export of object (and children)
165 virtual bool hideInExport();
166 virtual bool isHidden ();
172 QList<TreeItem*> childItems;
173 QList<QVariant> itemData;
174 TreeItem *parentItem;
176 /*! Set rootItem (does not change, needed for quick check
177 if some branch is mapCenter */
182 int lastSelectedBranchNum;
187 bool hidden; //! Hidden in export if true