コード例 #1
0
ファイル: DragHandler.cs プロジェクト: Pelsoft/fwk_10.3
		public void BeginDragPane(DockPane pane)
		{
			if (!InitDrag(pane, DragSource.Pane))
				return;

			Pane_BeginDrag();
		}
コード例 #2
0
ファイル: FloatWindow.cs プロジェクト: Pelsoft/fwk_10.3
		private void InternalConstruct(DockPanel dockPanel, DockPane pane, bool boundsSpecified, Rectangle bounds)
		{
			if (dockPanel == null)
				throw(new ArgumentNullException(ResourceHelper.GetString("FloatWindow.Constructor.NullDockPanel")));

			m_dockList = new DockList(this);

			FormBorderStyle = FormBorderStyle.SizableToolWindow;
			ShowInTaskbar = false;
			
			SuspendLayout();
			if (boundsSpecified)
			{
				Bounds = bounds;
				StartPosition = FormStartPosition.Manual;
			}
			else
				StartPosition = FormStartPosition.WindowsDefaultLocation;

			if (Environment.Version.Major == 1)
			{
				m_dummyControl = new DummyControl();
				m_dummyControl.Bounds = Rectangle.Empty;
				Controls.Add(m_dummyControl);
			}

			m_dockPanel = dockPanel;
			Owner = DockPanel.FindForm();
			DockPanel.AddFloatWindow(this);
			if (pane != null)
				pane.FloatWindow = this;

			ResumeLayout();
		}
コード例 #3
0
ファイル: DockPaneCollection.cs プロジェクト: gpanayir/sffwk
    internal void AddAt(DockPane pane, int index) {
      if (index < 0 || index > InnerList.Count - 1)
        return;

      if (Contains(pane))
        return;

      InnerList.Insert(index, pane);
    }
コード例 #4
0
ファイル: DockList.cs プロジェクト: gpanayir/sffwk
		internal void Add(DockPane pane)
		{
			if (pane == null)
				return;

			DockList oldDockList = (pane.DockListContainer == null) ? null : pane.DockListContainer.DockList;
			if (oldDockList != null)
				oldDockList.InternalRemove(pane);
			InnerList.Add(pane);
			if (oldDockList != null)
				oldDockList.CheckFloatWindowDispose();
		}
コード例 #5
0
ファイル: DockPaneStripBase.cs プロジェクト: Pelsoft/fwk_10.3
		/// <include file='CodeDoc/DockPaneStripBase.xml' path='//CodeDoc/Class[@name="DockPaneStripBase"]/Construct[@name="(DockPane)"]/*'/>
		protected internal DockPaneStripBase(DockPane pane)
		{
			m_dockPane = pane;

			#if FRAMEWORK_VER_2x
			SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			#else
			SetStyle(ControlStyles.DoubleBuffer, true);
			#endif

			SetStyle(ControlStyles.Selectable, false);
		}
コード例 #6
0
		public bool ContainsPane(DockPane pane)
		{
			if (pane.IsHidden)
				return false;

			for (int i=0; i<m_states.Length; i++)
			{
				if (m_states[i].DockState == pane.DockState && m_states[i].Selected)
					return true;
			}
			return false;
		}
コード例 #7
0
    /// <include file='CodeDoc/DockPaneCaptionBase.xml' path='//CodeDoc/Class[@name="DockPaneCaptionBase"]/Construct[@name="(DockPane)"]/*'/>
    protected internal DockPaneCaptionBase(DockPane pane) {
      m_dockPane = pane;

#if FRAMEWORK_VER_2x
      SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
#else
			SetStyle(ControlStyles.DoubleBuffer, true);
#endif
      SetStyle(ControlStyles.ResizeRedraw, true);
      SetStyle(ControlStyles.UserPaint, true);
      SetStyle(ControlStyles.AllPaintingInWmPaint, true);
      SetStyle(ControlStyles.Selectable, false);
    }
コード例 #8
0
ファイル: AutoHideWindow.cs プロジェクト: gpanayir/sffwk
		private void SetActivePane()
		{
			DockPane value = (ActiveContent == null ? null : ActiveContent.DockHandler.Pane);

			if (value == m_activePane)
				return;

			if (m_activePane != null)
				if (m_activePane.IsActivated)
					DockPanel.Focus();

			m_activePane = value;
		}
コード例 #9
0
    /// <include file='CodeDoc/DockPaneCaptionVS2005.xml' path='//CodeDoc/Class[@name="DockPaneCaptionVS2005"]/Construct[@name="(DockPane)"]/*'/>
    protected internal DockPaneCaptionVS2005(DockPane pane)
      : base(pane) {
      SuspendLayout();

      Font = SystemInformation.MenuFont;

      m_buttonClose = new InertButton(ImageCloseEnabled, ImageCloseDisabled);
      m_buttonAutoHide = new InertButton();

      m_buttonClose.ToolTipText = ToolTipClose;
      m_buttonClose.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      m_buttonClose.Click += new EventHandler(this.Close_Click);

      m_buttonAutoHide.ToolTipText = ToolTipAutoHide;
      m_buttonAutoHide.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      m_buttonAutoHide.Click += new EventHandler(AutoHide_Click);

      Controls.AddRange(new Control[] { m_buttonClose, m_buttonAutoHide });

      ResumeLayout();
    }
