// finds the potential dockhost control at the specified location internal Control FindDockHost(Floaty floaty, Point pt) { Control c = null; if (FormIsHit(floaty.DockState.OrgDockHost, pt)) { c = floaty.DockState.OrgDockHost; //assume toplevel control } if (floaty.DockOnHostOnly) { return(c); } foreach (Floaty f in Floaties) { if (f.DockState.Container.Visible && FormIsHit(f.DockState.Container, pt)) { // add this line to dissallow docking inside floaties //if (f.Visible) continue; c = f.DockState.Container; // found suitable floating form break; } } return(c); }
/// ------------------------------------------------------------------------------------ /// <summary> /// attach this class to any dockable type of container control to make it dockable. /// Attach a container control and use it as a grip hande. The handle must support mouse /// move events. Supply a splitter control to allow resizing of the docked container /// </summary> /// <param name="container">control to be dockable</param> /// <param name="handle">handle to be used to track the mouse movement (e.g. caption of /// the container)</param> /// <param name="splitter">splitter to resize the docked container (optional)</param> /// <returns></returns> /// ------------------------------------------------------------------------------------ public IFloaty Attach(ScrollableControl container, Control handle, Splitter splitter) { if (container == null) { throw new ArgumentException("container cannot be null"); } if (handle == null) { throw new ArgumentException("handle cannot be null"); } DockState dockState = new DockState(); dockState.Container = container; dockState.Handle = handle; dockState.OrgDockHost = _dockHost; dockState.Splitter = splitter; dockState.OrgFloatingBounds = container.Bounds; Floaty floaty = new Floaty(this); floaty.Persistence = m_persistence; floaty.Attach(dockState); _floaties.Add(floaty); return(floaty); }
/// <summary> /// attach this class to any dockable type of container control /// to make it dockable. /// Attach a container control and use it as a grip hande. The handle must support mouse move events. /// Supply a splitter control to allow resizing of the docked container /// </summary> /// <param name="container">control to be dockable</param> /// <param name="handle">handle to be used to track the mouse movement (e.g. caption of the container)</param> /// <param name="splitter">splitter to resize the docked container (optional)</param> public IFloaty Attach(ScrollableControl container, Control handle, Splitter splitter) { if (container == null) { throw new ArgumentException("container cannot be null"); } if (handle == null) { throw new ArgumentException("handle cannot be null"); } var _dockState = new DockState(); _dockState.Container = container; _dockState.Handle = handle; _dockState.OrgDockHost = _dockHost; _dockState.Splitter = splitter; var floaty = new Floaty(this); floaty.Attach(_dockState); Floaties.Add(floaty); return(floaty); }