Ejemplo n.º 1
0
        /// <summary>
        /// Determines whether the +/- button is clicked and expands or
        /// collapses the tree branch that starts from the node if so ...
        /// </summary>
        /// <param name="point">The document coordinates of the mouse pointer.</param>
        /// <returns>true if the expand/collapse button has been clicked.</returns>
        internal override bool hitTest(PointF point)
        {
            RectangleF bounds   = item.getRotatedBounds();
            RectangleF iconRect = getIconRect(bounds);

            if (Utilities.pointInRect(point, iconRect))
            {
                FlowChart fc   = item.flowChart;
                Node      node = item as Node;

                if (fc.ExpandButtonAction == ExpandButtonAction.ExpandTreeBranch)
                {
                    fc.UndoManager.onStartExpand();

                    if (node.Expanded)
                    {
                        // collapse the tree branch groiwng from this node
                        node.collapse();
                        fc.fireTreeCollapsed(node);
                    }
                    else
                    {
                        // expand the tree branch groiwng from this node
                        node.expand();
                        fc.fireTreeExpanded(node);
                    }

                    fc.UndoManager.onEndExpand();
                }

                if (fc.ExpandButtonAction == ExpandButtonAction.RaiseEvents)
                {
                    node.SetExpandedFlag(!node.isExpanded());
                    fc.raiseExpandBtnClicked(node);
                }

                return(true);
            }

            return(false);
        }