Exemplo n.º 1
0
        public MDIBorderContainer(int padding)
            : base(DockLocation.None)
        {
            windowTargetWidget         = Gui.Instance.createWidgetT("Widget", "MDILocationPreview", 0, 0, 10, 10, Align.Left | Align.Top, "Info", "");
            windowTargetWidget.Visible = false;

            left = new MDIBorderContainerDock(new MDILayoutContainerAbsolute(MDILayoutContainer.LayoutType.Horizontal, padding, DockLocation.Left));
            left._setParent(this);
            leftContainerWidget         = Gui.Instance.createWidgetT("Widget", "MDILocationPreview", 0, 0, LocationPreviewSize, LocationPreviewSize, Align.Left | Align.Top, "Info", "");
            leftContainerWidget.Visible = false;

            right = new MDIBorderContainerDock(new MDILayoutContainerAbsolute(MDILayoutContainer.LayoutType.Horizontal, padding, DockLocation.Right));
            right._setParent(this);
            rightContainerWidget         = Gui.Instance.createWidgetT("Widget", "MDILocationPreview", 0, 0, LocationPreviewSize, LocationPreviewSize, Align.Left | Align.Top, "Info", "");
            rightContainerWidget.Visible = false;

            top = new MDIBorderContainerDock(new MDILayoutContainerAbsolute(MDILayoutContainer.LayoutType.Vertical, padding, DockLocation.Top));
            top._setParent(this);
            topContainerWidget         = Gui.Instance.createWidgetT("Widget", "MDILocationPreview", 0, 0, LocationPreviewSize, LocationPreviewSize, Align.Left | Align.Top, "Info", "");
            topContainerWidget.Visible = false;

            bottom = new MDIBorderContainerDock(new MDILayoutContainerAbsolute(MDILayoutContainer.LayoutType.Vertical, padding, DockLocation.Bottom));
            bottom._setParent(this);
            bottomContainerWidget         = Gui.Instance.createWidgetT("Widget", "MDILocationPreview", 0, 0, LocationPreviewSize, LocationPreviewSize, Align.Left | Align.Top, "Info", "");
            bottomContainerWidget.Visible = false;

            documentArea = new MDILayoutContainerScale(MDILayoutContainer.LayoutType.Horizontal, padding, DockLocation.Center);
            Center       = documentArea;

            floating = new FloatingWindowContainer();
            floating._setParent(this);
        }
Exemplo n.º 2
0
        //All dialogs on a given level have the same alignment and can have the dialog found before it as the parent with "right" or "bottom" alignment
        //A dialog on a child level will have the opposite alignment of its parent (that is why it is a child)

        //so you need a function store level details, which takes the alignment to the parent and the parent dialog
        //assign the first dialog to have the parent and parent alignment, any other dialogs on that level parent to the previous found dialog and have right or bottom alignment
        private void storeLayoutInfo(StoredMDILayoutContainer storedLayout, MDIWindow parent, WindowAlignment alignmentToParent)
        {
            bool foundWindow = false;
            int  i           = 0;

            for (i = 0; i < children.Count; ++i)
            {
                //Search level for the first dialog, store all elements up till the dialog
                //if a dialog is found
                MDIWindow currentWindow = children[i] as MDIWindow;
                if (currentWindow != null)
                {
                    foundWindow = true;
                    //parent the dialog to the parent passed to the function with the alignment passed in
                    //add child level elements to the "left" or "top" from the list of stored dialogs (calling the recursive func)
                    storedLayout.addWindowEntry(new WindowEntry(currentWindow, alignmentToParent, parent));
                    foundWindow = true;
                    for (int j = 0; j < i; ++j)
                    {
                        MDILayoutContainer childLayout = (MDILayoutContainer)children[j];
                        childLayout.storeLayoutInfo(storedLayout, currentWindow, layoutType == LayoutType.Horizontal ? WindowAlignment.Left : WindowAlignment.Top);
                    }
                    //add remaining child elements to the "right" or "bottom" of the current window
                    //if another window is found, change currentwindow
                    //parent the newly found window to the currentwindow with "left" or "bottom" alignment
                    MDIWindow previousWindow = currentWindow;
                    for (++i; i < children.Count; ++i)
                    {
                        currentWindow = children[i] as MDIWindow;
                        if (currentWindow != null)
                        {
                            storedLayout.addWindowEntry(new WindowEntry(currentWindow, layoutType == LayoutType.Horizontal ? WindowAlignment.Right : WindowAlignment.Bottom, previousWindow));
                            previousWindow = currentWindow;
                        }
                        else
                        {
                            MDILayoutContainer childLayout = (MDILayoutContainer)children[i];
                            childLayout.storeLayoutInfo(storedLayout, previousWindow, layoutType == LayoutType.Horizontal ? WindowAlignment.Right : WindowAlignment.Bottom);
                        }
                    }
                }
            }
            if (!foundWindow)
            {
                //if no dialog is found it means we are at the top level and the default order was changed, no other levels should be able to be completely empty, in this case flip
                //the alignment and call again with no parent dialog (this will cause the first found dialog to be the parent and its sibling will get the correct flipped alignment
                foreach (MDILayoutContainer child in children)
                {
                    child.storeLayoutInfo(storedLayout, parent, child.layoutType == LayoutType.Horizontal ? WindowAlignment.Left : WindowAlignment.Top);
                }
            }
        }
 public SeparatorWidgetManagerScale(MDILayoutContainer parentContainer)
     : base(parentContainer)
 {
 }
Exemplo n.º 4
0
 internal override void promoteChild(MDIContainerBase mdiContainerBase, MDILayoutContainer mdiLayoutContainer)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 5
0
 internal override void promoteChild(MDIContainerBase mdiContainerBase, MDILayoutContainer mdiLayoutContainer)
 {
     layoutContainer.promoteChild(mdiContainerBase, mdiLayoutContainer);
 }
 public SeparatorWidgetManager(MDILayoutContainer parentContainer)
 {
     this.parentContainer = parentContainer;
 }
Exemplo n.º 7
0
 /// <summary>
 /// This is a helper method to promote a child to a parent container. It
 /// will swap the child with the formerParent's location and then
 /// dispose the formerParent.
 /// </summary>
 /// <param name="child">The child to promote.</param>
 /// <param name="formerParent">The former parent of child that will be replaced.</param>
 internal override void promoteChild(MDIContainerBase child, MDILayoutContainer formerParent)
 {
     swapAndRemove(child, formerParent);
     formerParent.Dispose();
     invalidate();
 }
 internal abstract void promoteChild(MDIContainerBase mdiContainerBase, MDILayoutContainer mdiLayoutContainer);