예제 #1
0
        public Pane Add(ManagedContent content, Dock dock)
        {
            DockablePane pane = new DockablePane(content, dock);

            Add(pane);

            return pane;
        }
        //public readonly DockablePane ReferencedPane;
        public FloatingWindow(DockablePane pane)
        {
            InitializeComponent();

            #region Hosted Pane
            HostedPane = new FloatingWindowHostedPane(this, pane);
            HostedPane.ReferencedPane.OnTitleChanged += new EventHandler(HostedPane_OnTitleChanged);
            Content = HostedPane;
            Title = HostedPane.Title;
            #endregion
        }
        public OverlayDockablePane(DockManager dockManager, DockableContent content, Dock initialDock)
            : base(dockManager, initialDock)
        {
            btnAutoHide.LayoutTransform = new RotateTransform(90);
            ReferencedPane = content.ContainerPane as DockablePane;
            ReferencedContent = content;
            Add(ReferencedContent);
            Show(ReferencedContent);
            ReferencedContent.SetContainerPane(ReferencedPane);

            _state = PaneState.AutoHide;
        }
예제 #4
0
        public void ChangeDock(DockablePane pane, Dock dock)
        {
            //if (dock == pane.Dock)
            //    return;

            //rimuovo innanizitutto il pane dalla griglia
            IPane resultPane = Remove(_rootPane, pane);
            if (resultPane != null)
                _rootPane = resultPane;

            pane.Dock = dock;
            //(pane.Parent as Grid).Children.Remove(pane);
            Add(pane);
        }
예제 #5
0
        public void Add(DockablePane pane, Pane relativePane, Dock relativeDock)
        {
            Console.WriteLine("Add(...)");
            AttachPaneEvents(pane);
            DockablePaneGroup group = GetPaneGroup(relativePane);
            //group.ParentGroup.ReplaceChildGroup(group, new DockablePaneGroup(group, new DockablePaneGroup(relativePane), relativeDock));

            switch (relativeDock)
            {
                case Dock.Right:
                case Dock.Bottom:
                    {
                        if (group == _rootGroup)
                        {
                            _rootGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                        }
                        else
                        {
                            DockablePaneGroup parentGroup = group.ParentGroup;
                            DockablePaneGroup newChildGroup = new DockablePaneGroup(group, new DockablePaneGroup(pane), relativeDock);
                            parentGroup.ReplaceChildGroup(group, newChildGroup);
                        }
                    }
                    break;
                case Dock.Left:
                case Dock.Top:
                    {
                        if (group == _rootGroup)
                        {
                            _rootGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                        }
                        else
                        {
                            DockablePaneGroup parentGroup = group.ParentGroup;
                            DockablePaneGroup newChildGroup = new DockablePaneGroup(new DockablePaneGroup(pane), group, relativeDock);
                            parentGroup.ReplaceChildGroup(group, newChildGroup);
                        }
                    }
                    break;
                    //return new DockablePaneGroup(new DockablePaneGroup(pane), this, pane.Dock);
            }

            //group.ChildGroup = new DockablePaneGroup(group.ChildGroup, pane, relativeDock);
            ArrangeLayout();
        }
예제 #6
0
 public void Add(DockablePane pane)
 {
     switch (pane.Dock)
     {
         case Dock.Right:
             _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Vertical);
             break;
         case Dock.Left:
             _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Vertical);
             break;
         case Dock.Bottom:
             _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Horizontal);
             break;
         case Dock.Top:
             _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Horizontal);
             break;
     }
 }
예제 #7
0
        /// <summary>
        /// Dock this pane to a destination pane border
        /// </summary>
        /// <param name="destinationPane"></param>
        /// <param name="relativeDock"></param>
        internal void MoveTo(Pane destinationPane, Dock relativeDock)
        {
            DockablePane dockableDestPane = destinationPane as DockablePane;

            if (dockableDestPane != null)
            {
                ChangeDock(dockableDestPane.Dock);
            }
            else
            {
                ChangeDock(relativeDock);
            }


            DockManager.MoveTo(this, destinationPane, relativeDock);
            ChangeState(PaneState.Docked);
            //Show();
            //ChangeState(PaneState.Docked);
        }
