20 class TreeItem:public MapItem
23 enum Type {Undefined,MapCenter,Branch,Image}; //FIXME-3 MapCenter still needed?
24 enum HideTmpMode {HideNone, HideExport};
27 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
31 // General housekeeping
32 virtual void setModel (VymModel *m);
33 virtual VymModel* getModel();
36 /*! Return number of item, as it would be after it would have been appended.
37 This is used to notify view about layout changes before model is modified. */
38 virtual int getRowNumAppend (TreeItem *child);
40 virtual void appendChild (TreeItem *child);
41 virtual void removeChild (int row);
42 virtual void removeChildBranches ();
44 virtual TreeItem *child(int row);
45 virtual int childCount() const;
46 virtual int childNumber() const;
47 virtual int columnCount() const;
48 virtual int branchCount() const;
49 virtual int imageCount() const;
50 virtual int xlinkCount() const;
52 virtual int row() const;
53 virtual int column() const;
55 virtual TreeItem *parent();
57 /*! Return number of item in parent by type,
58 e.g. first branch has number 0 */
59 virtual int childNum(); //! Return number of item in list of all children
60 virtual int num(); //! Return number of item by type
61 virtual int num (TreeItem *item); //! Return number of item by type
66 virtual void setType (const Type t);
67 virtual Type getType ();
68 virtual bool isBranchLikeType() const;
69 virtual QString getTypeName ();
72 virtual QVariant data(int column) const;
78 virtual void setHeading (const QString s);
79 virtual QString getHeading() const;
80 virtual std::string getHeadingStd() const; //! convenience function used for debugging
81 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
82 virtual QColor getHeadingColor(); //! Returns color of heading
88 void setURL (const QString &url); //! Set URL
89 QString getURL (); //! Get URL
95 void setVymLink (const QString &url); //! Set URL
96 QString getVymLink (); //! Get URL
102 virtual void setNote(const QString &s);
103 virtual void clearNote();
104 virtual QString getNote();
105 virtual bool hasEmptyNote();
106 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true); //FIXME-1 setNoteObj is called for every select or so???
108 virtual NoteObj getNoteObj();
109 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
110 virtual QString getNoteASCII(); // returns note (ASCII)
111 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
115 FlagRow standardFlags;
118 virtual void activateStandardFlag(const QString &flag);
119 virtual void deactivateStandardFlag(const QString &flag);
120 virtual void deactivateAllStandardFlags();
122 /*! \brief Toggle a Flag
123 If master is not NULL,, only one Flag from FlagRow master may
124 be active simultanously, the others get deactivated.
126 virtual void toggleStandardFlag(const QString &flag, FlagRow *master=NULL);
127 virtual bool isActiveStandardFlag (const QString &flag);
128 virtual QStringList activeStandardFlagNames();
129 virtual FlagRow* getStandardFlagRow ();
131 virtual QStringList activeSystemFlagNames();
134 virtual bool canMoveDown();
135 virtual bool canMoveUp();
138 QString objID; //! id set during load/save currently used for xLinks
140 virtual void setID (const QString &s);
141 virtual QString getID ();
143 // Navigation and selection
144 virtual TreeItem* getChildNum(const int &n);
145 virtual BranchItem* getFirstBranch();
146 virtual BranchItem* getLastBranch();
148 /*! Get next branch after current branch. Return NULL if there is no
150 virtual BranchItem* getNextBranch(BranchItem* currentBranch);
152 virtual BranchItem* getBranchNum(const int &n);
153 virtual BranchObj* getBranchObjNum(const int &n);
154 virtual void setLastSelectedBranch(); //! Set myself as last selected in parent
155 virtual void setLastSelectedBranch(int i); //! Set last selected branch directly
156 virtual TreeItem* getLastSelectedBranch();
158 virtual ImageItem* getImageNum(const int &n);
159 virtual FloatImageObj* getImageObjNum(const int &n);
161 bool hideExport; //! Hide this item in export
163 virtual void setHideTmp (HideTmpMode);
164 virtual bool hasHiddenExportParent ();
165 virtual void setHideInExport(bool); // set export of object (and children)
166 virtual bool hideInExport();
167 virtual bool isHidden ();
168 virtual QString getAttr(); //! Get attributes for saving as XML
174 QList<TreeItem*> childItems;
175 QList<QVariant> itemData;
176 TreeItem *parentItem;
178 /*! Set rootItem (does not change, needed for quick check
179 if some branch is mapCenter */
184 int lastSelectedBranchNum;
189 bool hidden; //! Hidden in export if true