Ejemplo n.º 1
0
        public LayoutManager(ILayoutRoot root)
        {
            Contract.Requires <NullReferenceException>(root != null);

            this.root         = root;
            this.layoutNeeded = new Subject <Unit>();
        }
Ejemplo n.º 2
0
        public void Drop(Point dropLocation, out bool dropHandled)
        {
            dropHandled = false;
            this.UpdateMouseLocation(dropLocation);
            ILayoutRoot root = (this._floatingWindow.Model as LayoutFloatingWindow).Root;

            if (this._currentHost != null)
            {
                this._currentHost.HideOverlayWindow();
            }
            if (this._currentDropTarget != null)
            {
                this._currentWindow.DragDrop(this._currentDropTarget);
                root.CollectGarbage();
                dropHandled = true;
            }
            this._currentWindowAreas.ForEach((IDropArea a) => this._currentWindow.DragLeave(a));
            if (this._currentDropTarget != null)
            {
                this._currentWindow.DragLeave(this._currentDropTarget);
            }
            if (this._currentWindow != null)
            {
                this._currentWindow.DragLeave(this._floatingWindow);
            }
            this._currentWindow = null;
            this._currentHost   = null;
        }
Ejemplo n.º 3
0
 protected virtual void OnRootChanged(ILayoutRoot oldRoot, ILayoutRoot newRoot)
 {
     if (oldRoot != null)
         ((LayoutRoot)oldRoot).OnLayoutElementRemoved(this);
     if (newRoot != null)
         ((LayoutRoot)newRoot).OnLayoutElementAdded(this);        
 }
Ejemplo n.º 4
0
 protected virtual void OnRootChanged(ILayoutRoot oldRoot, ILayoutRoot newRoot)
 {
     if (oldRoot != null)
         ((LayoutRoot)oldRoot).OnLayoutElementRemoved(this);
     if (newRoot != null)
         ((LayoutRoot)newRoot).OnLayoutElementAdded(this);
 }
Ejemplo n.º 5
0
        public void InvalidateMeasure()
        {
            ILayoutRoot root = this.GetLayoutRoot();

            if (root != null && root.LayoutManager != null)
            {
                root.LayoutManager.InvalidateMeasure(this);
            }
        }
Ejemplo n.º 6
0
        public void ExecuteInitialLayoutPass(ILayoutRoot root)
        {
            if (root != _owner)
            {
                throw new ArgumentException("ExecuteInitialLayoutPass called with incorrect root.");
            }

            ExecuteInitialLayoutPass();
        }
Ejemplo n.º 7
0
        public void InvalidateArrange()
        {
            ILayoutRoot root = this.GetLayoutRoot();

            if (root != null)
            {
                root.LayoutManager.InvalidateArrange(this);
            }
        }
Ejemplo n.º 8
0
        protected override void OnParentChanging(ILayoutContainer oldValue, ILayoutContainer newValue)
        {
            ILayoutRoot root = base.Root;

            if (oldValue != null)
            {
                this.IsSelected = false;
            }
            base.OnParentChanging(oldValue, newValue);
        }
Ejemplo n.º 9
0
        /// <inheritdoc/>
        public void ExecuteInitialLayoutPass(ILayoutRoot root)
        {
            Measure(root);
            Arrange(root);

            // Running the initial layout pass may have caused some control to be invalidated
            // so run a full layout pass now (this usually due to scrollbars; its not known
            // whether they will need to be shown until the layout pass has run and if the
            // first guess was incorrect the layout will need to be updated).
            ExecuteLayoutPass();
        }
Ejemplo n.º 10
0
        internal void CloseInternal()
        {
            ILayoutRoot root = base.Root;

            base.Parent.RemoveChild(this);
            if (root != null)
            {
                root.CollectGarbage();
            }
            this.OnClosed();
        }