예제 #8
0
        public void Add(DockablePane pane)
        {
            switch (pane.Dock)
            {
            case Dock.Right:
                _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Vertical);
                break;

            case Dock.Left:
                _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Vertical);
                break;

            case Dock.Bottom:
                _rootPane = new PaneGroup(_rootPane, pane, SplitOrientation.Horizontal);
                break;

            case Dock.Top:
                _rootPane = new PaneGroup(pane, _rootPane, SplitOrientation.Horizontal);
                break;
            }
        }
        public FloatingWindowHostedPane(FloatingWindow floatingWindow, DockablePane referencedPane) : base(referencedPane.DockManager)
        {
            ReferencedPane  = referencedPane;
            _floatingWindow = floatingWindow;

            DockableContent lastSelectedContent = ReferencedPane.ActiveContent;

            ChangeState(ReferencedPane.State);
            //ReferencedPane.Hide();

            //DockManager = ReferencedPane.DockManager;
            foreach (DockableContent content in ReferencedPane.Contents)
            {
                ReferencedPane.Hide(content);
                Add(content);
                Show(content);
                content.SetContainerPane(ReferencedPane);
            }

            ActiveContent = lastSelectedContent;
            ShowHeader    = false;
        }
        public FloatingWindowHostedPane(FloatingWindow floatingWindow, DockablePane referencedPane)
            : base(referencedPane.DockManager)
        {
            ReferencedPane = referencedPane;
            _floatingWindow = floatingWindow;

            DockableContent lastSelectedContent = ReferencedPane.ActiveContent;

            ChangeState(ReferencedPane.State);
            //ReferencedPane.Hide();

            //DockManager = ReferencedPane.DockManager;
            foreach (DockableContent content in ReferencedPane.Contents)
            {
                ReferencedPane.Hide(content);
                Add(content);
                Show(content);
                content.SetContainerPane(ReferencedPane);
            }

            ActiveContent = lastSelectedContent;
            ShowHeader = false;
        }
예제 #11
0
        /// <summary>
        /// Restore docking layout reading a xml string which is previously generated by a call to GetLayoutState
        /// </summary>
        /// <param name="xml">Xml containing layout state</param>
        /// <param name="getContentHandler">Delegate used by serializer to get user defined dockable contents</param>
        public void RestoreLayoutFromXml(string xml, GetContentFromTypeString getContentHandler)
        {
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);

            gridDocking.Deserialize(this, doc.ChildNodes[0], getContentHandler);

            List<Pane> addedPanes = new List<Pane>();
            foreach (DockableContent content in Contents)
            {
                DockablePane pane = content.ContainerPane as DockablePane;
                if (pane != null && !addedPanes.Contains(pane))
                {
                    if (pane.State == PaneState.AutoHide)
                    {
                        addedPanes.Add(pane);
                        AddPaneDockingButtons(pane);
                    }
                }
            }

            _currentButton = null;
        }
예제 #12
0
        public DockablePaneGroup RemovePane(DockablePane pane)
        {
            if (AttachedPane != null)
                return null;

            if (FirstChildGroup.AttachedPane==pane)
            {
                return SecondChildGroup;
            }
            else if (SecondChildGroup.AttachedPane==pane)
            {
                return FirstChildGroup;
            }
            else
            {
                DockablePaneGroup group = FirstChildGroup.RemovePane(pane);

                if (group != null)
                {
                    FirstChildGroup = group;
                    group._parentGroup = this;
                    return null;
                }

                group = SecondChildGroup.RemovePane(pane);

                if (group != null)
                {
                    SecondChildGroup = group;
                    group._parentGroup = this;
                    return null;
                }
            }

            return null;
        }