コード例 #10
0
ファイル: DockList.cs プロジェクト: gpanayir/sffwk
		/// <include file='CodeDoc\DockList.xml' path='//CodeDoc/Class[@name="DockList"]/Method[@name="IndexOf(DockPane)"]/*'/>
		public int IndexOf(DockPane pane)
		{
			return InnerList.IndexOf(pane);
		}
コード例 #11
0
 internal AutoHideTabCollection(DockPane pane)
 {
     m_dockPane  = pane;
     m_dockPanel = pane.DockPanel;
 }
コード例 #12
0
    /// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Show(DockPane, IDockContent)"]/*'/>
    public void Show(DockPane pane, IDockContent beforeContent) {
      if (pane == null)
        throw (new ArgumentNullException(ResourceHelper.GetString("IDockContent.Show.NullPane")));

      if (beforeContent != null && pane.Contents.IndexOf(beforeContent) == -1)
        throw (new ArgumentException(ResourceHelper.GetString("IDockContent.Show.InvalidBeforeContent")));

      DockPanel = pane.DockPanel;
      Pane = pane;
      pane.SetContentIndex(Content, pane.Contents.IndexOf(beforeContent));
      Show();
    }
コード例 #13
0
 private void SetVisibleContentsToPane(DockPane pane)
 {
     SetVisibleContentsToPane(pane, ActiveContent);
 }
コード例 #14
0
ファイル: DockPaneStripVS2005.cs プロジェクト: gpanayir/sffwk
    /// <include file='CodeDoc/DockPaneStripVS2005.xml' path='//CodeDoc/Class[@name="DockPaneStripVS2005"]/Construct[@name="(DockPane)"]/*'/>
    protected internal DockPaneStripVS2005(DockPane pane)
      : base(pane) {
      SetStyle(ControlStyles.ResizeRedraw, true);
      SetStyle(ControlStyles.UserPaint, true);
      SetStyle(ControlStyles.AllPaintingInWmPaint, true);

      SuspendLayout();

      Font = SystemInformation.MenuFont;
      BackColor = Color.WhiteSmoke;

      m_components = new Container();
      m_toolTip = new ToolTip(Components);

      m_buttonClose = new InertButton(ImageCloseEnabled, ImageCloseDisabled);
      m_buttonScrollLeft = new InertButton(ImageScrollLeftEnabled, ImageScrollLeftDisabled);
      m_buttonScrollRight = new InertButton(ImageScrollRightEnabled, ImageScrollRightDisabled);

      m_buttonClose.ToolTipText = ToolTipClose;
      m_buttonClose.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      m_buttonClose.Click += new EventHandler(Close_Click);

      m_buttonScrollLeft.Enabled = false;
      m_buttonScrollLeft.RepeatClick = true;
      m_buttonScrollLeft.ToolTipText = ToolTipScrollLeft;
      m_buttonScrollLeft.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      m_buttonScrollLeft.Click += new EventHandler(ScrollLeft_Click);

      m_buttonScrollRight.Enabled = false;
      m_buttonScrollRight.RepeatClick = true;
      m_buttonScrollRight.ToolTipText = ToolTipScrollRight;
      m_buttonScrollRight.Anchor = AnchorStyles.Top | AnchorStyles.Right;
      m_buttonScrollRight.Click += new EventHandler(ScrollRight_Click);

      Controls.AddRange(new Control[] {	m_buttonClose,
												m_buttonScrollLeft,
												m_buttonScrollRight	});

      ResumeLayout();
    }
コード例 #15
0
ファイル: FloatWindow.cs プロジェクト: Pelsoft/fwk_10.3
		/// <include file='CodeDoc\FloatWindow.xml' path='//CodeDoc/Class[@name="FloatWindow"]/Constructor[@name="(DockPanel, DockPane, Rectangle)"]/*'/>
		public FloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
		{
			InternalConstruct(dockPanel, pane, true, bounds);
		}
