xlinkitem.h
author insilmaril
Fri, 09 Apr 2010 14:24:04 +0000
changeset 846 f0fe7c36ec5c
parent 814 31de6677aa96
child 847 43268373032d
permissions -rw-r--r--
Version 1.13.3 and added treeeditor.png
     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 	BranchItem* getOtherBranch (TreeItem *ti);
    35 	XLinkItem *getPartnerXLink();	//! Partner XLink
    36 	QString saveToDir ();
    37 	virtual XLinkObj* createMapObj(QGraphicsScene *scene);
    38 
    39 private:
    40 	XLinkState xLinkState;	// init during drawing or active
    41 	QColor color;
    42 	int width;
    43 	BranchItem *beginBranch;
    44 	BranchItem *endBranch;
    45 	XLinkItem *partnerXLink;
    46 	bool isBeginXLink;
    47 };
    48 
    49 #endif