branchobj.h
author insilmaril
Thu, 17 Jul 2008 09:27:20 +0000
branchrelease-1-12-maintained
changeset 39 e37153bea487
parent 0 7a96bd401351
child 2 608f976aa7bb
child 41 6f28020b33d1
child 83 e90f5bef70c8
permissions -rw-r--r--
removed pixel garbage on right side of exported images
     1 #ifndef BRANCHOBJ_H
     2 #define BRANCHOBJ_H
     3 
     4 #include "floatimageobj.h"
     5 #include "linkablemapobj.h"
     6 #include "ornamentedobj.h"
     7 
     8 class BranchObjPtrList : public QPtrList<BranchObj>
     9 {
    10 	virtual int compareItems (QPtrCollection::Item i, QPtrCollection::Item j);
    11 };
    12 
    13 /////////////////////////////////////////////////////////////////////////////
    14 class BranchObj:public OrnamentedObj {
    15 public:
    16     BranchObj ();
    17     BranchObj (QCanvas*);
    18     BranchObj (QCanvas*, LinkableMapObj* parent);
    19     ~BranchObj ();
    20 	bool operator< ( const BranchObj & );
    21 	bool operator== ( const BranchObj & );
    22     virtual void init ();
    23     virtual void copy (BranchObj*);
    24     void clear();
    25 	virtual int getNum();				// return number of this in parent
    26 	virtual int getNum(BranchObj*);		// return number of this in parent
    27 	virtual int getFloatImageNum(FloatImageObj*);		
    28 	virtual int countBranches();		
    29 	virtual int countFloatImages();		
    30     virtual void setParObjTmp (LinkableMapObj*,QPoint,int);// Only for moving Obj around
    31 	virtual void unsetParObjTmp();			// reuse original ParObj
    32 
    33 	virtual void unScroll();				
    34 	virtual void toggleScroll();			// scroll or unscroll
    35 	virtual bool isScrolled();				// returns scroll state
    36 	virtual bool hasScrolledParent(BranchObj*);	// true, if any of the parents is scrolled
    37 	virtual void tmpUnscroll();				// unscroll scrolled parents temporary e.g. during "find" process
    38 	virtual void resetTmpUnscroll();		// scroll all tmp scrolled parents again e.g. when unselecting
    39 
    40 	virtual void setVisibility(bool,int);	// set visibility
    41     virtual void setVisibility(bool);	    // set vis. for w
    42 	virtual void setLinkColor();			// set the color of link
    43 	virtual void setColor(QColor,bool);		// set the color of heading
    44 
    45 
    46 	BranchObj* first ();				// set Iterator to first LMO
    47 	BranchObj* next ();					// find next LMO after given one
    48 	BranchObj* getLastIterator();		// to interrupt and resume next iteration
    49 	void setLastIterator (BranchObj*);	// needed by next() 
    50 
    51     virtual void move (double x,double y);
    52     virtual void move (QPoint);
    53     virtual void moveBy (double x,double y);
    54     virtual void moveBy (QPoint);
    55     virtual void positionBBox();
    56     virtual void calcBBoxSize();
    57     virtual LinkableMapObj* findMapObj(QPoint,LinkableMapObj*);	// find MapObj 
    58     virtual void setHeading (QString);
    59     virtual void setURL (QString);
    60     virtual QString getURL ();
    61     virtual void setVymLink (QString);
    62     virtual QString getVymLink ();
    63 	virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data recursivly to tempdir
    64 	virtual LinkableMapObj* addFloatImage();
    65 	virtual LinkableMapObj* addFloatImage(FloatImageObj*);
    66 	virtual void removeFloatImage(FloatImageObj*);
    67     virtual FloatImageObj* getFirstFloatImage();
    68     virtual FloatImageObj* getLastFloatImage();
    69 	virtual FloatImageObj* getFloatImageNum(const uint &);
    70 protected:	
    71 	virtual void savePosInAngle();			// write pos in angle for resorting			
    72 public:	
    73     virtual BranchObj* addBranch();
    74     virtual BranchObj* addBranch(BranchObj*);		// makes deep copy of BranchObj
    75     virtual BranchObj* insertBranch(int);
    76     virtual BranchObj* insertBranch(BranchObj*,int);
    77     virtual void removeBranch(BranchObj*);  
    78     virtual void setLastSelectedBranch(BranchObj*);
    79     virtual BranchObj* getLastSelectedBranch();
    80     virtual BranchObj* getFirstBranch();
    81     virtual BranchObj* getLastBranch();
    82 	virtual BranchObj* getBranchNum(const uint &);
    83     virtual BranchObj* moveBranchUp(BranchObj*);
    84     virtual BranchObj* moveBranchDown(BranchObj*);
    85 
    86     virtual void alignRelativeTo(const QPoint );
    87 	virtual void reposition();
    88 
    89 	virtual QRect getTotalBBox();			// return BBox including childs			
    90 	virtual QRect getBBoxSizeWithChilds();	// return size of BBox including childs  
    91 	virtual void calcBBoxSizeWithChilds();	// calc size of  BBox including childs recursivly
    92 
    93     virtual void select();
    94     virtual void unselect();
    95 	virtual QString getSelectString();
    96 
    97 protected:
    98 	static BranchObj* itLast;		// iterator for first(), next()
    99     BranchObjPtrList branch;		// all child branches
   100 	QPtrList<FloatImageObj> floatimage;	// child images
   101 public:	
   102 	float angle;					// used in mainbranch to reorder mainbranches
   103 protected:	
   104     int lastSelectedBranch;			// for going deeper into tree
   105 	bool scrolled;					// true if all childs are scrolled and thus invisible
   106 	bool tmpUnscrolled;				// can only be true (temporary) for a scrolled subtree
   107 	QString url;					// url to external doc
   108 	QString vymLink;				// path to another map
   109 };
   110 
   111 
   112 #endif
   113