Ejemplo n.º 11
0
        /// <inheritdoc/>
        public void ExecuteInitialLayoutPass(ILayoutRoot root)
        {
            Measure(root);
            Arrange(root);

            // Running the initial layout pass may have caused some control to be invalidated
            // so run a full layout pass now (this usually due to scrollbars; its not known
            // whether they will need to be shown until the layout pass has run and if the
            // first guess was incorrect the layout will need to be updated).
            ExecuteLayoutPass();
        }
Ejemplo n.º 12
0
        protected override void OnClosed(EventArgs e)
        {
            ILayoutRoot root = this.Model.Root;

            root.Manager.RemoveFloatingWindow(this);
            root.CollectGarbage();
            base.OnClosed(e);
            if (!base.CloseInitiatedByUser)
            {
                root.FloatingWindows.Remove(this._model);
            }
            this._model.RootDocumentChanged -= new EventHandler(this._model_RootDocumentChanged);
        }
Ejemplo n.º 13
0
        public RawMouseEventArgs(
            IInputDevice device,
            ILayoutRoot root,
            RawMouseEventType type,
            Point position)
            : base(device)
        {
            Contract.Requires <ArgumentNullException>(device != null);
            Contract.Requires <ArgumentNullException>(root != null);

            this.Root     = root;
            this.Position = position;
            this.Type     = type;
        }
Ejemplo n.º 14
0
        private bool CanExecuteHideWindowCommand(object parameter)
        {
            if (this.Model == null)
            {
                return(false);
            }
            ILayoutRoot root = this.Model.Root;

            if (root == null)
            {
                return(false);
            }
            DockingManager manager = root.Manager;

            if (manager == null)
            {
                return(false);
            }
            bool flag = false;

            LayoutAnchorable[] array = this.Model.Descendents().OfType <LayoutAnchorable>().ToArray <LayoutAnchorable>();
            int num = 0;

            while (num < (int)array.Length)
            {
                LayoutAnchorable layoutAnchorable = array[num];
                if (layoutAnchorable.CanHide)
                {
                    LayoutAnchorableItem layoutItemFromModel = manager.GetLayoutItemFromModel(layoutAnchorable) as LayoutAnchorableItem;
                    if (layoutItemFromModel == null || layoutItemFromModel.HideCommand == null || !layoutItemFromModel.HideCommand.CanExecute(parameter))
                    {
                        flag = false;
                        break;
                    }
                    else
                    {
                        flag = true;
                        num++;
                    }
                }
                else
                {
                    flag = false;
                    break;
                }
            }
            return(flag);
        }
Ejemplo n.º 15
0
        /*
         * public void RemoveSide()
         * {
         *  if (Parent is LayoutAnchorGroup)
         *  {
         *      ILayoutRoot root = Root;
         *      LayoutAnchorGroup lagroup = (LayoutAnchorGroup)(Parent);
         *      if (root.RightSide.Children.Contains(lagroup))
         *      {
         *          root.RightSide.Children.Remove(lagroup);
         *      }
         *      if (root.LeftSide.Children.Contains(lagroup))
         *      {
         *          root.LeftSide.Children.Remove(lagroup);
         *      }
         *      if (root.TopSide.Children.Contains(lagroup))
         *      {
         *          root.TopSide.Children.Remove(lagroup);
         *      }
         *      if (root.BottomSide.Children.Contains(lagroup))
         *      {
         *          root.BottomSide.Children.Remove(lagroup);
         *      }
         *      lagroup.Parent = (ILayoutContainer)(root);
         *  }
         * }
         */
        public void ReplaceSide(AnchorSide side)
        {
            if (Parent is LayoutAnchorGroup)
            {
                ILayoutRoot       root    = Root;
                LayoutAnchorGroup lagroup = (LayoutAnchorGroup)(Parent);
                if (root.RightSide.Children.Contains(lagroup))
                {
                    root.RightSide.Children.Remove(lagroup);
                }
                if (root.LeftSide.Children.Contains(lagroup))
                {
                    root.LeftSide.Children.Remove(lagroup);
                }
                if (root.TopSide.Children.Contains(lagroup))
                {
                    root.TopSide.Children.Remove(lagroup);
                }
                if (root.BottomSide.Children.Contains(lagroup))
                {
                    root.BottomSide.Children.Remove(lagroup);
                }
                switch (side)
                {
                case AnchorSide.Right:
                    root.RightSide.Children.Add(lagroup);
                    LayoutSetting.AddDefaultSideAnchorable(Title, "RIGHT");
                    break;

                case AnchorSide.Left:
                    root.LeftSide.Children.Add(lagroup);
                    LayoutSetting.AddDefaultSideAnchorable(Title, "LEFT");
                    break;

                case AnchorSide.Top:
                    root.TopSide.Children.Add(lagroup);
                    LayoutSetting.AddDefaultSideAnchorable(Title, "TOP");
                    break;

                case AnchorSide.Bottom:
                    root.BottomSide.Children.Add(lagroup);
                    LayoutSetting.AddDefaultSideAnchorable(Title, "BOTTOM");
                    break;
                }
            }
        }