예제 #13
0
        //public void SaveChildPanesSize()
        //{
        //    if (AttachedPane != null && ParentGroup!=null)
        //        AttachedPane.SaveSize(ParentGroup.Dock);
        //    else
        //    {
        //        FirstChildGroup.SaveChildPanesSize();
        //        SecondChildGroup.SaveChildPanesSize();
        //    }
        //}
        public DockablePaneGroup AddPane(DockablePane pane)
        {
            switch (pane.Dock)
            {
                case Dock.Right:
                case Dock.Bottom:
                    return new DockablePaneGroup(this, new DockablePaneGroup(pane), pane.Dock);

                case Dock.Left:
                case Dock.Top:
                    return new DockablePaneGroup(new DockablePaneGroup(pane), this, pane.Dock);
            }

            return null;
            //DockablePaneGroup resGroup = null;

            //if (AttachedPane != null)
            //{
            //    DockablePaneGroup newChildGroup = new DockablePaneGroup(AttachedPane);
            //    switch (pane.Dock)
            //    {
            //        case Dock.Left:
            //            resGroup = new DockablePaneGroup(new DockablePaneGroup(pane), newChildGroup, SplitOrientation.Vertical);
            //            break;
            //        case Dock.Right:
            //            resGroup = new DockablePaneGroup(newChildGroup, new DockablePaneGroup(pane), SplitOrientation.Vertical);
            //            break;
            //        case Dock.Top:
            //            resGroup = new DockablePaneGroup(new DockablePaneGroup(pane), newChildGroup, SplitOrientation.Horizontal);
            //            break;
            //        case Dock.Bottom:
            //            resGroup = new DockablePaneGroup(newChildGroup, new DockablePaneGroup(pane), SplitOrientation.Horizontal);
            //            break;
            //    }
            //}
            //else
            //{
            //    if (SplitOrientation == SplitOrientation.Vertical)
            //    {
            //        if (pane.Dock == Dock.Left)
            //        {
            //            ChildGroups.Insert(0, new DockablePaneGroup(pane));
            //            resGroup = this;
            //        }
            //        else if (pane.Dock == Dock.Right)
            //        {
            //            int index = 0;
            //            for (int i = 0; i < ChildGroups.Count;i++)
            //                if (ChildGroups[i].do

            //            ChildGroups.Add(new DockablePaneGroup(pane));
            //            resGroup = this;
            //        }
            //        else if (pane.Dock == Dock.Bottom)
            //            resGroup = new DockablePaneGroup(this, new DockablePaneGroup(pane), SplitOrientation.Horizontal);
            //        else if (pane.Dock == Dock.Top)
            //            resGroup = new DockablePaneGroup(new DockablePaneGroup(pane), this, SplitOrientation.Horizontal);
            //    }
            //    else //if (SplitOrientation == SplitOrientation.Horizontal)
            //    {
            //        if (pane.Dock == Dock.Top)
            //        {
            //            ChildGroups.Insert(0, new DockablePaneGroup(pane));
            //            resGroup = this;
            //        }
            //        else if (pane.Dock == Dock.Bottom)
            //        {
            //            ChildGroups.Add(new DockablePaneGroup(pane));
            //            resGroup = this;
            //        }
            //        else if (pane.Dock == Dock.Right)
            //            resGroup = new DockablePaneGroup(this, new DockablePaneGroup(pane), SplitOrientation.Vertical);
            //        else if (pane.Dock == Dock.Left)
            //            resGroup = new DockablePaneGroup(new DockablePaneGroup(pane), this, SplitOrientation.Vertical);
            //    }
            //}

            //return resGroup;
        }
예제 #14
0
        public void Deserialize(DockManager managerToAttach, System.Xml.XmlNode node, GetContentFromTypeString getObjectHandler)
        {
            _dock = (Dock)Enum.Parse(typeof(Dock), node.Attributes["Dock"].Value);

            if (node.ChildNodes[0].Name == "DockablePane")
            {
                DockablePane pane = new DockablePane(managerToAttach);
                pane.Deserialize(managerToAttach, node.ChildNodes[0], getObjectHandler);
                _attachedPane = pane;
            }
            else if (node.ChildNodes[0].Name == "DocumentsPane")
            {
                DocumentsPane pane = managerToAttach.GetDocumentsPane();
                pane.Deserialize(managerToAttach, node.ChildNodes[0], getObjectHandler);
                _attachedPane = pane;
            }
            else
            {
                _firstChildGroup = new DockablePaneGroup();
                _firstChildGroup._parentGroup = this;
                _firstChildGroup.Deserialize(managerToAttach, node.ChildNodes[0].ChildNodes[0], getObjectHandler);

                _secondChildGroup = new DockablePaneGroup();
                _secondChildGroup._parentGroup = this;
                _secondChildGroup.Deserialize(managerToAttach, node.ChildNodes[0].ChildNodes[1], getObjectHandler);

            }
        }
예제 #15
0
        public void StartDrag(FloatingWindow wnd, Point point, Point offset)
        {
            _pane = wnd.HostedPane;
            Offset = offset;

            _wnd = wnd;

            if (Offset.X >= _wnd.Width)
                Offset.X = _wnd.Width / 2;

            _wnd.Left = point.X - Offset.X;
            _wnd.Top = point.Y - Offset.Y;
            _wnd.Show();

            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    SurfacesWithDragOver.Add(surface);
                    surface.OnDragEnter(point);
                }
            }
        }