コード例 #16
0
ファイル: DockList.cs プロジェクト: gpanayir/sffwk
		private void InternalRemove(DockPane pane)
		{
			if (!Contains(pane))
				return;

			NestedDockingStatus statusPane = pane.NestedDockingStatus;
			DockPane lastNestedPane = null;
			for (int i=Count - 1; i> IndexOf(pane); i--)
			{
				if (this[i].NestedDockingStatus.PrevPane == pane)
				{
					lastNestedPane = this[i];
					break;
				}
			}

			if (lastNestedPane != null)
			{
				int indexLastNestedPane = IndexOf(lastNestedPane);
				InnerList.Remove(lastNestedPane);
				InnerList[IndexOf(pane)] = lastNestedPane;
				NestedDockingStatus lastNestedDock = lastNestedPane.NestedDockingStatus;
				lastNestedDock.SetStatus(this, statusPane.PrevPane, statusPane.Alignment, statusPane.Proportion);
				for (int i=indexLastNestedPane - 1; i>IndexOf(lastNestedPane); i--)
				{
					NestedDockingStatus status = this[i].NestedDockingStatus;
					if (status.PrevPane == pane)
						status.SetStatus(this, lastNestedPane, status.Alignment, status.Proportion);
				}
			}
			else
				InnerList.Remove(pane);

			statusPane.SetStatus(null, null, DockAlignment.Left, 0.5);
			statusPane.SetDisplayingStatus(false, null, DockAlignment.Left, 0.5);
			statusPane.SetDisplayingBounds(Rectangle.Empty, Rectangle.Empty, Rectangle.Empty);
		}
コード例 #17
0
 /// <include file='CodeDoc\DockPaneCollection.xml' path='//CodeDoc/Class[@name="DockPaneCollection"]/Method[@name="Contains(DockPane)"]/*'/>>
 public bool Contains(DockPane pane)
 {
     return(InnerList.Contains(pane));
 }
コード例 #18
0
 /// <include file='CodeDoc\DockPaneCollection.xml' path='//CodeDoc/Class[@name="DockPaneCollection"]/Method[@name="IndexOf(DockPane)"]/*'/>>
 public int IndexOf(DockPane pane)
 {
     return(InnerList.IndexOf(pane));
 }
コード例 #19
0
 internal void Remove(DockPane pane)
 {
     InnerList.Remove(pane);
 }
