xlinkitem.h
author insilmaril
Thu, 17 Sep 2009 09:41:09 +0000
changeset 795 6b0a5f4923d3
child 814 31de6677aa96
permissions -rw-r--r--
Fixed sort children and addMapReplaceInt
     1 #ifndef XLINKITEM_H
     2 #define XLINKITEM_H
     3 
     4 class BranchItem;
     5 class XLinkObj;
     6 class QGraphicsScene;
     7 
     8 #include "mapitem.h"
     9 
    10 /*! \brief xlinks are used to draw arbitrary connections between branches (BranchObj) in the map. */
    11 
    12 /////////////////////////////////////////////////////////////////////////////
    13 class XLinkItem:public MapItem {
    14 public:
    15 	enum XLinkState {undefinedXLink,initXLink,activeXLink,deleteXLink};	
    16 
    17 	XLinkItem (const QList<QVariant> &data, TreeItem *parent=NULL);
    18     virtual ~XLinkItem ();
    19     virtual void init ();
    20 	void setBegin (BranchItem*);
    21 	BranchItem* getBegin();
    22 	void setEnd   (BranchItem*);
    23 	void setEnd   (QPointF);
    24 	BranchItem* getEnd();
    25 	void setColor(QColor);
    26 	QColor getColor();
    27 	void setWidth (int);
    28 	int getWidth ();
    29 	bool activate ();			//! Creates a 2nd XLink (without a XLinkObj attached) 
    30 	bool isBegin();		//! true, if this is master xLink, which may have an XLinkObj attached
    31 	void updateXLink();
    32 	virtual void updateVisibility();	// FIXME-3 not really needed atm...
    33 	BranchItem* getPartnerBranch ();
    34 	XLinkItem *getPartnerXLink();	//! Partner XLink
    35 	QString saveToDir ();
    36 	virtual XLinkObj* createMapObj(QGraphicsScene *scene);
    37 
    38 private:
    39 	XLinkState xLinkState;	// init during drawing or active
    40 	QColor color;
    41 	int width;
    42 	BranchItem *beginBranch;
    43 	BranchItem *endBranch;
    44 	XLinkItem *partnerXLink;
    45 	bool isBeginXLink;
    46 };
    47 
    48 #endif