예제 #16
0
        public void EndDrag(Point point)
        {
            IDropSurface dropSufrace = null;
            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    if (surface.OnDrop(point))
                    {
                        dropSufrace = surface;
                        break;
                    }
                }
            }

            foreach (IDropSurface surface in SurfacesWithDragOver)
            {
                if (surface != dropSufrace)
                {
                    surface.OnDragLeave(point);
                }
            }

            SurfacesWithDragOver.Clear();

            if (dropSufrace != null)
                _wnd.Close();

            _wnd = null;
            _pane = null;
        }
예제 #17
0
 /// <summary>
 /// Add a dockapble to layout management
 /// </summary>
 /// <param name="pane">Pane to manage</param>
 internal void Add(DockablePane pane)
 {
     gridDocking.Add(pane);
     AttachPaneEvents(pane);
 }
예제 #18
0
 public void Add(DockablePane pane)
 {
     _rootGroup = _rootGroup.AddPane(pane);
     ArrangeLayout();
 }
예제 #19
0
 public void MoveInto(DockablePane sourcePane, Pane destinationPane)
 {
     Remove(sourcePane);
     while (sourcePane.Contents.Count > 0)
     {
         DockableContent content = sourcePane.Contents[0];
         sourcePane.Remove(content);
         destinationPane.Add(content);
         destinationPane.Show(content);
     }
     sourcePane.Close();
 }
예제 #20
0
        /// <summary>
        /// Detach pane events handler
        /// </summary>
        /// <param name="pane"></param>
        internal void DetachPaneEvents(DockablePane pane)
        {
            pane.OnStateChanged -= new EventHandler(pane_OnStateChanged);

            gridDocking.DetachPaneEvents(pane);
        }
예제 #21
0
 public void MoveTo(DockablePane sourcePane, Pane destinationPane, Dock relativeDock)
 {
     Remove(sourcePane);
     Add(sourcePane, destinationPane, relativeDock);
 }
예제 #22
0
        /// <summary>
        /// Add a group of docking buttons for a pane docked to a dockingmanager border
        /// </summary>
        /// <param name="pane"></param>
        private void AddPaneDockingButtons(DockablePane pane)
        {
            DockingButtonGroup buttonGroup = new DockingButtonGroup();
            buttonGroup.Dock = pane.Dock;

            foreach (DockableContent content in pane.Contents)
            {
                DockingButton btn = new DockingButton();
                btn.DockableContent = content;
                btn.DockingButtonGroup = buttonGroup;

                if (_currentButton == null)
                    _currentButton = btn;

                buttonGroup.Buttons.Add(btn);
            }

            _dockingBtnGroups.Add(buttonGroup);

            AddDockingButtons(buttonGroup);
        }
예제 #23
0
 /// <summary>
 /// Remove a dockable pane from layout management
 /// </summary>
 /// <param name="dockablePane">Dockable pane to remove</param>
 /// <remarks>Also pane event handlers are detached</remarks>
 internal void Remove(DockablePane dockablePane)
 {
     gridDocking.Remove(dockablePane);
      DetachPaneEvents(dockablePane);
 }
예제 #24
0
 /// <summary>
 /// Handle dockable pane layout changing
 /// </summary>
 /// <param name="sourcePane">Source pane to move</param>
 /// <param name="destinationPane">Relative pane</param>
 /// <param name="relativeDock"></param>
 internal void MoveTo(DockablePane sourcePane, Pane destinationPane, Dock relativeDock)
 {
     gridDocking.MoveTo(sourcePane, destinationPane, relativeDock);
 }
예제 #25
0
 /// <summary>
 /// Called from a pane when it's dropped into an other pane
 /// </summary>
 /// <param name="sourcePane">Source pane which is going to be closed</param>
 /// <param name="destinationPane">Destination pane which is about to host contents from SourcePane</param>
 internal void MoveInto(DockablePane sourcePane, Pane destinationPane)
 {
     gridDocking.MoveInto(sourcePane, destinationPane);
 }
예제 #26
0
 internal void AttachPaneEvents(DockablePane pane)
 {
     pane.OnStateChanged += new EventHandler(pane_OnStateChanged);
     pane.OnDockChanged += new EventHandler(pane_OnDockChanged);
 }