コード例 #20
0
        public static void LoadFromXml(DockPanel dockPanel, Stream stream, DeserializeDockContent deserializeContent, bool closeStream)
        {
            if (dockPanel.Contents.Count != 0)
            {
                throw new InvalidOperationException(ResourceHelper.GetString("DockPanel.LoadFromXml.AlreadyInitialized"));
            }

            EnumConverter      dockStateConverter     = new EnumConverter(typeof(DockState));
            EnumConverter      dockAlignmentConverter = new EnumConverter(typeof(DockAlignment));
            RectangleConverter rectConverter          = new RectangleConverter();

            XmlTextReader xmlIn = new XmlTextReader(stream);

            xmlIn.WhitespaceHandling = WhitespaceHandling.None;
            xmlIn.MoveToContent();

            while (!xmlIn.Name.Equals("DockPanel"))
            {
                if (!MoveToNextElement(xmlIn))
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
            }

            string formatVersion = xmlIn.GetAttribute("FormatVersion");

            if (!IsFormatVersionValid(formatVersion))
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidFormatVersion"));
            }

            DockPanelStruct dockPanelStruct = new DockPanelStruct();

            dockPanelStruct.DockLeftPortion         = Convert.ToDouble(xmlIn.GetAttribute("DockLeftPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.DockRightPortion        = Convert.ToDouble(xmlIn.GetAttribute("DockRightPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.DockTopPortion          = Convert.ToDouble(xmlIn.GetAttribute("DockTopPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.DockBottomPortion       = Convert.ToDouble(xmlIn.GetAttribute("DockBottomPortion"), CultureInfo.InvariantCulture);
            dockPanelStruct.IndexActiveDocumentPane = Convert.ToInt32(xmlIn.GetAttribute("ActiveDocumentPane"));
            dockPanelStruct.IndexActivePane         = Convert.ToInt32(xmlIn.GetAttribute("ActivePane"));

            // Load Contents
            MoveToNextElement(xmlIn);
            if (xmlIn.Name != "Contents")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfContents = Convert.ToInt32(xmlIn.GetAttribute("Count"));

            ContentStruct[] contents = new ContentStruct[countOfContents];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfContents; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "Content" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                contents[i].PersistString   = xmlIn.GetAttribute("PersistString");
                contents[i].AutoHidePortion = Convert.ToDouble(xmlIn.GetAttribute("AutoHidePortion"), CultureInfo.InvariantCulture);
                contents[i].IsHidden        = Convert.ToBoolean(xmlIn.GetAttribute("IsHidden"));
                contents[i].IsFloat         = Convert.ToBoolean(xmlIn.GetAttribute("IsFloat"));
                MoveToNextElement(xmlIn);
            }

            // Load Panes
            if (xmlIn.Name != "Panes")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfPanes = Convert.ToInt32(xmlIn.GetAttribute("Count"));

            PaneStruct[] panes = new PaneStruct[countOfPanes];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfPanes; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "Pane" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                panes[i].DockState          = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
                panes[i].IndexActiveContent = Convert.ToInt32(xmlIn.GetAttribute("ActiveContent"));
                panes[i].ZOrderIndex        = -1;

                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "Contents")
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
                int countOfPaneContents = Convert.ToInt32(xmlIn.GetAttribute("Count"));
                panes[i].IndexContents = new int[countOfPaneContents];
                MoveToNextElement(xmlIn);
                for (int j = 0; j < countOfPaneContents; j++)
                {
                    int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                    if (xmlIn.Name != "Content" || id2 != j)
                    {
                        throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                    }

                    panes[i].IndexContents[j] = Convert.ToInt32(xmlIn.GetAttribute("RefID"));
                    MoveToNextElement(xmlIn);
                }
            }

            // Load DockWindows
            if (xmlIn.Name != "DockWindows")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfDockWindows = dockPanel.DockWindows.Count;

            DockWindowStruct[] dockWindows = new DockWindowStruct[countOfDockWindows];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfDockWindows; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "DockWindow" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                dockWindows[i].DockState   = (DockState)dockStateConverter.ConvertFrom(xmlIn.GetAttribute("DockState"));
                dockWindows[i].ZOrderIndex = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"));
                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "DockList")
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
                int countOfDockList = Convert.ToInt32(xmlIn.GetAttribute("Count"));
                dockWindows[i].DockList = new DockListItem[countOfDockList];
                MoveToNextElement(xmlIn);
                for (int j = 0; j < countOfDockList; j++)
                {
                    int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                    if (xmlIn.Name != "Pane" || id2 != j)
                    {
                        throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                    }
                    dockWindows[i].DockList[j].IndexPane     = Convert.ToInt32(xmlIn.GetAttribute("RefID"));
                    dockWindows[i].DockList[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"));
                    dockWindows[i].DockList[j].Alignment     = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
                    dockWindows[i].DockList[j].Proportion    = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
                    MoveToNextElement(xmlIn);
                }
            }

            // Load FloatWindows
            if (xmlIn.Name != "FloatWindows")
            {
                throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
            }
            int countOfFloatWindows = Convert.ToInt32(xmlIn.GetAttribute("Count"));

            FloatWindowStruct[] floatWindows = new FloatWindowStruct[countOfFloatWindows];
            MoveToNextElement(xmlIn);
            for (int i = 0; i < countOfFloatWindows; i++)
            {
                int id = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                if (xmlIn.Name != "FloatWindow" || id != i)
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }

                floatWindows[i].Bounds         = (Rectangle)rectConverter.ConvertFromInvariantString(xmlIn.GetAttribute("Bounds"));
                floatWindows[i].AllowRedocking = Convert.ToBoolean(xmlIn.GetAttribute("AllowRedocking"));
                floatWindows[i].ZOrderIndex    = Convert.ToInt32(xmlIn.GetAttribute("ZOrderIndex"));
                MoveToNextElement(xmlIn);
                if (xmlIn.Name != "DockList")
                {
                    throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                }
                int countOfDockList = Convert.ToInt32(xmlIn.GetAttribute("Count"));
                floatWindows[i].DockList = new DockListItem[countOfDockList];
                MoveToNextElement(xmlIn);
                for (int j = 0; j < countOfDockList; j++)
                {
                    int id2 = Convert.ToInt32(xmlIn.GetAttribute("ID"));
                    if (xmlIn.Name != "Pane" || id2 != j)
                    {
                        throw new ArgumentException(ResourceHelper.GetString("DockPanel.LoadFromXml.InvalidXmlFormat"));
                    }
                    floatWindows[i].DockList[j].IndexPane     = Convert.ToInt32(xmlIn.GetAttribute("RefID"));
                    floatWindows[i].DockList[j].IndexPrevPane = Convert.ToInt32(xmlIn.GetAttribute("PrevPane"));
                    floatWindows[i].DockList[j].Alignment     = (DockAlignment)dockAlignmentConverter.ConvertFrom(xmlIn.GetAttribute("Alignment"));
                    floatWindows[i].DockList[j].Proportion    = Convert.ToDouble(xmlIn.GetAttribute("Proportion"), CultureInfo.InvariantCulture);
                    MoveToNextElement(xmlIn);
                }
            }

            if (closeStream)
            {
                xmlIn.Close();
            }

            dockPanel.DockLeftPortion   = dockPanelStruct.DockLeftPortion;
            dockPanel.DockRightPortion  = dockPanelStruct.DockRightPortion;
            dockPanel.DockTopPortion    = dockPanelStruct.DockTopPortion;
            dockPanel.DockBottomPortion = dockPanelStruct.DockBottomPortion;

            // Set DockWindow ZOrders
            int prevMaxDockWindowZOrder = int.MaxValue;

            for (int i = 0; i < dockWindows.Length; i++)
            {
                int maxDockWindowZOrder = -1;
                int index = -1;
                for (int j = 0; j < dockWindows.Length; j++)
                {
                    if (dockWindows[j].ZOrderIndex > maxDockWindowZOrder && dockWindows[j].ZOrderIndex < prevMaxDockWindowZOrder)
                    {
                        maxDockWindowZOrder = dockWindows[j].ZOrderIndex;
                        index = j;
                    }
                }

                dockPanel.DockWindows[dockWindows[index].DockState].BringToFront();
                prevMaxDockWindowZOrder = maxDockWindowZOrder;
            }

            // Create Contents
            for (int i = 0; i < contents.Length; i++)
            {
                IDockContent content = deserializeContent(contents[i].PersistString);
                if (content == null)
                {
                    content = new DummyContent();
                }
                content.DockHandler.DockPanel       = dockPanel;
                content.DockHandler.AutoHidePortion = contents[i].AutoHidePortion;
                content.DockHandler.IsHidden        = true;
                content.DockHandler.IsFloat         = contents[i].IsFloat;
            }

            // Create panes
            for (int i = 0; i < panes.Length; i++)
            {
                DockPane pane = null;
                for (int j = 0; j < panes[i].IndexContents.Length; j++)
                {
                    IDockContent content = dockPanel.Contents[panes[i].IndexContents[j]];
                    if (j == 0)
                    {
                        pane = dockPanel.DockPaneFactory.CreateDockPane(content, panes[i].DockState, false);
                    }
                    else if (panes[i].DockState == DockState.Float)
                    {
                        content.DockHandler.FloatPane = pane;
                    }
                    else
                    {
                        content.DockHandler.PanelPane = pane;
                    }
                }
            }

            // Assign Panes to DockWindows
            for (int i = 0; i < dockWindows.Length; i++)
            {
                for (int j = 0; j < dockWindows[i].DockList.Length; j++)
                {
                    DockWindow    dw            = dockPanel.DockWindows[dockWindows[i].DockState];
                    int           indexPane     = dockWindows[i].DockList[j].IndexPane;
                    DockPane      pane          = dockPanel.Panes[indexPane];
                    int           indexPrevPane = dockWindows[i].DockList[j].IndexPrevPane;
                    DockPane      prevPane      = (indexPrevPane == -1) ? dw.DockList.GetDefaultPrevPane(pane) : dockPanel.Panes[indexPrevPane];
                    DockAlignment alignment     = dockWindows[i].DockList[j].Alignment;
                    double        proportion    = dockWindows[i].DockList[j].Proportion;
                    pane.AddToDockList(dw, prevPane, alignment, proportion);
                    if (panes[indexPane].DockState == dw.DockState)
                    {
                        panes[indexPane].ZOrderIndex = dockWindows[i].ZOrderIndex;
                    }
                }
            }

            // Create float windows
            for (int i = 0; i < floatWindows.Length; i++)
            {
                FloatWindow fw = null;
                for (int j = 0; j < floatWindows[i].DockList.Length; j++)
                {
                    int      indexPane = floatWindows[i].DockList[j].IndexPane;
                    DockPane pane      = dockPanel.Panes[indexPane];
                    if (j == 0)
                    {
                        fw = dockPanel.FloatWindowFactory.CreateFloatWindow(dockPanel, pane, floatWindows[i].Bounds);
                    }
                    else
                    {
                        int           indexPrevPane = floatWindows[i].DockList[j].IndexPrevPane;
                        DockPane      prevPane      = indexPrevPane == -1 ? null : dockPanel.Panes[indexPrevPane];
                        DockAlignment alignment     = floatWindows[i].DockList[j].Alignment;
                        double        proportion    = floatWindows[i].DockList[j].Proportion;
                        pane.AddToDockList(fw, prevPane, alignment, proportion);
                        if (panes[indexPane].DockState == fw.DockState)
                        {
                            panes[indexPane].ZOrderIndex = floatWindows[i].ZOrderIndex;
                        }
                    }
                }
            }

            // sort IDockContent by its Pane's ZOrder
            int[] sortedContents = null;
            if (contents.Length > 0)
            {
                sortedContents = new int[contents.Length];
                for (int i = 0; i < contents.Length; i++)
                {
                    sortedContents[i] = i;
                }

                int lastDocument = contents.Length;
                for (int i = 0; i < contents.Length - 1; i++)
                {
                    for (int j = i + 1; j < contents.Length; j++)
                    {
                        DockPane pane1        = dockPanel.Contents[sortedContents[i]].DockHandler.Pane;
                        int      ZOrderIndex1 = pane1 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane1)].ZOrderIndex;
                        DockPane pane2        = dockPanel.Contents[sortedContents[j]].DockHandler.Pane;
                        int      ZOrderIndex2 = pane2 == null ? 0 : panes[dockPanel.Panes.IndexOf(pane2)].ZOrderIndex;
                        if (ZOrderIndex1 > ZOrderIndex2)
                        {
                            int temp = sortedContents[i];
                            sortedContents[i] = sortedContents[j];
                            sortedContents[j] = temp;
                        }
                    }
                }
            }

            // show non-document IDockContent first to avoid screen flickers
            for (int i = 0; i < contents.Length; i++)
            {
                IDockContent content = dockPanel.Contents[sortedContents[i]];
                if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState != DockState.Document)
                {
                    content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
                }
            }

            // after all non-document IDockContent, show document IDockContent
            for (int i = 0; i < contents.Length; i++)
            {
                IDockContent content = dockPanel.Contents[sortedContents[i]];
                if (content.DockHandler.Pane != null && content.DockHandler.Pane.DockState == DockState.Document)
                {
                    content.DockHandler.IsHidden = contents[sortedContents[i]].IsHidden;
                }
            }

            for (int i = 0; i < panes.Length; i++)
            {
                dockPanel.Panes[i].ActiveContent = panes[i].IndexActiveContent == -1 ? null : dockPanel.Contents[panes[i].IndexActiveContent];
            }

            if (dockPanelStruct.IndexActiveDocumentPane != -1)
            {
                dockPanel.Panes[dockPanelStruct.IndexActiveDocumentPane].Activate();
            }

            if (dockPanelStruct.IndexActivePane != -1)
            {
                dockPanel.Panes[dockPanelStruct.IndexActivePane].Activate();
            }

            for (int i = dockPanel.Contents.Count - 1; i >= 0; i--)
            {
                if (dockPanel.Contents[i] is DummyContent)
                {
                    dockPanel.Contents[i].DockHandler.Form.Close();
                }
            }
        }
