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