internal void AddUndockingPanels(StiDockingPanel dockingPanel)
 {
     UndockedPanels.Add(dockingPanel);
     Form = (dockingPanel.FloatingForm != null)
         ? dockingPanel.LastDockForm
         : dockingPanel.Parent as Form;
 }
예제 #2
0
        public StiFloatingForm(StiDockingPanel panel)
        {
            SetStyle(ControlStyles.ResizeRedraw, true);
            InitializeComponent();

            this.AutoScaleMode = AutoScaleMode.None;

            this.DockPadding.All = 4;
            this.Panel           = panel;
        }
예제 #3
0
        private void OnAddToBottom(object sender, EventArgs e)
        {
            IDesignerHost       host        = (IDesignerHost)this.GetService(typeof(IDesignerHost));
            DesignerTransaction transaction = host.CreateTransaction("Add to bottom");
            StiDockingPanel     panel       = (StiDockingPanel)host.CreateComponent(typeof(StiDockingPanel));

            ((Form)host.RootComponent).Controls.Add(panel);
            dockingManager.DockedPanels.Add(panel);
            panel.Manager = dockingManager;
            panel.Dock    = DockStyle.Bottom;
            transaction.Commit();
        }
        internal static void StartDockingWindow(StiDockingPanel pn, Rectangle rect)
        {
            panel         = pn;
            DockingWindow = new StiDockingWindow();

            Win32.SetWindowPos(
                DockingWindow.Handle,
                new IntPtr((int)-1),
                0, 0, rect.Width, rect.Height,
                (int)Win32.SetWindowPosFlags.SWP_NOACTIVATE |
                (int)Win32.SetWindowPosFlags.SWP_SHOWWINDOW |
                (int)Win32.SetWindowPosFlags.SWP_NOSIZE |
                (int)Win32.SetWindowPosFlags.SWP_NOMOVE);
        }
예제 #5
0
        /// <summary>
        /// Start resize Docking.
        /// </summary>
        public static void StartResize(StiDockingPanel panel, Rectangle rect, int minimumSize, int maximumSize)
        {
            minSize = minimumSize;
            maxSize = maximumSize;

            dockingPanel         = panel;
            startResizeRectangle = lastResizeRectangle = rect;
            if (ResizeControl != null)
            {
                ResizeControl.Dispose();
                ResizeControl = null;
            }
            ResizeControl        = new StiControlResize();
            ResizeControl.Bounds = rect;
            dockingPanel.Parent.Controls.Add(ResizeControl);
            dockingPanel.Parent.Controls.SetChildIndex(ResizeControl, 0);
            dockingPanel.IsResizing = true;
            lastResizePos           = Cursor.Position;
        }
        internal StiDockingControl GetDockingControl(string guid)
        {
            var al = DockedPanels;

            foreach (var panel in al)
            {
                foreach (StiDockingControl control in panel.Controls)
                {
                    if (control.Guid == guid)
                    {
                        return(control);
                    }
                }
            }

            foreach (var panel in UndockedPanels)
            {
                foreach (StiDockingControl control in panel.Controls)
                {
                    if (control.Guid == guid)
                    {
                        return(control);
                    }
                }
            }

            foreach (var control in ClosedControls)
            {
                var panel = new StiDockingPanel(this);
                panel.LastDockForm = ParentForm;
                panel.Controls.Add(control);

                if (control.Guid == guid)
                {
                    return(control);
                }
            }
            return(null);
        }
        private static Rectangle GetPanelDockRectangle(StiDockingPanel dockPanel, Rectangle rect)
        {
            Point pos = Cursor.Position;

            ControlToDock = dockPanel;

            if (dockPanel.Collapsed)
            {
                Rectangle clientRectangle = dockPanel.RectangleToScreen(dockPanel.ClientRectangle);
                if (clientRectangle.Contains(pos))
                {
                    return(clientRectangle);
                }
            }

            Rectangle bounds = dockPanel.RectangleToScreen(dockPanel.PanelBounds);

            if (!bounds.Contains(pos))
            {
                return(Rectangle.Empty);
            }


            if (dockPanel == panel)
            {
                return(Rectangle.Empty);
            }

            int tabHt = 0;

            if (dockPanel.Controls.Count > 1)
            {
                tabHt = StiDockingPanel.TabHeight;
            }

            #region Title
            if (new Rectangle(bounds.Left, bounds.Top, bounds.Width, StiDockingPanel.TitleHeight).Contains(pos))
            {
                DockType = DockStyle.Fill;
                return(bounds);
            }
            #endregion

            #region Tabs
            if (tabHt != 0 && new Rectangle(bounds.Left, bounds.Bottom - StiDockingPanel.TabHeight,
                                            bounds.Width, StiDockingPanel.TabHeight).Contains(pos))
            {
                DockType = DockStyle.Fill;
                return(bounds);
            }
            #endregion

            switch (dockPanel.Dock)
            {
            case DockStyle.Left:
                if (new Rectangle(bounds.Left, bounds.Top, 20, bounds.Height).Contains(pos))
                {
                    DockType = DockStyle.Fill;
                    return(bounds);
                }
                break;

            case DockStyle.Right:
                if (new Rectangle(bounds.Right - 20, bounds.Top, 20, bounds.Height).Contains(pos))
                {
                    DockType = DockStyle.Fill;
                    return(bounds);
                }
                break;

            case DockStyle.Bottom:
                if (new Rectangle(bounds.Left, bounds.Bottom - 20, bounds.Width, 20).Contains(pos))
                {
                    DockType = DockStyle.Fill;
                    return(bounds);
                }
                break;
            }

            return(Rectangle.Empty);
        }
 internal void RemoveUndockingPanels(StiDockingPanel dockingPanel)
 {
     UndockedPanels.Remove(dockingPanel);
 }