コード例 #21
0
 internal void AddAt(DockPane pane, DockPane paneBefore)
 {
     AddAt(pane, IndexOf(paneBefore));
 }
コード例 #22
0
ファイル: DockPanel.cs プロジェクト: gpanayir/sffwk
    private void SetActiveDocumentPane() {
      DockPane value = null;

      if (ActivePane != null && ActivePane.DockState == DockState.Document)
        value = ActivePane;

      if (value == null) {
        if (ActiveDocumentPane == null)
          value = DockWindows[DockState.Document].DefaultPane;
        else if (ActiveDocumentPane.DockPanel != this || ActiveDocumentPane.DockState != DockState.Document)
          value = DockWindows[DockState.Document].DefaultPane;
        else
          value = m_activeDocumentPane;
      }

      if (m_activeDocumentPane == value)
        return;

      if (m_activeDocumentPane != null)
        m_activeDocumentPane.SetIsActiveDocumentPane(false);

      m_activeDocumentPane = value;

      if (m_activeDocumentPane != null)
        m_activeDocumentPane.SetIsActiveDocumentPane(true);
    }
コード例 #23
0
ファイル: DockList.cs プロジェクト: gpanayir/sffwk
		internal void Remove(DockPane pane)
		{
			InternalRemove(pane);
			CheckFloatWindowDispose();
		}