Ejemplo n.º 16
0
        protected override void OnClosed(EventArgs e)
        {
            ILayoutRoot root = this.Model.Root;

            root.Manager.RemoveFloatingWindow(this);
            root.CollectGarbage();
            if (this._overlayWindow != null)
            {
                this._overlayWindow.Close();
                this._overlayWindow = null;
            }
            base.OnClosed(e);
            if (!base.CloseInitiatedByUser)
            {
                root.FloatingWindows.Remove(this._model);
            }
            this._model.PropertyChanged -= new PropertyChangedEventHandler(this._model_PropertyChanged);
        }
Ejemplo n.º 17
0
        public void Show()
        {
            if (this.IsVisible)
            {
                return;
            }
            if (!this.IsHidden)
            {
                throw new InvalidOperationException();
            }
            this.RaisePropertyChanging("IsHidden");
            this.RaisePropertyChanging("IsVisible");
            bool        flag = false;
            ILayoutRoot root = base.Root;

            if (root != null && root.Manager != null && root.Manager.LayoutUpdateStrategy != null)
            {
                flag = root.Manager.LayoutUpdateStrategy.BeforeInsertAnchorable(root as LayoutRoot, this, base.PreviousContainer);
            }
            if (!flag && base.PreviousContainer != null)
            {
                ILayoutGroup previousContainer = base.PreviousContainer as ILayoutGroup;
                if (base.PreviousContainerIndex >= previousContainer.ChildrenCount)
                {
                    previousContainer.InsertChildAt(previousContainer.ChildrenCount, this);
                }
                else
                {
                    previousContainer.InsertChildAt(base.PreviousContainerIndex, this);
                }
                base.IsSelected = true;
                base.IsActive   = true;
            }
            if (root != null && root.Manager != null && root.Manager.LayoutUpdateStrategy != null)
            {
                root.Manager.LayoutUpdateStrategy.AfterInsertAnchorable(root as LayoutRoot, this);
            }
            base.PreviousContainer      = null;
            base.PreviousContainerIndex = -1;
            this.RaisePropertyChanged("IsVisible");
            this.RaisePropertyChanged("IsHidden");
            this.NotifyIsVisibleChanged();
        }
Ejemplo n.º 18
0
        public void Drop(LayoutFloatingWindow floatingWindow)
        {
            ILayoutRoot   root          = floatingWindow.Root;
            LayoutContent activeContent = floatingWindow.Root.ActiveContent;
            LayoutAnchorableFloatingWindow layoutAnchorableFloatingWindow = floatingWindow as LayoutAnchorableFloatingWindow;

            if (layoutAnchorableFloatingWindow == null)
            {
                this.Drop(floatingWindow as LayoutDocumentFloatingWindow);
            }
            else
            {
                this.Drop(layoutAnchorableFloatingWindow);
            }
            base.Dispatcher.BeginInvoke(new Action(() => {
                activeContent.IsSelected = false;
                activeContent.IsActive   = false;
                activeContent.IsActive   = true;
            }), DispatcherPriority.Background, new object[0]);
        }