예제 #27
0
 public void Add(DockablePane pane)
 {
     _rootGroup = _rootGroup.AddPane(pane);
     ArrangeLayout();
 }
예제 #28
0
 /// <summary>
 /// Show this content
 /// </summary>
 /// <remarks>Show this content in a dockable pane. If no pane was previuosly created, it creates a new one with passed initial dock. </remarks>
 public void Show(Dock dock)
 {
     if (ContainerPane == null)
     {
         _containerPane = new DockablePane(DockManager, dock);
         //_containerPane.DockManager = DockManager;
         _containerPane.Add(this);
         _containerPane.Show();
         //DockManager.Add(this);
         DockManager.Add(_containerPane as DockablePane);
     }
     else
     {
         ContainerPane.Show(this);
         ContainerPane.Show();
     }
 }
예제 #29
0
 internal void AttachPaneEvents(DockablePane pane)
 {
     pane.OnStateChanged += new EventHandler(pane_OnStateChanged);
     pane.OnDockChanged  += new EventHandler(pane_OnDockChanged);
 }
예제 #30
0
파일: Pane.cs 프로젝트: truonghinh/TnX
 protected virtual void DragContent(DockableContent contentToDrag, Point startDragPoint, Point offset)
 {
     Remove(contentToDrag);
     DockablePane pane = new DockablePane(DockManager);
     //pane = new DockablePane();
     //pane.DockManager = DockManager;
     pane.Add(contentToDrag);
     pane.Show();
     DockManager.Add(pane);
     //DockManager.Add(contentToDrag);
     FloatingWindow wnd = new FloatingWindow(pane);
     pane.ChangeState(PaneState.DockableWindow);
     DockManager.Drag(wnd, startDragPoint, offset);
 }
예제 #31
0
        public void Remove(DockablePane pane)
        {
            DockablePaneGroup groupToAttach = _rootGroup.RemovePane(pane);
            if (groupToAttach != null)
            {
                _rootGroup = groupToAttach;
                _rootGroup.ParentGroup = null;
            }

            ArrangeLayout();
        }
예제 #32
0
 public void MoveTo(DockablePane sourcePane, Pane destinationPane, Dock relativeDock)
 {
     Remove(sourcePane);
     Add(sourcePane, destinationPane, relativeDock);
 }
예제 #33
0
        /// <summary>
        /// Show tampoary pane attached to current docking buttno
        /// </summary>
        /// <param name="smooth">True if resize animation is enabled</param>
        private void ShowTempPane(bool smooth)
        {
            _tempPane = new OverlayDockablePane(this, _currentButton.DockableContent, _currentButton.DockingButtonGroup.Dock);
            _tempPane.OnStateChanged += new EventHandler(_tempPane_OnStateChanged);

            DockablePane pane = gridDocking.GetPaneFromContent(_currentButton.DockableContent) as DockablePane;

            panelFront.Children.Clear();
            _tempPane.SetValue(DockPanel.DockProperty, _currentButton.DockingButtonGroup.Dock);
            panelFront.Children.Add(_tempPane);
            DockPanelSplitter splitter = null;
            bool   right_left          = false;
            double length = 0.0;

            switch (_currentButton.DockingButtonGroup.Dock)
            {
            case Dock.Left:
                splitter   = new DockPanelSplitter(_tempPane, null, SplitOrientation.Vertical);
                length     = pane.PaneWidth;
                right_left = true;
                break;

            case Dock.Right:
                splitter   = new DockPanelSplitter(null, _tempPane, SplitOrientation.Vertical);
                length     = pane.PaneWidth;
                right_left = true;
                break;

            case Dock.Top:
                splitter   = new DockPanelSplitter(_tempPane, null, SplitOrientation.Horizontal);
                length     = pane.PaneHeight;
                right_left = false;
                break;

            case Dock.Bottom:
                splitter   = new DockPanelSplitter(null, _tempPane, SplitOrientation.Horizontal);
                length     = pane.PaneHeight;
                right_left = false;
                break;
            }

            splitter.SetValue(DockPanel.DockProperty, _currentButton.DockingButtonGroup.Dock);
            panelFront.Children.Add(splitter);

            if (smooth)
            {
                ShowOverlayPanel(length, right_left);
            }
            else
            {
                if (right_left)
                {
                    _tempPane.Width = length;
                }
                else
                {
                    _tempPane.Height = length;
                }
                panelFront.Opacity = 1.0;
            }
        }