コード例 #24
0
ファイル: DockPanel.cs プロジェクト: gpanayir/sffwk
    internal void RemovePane(DockPane pane) {
      if (!Panes.Contains(pane))
        return;

      Panes.Remove(pane);
    }
コード例 #25
0
ファイル: FloatWindow.cs プロジェクト: Pelsoft/fwk_10.3
		/// <include file='CodeDoc\FloatWindow.xml' path='//CodeDoc/Class[@name="FloatWindow"]/Constructor[@name="Overloads"]/*'/>
		/// <include file='CodeDoc\FloatWindow.xml' path='//CodeDoc/Class[@name="FloatWindow"]/Constructor[@name="(DockPanel, DockPane)"]/*'/>
		public FloatWindow(DockPanel dockPanel, DockPane pane)
		{
			InternalConstruct(dockPanel, pane, false, Rectangle.Empty);
		}
コード例 #26
0
 private void ResumeSetDockState(bool isHidden, DockState visibleState, DockPane oldPane) {
   ResumeSetDockState();
   SetDockState(isHidden, visibleState, oldPane);
 }
コード例 #27
0
        private void RefreshChanges()
        {
            Region    region       = new Region(Rectangle.Empty);
            Rectangle rectDockArea = FullPanelEdge ? DockPanel.DockArea : DockPanel.DocumentWindowBounds;

            rectDockArea.Location = DockPanel.PointToScreen(rectDockArea.Location);
            if (ShouldPanelIndicatorVisible(DockState.DockLeft))
            {
                PanelLeft.Location = new Point(rectDockArea.X + _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
                PanelLeft.Visible  = true;
                region.Union(PanelLeft.Bounds);
            }
            else
            {
                PanelLeft.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockRight))
            {
                PanelRight.Location = new Point(rectDockArea.X + rectDockArea.Width - PanelRight.Width - _PanelIndicatorMargin, rectDockArea.Y + (rectDockArea.Height - PanelRight.Height) / 2);
                PanelRight.Visible  = true;
                region.Union(PanelRight.Bounds);
            }
            else
            {
                PanelRight.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockTop))
            {
                PanelTop.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelTop.Width) / 2, rectDockArea.Y + _PanelIndicatorMargin);
                PanelTop.Visible  = true;
                region.Union(PanelTop.Bounds);
            }
            else
            {
                PanelTop.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.DockBottom))
            {
                PanelBottom.Location = new Point(rectDockArea.X + (rectDockArea.Width - PanelBottom.Width) / 2, rectDockArea.Y + rectDockArea.Height - PanelBottom.Height - _PanelIndicatorMargin);
                PanelBottom.Visible  = true;
                region.Union(PanelBottom.Bounds);
            }
            else
            {
                PanelBottom.Visible = false;
            }

            if (ShouldPanelIndicatorVisible(DockState.Document))
            {
                Rectangle rectDocumentWindow = DockPanel.DocumentWindowBounds;
                rectDocumentWindow.Location = DockPanel.PointToScreen(rectDocumentWindow.Location);
                PanelFill.Location          = new Point(rectDocumentWindow.X + (rectDocumentWindow.Width - PanelFill.Width) / 2, rectDocumentWindow.Y + (rectDocumentWindow.Height - PanelFill.Height) / 2);
                PanelFill.Visible           = true;
                region.Union(PanelFill.Bounds);
            }
            else
            {
                PanelFill.Visible = false;
            }

            if (ShouldPaneDiamondVisible())
            {
                Rectangle rect = DockPane.ClientRectangle;
                rect.Location        = DockPane.PointToScreen(rect.Location);
                PaneDiamond.Location = new Point(rect.Left + (rect.Width - PaneDiamond.Width) / 2, rect.Top + (rect.Height - PaneDiamond.Height) / 2);
                PaneDiamond.Visible  = true;
                using (GraphicsPath graphicsPath = PaneDiamond.DisplayingGraphicsPath.Clone() as GraphicsPath) {
                    Point[] pts = new Point[]
                    {
                        new Point(PaneDiamond.Left, PaneDiamond.Top),
                        new Point(PaneDiamond.Right, PaneDiamond.Top),
                        new Point(PaneDiamond.Left, PaneDiamond.Bottom)
                    };
                    using (Matrix matrix = new Matrix(PaneDiamond.ClientRectangle, pts)) {
                        graphicsPath.Transform(matrix);
                    }
                    region.Union(graphicsPath);
                }
            }
            else
            {
                PaneDiamond.Visible = false;
            }

            Region = region;
        }
