ChangesType PortNodeHandler::HandleClick(Node n, double inX, double inY,
int kstate, idvc::MouseButton Button)
{
ChangesType processed = ctNone;
idvc::dpoint pos = n->GetPosition();
idvc::dsize size = n->GetSize();
// 如果节点没有嵌套的节点且使用鼠标左键对其单击
if ( (n->GetOwned()->GetCount() == 0) && (Button == idvc::mbLeft) )
{
if (node_drawer.IsLeftPortClicked(n, inX, inY))
{
bool hide = ( CountAllParents(n) == CountVisibleParents(n) );
// 如果所有父节点可见
if( hide ) Fold(n, fdParents);
else Unfold(n, fdParents);
}
else if (node_drawer.IsRightPortClicked(n, inX, inY))
{
bool hide = ( CountAllChildren(n) == CountVisibleChildren(n) );
// 如果所有子节点可见
if( hide ) Fold(n, fdChildren);
else Unfold(n, fdChildren);
}
else
{
// 如果用户单击节点本身,则会选中它
SetFlag(n, Node::fSelected, !IsFlagSet(n, Node::fSelected));
};
processed = ctAll;
};
OnClick.fire(n, inX, inY, kstate, Button);
return processed;
};
|