X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=src%2Fxlinkitem.cpp;fp=src%2Fxlinkitem.cpp;h=e3df3e1a5a20cae93aff61d7075def1d8287c0b3;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=0000000000000000000000000000000000000000;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/src/xlinkitem.cpp b/src/xlinkitem.cpp new file mode 100644 index 0000000..e3df3e1 --- /dev/null +++ b/src/xlinkitem.cpp @@ -0,0 +1,81 @@ +#include "xlinkitem.h" +#include + +#include "branchitem.h" +#include "linkablemapobj.h" +#include "vymmodel.h" +#include "xlinkobj.h" + +///////////////////////////////////////////////////////////////// +// XLinkItem +///////////////////////////////////////////////////////////////// + +XLinkItem::XLinkItem(TreeItem *parent) + : MapItem(parent) + +{ + // qDebug() << "Const XLinkItem () "<updateLink(); +} + +MapObj *XLinkItem::getMO() +{ + if (link) + return link->getMO(); + return nullptr; +} + +void XLinkItem::setSelection() +{ + if (link) { + XLinkObj *xlo = (XLinkObj *)getMO(); + if (xlo) { + if (parentItem == link->getBeginBranch()) + xlo->setSelection(XLinkObj::C0); + else if (parentItem == link->getEndBranch()) + xlo->setSelection(XLinkObj::C1); + } + } +} + +BranchItem *XLinkItem::getPartnerBranch() +{ + if (link && link->getBeginBranch() && link->getEndBranch()) { + if (parentItem == link->getBeginBranch()) + return link->getEndBranch(); + else + return link->getBeginBranch(); + } + return NULL; +}