Ejemplo n.º 19
0
 public void JustDecompileGenerated_set_Parent(ILayoutContainer value)
 {
     if (this._parent != value)
     {
         ILayoutContainer layoutContainer = this._parent;
         ILayoutRoot      layoutRoot      = this._root;
         this.RaisePropertyChanging("Parent");
         this.OnParentChanging(layoutContainer, value);
         this._parent = value;
         this.OnParentChanged(layoutContainer, value);
         this._root = this.Root;
         if (layoutRoot != this._root)
         {
             this.OnRootChanged(layoutRoot, this._root);
         }
         this.RaisePropertyChanged("Parent");
         LayoutRoot root = this.Root as LayoutRoot;
         if (root != null)
         {
             root.FireLayoutUpdated();
         }
     }
 }
Ejemplo n.º 20
0
 public LayoutManager(ILayoutRoot owner)
 {
     _owner             = owner ?? throw new ArgumentNullException(nameof(owner));
     _executeLayoutPass = ExecuteLayoutPass;
 }
Ejemplo n.º 21
0
        public void ToggleAutoHide()
        {
            LayoutAnchorable[] array;
            int i;
            Func <ILayoutPreviousContainer, bool> func = null;

            if (!this.IsAutoHidden)
            {
                if (base.Parent is LayoutAnchorablePane)
                {
                    ILayoutRoot          root              = base.Root;
                    LayoutAnchorablePane parent            = base.Parent as LayoutAnchorablePane;
                    LayoutAnchorGroup    layoutAnchorGroup = new LayoutAnchorGroup();
                    ((ILayoutPreviousContainer)layoutAnchorGroup).PreviousContainer = parent;
                    array = parent.Children.ToArray <LayoutAnchorable>();
                    for (i = 0; i < (int)array.Length; i++)
                    {
                        LayoutAnchorable layoutAnchorable = array[i];
                        layoutAnchorGroup.Children.Add(layoutAnchorable);
                    }
                    switch (parent.GetSide())
                    {
                    case AnchorSide.Left:
                    {
                        root.LeftSide.Children.Add(layoutAnchorGroup);
                        return;
                    }

                    case AnchorSide.Top:
                    {
                        root.TopSide.Children.Add(layoutAnchorGroup);
                        return;
                    }

                    case AnchorSide.Right:
                    {
                        root.RightSide.Children.Add(layoutAnchorGroup);
                        return;
                    }

                    case AnchorSide.Bottom:
                    {
                        root.BottomSide.Children.Add(layoutAnchorGroup);
                        break;
                    }

                    default:
                    {
                        return;
                    }
                    }
                }
                return;
            }
            LayoutAnchorGroup    parent1           = base.Parent as LayoutAnchorGroup;
            LayoutAnchorSide     layoutAnchorSide  = parent1.Parent as LayoutAnchorSide;
            LayoutAnchorablePane previousContainer = ((ILayoutPreviousContainer)parent1).PreviousContainer as LayoutAnchorablePane;

            if (previousContainer != null)
            {
                IEnumerable <ILayoutPreviousContainer> layoutPreviousContainers = (parent1.Root as LayoutRoot).Descendents().OfType <ILayoutPreviousContainer>();
                Func <ILayoutPreviousContainer, bool>  func1 = func;
                if (func1 == null)
                {
                    Func <ILayoutPreviousContainer, bool> previousContainer1 = (ILayoutPreviousContainer c) => c.PreviousContainer == parent1;
                    Func <ILayoutPreviousContainer, bool> func2 = previousContainer1;
                    func  = previousContainer1;
                    func1 = func2;
                }
                foreach (ILayoutPreviousContainer layoutPreviousContainer in layoutPreviousContainers.Where <ILayoutPreviousContainer>(func1))
                {
                    layoutPreviousContainer.PreviousContainer = previousContainer;
                }
            }
            else
            {
                switch ((parent1.Parent as LayoutAnchorSide).Side)
                {
                case AnchorSide.Left:
                {
                    if (parent1.Root.RootPanel.Orientation != Orientation.Horizontal)
                    {
                        previousContainer = new LayoutAnchorablePane();
                        LayoutPanel layoutPanel = new LayoutPanel()
                        {
                            Orientation = Orientation.Horizontal
                        };
                        LayoutRoot  layoutRoot = parent1.Root as LayoutRoot;
                        LayoutPanel rootPanel  = parent1.Root.RootPanel;
                        layoutRoot.RootPanel = layoutPanel;
                        layoutPanel.Children.Add(previousContainer);
                        layoutPanel.Children.Add(rootPanel);
                        break;
                    }
                    else
                    {
                        previousContainer = new LayoutAnchorablePane()
                        {
                            DockMinWidth = this.AutoHideMinWidth
                        };
                        parent1.Root.RootPanel.Children.Insert(0, previousContainer);
                        break;
                    }
                }

                case AnchorSide.Top:
                {
                    if (parent1.Root.RootPanel.Orientation != Orientation.Vertical)
                    {
                        previousContainer = new LayoutAnchorablePane();
                        LayoutPanel layoutPanel1 = new LayoutPanel()
                        {
                            Orientation = Orientation.Vertical
                        };
                        LayoutRoot  root1      = parent1.Root as LayoutRoot;
                        LayoutPanel rootPanel1 = parent1.Root.RootPanel;
                        root1.RootPanel = layoutPanel1;
                        layoutPanel1.Children.Add(previousContainer);
                        layoutPanel1.Children.Add(rootPanel1);
                        break;
                    }
                    else
                    {
                        previousContainer = new LayoutAnchorablePane()
                        {
                            DockMinHeight = this.AutoHideMinHeight
                        };
                        parent1.Root.RootPanel.Children.Insert(0, previousContainer);
                        break;
                    }
                }

                case AnchorSide.Right:
                {
                    if (parent1.Root.RootPanel.Orientation != Orientation.Horizontal)
                    {
                        previousContainer = new LayoutAnchorablePane();
                        LayoutPanel layoutPanel2 = new LayoutPanel()
                        {
                            Orientation = Orientation.Horizontal
                        };
                        LayoutRoot  layoutRoot1 = parent1.Root as LayoutRoot;
                        LayoutPanel rootPanel2  = parent1.Root.RootPanel;
                        layoutRoot1.RootPanel = layoutPanel2;
                        layoutPanel2.Children.Add(rootPanel2);
                        layoutPanel2.Children.Add(previousContainer);
                        break;
                    }
                    else
                    {
                        previousContainer = new LayoutAnchorablePane()
                        {
                            DockMinWidth = this.AutoHideMinWidth
                        };
                        parent1.Root.RootPanel.Children.Add(previousContainer);
                        break;
                    }
                }

                case AnchorSide.Bottom:
                {
                    if (parent1.Root.RootPanel.Orientation != Orientation.Vertical)
                    {
                        previousContainer = new LayoutAnchorablePane();
                        LayoutPanel layoutPanel3 = new LayoutPanel()
                        {
                            Orientation = Orientation.Vertical
                        };
                        LayoutRoot  root2      = parent1.Root as LayoutRoot;
                        LayoutPanel rootPanel3 = parent1.Root.RootPanel;
                        root2.RootPanel = layoutPanel3;
                        layoutPanel3.Children.Add(rootPanel3);
                        layoutPanel3.Children.Add(previousContainer);
                        break;
                    }
                    else
                    {
                        previousContainer = new LayoutAnchorablePane()
                        {
                            DockMinHeight = this.AutoHideMinHeight
                        };
                        parent1.Root.RootPanel.Children.Add(previousContainer);
                        break;
                    }
                }
                }
            }
            array = parent1.Children.ToArray <LayoutAnchorable>();
            for (i = 0; i < (int)array.Length; i++)
            {
                LayoutAnchorable layoutAnchorable1 = array[i];
                previousContainer.Children.Add(layoutAnchorable1);
            }
            layoutAnchorSide.Children.Remove(parent1);
        }
