public DockToolbarFrame() { vbox = new VBox (); Add (vbox); DockToolbarPanel topPanel = new DockToolbarPanel (this, Placement.Top); DockToolbarPanel bottomPanel = new DockToolbarPanel (this, Placement.Bottom); DockToolbarPanel leftPanel = new DockToolbarPanel (this, Placement.Left); DockToolbarPanel rightPanel = new DockToolbarPanel (this, Placement.Right); panels = new DockToolbarPanel [4]; panels [(int)Placement.Top] = topPanel; panels [(int)Placement.Bottom] = bottomPanel; panels [(int)Placement.Left] = leftPanel; panels [(int)Placement.Right] = rightPanel; vbox.PackStart (topPanel, false, false, 0); HBox hbox = new HBox (); contentBox = new VBox (); hbox.PackStart (leftPanel, false, false, 0); hbox.PackStart (contentBox, true, true, 0); hbox.PackStart (rightPanel, false, false, 0); vbox.PackStart (hbox, true, true, 0); vbox.PackStart (bottomPanel, false, false, 0); this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; ShowAll (); }
internal bool CanDockTo(DockToolbarPanel panel) { return true; }
protected override bool OnMotionNotifyEvent(EventMotion e) { if (dragBar != null) { int sx,sy; this.GdkWindow.GetOrigin (out sx, out sy); int rx = (int)e.XRoot - sx; int ry = (int)e.YRoot - sy; if (dragBar.Floating) { bool foundPanel = false; dragBar.FloatingDock.Move ((int)e.XRoot + xDragDif, (int)e.YRoot + yDragDif); Rectangle barRect = new Rectangle (rx + xDragDif, ry + yDragDif, dragBar.Allocation.Width, dragBar.DefaultHeight); foreach (DockToolbarPanel p in panels) { if (p.Allocation.IntersectsWith (barRect)) { if (targetPanel != null && targetPanel != p) targetPanel.EndDragBar (dragBar); p.Reposition (dragBar, rx, ry, xDragDif, yDragDif); targetPanel = p; foundPanel = true; break; } } if (!foundPanel && targetPanel != null) targetPanel.EndDragBar (dragBar); } else { DockToolbarPanel panel = (DockToolbarPanel) dragBar.Parent; panel.Reposition (dragBar, rx, ry, xDragDif, yDragDif); } } return base.OnMotionNotifyEvent (e); }