]> git.sven.stormbind.net Git - sven/vym.git/blob - branchitem.h
207ab0cc69b95cb68d5301d48ce61b308204b5ae
[sven/vym.git] / branchitem.h
1 #ifndef BRANCHITEM_H
2 #define BRANCHITEM_H
3
4 #include "mapitem.h"
5 #include "task.h"
6
7 #include <QList>
8
9 class QString;
10 class QGraphicsScene;
11 class BranchObj;
12 class Link;
13 class XLinkItem;
14
15 class BranchItem:public MapItem
16 {
17 public:
18     enum LayoutHint {AutoPositioning, FreePositioning};
19
20     BranchItem(const QList<QVariant> &data, TreeItem *parent = 0);
21     virtual ~BranchItem();
22     virtual void clear();
23     virtual void copy (BranchItem *item);
24     virtual BranchItem* parentBranch();
25
26     virtual void insertBranch (int pos,BranchItem *branch);
27
28     virtual QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset,QList <Link*> &tmpLinks);
29
30     virtual void updateVisibility();
31
32     virtual void setHeadingColor (QColor color); //!Overloaded from TreeItem to update QGraphicsView
33
34 protected:  
35     bool scrolled;      // true if all children are scrolled and thus invisible
36     bool tmpUnscrolled;     // can only be true (temporary) for a scrolled subtree
37
38 public:
39     void updateTaskFlag();
40     void setTask (Task* t);
41     Task* getTask();
42 private:
43     Task* task;
44
45 public:
46     virtual void unScroll();            
47     virtual bool toggleScroll();        // scroll or unscroll
48     virtual bool isScrolled();          // returns scroll state
49     virtual bool hasScrolledParent(BranchItem* start=NULL);    // true, if any of the parents is scrolled
50     virtual bool tmpUnscroll(BranchItem* start=NULL);           // unscroll scrolled parents temporary e.g. during "find" process
51     virtual bool resetTmpUnscroll();        // scroll all tmp scrolled parents again e.g. when unselecting
52     virtual void sortChildren(bool inverse=false);  //! Sort children 
53     virtual void setChildrenLayout(BranchItem::LayoutHint layoutHint);
54     virtual BranchItem::LayoutHint getChildrenLayout();
55
56 protected:
57     bool includeImagesVer;      //! include floatimages in bbox vertically
58     bool includeImagesHor;      //! include floatimages in bbox horizontally
59     bool includeChildren;       //! include children in frame
60     LayoutHint childrenLayout;  //! should children be positioned freely?
61
62 public:
63     void setIncludeImagesVer(bool);
64     bool getIncludeImagesVer();
65     void setIncludeImagesHor(bool);
66     bool getIncludeImagesHor();
67     QString getIncludeImageAttr();
68     BranchItem* getFramedParentBranch(BranchItem *start);
69     void setFrameIncludeChildren(bool);
70     bool getFrameIncludeChildren();
71
72 protected:
73     int lastSelectedBranchNum;
74     int lastSelectedBranchNumAlt;
75 public:
76     virtual void setLastSelectedBranch();       //! Set myself as last selected in parent
77     virtual void setLastSelectedBranch(int i);      //! Set last selected branch directly
78     virtual BranchItem* getLastSelectedBranch();    //! Returns last selected branch usually
79     virtual BranchItem* getLastSelectedBranchAlt(); //! Used to return last selected branch left of a mapcenter
80
81 public:
82     TreeItem* findMapItem (QPointF p,TreeItem* excludeTI);  //! search map for branches or images. Ignore excludeTI, where search is started 
83
84     virtual void updateStyles (const bool &keepFrame=false);        //! update related fonts, parObjects, links, ...
85     virtual BranchObj* getBranchObj();  
86     virtual BranchObj* createMapObj(QGraphicsScene *scene); //! Create classic object in GraphicsView
87 };
88
89 #endif