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 DockBarItem BarDock(Gtk.PositionType pos, DockItem item, int size) { return(GetDockBar(pos).AddItem(item, size)); }
public DockGroupItem(DockFrame frame, DockItem item) : base(frame) { this.item = item; visibleFlag = item.Visible; }
internal void DockInPlaceholder(DockItem item) { container.DockInPlaceholder(item); }
internal void UpdatePlaceholder(DockItem item, Gdk.Size size, bool allowDocking) { container.UpdatePlaceholder(item, size, allowDocking); }
internal abstract bool GetDockTarget(DockItem item, int px, int py, out DockDelegate dockDelegate, out Gdk.Rectangle rect);
DockGroupItem AddDefaultItem(DockGroup grp, DockItem it) { return(AddItemAtLocation(grp, it, it.DefaultLocation, it.DefaultVisible, it.DefaultStatus)); }
public DockGroupItem AddObject(DockItem obj, DockPosition pos, string relItemId) { int npos = -1; if (relItemId != null) { for (int n = 0; n < dockObjects.Count; n++) { DockGroupItem it = dockObjects [n] as DockGroupItem; if (it != null && it.Id == relItemId) { npos = n; } } } if (npos == -1) { if (pos == DockPosition.Left || pos == DockPosition.Top) { npos = 0; } else { npos = dockObjects.Count - 1; } } DockGroupItem gitem = null; if (pos == DockPosition.Left || pos == DockPosition.Right) { if (type != DockGroupType.Horizontal) { gitem = Split(DockGroupType.Horizontal, pos == DockPosition.Left, obj, npos); } else { gitem = InsertObject(obj, npos, pos); } } else if (pos == DockPosition.Top || pos == DockPosition.Bottom) { if (type != DockGroupType.Vertical) { gitem = Split(DockGroupType.Vertical, pos == DockPosition.Top, obj, npos); } else { gitem = InsertObject(obj, npos, pos); } } else if (pos == DockPosition.CenterBefore || pos == DockPosition.Center) { if (type != DockGroupType.Tabbed) { gitem = Split(DockGroupType.Tabbed, pos == DockPosition.CenterBefore, obj, npos); } else { if (pos == DockPosition.Center) { npos++; } gitem = new DockGroupItem(Frame, obj); dockObjects.Insert(npos, gitem); gitem.ParentGroup = this; } } ResetVisibleGroups(); return(gitem); }
DockGroupItem Split(DockGroupType newType, bool addFirst, DockItem obj, int npos) { DockGroupItem item = new DockGroupItem(Frame, obj); if (npos == -1 || type == DockGroupType.Tabbed) { if (ParentGroup != null && ParentGroup.Type == newType) { // No need to split. Just add the new item as a sibling of this one. int i = ParentGroup.Objects.IndexOf(this); if (addFirst) { ParentGroup.Objects.Insert(i, item); } else { ParentGroup.Objects.Insert(i + 1, item); } item.ParentGroup = ParentGroup; item.ResetDefaultSize(); } else { DockGroup grp = Copy(); dockObjects.Clear(); if (addFirst) { dockObjects.Add(item); dockObjects.Add(grp); } else { dockObjects.Add(grp); dockObjects.Add(item); } item.ParentGroup = this; item.ResetDefaultSize(); grp.ParentGroup = this; grp.ResetDefaultSize(); Type = newType; } } else { DockGroup grp = new DockGroup(Frame, newType); DockObject replaced = dockObjects[npos]; if (addFirst) { grp.AddObject(item); grp.AddObject(replaced); } else { grp.AddObject(replaced); grp.AddObject(item); } grp.CopySizeFrom(replaced); dockObjects [npos] = grp; grp.ParentGroup = this; } return(item); }
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); }
public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size) { this.position = pos; this.frame = frame; this.targetSize = size; horiz = pos == PositionType.Left || pos == PositionType.Right; startPos = pos == PositionType.Top || pos == PositionType.Left; Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; Box fr; CustomFrame cframe = new CustomFrame(); switch (pos) { case PositionType.Left: cframe.SetMargins(1, 1, 0, 1); break; case PositionType.Right: cframe.SetMargins(1, 1, 1, 0); break; case PositionType.Top: cframe.SetMargins(0, 1, 1, 1); break; case PositionType.Bottom: cframe.SetMargins(1, 0, 1, 1); break; } EventBox sepBox = new EventBox(); cframe.Add(sepBox); if (horiz) { fr = new HBox(); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; }; sepBox.WidthRequest = gripSize; } else { fr = new VBox(); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; }; sepBox.HeightRequest = gripSize; } sepBox.Events = EventMask.AllEventsMask; if (pos == PositionType.Left || pos == PositionType.Top) { fr.PackEnd(cframe, false, false, 0); } else { fr.PackStart(cframe, false, false, 0); } Add(fr); ShowAll(); Hide(); scrollable = new ScrollableContainer(); scrollable.ScrollMode = false; scrollable.Show(); item.Widget.Show(); scrollable.Add(item.Widget); fr.PackStart(scrollable, true, true, 0); sepBox.ButtonPressEvent += OnSizeButtonPress; sepBox.ButtonReleaseEvent += OnSizeButtonRelease; sepBox.MotionNotifyEvent += OnSizeMotion; sepBox.ExposeEvent += OnGripExpose; sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw(); }; sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw(); }; }
public DockItemContainer(DockFrame frame, DockItem item) { this.frame = frame; this.item = item; ResizeMode = Gtk.ResizeMode.Queue; Spacing = 0; title = new Gtk.Label(); title.Xalign = 0; title.Xpad = 3; title.UseMarkup = true; title.Ellipsize = Pango.EllipsizeMode.End; btnDock = new Button(new Gtk.Image(pixAutoHide)); btnDock.Relief = ReliefStyle.None; btnDock.CanFocus = false; btnDock.WidthRequest = btnDock.HeightRequest = 17; btnDock.Clicked += OnClickDock; btnClose = new Button(new Gtk.Image(pixClose)); btnClose.TooltipText = Catalog.GetString("Hide"); btnClose.Relief = ReliefStyle.None; btnClose.CanFocus = false; btnClose.WidthRequest = btnClose.HeightRequest = 17; btnClose.Clicked += delegate { item.Visible = false; }; HBox box = new HBox(false, 0); box.PackStart(title, true, true, 0); box.PackEnd(btnClose, false, false, 0); box.PackEnd(btnDock, false, false, 0); headerAlign = new Alignment(0.0f, 0.0f, 1.0f, 1.0f); headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1; headerAlign.Add(box); header = new EventBox(); header.Events |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask; header.ButtonPressEvent += HeaderButtonPress; header.ButtonReleaseEvent += HeaderButtonRelease; header.MotionNotifyEvent += HeaderMotion; header.KeyPressEvent += HeaderKeyPress; header.KeyReleaseEvent += HeaderKeyRelease; header.Add(headerAlign); header.ExposeEvent += HeaderExpose; header.Realized += delegate { header.GdkWindow.Cursor = handCursor; }; foreach (Widget w in new Widget [] { header, btnDock, btnClose }) { w.EnterNotifyEvent += HeaderEnterNotify; w.LeaveNotifyEvent += HeaderLeaveNotify; } PackStart(header, false, false, 0); ShowAll(); PackStart(item.GetToolbar(PositionType.Top).Container, false, false, 0); HBox hbox = new HBox(); hbox.Show(); hbox.PackStart(item.GetToolbar(PositionType.Left).Container, false, false, 0); contentBox = new HBox(); contentBox.Show(); hbox.PackStart(contentBox, true, true, 0); hbox.PackStart(item.GetToolbar(PositionType.Right).Container, false, false, 0); PackStart(hbox, true, true, 0); PackStart(item.GetToolbar(PositionType.Bottom).Container, false, false, 0); UpdateBehavior(); }