Ejemplo n.º 22
0
 public DockManager()
 {
     LayoutRoot = new LayoutRoot(this);
 }
Ejemplo n.º 23
0
        private void UpdateRowColDefinitions()
        {
            ILayoutRoot root = this._model.Root;

            if (root == null)
            {
                return;
            }
            DockingManager manager = root.Manager;

            if (manager == null)
            {
                return;
            }
            this.FixChildrenDockLengths();
            base.RowDefinitions.Clear();
            base.ColumnDefinitions.Clear();
            if (this.Orientation == System.Windows.Controls.Orientation.Horizontal)
            {
                int num  = 0;
                int num1 = 0;
                int num2 = 0;
                while (num2 < this._model.Children.Count)
                {
                    ILayoutPositionableElement item = (object)this._model.Children[num2] as ILayoutPositionableElement;
                    base.ColumnDefinitions.Add(new ColumnDefinition()
                    {
                        Width    = (item.IsVisible ? item.DockWidth : new GridLength(0, GridUnitType.Pixel)),
                        MinWidth = (item.IsVisible ? item.DockMinWidth : 0)
                    });
                    Grid.SetColumn(base.InternalChildren[num1], num);
                    if (num1 < base.InternalChildren.Count - 1)
                    {
                        num1++;
                        num++;
                        bool flag = false;
                        int  num3 = num2 + 1;
                        while (num3 < this._model.Children.Count)
                        {
                            if (!((object)this._model.Children[num3] as ILayoutPositionableElement).IsVisible)
                            {
                                num3++;
                            }
                            else
                            {
                                flag = true;
                                break;
                            }
                        }
                        base.ColumnDefinitions.Add(new ColumnDefinition()
                        {
                            Width = (item.IsVisible & flag ? new GridLength(manager.GridSplitterWidth) : new GridLength(0, GridUnitType.Pixel))
                        });
                        Grid.SetColumn(base.InternalChildren[num1], num);
                    }
                    num2++;
                    num++;
                    num1++;
                }
                return;
            }
            int num4 = 0;
            int num5 = 0;
            int num6 = 0;

            while (num6 < this._model.Children.Count)
            {
                ILayoutPositionableElement layoutPositionableElement = (object)this._model.Children[num6] as ILayoutPositionableElement;
                base.RowDefinitions.Add(new RowDefinition()
                {
                    Height    = (layoutPositionableElement.IsVisible ? layoutPositionableElement.DockHeight : new GridLength(0, GridUnitType.Pixel)),
                    MinHeight = (layoutPositionableElement.IsVisible ? layoutPositionableElement.DockMinHeight : 0)
                });
                Grid.SetRow(base.InternalChildren[num5], num4);
                if (num5 < base.InternalChildren.Count - 1)
                {
                    num5++;
                    num4++;
                    bool flag1 = false;
                    int  num7  = num6 + 1;
                    while (num7 < this._model.Children.Count)
                    {
                        if (!((object)this._model.Children[num7] as ILayoutPositionableElement).IsVisible)
                        {
                            num7++;
                        }
                        else
                        {
                            flag1 = true;
                            break;
                        }
                    }
                    base.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = (layoutPositionableElement.IsVisible & flag1 ? new GridLength(manager.GridSplitterHeight) : new GridLength(0, GridUnitType.Pixel))
                    });
                    Grid.SetRow(base.InternalChildren[num5], num4);
                }
                num6++;
                num4++;
                num5++;
            }
        }
Ejemplo n.º 24
0
 protected virtual void OnRootChanged(ILayoutRoot oldRoot, ILayoutRoot newRoot)
 {
 }