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