コード例 #28
0
 private void RefreshDockPane(DockPane pane) {
   pane.RefreshChanges();
   pane.ValidateActiveContent();
 }
コード例 #29
0
ファイル: DockPanel.cs プロジェクト: gpanayir/sffwk
    private void SetActivePane() {
      DockPane value = GetPaneFromHandle(User32.GetFocus());
      if (m_activePane == value)
        return;

      if (m_activePane != null)
        m_activePane.SetIsActivated(false);

      m_activePane = value;

      if (m_activePane != null)
        m_activePane.SetIsActivated(true);
    }
コード例 #30
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);
        }
コード例 #31
0
ファイル: DockPanel.cs プロジェクト: gpanayir/sffwk
    internal void AddPane(DockPane pane) {
      if (Panes.Contains(pane))
        return;

      Panes.Add(pane);
    }
コード例 #32
0
ファイル: DockOutline.cs プロジェクト: Pelsoft/fwk_10.3
    private void SetOutline(DockPane pane, DockStyle dock, int contentIndex) {
      if (dock != DockStyle.Fill) {
        Rectangle rect = pane.DisplayingRectangle;
        if (dock == DockStyle.Right)
          rect.X += rect.Width / 2;
        if (dock == DockStyle.Bottom)
          rect.Y += rect.Height / 2;
        if (dock == DockStyle.Left || dock == DockStyle.Right)
          rect.Width -= rect.Width / 2;
        if (dock == DockStyle.Top || dock == DockStyle.Bottom)
          rect.Height -= rect.Height / 2;
        rect.Location = pane.PointToScreen(rect.Location);

        SetDragForm(rect);
      } else if (contentIndex == -1) {
        Rectangle rect = pane.DisplayingRectangle;
        rect.Location = pane.PointToScreen(rect.Location);
        SetDragForm(rect);
      } else {
        using (GraphicsPath path = pane.TabStripControl.GetOutlinePath(contentIndex)) {
          RectangleF rectF = path.GetBounds();
          Rectangle rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
          using (Matrix matrix = new Matrix(rect, new Point[] { new Point(0, 0), new Point(rect.Width, 0), new Point(0, rect.Height) })) {
            path.Transform(matrix);
          }
          Region region = new Region(path);
          SetDragForm(rect, region);
        }
      }
    }
