Exemplo n.º 1
0
        private static void ComputePositions(XisMenu menu, EA.Diagram diagram, EA.DiagramObject parent, EA.DiagramObject sibling)
        {
            EA.DiagramObject obj = null;

            if (parent != null)
            {
                menu.Element.Methods.Refresh();
                obj = menu.SetPosition(diagram,
                    parent.left + 10, parent.right - 10, -parent.top + 40, -parent.top + 90 + 30 * menu.Element.Methods.Count,
                    parent.Sequence - 1);
            }
            else if (sibling != null)
            {
                menu.Element.Methods.Refresh();
                obj = menu.SetPosition(diagram,
                    sibling.left, sibling.right, -sibling.bottom + 10, -sibling.bottom + 60 + 30 * menu.Element.Methods.Count,
                    sibling.Sequence);
            }

            if (obj != null)
            {
                if (menu.Widgets.Count > 0)
                {
                    ComputePositions(menu.Widgets.First(), diagram, obj, null);
                    EA.DiagramObject aux = menu.Widgets.First().GetDiagramObject(diagram);

                    for (int i = 1; i < menu.Widgets.Count; i++)
                    {
                        ComputePositions(menu.Widgets[i], diagram, null, aux);
                        aux = menu.Widgets[i].GetDiagramObject(diagram);
                    }

                    menu.SetPosition(diagram, obj.left, obj.right, -obj.top, -aux.bottom + 10, obj.Sequence);
                }
            }
        }
Exemplo n.º 2
0
        // Use on Context Menus
        private static void ComputePositions(XisMenu menu, EA.Diagram diagram)
        {
            if (menu.Items.Count > 0)
            {
                EA.DiagramObject menuObj = menu.GetDiagramObject(diagram);
                ComputePositions(menu.Items.First(), diagram, menuObj, null);
                EA.DiagramObject obj = menu.Items.First().GetDiagramObject(diagram);

                for (int i = 1; i < menu.Items.Count; i++)
                {
                    ComputePositions(menu.Items[i], diagram, null, obj);
                    obj = menu.Items[i].GetDiagramObject(diagram);
                }

                menu.SetPosition(diagram, menuObj.left, menuObj.right, -menuObj.top, -obj.bottom + 10, menuObj.Sequence);
            }
        }