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