コード例 #33
0
ファイル: DockPanel.cs プロジェクト: gpanayir/sffwk
    /// <include file='CodeDoc\DockPanel.xml' path='//CodeDoc/Class[@name="DockPanel"]/Method[@name="SetPaneIndex(DockPane, int)"]/*'/>
    public void SetPaneIndex(DockPane pane, int index) {
      int oldIndex = Panes.IndexOf(pane);
      if (oldIndex == -1)
        throw (new ArgumentException(ResourceHelper.GetString("DockPanel.SetPaneIndex.InvalidPane")));

      if (index < 0 || index > Panes.Count - 1)
        if (index != -1)
          throw (new ArgumentOutOfRangeException(ResourceHelper.GetString("DockPanel.SetPaneIndex.InvalidIndex")));

      if (oldIndex == index)
        return;
      if (oldIndex == Panes.Count - 1 && index == -1)
        return;

      Panes.Remove(pane);
      if (index == -1)
        Panes.Add(pane);
      else if (oldIndex < index)
        Panes.AddAt(pane, index - 1);
      else
        Panes.AddAt(pane, index);
    }
コード例 #34
0
		internal DockContentCollection(DockPane pane)
		{
			m_dockPane = pane;
		}
コード例 #35
0
    internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPane) {
      if (IsSuspendSetDockState)
        return;

      if (DockPanel == null && visibleState != DockState.Unknown)
        throw new InvalidOperationException(ResourceHelper.GetString("IDockContent.SetDockState.NullPanel"));

      if (visibleState == DockState.Hidden || (visibleState != DockState.Unknown && !IsDockStateValid(visibleState)))
        throw new InvalidOperationException(ResourceHelper.GetString("IDockContent.SetDockState.InvalidState"));

      SuspendSetDockState();

      DockState oldDockState = DockState;

      if (m_isHidden != isHidden || oldDockState == DockState.Unknown) {
        m_isHidden = isHidden;
      }
      m_visibleState = visibleState;
      m_dockState = isHidden ? DockState.Hidden : visibleState;

      if (visibleState == DockState.Unknown)
        Pane = null;
      else {
        m_isFloat = (m_visibleState == DockState.Float);

        if (Pane == null)
          Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
        else if (Pane.DockState != visibleState) {
          if (Pane.Contents.Count == 1)
            Pane.SetDockState(visibleState);
          else
            Pane = DockPanel.DockPaneFactory.CreateDockPane(Content, visibleState, true);
        }
      }

      SetPane(Pane);
      SetVisible();

      if (oldPane != null && !oldPane.IsDisposed && oldDockState == oldPane.DockState)
        RefreshDockPane(oldPane);

      if (Pane != null && DockState == Pane.DockState) {
        if ((Pane != oldPane) ||
          (Pane == oldPane && oldDockState != oldPane.DockState))
          RefreshDockPane(Pane);
      }

      if (oldDockState != DockState)
        OnDockStateChanged(EventArgs.Empty);

      ResumeSetDockState();
    }
コード例 #36
0
ファイル: DockList.cs プロジェクト: gpanayir/sffwk
		/// <include file='CodeDoc\DockList.xml' path='//CodeDoc/Class[@name="DockList"]/Method[@name="GetDefaultPrevPane(DockPane)"]/*'/>
		public DockPane GetDefaultPrevPane(DockPane pane)
		{
			for (int i=Count-1; i>=0; i--)
				if (this[i] != pane)
					return this[i];

			return null;
		}
コード例 #37
0
 internal void SetPane(DockPane pane) {
   if (pane != null && pane.DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyles.DockingMdi) {
     if (Form.Parent is DockPane)
       SetParent(null);
     if (Form.MdiParent != DockPanel.ParentForm) {
       FlagClipWindow = true;
       Form.MdiParent = DockPanel.ParentForm;
     }
   } else {
     FlagClipWindow = true;
     if (Form.MdiParent != null)
       Form.MdiParent = null;
     if (Form.TopLevel)
       Form.TopLevel = false;
     SetParent(pane);
   }
 }
コード例 #38
0
ファイル: DockList.cs プロジェクト: gpanayir/sffwk
		/// <include file='CodeDoc\DockList.xml' path='//CodeDoc/Class[@name="DockList"]/Method[@name="Contains(DockPane)"]/*'/>
		public bool Contains(DockPane pane)
		{
			return InnerList.Contains(pane);
		}
コード例 #39
0
    /// <include file='CodeDoc\DockContentHandler.xml' path='//CodeDoc/Class[@name="DockContentHandler"]/Method[@name="Show(DockPane, DockAlignment, double)"]/*'/>
    public void Show(DockPane prevPane, DockAlignment alignment, double proportion) {
      if (prevPane == null)
        throw (new ArgumentException(ResourceHelper.GetString("IDockContent.Show.InvalidPrevPane")));

      if (DockHelper.IsDockStateAutoHide(prevPane.DockState))
        throw (new ArgumentException(ResourceHelper.GetString("IDockContent.Show.InvalidPrevPane")));

      DockPanel = prevPane.DockPanel;
      DockPanel.DockPaneFactory.CreateDockPane(Content, prevPane, alignment, proportion, true);
      Show();
    }
コード例 #40
0
 public DockPaneSplitter(DockPane pane)
 {
     SetStyle(ControlStyles.Selectable, false);
     m_pane = pane;
 }