18 class TreeItem:public MapItem
21 enum Type {Undefined,MapCenter,Branch,Image};
22 enum HideTmpMode {HideNone, HideExport};
24 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
28 // General housekeeping
29 virtual void setModel (VymModel *m);
30 virtual VymModel* getModel();
32 virtual void appendChild (TreeItem *child);
33 virtual void removeChild (int row);
34 virtual void removeChildBranches ();
36 virtual TreeItem *child(int row);
37 virtual int childCount() const;
38 virtual int childNumber() const;
39 virtual int columnCount() const;
40 virtual int branchCount() const;
41 virtual int imageCount() const;
42 virtual int xlinkCount() const;
44 virtual int row() const;
45 virtual int column() const;
47 virtual TreeItem *parent();
49 /*! Return number of item in parent by type,
50 e.g. first branch has number 0 */
51 virtual int childNum(); //! Return number of item in list of all children
52 virtual int num(); //! Return number of item by type
53 virtual int num (TreeItem *item); //! Return number of item by type
58 virtual void setType (const Type t);
59 virtual Type getType ();
60 virtual bool isBranchLikeType() const;
61 virtual QString getTypeName ();
64 virtual QVariant data(int column) const;
70 virtual void setHeading (const QString s);
71 virtual QString getHeading() const;
72 virtual std::string getHeadingStd() const; //! convenience function used for debugging
73 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
74 virtual QColor getHeadingColor(); //! Returns color of heading
80 void setURL (const QString &url); //! Set URL
81 QString getURL (); //! Get URL
87 void setVymLink (const QString &url); //! Set URL
88 QString getVymLink (); //! Get URL
94 virtual void setNote(const QString &s);
95 virtual void clearNote();
96 virtual QString getNote();
97 virtual bool hasEmptyNote();
98 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true);
99 virtual NoteObj getNoteObj();
100 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
101 virtual QString getNoteASCII(); // returns note (ASCII)
102 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
106 FlagRow standardFlags;
109 virtual void activateStandardFlag(const QString &flag);
110 virtual void deactivateStandardFlag(const QString &flag);
111 virtual void deactivateAllStandardFlags();
113 /*! \brief Toggle a Flag
114 If master is not NULL,, only one Flag from FlagRow master may
115 be active simultanously, the others get deactivated.
117 virtual void toggleStandardFlag(const QString &flag, FlagRow *master=NULL);
118 virtual bool isActiveStandardFlag (const QString &flag);
119 virtual QStringList activeStandardFlagNames();
120 virtual FlagRow* getStandardFlagRow ();
122 virtual QStringList activeSystemFlagNames();
125 virtual bool canMoveDown();
126 virtual bool canMoveUp();
129 QString objID; //! id set during load/save currently used for xLinks
131 virtual void setID (const QString &s);
132 virtual QString getID ();
134 // Navigation and selection
135 virtual TreeItem* getChildNum(const int &n);
136 virtual BranchItem* getFirstBranch();
137 virtual BranchItem* getLastBranch();
139 /*! Get next branch after current branch. Return NULL if there is no
141 virtual BranchItem* getNextBranch(BranchItem* currentBranch);
143 virtual BranchItem* getBranchNum(const int &n);
144 virtual BranchObj* getBranchObjNum(const int &n);
145 virtual void setLastSelectedBranch(); //! Set myself as last selected in parent
146 virtual void setLastSelectedBranch(int i); //! Set last selected branch directly
147 virtual TreeItem* getLastSelectedBranch();
150 bool hideExport; //! Hide this item in export
152 virtual void setHideTmp (HideTmpMode);
153 virtual bool hasHiddenExportParent ();
154 virtual void setHideInExport(bool); // set export of object (and children)
155 virtual bool hideInExport();
156 virtual bool isHidden ();
162 QList<TreeItem*> childItems;
163 QList<QVariant> itemData;
164 TreeItem *parentItem;
166 /*! Set rootItem (does not change, needed for quick check
167 if some branch is mapCenter */
172 int lastSelectedBranchNum;
177 bool hidden; //! Hidden in export if true