17 class TreeItem:public MapItem
20 enum Type {Undefined,MapCenter,Branch,Image};
21 enum HideTmpMode {HideNone, HideExport};
23 TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
27 virtual QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset);
30 // General housekeeping
31 virtual void setModel (VymModel *m);
32 virtual VymModel* getModel();
34 virtual void appendChild (TreeItem *child);
35 virtual void removeChild (int row);
37 virtual TreeItem *child(int row);
38 virtual int childCount() const;
39 virtual int childNumber() const;
40 virtual int columnCount() const;
41 virtual int branchCount() const;
42 virtual int imageCount() const;
43 virtual int xlinkCount() const;
45 virtual int row() const;
46 virtual int column() const;
48 virtual TreeItem *parent();
50 /*! Return number of item in parent by type,
51 e.g. first branch has number 0 */
52 virtual int childNum(); //! Return number of item in list of all children
53 virtual int num(); //! Return number of item by type
54 virtual int num (TreeItem *item); //! Return number of item by type
57 virtual QVariant data(int column) const;
62 virtual void setHeading (const QString s);
63 virtual QString getHeading() const;
64 virtual std::string getHeadingStd() const; //! convenience function used for debugging
65 virtual void setHeadingColor(QColor color); //! Set color of heading. In BranchItem overloaded to update QGraphicsView
66 virtual QColor getHeadingColor(); //! Returns color of heading
71 virtual void setNote(const QString s);
72 virtual QString getNote();
73 virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true);
74 virtual NoteObj getNoteObj();
75 virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII)
76 virtual QString getNoteASCII(); // returns note (ASCII)
77 virtual QString getNoteOpenDoc(); // returns note (OpenDoc)
82 virtual void setType (const Type t);
83 virtual Type getType ();
84 virtual bool isBranchLikeType() const;
85 virtual QString getTypeName ();
88 QString objID; //! id set during load/save currently used for xLinks
90 virtual void setID (const QString &s);
91 virtual QString getID ();
93 // Navigation and selection
94 virtual TreeItem* getChildNum(const int &n);
95 virtual BranchItem* getFirstBranch();
96 virtual BranchItem* getLastBranch();
98 /*! Get next branch after current branch. Return NULL if there is no
100 virtual BranchItem* getNextBranch(BranchItem* currentBranch);
102 virtual BranchItem* getBranchNum(const int &n);
103 virtual BranchObj* getBranchObjNum(const int &n);
104 virtual void setLastSelectedBranch(); //! Set myself as last selected in parent
105 virtual void setLastSelectedBranch(int i); //! Set last selected branch directly
106 virtual TreeItem* getLastSelectedBranch();
108 virtual void setHideTmp (HideTmpMode);
109 virtual bool hasHiddenExportParent ();
110 virtual void setHideInExport(bool); // set export of object (and children)
111 virtual bool hideInExport();
112 virtual bool isHidden ();
118 QList<TreeItem*> childItems;
119 QList<QVariant> itemData;
120 TreeItem *parentItem;
124 int lastSelectedBranchNum;
129 bool hideExport;//! Hide this item in export
130 bool hidden; //! Hidden in export if true