public bool GetDockTarget(DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect) { dockDelegate = null; if (item != this.item && this.item.Visible && rect.Contains(px, py)) { int xdockMargin = (int)((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2; int ydockMargin = (int)((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2; DockPosition pos; /* if (ParentGroup.Type == DockGroupType.Tabbed) { * rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2); * pos = DockPosition.CenterAfter; * } */ if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) { outrect = new Gdk.Rectangle(rect.X, rect.Y, xdockMargin, rect.Height); pos = DockPosition.Left; } else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) { outrect = new Gdk.Rectangle(rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height); pos = DockPosition.Right; } else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) { outrect = new Gdk.Rectangle(rect.X, rect.Y, rect.Width, ydockMargin); pos = DockPosition.Top; } else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) { outrect = new Gdk.Rectangle(rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin); pos = DockPosition.Bottom; } else { outrect = new Gdk.Rectangle(rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin * 2, rect.Height - ydockMargin * 2); pos = DockPosition.Center; } dockDelegate = delegate(DockItem dit) { DockGroupItem it = ParentGroup.AddObject(dit, pos, Id); it.SetVisible(true); ParentGroup.FocusItem(it); }; return(true); } outrect = Gdk.Rectangle.Zero; return(false); }
internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect) { return(GetDockTarget(item, px, py, Allocation, out dockDelegate, out rect)); }
public void SetDockInfo (DockDelegate dockDelegate, Rectangle rect) { DockDelegate = dockDelegate; DockRect = rect; }
internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect) { if (!Allocation.Contains(px, py) || VisibleObjects.Count == 0) { dockDelegate = null; rect = Gdk.Rectangle.Zero; return(false); } if (type == DockGroupType.Tabbed) { // Tabs can only contain DockGroupItems return(((DockGroupItem)VisibleObjects[0]).GetDockTarget(item, px, py, Allocation, out dockDelegate, out rect)); } else if (type == DockGroupType.Horizontal) { if (px >= Allocation.Right - DockFrame.GroupDockSeparatorSize) { // Dock to the right of the group dockDelegate = delegate(DockItem it) { DockTarget(it, dockObjects.Count); }; rect = new Gdk.Rectangle(Allocation.Right - DockFrame.GroupDockSeparatorSize, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return(true); } else if (px <= Allocation.Left + DockFrame.GroupDockSeparatorSize) { // Dock to the left of the group dockDelegate = delegate(DockItem it) { DockTarget(it, 0); }; rect = new Gdk.Rectangle(Allocation.Left, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return(true); } // Dock in a separator for (int n = 0; n < VisibleObjects.Count; n++) { DockObject ob = VisibleObjects [n]; if (n < VisibleObjects.Count - 1 && px >= ob.Allocation.Right - DockFrame.GroupDockSeparatorSize / 2 && px <= ob.Allocation.Right + DockFrame.GroupDockSeparatorSize / 2) { int dn = dockObjects.IndexOf(ob); dockDelegate = delegate(DockItem it) { DockTarget(it, dn + 1); }; rect = new Gdk.Rectangle(ob.Allocation.Right - DockFrame.GroupDockSeparatorSize / 2, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return(true); } else if (ob.GetDockTarget(item, px, py, out dockDelegate, out rect)) { return(true); } } } else if (type == DockGroupType.Vertical) { if (py >= Allocation.Bottom - DockFrame.GroupDockSeparatorSize) { // Dock to the bottom of the group dockDelegate = delegate(DockItem it) { DockTarget(it, dockObjects.Count); }; rect = new Gdk.Rectangle(Allocation.X, Allocation.Bottom - DockFrame.GroupDockSeparatorSize, Allocation.Width, DockFrame.GroupDockSeparatorSize); return(true); } else if (py <= Allocation.Top + DockFrame.GroupDockSeparatorSize) { // Dock to the top of the group dockDelegate = delegate(DockItem it) { DockTarget(it, 0); }; rect = new Gdk.Rectangle(Allocation.X, Allocation.Top, Allocation.Width, DockFrame.GroupDockSeparatorSize); return(true); } // Dock in a separator for (int n = 0; n < VisibleObjects.Count; n++) { DockObject ob = VisibleObjects [n]; if (n < VisibleObjects.Count - 1 && py >= ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize / 2 && py <= ob.Allocation.Bottom + DockFrame.GroupDockSeparatorSize / 2) { int dn = dockObjects.IndexOf(ob); dockDelegate = delegate(DockItem it) { DockTarget(it, dn + 1); }; rect = new Gdk.Rectangle(Allocation.X, ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize / 2, Allocation.Width, DockFrame.GroupDockSeparatorSize); return(true); } else if (ob.GetDockTarget(item, px, py, out dockDelegate, out rect)) { return(true); } } } dockDelegate = null; rect = Gdk.Rectangle.Zero; return(false); }
internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
public bool GetDockTarget (DockItem item, int px, int py, Gdk.Rectangle rect, out DockDelegate dockDelegate, out Gdk.Rectangle outrect) { outrect = Gdk.Rectangle.Zero; dockDelegate = null; if (item != this.item && this.item.Visible && rect.Contains (px, py)) { // Check if the item is allowed to be docked here var s = Frame.GetRegionStyleForObject (this); int xdockMargin = (int) ((double)rect.Width * (1.0 - DockFrame.ItemDockCenterArea)) / 2; int ydockMargin = (int) ((double)rect.Height * (1.0 - DockFrame.ItemDockCenterArea)) / 2; DockPosition pos; /* if (ParentGroup.Type == DockGroupType.Tabbed) { rect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2); pos = DockPosition.CenterAfter; }*/ if (px <= rect.X + xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) { if (s.SingleColumnMode.Value) return false; outrect = new Gdk.Rectangle (rect.X, rect.Y, xdockMargin, rect.Height); pos = DockPosition.Left; } else if (px >= rect.Right - xdockMargin && ParentGroup.Type != DockGroupType.Horizontal) { if (s.SingleColumnMode.Value) return false; outrect = new Gdk.Rectangle (rect.Right - xdockMargin, rect.Y, xdockMargin, rect.Height); pos = DockPosition.Right; } else if (py <= rect.Y + ydockMargin && ParentGroup.Type != DockGroupType.Vertical) { if (s.SingleRowMode.Value) return false; outrect = new Gdk.Rectangle (rect.X, rect.Y, rect.Width, ydockMargin); pos = DockPosition.Top; } else if (py >= rect.Bottom - ydockMargin && ParentGroup.Type != DockGroupType.Vertical) { if (s.SingleRowMode.Value) return false; outrect = new Gdk.Rectangle (rect.X, rect.Bottom - ydockMargin, rect.Width, ydockMargin); pos = DockPosition.Bottom; } else { outrect = new Gdk.Rectangle (rect.X + xdockMargin, rect.Y + ydockMargin, rect.Width - xdockMargin*2, rect.Height - ydockMargin*2); pos = DockPosition.Center; } dockDelegate = delegate (DockItem dit) { DockGroupItem it = ParentGroup.AddObject (dit, pos, Id); it.SetVisible (true); ParentGroup.FocusItem (it); }; return true; } return false; }
internal override bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect) { return GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect); }
internal override bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect) { dockDelegate = null; rect = Gdk.Rectangle.Zero; if (!Allocation.Contains (px, py) || VisibleObjects.Count == 0) return false; if (type == DockGroupType.Tabbed) { // Tabs can only contain DockGroupItems var sel = boundTabStrip != null ? VisibleObjects[boundTabStrip.CurrentTab] : VisibleObjects[VisibleObjects.Count - 1]; return ((DockGroupItem)sel).GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect); } else if (type == DockGroupType.Horizontal) { if (px >= Allocation.Right - DockFrame.GroupDockSeparatorSize) { // Check if the item is allowed to be docked here var s = Frame.GetRegionStyleForObject (VisibleObjects[VisibleObjects.Count - 1]); if (s.SingleColumnMode.Value) return false; // Dock to the right of the group dockDelegate = delegate (DockItem it) { DockTarget (it, dockObjects.Count); }; rect = new Gdk.Rectangle (Allocation.Right - DockFrame.GroupDockSeparatorSize, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return true; } else if (px <= Allocation.Left + DockFrame.GroupDockSeparatorSize) { // Check if the item is allowed to be docked here var s = Frame.GetRegionStyleForObject (VisibleObjects[0]); if (s.SingleColumnMode.Value) return false; // Dock to the left of the group dockDelegate = delegate (DockItem it) { DockTarget (it, 0); }; rect = new Gdk.Rectangle (Allocation.Left, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return true; } // Dock in a separator for (int n=0; n<VisibleObjects.Count; n++) { DockObject ob = VisibleObjects [n]; if (n < VisibleObjects.Count - 1 && px >= ob.Allocation.Right - DockFrame.GroupDockSeparatorSize/2 && px <= ob.Allocation.Right + DockFrame.GroupDockSeparatorSize/2) { // Check if the item is allowed to be docked here int dn = dockObjects.IndexOf (ob) + 1; var s = Frame.GetRegionStyleForPosition (this, dn, true); if (s.SingleColumnMode.Value) return false; dockDelegate = delegate (DockItem it) { DockTarget (it, dn); }; rect = new Gdk.Rectangle (ob.Allocation.Right - DockFrame.GroupDockSeparatorSize/2, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return true; } else if (ob.GetDockTarget (item, px, py, out dockDelegate, out rect)) return true; } } else if (type == DockGroupType.Vertical) { if (py >= Allocation.Bottom - DockFrame.GroupDockSeparatorSize) { // Check if the item is allowed to be docked here var s = Frame.GetRegionStyleForObject (VisibleObjects[VisibleObjects.Count - 1]); if (s.SingleRowMode.Value) return false; // Dock to the bottom of the group dockDelegate = delegate (DockItem it) { DockTarget (it, dockObjects.Count); }; rect = new Gdk.Rectangle (Allocation.X, Allocation.Bottom - DockFrame.GroupDockSeparatorSize, Allocation.Width, DockFrame.GroupDockSeparatorSize); return true; } else if (py <= Allocation.Top + DockFrame.GroupDockSeparatorSize) { // Check if the item is allowed to be docked here var s = Frame.GetRegionStyleForObject (VisibleObjects[0]); if (s.SingleRowMode.Value) return false; // Dock to the top of the group dockDelegate = delegate (DockItem it) { DockTarget (it, 0); }; rect = new Gdk.Rectangle (Allocation.X, Allocation.Top, Allocation.Width, DockFrame.GroupDockSeparatorSize); return true; } // Dock in a separator for (int n=0; n<VisibleObjects.Count; n++) { DockObject ob = VisibleObjects [n]; if (n < VisibleObjects.Count - 1 && py >= ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize/2 && py <= ob.Allocation.Bottom + DockFrame.GroupDockSeparatorSize/2) { // Check if the item is allowed to be docked here int dn = dockObjects.IndexOf (ob) + 1; var s = Frame.GetRegionStyleForPosition (this, dn, true); if (s.SingleRowMode.Value) return false; dockDelegate = delegate (DockItem it) { DockTarget (it, dn); }; rect = new Gdk.Rectangle (Allocation.X, ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize/2, Allocation.Width, DockFrame.GroupDockSeparatorSize); return true; } else if (ob.GetDockTarget (item, px, py, out dockDelegate, out rect)) return true; } } dockDelegate = null; rect = Gdk.Rectangle.Zero; return false; }
internal override bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect) { if (!Allocation.Contains (px, py) || VisibleObjects.Count == 0) { dockDelegate = null; rect = Gdk.Rectangle.Zero; return false; } if (type == DockGroupType.Tabbed) { // Tabs can only contain DockGroupItems return ((DockGroupItem)VisibleObjects[0]).GetDockTarget (item, px, py, Allocation, out dockDelegate, out rect); } else if (type == DockGroupType.Horizontal) { if (px >= Allocation.Right - DockFrame.GroupDockSeparatorSize) { // Dock to the right of the group dockDelegate = delegate (DockItem it) { DockTarget (it, dockObjects.Count); }; rect = new Gdk.Rectangle (Allocation.Right - DockFrame.GroupDockSeparatorSize, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return true; } else if (px <= Allocation.Left + DockFrame.GroupDockSeparatorSize) { // Dock to the left of the group dockDelegate = delegate (DockItem it) { DockTarget (it, 0); }; rect = new Gdk.Rectangle (Allocation.Left, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return true; } // Dock in a separator for (int n=0; n<VisibleObjects.Count; n++) { DockObject ob = VisibleObjects [n]; if (n < VisibleObjects.Count - 1 && px >= ob.Allocation.Right - DockFrame.GroupDockSeparatorSize/2 && px <= ob.Allocation.Right + DockFrame.GroupDockSeparatorSize/2) { int dn = dockObjects.IndexOf (ob); dockDelegate = delegate (DockItem it) { DockTarget (it, dn+1); }; rect = new Gdk.Rectangle (ob.Allocation.Right - DockFrame.GroupDockSeparatorSize/2, Allocation.Y, DockFrame.GroupDockSeparatorSize, Allocation.Height); return true; } else if (ob.GetDockTarget (item, px, py, out dockDelegate, out rect)) return true; } } else if (type == DockGroupType.Vertical) { if (py >= Allocation.Bottom - DockFrame.GroupDockSeparatorSize) { // Dock to the bottom of the group dockDelegate = delegate (DockItem it) { DockTarget (it, dockObjects.Count); }; rect = new Gdk.Rectangle (Allocation.X, Allocation.Bottom - DockFrame.GroupDockSeparatorSize, Allocation.Width, DockFrame.GroupDockSeparatorSize); return true; } else if (py <= Allocation.Top + DockFrame.GroupDockSeparatorSize) { // Dock to the top of the group dockDelegate = delegate (DockItem it) { DockTarget (it, 0); }; rect = new Gdk.Rectangle (Allocation.X, Allocation.Top, Allocation.Width, DockFrame.GroupDockSeparatorSize); return true; } // Dock in a separator for (int n=0; n<VisibleObjects.Count; n++) { DockObject ob = VisibleObjects [n]; if (n < VisibleObjects.Count - 1 && py >= ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize/2 && py <= ob.Allocation.Bottom + DockFrame.GroupDockSeparatorSize/2) { int dn = dockObjects.IndexOf (ob); dockDelegate = delegate (DockItem it) { DockTarget (it, dn+1); }; rect = new Gdk.Rectangle (Allocation.X, ob.Allocation.Bottom - DockFrame.GroupDockSeparatorSize/2, Allocation.Width, DockFrame.GroupDockSeparatorSize); return true; } else if (ob.GetDockTarget (item, px, py, out dockDelegate, out rect)) return true; } } dockDelegate = null; rect = Gdk.Rectangle.Zero; return false; }
internal abstract bool GetDockTarget (DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
public void SetDockInfo(DockDelegate dockDelegate, Rectangle rect) { DockDelegate = dockDelegate; DockRect = rect; }