Beispiel #1
0
        private Rectangle GetPaneSplitterDragRectangle()
        {
            DockPaneSplitter    splitter  = DragControl as DockPaneSplitter;
            DockPane            pane      = splitter.DockPane;
            NestedDockingStatus status    = pane.NestedDockingStatus;
            Rectangle           rectLimit = status.LogicalBounds;

            rectLimit.Location = splitter.Parent.PointToScreen(rectLimit.Location);
            bool bVerticalSplitter;

            if (status.DisplayingAlignment == DockAlignment.Left || status.DisplayingAlignment == DockAlignment.Right)
            {
                rectLimit.X      += MeasurePane.MinSize;
                rectLimit.Width  -= 2 * MeasurePane.MinSize;
                bVerticalSplitter = true;
            }
            else
            {
                rectLimit.Y      += MeasurePane.MinSize;
                rectLimit.Height -= 2 * MeasurePane.MinSize;
                bVerticalSplitter = false;
            }

            return(GetSplitterDragRectangle(rectLimit, bVerticalSplitter));
        }
Beispiel #2
0
        public void BeginDragPaneSplitter(DockPaneSplitter splitter)
        {
            if (!InitDrag(splitter, DragSource.PaneSplitter))
            {
                return;
            }

            PaneSplitter_BeginDrag(splitter.Location);
        }
Beispiel #3
0
        private void PaneSplitter_OnEndDrag(bool abort)
        {
            if (abort)
            {
                return;
            }

            Point               pt       = m_splitterLocation;
            Rectangle           rect     = GetPaneSplitterDragRectangle();
            DockPaneSplitter    splitter = DragControl as DockPaneSplitter;
            DockPane            pane     = splitter.DockPane;
            NestedDockingStatus status   = pane.NestedDockingStatus;

            double proportion = status.Proportion;

            if (status.LogicalBounds.Width <= 0 || status.LogicalBounds.Height <= 0)
            {
                return;
            }
            else if (status.DisplayingAlignment == DockAlignment.Left)
            {
                proportion += ((double)rect.X - (double)pt.X) / (double)status.LogicalBounds.Width;
            }
            else if (status.DisplayingAlignment == DockAlignment.Right)
            {
                proportion -= ((double)rect.X - (double)pt.X) / (double)status.LogicalBounds.Width;
            }
            else if (status.DisplayingAlignment == DockAlignment.Top)
            {
                proportion += ((double)rect.Y - (double)pt.Y) / (double)status.LogicalBounds.Height;
            }
            else
            {
                proportion -= ((double)rect.Y - (double)pt.Y) / (double)status.LogicalBounds.Height;
            }

            pane.SetNestedDockingProportion(proportion);
        }
Beispiel #4
0
		public void BeginDragPaneSplitter(DockPaneSplitter splitter)
		{
			if (!InitDrag(splitter, DragSource.PaneSplitter))
				return;

			PaneSplitter_BeginDrag(splitter.Location);
		}
Beispiel #5
0
		private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
		{
			if (dockState == DockState.Hidden || dockState == DockState.Unknown)
				throw new ArgumentException(ResourceHelper.GetString("DockPane.DockState.InvalidState"));

			if (content == null)
				throw new ArgumentNullException(ResourceHelper.GetString("DockPane.Constructor.NullContent"));

			if (content.DockHandler.DockPanel == null)
				throw new ArgumentException(ResourceHelper.GetString("DockPane.Constructor.NullDockPanel"));


			SuspendLayout();
			SetStyle(ControlStyles.Selectable, false);

			m_isFloat = (dockState == DockState.Float);

			m_contents = new DockContentCollection();
			m_displayingContents = new DockContentCollection(this);
			m_tabs = new DockPaneTabCollection(this);
			m_dockPanel = content.DockHandler.DockPanel;
			m_dockPanel.AddPane(this);

			m_splitter = new DockPaneSplitter(this);

			m_nestedDockingStatus = new NestedDockingStatus(this);

			m_autoHidePane = DockPanel.AutoHidePaneFactory.CreateAutoHidePane(this);
			m_captionControl = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
			m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
			Controls.AddRange(new Control[] {	m_captionControl, m_tabStripControl	});
			
			DockPanel.SuspendLayout(true);
			if (flagBounds)
				FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
			else if (prevPane != null)
				AddToDockList(prevPane.DockListContainer, prevPane, alignment, proportion);

			SetDockState(dockState);
			if (show)
				content.DockHandler.Pane = this;
			else if (this.IsFloat)
				content.DockHandler.FloatPane = this;
			else
				content.DockHandler.PanelPane = this;

			ResumeLayout();
			DockPanel.ResumeLayout(true, true);
		}
Beispiel #6
0
        private void InternalConstruct(IDockContent content, DockState dockState, bool flagBounds, Rectangle floatWindowBounds, DockPane prevPane, DockAlignment alignment, double proportion, bool show)
        {
            if (dockState == DockState.Hidden || dockState == DockState.Unknown)
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPane.DockState.InvalidState"));
            }

            if (content == null)
            {
                throw new ArgumentNullException(ResourceHelper.GetString("DockPane.Constructor.NullContent"));
            }

            if (content.DockHandler.DockPanel == null)
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPane.Constructor.NullDockPanel"));
            }


            SuspendLayout();
            SetStyle(ControlStyles.Selectable, false);

            m_isFloat = (dockState == DockState.Float);

            m_contents           = new DockContentCollection();
            m_displayingContents = new DockContentCollection(this);
            m_tabs      = new DockPaneTabCollection(this);
            m_dockPanel = content.DockHandler.DockPanel;
            m_dockPanel.AddPane(this);

            m_splitter = new DockPaneSplitter(this);

            m_nestedDockingStatus = new NestedDockingStatus(this);

            m_autoHidePane    = DockPanel.AutoHidePaneFactory.CreateAutoHidePane(this);
            m_captionControl  = DockPanel.DockPaneCaptionFactory.CreateDockPaneCaption(this);
            m_tabStripControl = DockPanel.DockPaneStripFactory.CreateDockPaneStrip(this);
            Controls.AddRange(new Control[] { m_captionControl, m_tabStripControl });

            DockPanel.SuspendLayout(true);
            if (flagBounds)
            {
                FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this, floatWindowBounds);
            }
            else if (prevPane != null)
            {
                AddToDockList(prevPane.DockListContainer, prevPane, alignment, proportion);
            }

            SetDockState(dockState);
            if (show)
            {
                content.DockHandler.Pane = this;
            }
            else if (this.IsFloat)
            {
                content.DockHandler.FloatPane = this;
            }
            else
            {
                content.DockHandler.PanelPane = this;
            }

            ResumeLayout();
            DockPanel.ResumeLayout(true, true);
        }