public void OrganizeOnDrag(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem) { if (siblingItems == null) { throw new ArgumentNullException(nameof(siblingItems)); } if (dockItem == null) { throw new ArgumentNullException(nameof(dockItem)); } var currentLocations = siblingItems .Select(GetLocationInfo) .Union(new[] { GetLocationInfo(dockItem) }) .OrderBy(loc => loc.Item == dockItem ? loc.Start : _siblingItemLocationOnDragStart[loc.Item].Start); var currentCoord = 0.0; var zIndex = int.MaxValue; foreach (var location in currentLocations) { if (!Equals(location.Item, dockItem)) { SendToLocation(location.Item, currentCoord); location.Item.SetValue(Visual.ZIndexProperty, --zIndex); } currentCoord += _getDesiredSize(location.Item) + _itemOffset; } dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue); }
public void OrganizeOnMouseDownWithin(DockItemsControl requestor, Size measureBounds, List <DockItem> siblingItems, DockItem dockItem) { var zIndex = int.MaxValue; foreach (var source in siblingItems.OrderByDescending(x => x.GetValue(Visual.ZIndexProperty))) { source.SetValue(Visual.ZIndexProperty, --zIndex); } dockItem.SetValue(Visual.ZIndexProperty, int.MaxValue); }
public void Organize(DockItemsControl requestor, Size measureBounds, IOrderedEnumerable <DockItem> items) { if (items == null) { throw new ArgumentNullException(nameof(items)); } OrganizeInternal( requestor, measureBounds, items); }
public void OrganizeOnDragStarted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem) { if (siblingItems == null) { throw new ArgumentNullException(nameof(siblingItems)); } if (dockItem == null) { throw new ArgumentNullException(nameof(dockItem)); } _siblingItemLocationOnDragStart = siblingItems.Select(GetLocationInfo).ToDictionary(loc => loc.Item); }
public Point ConstrainLocation(DockItemsControl requestor, Size measureBounds, Point itemCurrentLocation, Size itemCurrentSize, Point itemDesiredLocation, Size itemDesiredSize) { var reduceBoundsWidth = itemCurrentLocation.X + itemCurrentSize.Width > measureBounds.Width ? 0 : itemDesiredSize.Width; var reduceBoundsHeight = itemCurrentLocation.Y + itemCurrentSize.Height > measureBounds.Height ? 0 : itemDesiredSize.Height; return(new Point( Math.Min(Math.Max(itemDesiredLocation.X, 0), measureBounds.Width - reduceBoundsWidth), Math.Min(Math.Max(itemDesiredLocation.Y, 0), measureBounds.Height - reduceBoundsHeight))); }
public void Organize(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> items) { if (items == null) { throw new ArgumentNullException(nameof(items)); } OrganizeInternal( requestor, measureBounds, items.Select((di, idx) => new Tuple <int, DockItem>(idx, di)) .OrderBy(tuple => tuple, MultiComparer <Tuple <int, DockItem> > .Ascending(tuple => _getLocation(tuple.Item2)) .ThenAscending(tuple => tuple.Item1)) .Select(tuple => tuple.Item2)); }
private void OrganizeInternal(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> items) { var currentCoord = 0.0; var z = int.MaxValue; var logicalIndex = 0; foreach (var newItem in items) { newItem.SetValue(Visual.ZIndexProperty, newItem.IsSelected ? int.MaxValue : --z); SetLocation(newItem, currentCoord); newItem.LogicalIndex = logicalIndex++; newItem.Measure(measureBounds); currentCoord += _getDesiredSize(newItem) + _itemOffset; } }
public Point ConstrainLocation(DockItemsControl requestor, Size measureBounds, Point itemCurrentLocation, Size itemCurrentSize, Point itemDesiredLocation, Size itemDesiredSize) { var fixedItems = requestor.FixedItemCount; var lowerBound = fixedItems == 0 ? -1d : GetLocationInfo(requestor.DockItems() .Take(fixedItems) .Last()).End + _itemOffset - 1; return(new Point( _orientation == Orientation.Vertical ? 0 : Math.Min(Math.Max(lowerBound, itemDesiredLocation.X), (measureBounds.Width) + 1), _orientation == Orientation.Horizontal ? 0 : Math.Min(Math.Max(lowerBound, itemDesiredLocation.Y), (measureBounds.Height) + 1) )); }
public Size Measure(DockItemsControl requestor, Size availableSize, IEnumerable <DockItem> items) { if (items == null) { throw new ArgumentNullException(nameof(items)); } var size = new Size(double.PositiveInfinity, double.PositiveInfinity); double width = 0, height = 0; var isFirst = true; foreach (var dockItem in items) { dockItem.Measure(size); if (_orientation == Orientation.Horizontal) { width += dockItem.Width; if (!isFirst) { width += _itemOffset; } height = Math.Max(height, dockItem.Height); } else { width = Math.Max(width, dockItem.Width); height += dockItem.Height; if (!isFirst) { height += _itemOffset; } } isFirst = false; } return(new Size(Math.Max(width, 0), Math.Max(height, 0))); }
public Size Measure(DockItemsControl requestor, Size availableSize, IEnumerable <DockItem> items) { return(availableSize); }
public void OrganizeOnDragCompleted(DockItemsControl requestor, Size measureBounds, IEnumerable <DockItem> siblingItems, DockItem dockItem) { }
public void Organize(DockItemsControl requestor, Size measureBounds, IOrderedEnumerable <DockItem> items) { }
public void OrganizeOnMouseDownWithin(DockItemsControl requestor, Size measureBounds, List <DockItem> siblingItems, DockItem dockItem) { }
private bool ShouldDragWindow(DockItemsControl sourceOfDockItemsControl) { return(((IList)Items).Count == 1 && (InterTabController == null || InterTabController.MoveWindowWithSolitaryTabs) && !Layout.IsContainedWithinBranch(sourceOfDockItemsControl)); }
internal static DockControl GetOwnerOfHeaderItems(DockItemsControl itemsControl) { return(LoadedInstances.FirstOrDefault(t => Equals(t._dockItemsControl, itemsControl))); }