xlinkobj.h
author insilmaril
Mon May 05 13:46:43 2008 +0000 (2008-05-05)
changeset 697 82fad0ca8206
parent 478 f4aae4fdc1bc
child 790 133e2ed6b9c5
permissions -rw-r--r--
Some code cleanup and experimental stuff to support animations later
     1 #ifndef XLINKOBJ_H
     2 #define XLINKOBJ_H
     3 
     4 #include "linkablemapobj.h"
     5 
     6 class BranchObj;
     7 
     8 enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink};
     9 
    10 /*! \brief xlinks are used to draw arbitrary connections between branches (BranchObj) in the map. */
    11 
    12 /////////////////////////////////////////////////////////////////////////////
    13 class XLinkObj:public MapObj {
    14 public:
    15     XLinkObj ();
    16     XLinkObj (QGraphicsScene*);
    17     ~XLinkObj ();
    18     virtual void init ();
    19     virtual void copy (XLinkObj*);
    20 	void setBegin (BranchObj*);
    21 	BranchObj* getBegin();
    22 	void setEnd   (BranchObj*);
    23 	void setEnd   (QPointF);
    24 	BranchObj* getEnd();
    25 	void setColor(QColor);
    26 	QColor getColor();
    27 	void setWidth (int);
    28 	int getWidth ();
    29 	bool activate ();			// Sets pointers in branchObjects
    30 	void deactivate();			// removes those pointers
    31 	bool isUsed();				// true, if at least on branch uses it
    32 	void updateXLink();
    33 	BranchObj* otherBranch (BranchObj*);
    34 	void positionBBox();
    35 	void calcBBoxSize();
    36 	void setVisibility (bool);
    37 	void setVisibility ();
    38 	QString saveToDir ();
    39 
    40 private:
    41 	static int arrowSize;
    42 	QPen pen;
    43 	QColor color;
    44 	int width;
    45 	QGraphicsLineItem *line;
    46 	QGraphicsPolygonItem *poly;
    47 	BranchObj *beginBranch;
    48 	BranchObj *endBranch;
    49 	BranchObj *visBranch;	// the "visible" part of a partially scrolled link
    50 	XLinkState xLinkState;	// init during drawing or active
    51 	QPointF beginPos;
    52 	QPointF   endPos;
    53 };
    54 
    55 #endif