public static FloatingItemSnapShot Take(DragablzItem dragablzItem) { if (dragablzItem == null) throw new ArgumentNullException("dragablzItem"); return new FloatingItemSnapShot( dragablzItem.Content, new Rect(dragablzItem.X, dragablzItem.Y, dragablzItem.ActualWidth, dragablzItem.ActualHeight), Panel.GetZIndex(dragablzItem), Layout.GetFloatingItemState(dragablzItem)); }
public void Apply(DragablzItem dragablzItem) { if (dragablzItem == null) throw new ArgumentNullException("dragablzItem"); dragablzItem.SetCurrentValue(DragablzItem.XProperty, Location.Left); dragablzItem.SetCurrentValue(DragablzItem.YProperty, Location.Top); dragablzItem.SetCurrentValue(FrameworkElement.WidthProperty, Location.Width); dragablzItem.SetCurrentValue(FrameworkElement.HeightProperty, Location.Height); Layout.SetFloatingItemState(dragablzItem, State); Panel.SetZIndex(dragablzItem, ZIndex); }
private static bool TryGetSourceTabControl(DragablzItem dragablzItem, out TabablzControl tabablzControl) { if (!(ItemsControl.ItemsControlFromItemContainer(dragablzItem) is DragablzItemsControl sourceOfDragItemsControl)) { throw new ApplicationException("Unable to determine source items control."); } tabablzControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); return(tabablzControl != null); }
internal void AddTabablzData(string header0, IEnumerable <TabablzControl> tctrl, TabContent tc1) { TabablzControl lastTabablzControl = tctrl.Last(); // adds a new tab after the last right tab IEnumerable <DragablzItem> orderedDragablzItem = lastTabablzControl.GetOrderedHeaders(); DragablzItem lastTab = orderedDragablzItem.Last(); TabablzControl.AddItem(tc1, lastTab.DataContext, AddLocationHint.After); TabablzControl.SelectItem(tc1); }
internal void AddTabablzData(string header0, IEnumerable <TabablzControl> tctrl, TabContent tc1) { TabablzControl lastTabablzControl = tctrl.Last(); // dodaje novi tab iza zadnjeg tab-a koji se vidi IEnumerable <DragablzItem> orderedDragablzItem = lastTabablzControl.GetOrderedHeaders(); DragablzItem lastTab = orderedDragablzItem.Last(); TabablzControl.AddItem(tc1, lastTab.DataContext, AddLocationHint.After); TabablzControl.SelectItem(tc1); }
public TabHeaderDragStartInformation( DragablzItem dragItem, double dragablzItemsControlHorizontalOffset, double dragablzItemControlVerticalOffset, double dragablzItemHorizontalOffset, double dragablzItemVerticalOffset) { if (dragItem == null) throw new ArgumentNullException("dragItem"); _dragItem = dragItem; _dragablzItemsControlHorizontalOffset = dragablzItemsControlHorizontalOffset; _dragablzItemControlVerticalOffset = dragablzItemControlVerticalOffset; _dragablzItemHorizontalOffset = dragablzItemHorizontalOffset; _dragablzItemVerticalOffset = dragablzItemVerticalOffset; }
public static FloatingItemSnapShot Take(DragablzItem dragablzItem) { if (dragablzItem == null) { throw new ArgumentNullException(nameof(dragablzItem)); } return(new FloatingItemSnapShot( dragablzItem.Content, new Rect(dragablzItem.X, dragablzItem.Y, dragablzItem.ActualWidth, dragablzItem.ActualHeight), Panel.GetZIndex(dragablzItem), Layout.GetFloatingItemState(dragablzItem))); }
public InterTabTransfer(object item, DragablzItem originatorContainer, Orientation breachOrientation, Point dragStartWindowOffset, Point dragStartItemOffset, Size itemSize, IList <FloatingItemSnapShot> floatingItemSnapShots, bool isTransposing) { TransferReason = InterTabTransferReason.Breach; Item = item ?? throw new ArgumentNullException(nameof(item)); OriginatorContainer = originatorContainer ?? throw new ArgumentNullException(nameof(originatorContainer)); BreachOrientation = breachOrientation; DragStartWindowOffset = dragStartWindowOffset; DragStartItemOffset = dragStartItemOffset; ItemSize = itemSize; FloatingItemSnapShots = floatingItemSnapShots ?? throw new ArgumentNullException(nameof(floatingItemSnapShots)); IsTransposing = isTransposing; }
public InterTabTransfer(object item, DragablzItem originatorContainer, Point dragStartItemOffset, IList<FloatingItemSnapShot> floatingItemSnapShots) { if (item == null) throw new ArgumentNullException("item"); if (originatorContainer == null) throw new ArgumentNullException("originatorContainer"); if (floatingItemSnapShots == null) throw new ArgumentNullException("floatingItemSnapShots"); _transferReason = InterTabTransferReason.Reentry; _item = item; _originatorContainer = originatorContainer; _dragStartItemOffset = dragStartItemOffset; _floatingItemSnapShots = floatingItemSnapShots; }
public void Apply(DragablzItem dragablzItem) { if (dragablzItem == null) { throw new ArgumentNullException(nameof(dragablzItem)); } dragablzItem.SetCurrentValue(DragablzItem.XProperty, Location.Left); dragablzItem.SetCurrentValue(DragablzItem.YProperty, Location.Top); dragablzItem.SetCurrentValue(FrameworkElement.WidthProperty, Location.Width); dragablzItem.SetCurrentValue(FrameworkElement.HeightProperty, Location.Height); Layout.SetFloatingItemState(dragablzItem, State); Panel.SetZIndex(dragablzItem, ZIndex); }
public TabHeaderDragStartInformation( DragablzItem dragItem, double dragablzItemsControlHorizontalOffset, double dragablzItemControlVerticalOffset, double dragablzItemHorizontalOffset, double dragablzItemVerticalOffset) { if (dragItem == null) { throw new ArgumentNullException("dragItem"); } _dragItem = dragItem; _dragablzItemsControlHorizontalOffset = dragablzItemsControlHorizontalOffset; _dragablzItemControlVerticalOffset = dragablzItemControlVerticalOffset; _dragablzItemHorizontalOffset = dragablzItemHorizontalOffset; _dragablzItemVerticalOffset = dragablzItemVerticalOffset; }
public InterTabTransfer(object item, DragablzItem originatorContainer, Point dragStartItemOffset) { if (item == null) { throw new ArgumentNullException("item"); } if (originatorContainer == null) { throw new ArgumentNullException("originatorContainer"); } _transferReason = InterTabTransferReason.Reentry; _item = item; _originatorContainer = originatorContainer; _dragStartItemOffset = dragStartItemOffset; }
private static TabablzControl AssertGetSourceTabControl(DragablzItem dragablzItem) { var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(dragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null) { throw new ApplicationException("Unable to determine source items control."); } var sourceTabControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); if (sourceTabControl == null) { throw new ApplicationException("Unable to determine source tab control."); } return(sourceTabControl); }
public InterTabTransfer(object item, DragablzItem originatorContainer, Orientation breachOrientation, Point dragStartWindowOffset, Point dragStartItemOffset, Point itemPositionWithinHeader, Size itemSize, IList<FloatingItemSnapShot> floatingItemSnapShots, bool isTransposing) { if (item == null) throw new ArgumentNullException("item"); if (originatorContainer == null) throw new ArgumentNullException("originatorContainer"); if (floatingItemSnapShots == null) throw new ArgumentNullException("floatingItemSnapShots"); _transferReason = InterTabTransferReason.Breach; _item = item; _originatorContainer = originatorContainer; _breachOrientation = breachOrientation; _dragStartWindowOffset = dragStartWindowOffset; _dragStartItemOffset = dragStartItemOffset; _itemPositionWithinHeader = itemPositionWithinHeader; _itemSize = itemSize; _floatingItemSnapShots = floatingItemSnapShots; _isTransposing = isTransposing; }
private static void Float(Layout layout, DragablzItem dragablzItem) { //TODO we need eq of IManualInterTabClient here, so consumer can control this op'. //remove from source var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(dragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null) { throw new ApplicationException("Unable to determin source items control."); } var sourceTabControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); layout._floatTransfer = FloatTransfer.TakeSnapshot(dragablzItem, sourceTabControl); var floatingItemSnapShots = sourceTabControl.VisualTreeDepthFirstTraversal() .OfType <Layout>() .SelectMany(l => l.FloatingDragablzItems().Select(FloatingItemSnapShot.Take)) .ToList(); if (sourceTabControl == null) { throw new ApplicationException("Unable to determin source tab control."); } sourceTabControl.RemoveItem(dragablzItem); //add to float layer CollectionTeaser collectionTeaser; if (CollectionTeaser.TryCreate(layout.FloatingItemsSource, out collectionTeaser)) { collectionTeaser.Add(layout._floatTransfer.Content); } else { layout.FloatingItems.Add(layout._floatTransfer.Content); } layout.Dispatcher.BeginInvoke(new Action(() => RestoreFloatingItemSnapShots(layout, floatingItemSnapShots)), DispatcherPriority.Loaded); }
private static void SetupParticipatingLayouts(DragablzItem dragablzItem) { if (!(ItemsControl.ItemsControlFromItemContainer(dragablzItem) is DragablzItemsControl sourceOfDragItemsControl) || sourceOfDragItemsControl.Items.Count != 1) { return; } var draggingWindow = Window.GetWindow(dragablzItem); if (draggingWindow == null) { return; } foreach (var loadedLayout in LoadedLayouts.Where(l => l.Partition == dragablzItem.PartitionAtDragStart && !Equals(Window.GetWindow(l), draggingWindow))) { loadedLayout.IsParticipatingInDrag = true; } }
public InterTabTransfer(object item, DragablzItem originatorContainer, Point dragStartItemOffset, IList <FloatingItemSnapShot> floatingItemSnapShots) { if (item == null) { throw new ArgumentNullException("item"); } if (originatorContainer == null) { throw new ArgumentNullException("originatorContainer"); } if (floatingItemSnapShots == null) { throw new ArgumentNullException("floatingItemSnapShots"); } _transferReason = InterTabTransferReason.Reentry; _item = item; _originatorContainer = originatorContainer; _dragStartItemOffset = dragStartItemOffset; _floatingItemSnapShots = floatingItemSnapShots; }
private static bool TryGetSourceTabControl(DragablzItem dragablzItem, out TabablzControl tabablzControl) { var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(dragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null) throw new ApplicationException("Unable to determine source items control."); tabablzControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); return tabablzControl != null; }
private static void SetupParticipatingLayouts(DragablzItem dragablzItem) { var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(dragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null || sourceOfDragItemsControl.Items.Count != 1) return; var draggingWindow = Window.GetWindow(dragablzItem); if (draggingWindow == null) return; foreach (var loadedLayout in LoadedLayouts.Where(l => l.Partition == dragablzItem.PartitionAtDragStart && !Equals(Window.GetWindow(l), draggingWindow))) { loadedLayout.IsParticipatingInDrag = true; } }
public FloatRequestedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem) : base(routedEvent, source, dragablzItem) { }
public FloatRequestedEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem) : base(routedEvent, dragablzItem) { }
public static void SetIcon(DragablzItem item, object value) { item.SetValue(IconProperty, value); }
private void Branch(DropZoneLocation location, DragablzItem sourceDragablzItem) { if (InterLayoutClient == null) throw new InvalidOperationException("InterLayoutClient is not set."); var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(sourceDragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null) throw new ApplicationException("Unable to determin source items control."); var sourceTabControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); if (sourceTabControl == null) throw new ApplicationException("Unable to determin source tab control."); var floatingItemSnapShots = sourceTabControl.VisualTreeDepthFirstTraversal() .OfType<Layout>() .SelectMany(l => l.FloatingDragablzItems().Select(FloatingItemSnapShot.Take)) .ToList(); var sourceItem = sourceOfDragItemsControl.ItemContainerGenerator.ItemFromContainer(sourceDragablzItem); sourceTabControl.RemoveItem(sourceDragablzItem); var branchItem = new Branch { Orientation = (location == DropZoneLocation.Right || location == DropZoneLocation.Left) ? Orientation.Horizontal : Orientation.Vertical }; object newContent; if (BranchTemplate == null) { var newTabHost = InterLayoutClient.GetNewHost(Partition, sourceTabControl); if (newTabHost == null) throw new ApplicationException("InterLayoutClient did not provide a new tab host."); newTabHost.TabablzControl.AddToSource(sourceItem); newTabHost.TabablzControl.SelectedItem = sourceItem; newContent = newTabHost.Container; Dispatcher.BeginInvoke(new Action(() => RestoreFloatingItemSnapShots(newTabHost.TabablzControl, floatingItemSnapShots)), DispatcherPriority.Loaded); } else { newContent = new ContentControl { Content = new object(), ContentTemplate = BranchTemplate, }; ((ContentControl) newContent).Dispatcher.BeginInvoke(new Action(() => { //TODO might need to improve this a bit, make it a bit more declarative for complex trees var newTabControl = ((ContentControl)newContent).VisualTreeDepthFirstTraversal().OfType<TabablzControl>().FirstOrDefault(); if (newTabControl == null) return; newTabControl.DataContext = sourceTabControl.DataContext; newTabControl.AddToSource(sourceItem); newTabControl.SelectedItem = sourceItem; Dispatcher.BeginInvoke(new Action(() => RestoreFloatingItemSnapShots(newTabControl, floatingItemSnapShots)), DispatcherPriority.Loaded); }), DispatcherPriority.Loaded); } if (location == DropZoneLocation.Right || location == DropZoneLocation.Bottom) { branchItem.FirstItem = Content; branchItem.SecondItem = newContent; } else { branchItem.FirstItem = newContent; branchItem.SecondItem = Content; } SetCurrentValue(ContentProperty, branchItem); }
public override void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds, IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem) { DragCompleted?.Invoke(); base.OrganiseOnDragCompleted(requestor, measureBounds, siblingItems, dragItem); }
private static void Float(Layout layout, DragablzItem dragablzItem) { //TODO we need eq of IManualInterTabClient here, so consumer can control this op'. //remove from source var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(dragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null) throw new ApplicationException("Unable to determin source items control."); var sourceTabControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); layout._floatTransfer = FloatTransfer.TakeSnapshot(dragablzItem, sourceTabControl); var floatingItemSnapShots = sourceTabControl.VisualTreeDepthFirstTraversal() .OfType<Layout>() .SelectMany(l => l.FloatingDragablzItems().Select(FloatingItemSnapShot.Take)) .ToList(); if (sourceTabControl == null) throw new ApplicationException("Unable to determin source tab control."); sourceTabControl.RemoveItem(dragablzItem); //add to float layer CollectionTeaser collectionTeaser; if (CollectionTeaser.TryCreate(layout.FloatingItemsSource, out collectionTeaser)) collectionTeaser.Add(layout._floatTransfer.Content); else layout.FloatingItems.Add(layout._floatTransfer.Content); layout.Dispatcher.BeginInvoke(new Action(() => RestoreFloatingItemSnapShots(layout, floatingItemSnapShots)), DispatcherPriority.Loaded); }
public static FloatTransfer TakeSnapshot(DragablzItem dragablzItem, TabablzControl sourceTabControl) { if (dragablzItem == null) throw new ArgumentNullException("dragablzItem"); return new FloatTransfer(sourceTabControl.ActualWidth, sourceTabControl.ActualHeight, dragablzItem.UnderlyingContent ?? dragablzItem.Content ?? dragablzItem); }
private void Branch(DropZoneLocation location, DragablzItem sourceDragablzItem) { if (InterLayoutClient == null) { throw new InvalidOperationException("InterLayoutClient is not set."); } var sourceOfDragItemsControl = ItemsControl.ItemsControlFromItemContainer(sourceDragablzItem) as DragablzItemsControl; if (sourceOfDragItemsControl == null) { throw new ApplicationException("Unable to determin source items control."); } var sourceTabControl = TabablzControl.GetOwnerOfHeaderItems(sourceOfDragItemsControl); if (sourceTabControl == null) { throw new ApplicationException("Unable to determin source tab control."); } var sourceItem = sourceOfDragItemsControl.ItemContainerGenerator.ItemFromContainer(sourceDragablzItem); sourceTabControl.RemoveItem(sourceDragablzItem); var branchItem = new Branch { Orientation = (location == DropZoneLocation.Right || location == DropZoneLocation.Left) ? Orientation.Horizontal : Orientation.Vertical }; object newContent; if (BranchTemplate == null) { var newTabHost = InterLayoutClient.GetNewHost(Partition, sourceTabControl); if (newTabHost == null) { throw new ApplicationException("InterLayoutClient did not provide a new tab host."); } newTabHost.TabablzControl.AddToSource(sourceItem); newTabHost.TabablzControl.SelectedItem = sourceItem; newContent = newTabHost.Container; } else { newContent = new ContentControl { Content = new object(), ContentTemplate = BranchTemplate, }; ((ContentControl)newContent).Dispatcher.BeginInvoke(new Action(() => { //TODO might need to improve this a bit, make it a bit more declarative for complex trees var newTabControl = ((ContentControl)newContent).VisualTreeDepthFirstTraversal().OfType <TabablzControl>().FirstOrDefault(); if (newTabControl != null) { newTabControl.DataContext = sourceTabControl.DataContext; newTabControl.AddToSource(sourceItem); newTabControl.SelectedItem = sourceItem; } }), DispatcherPriority.Loaded); } if (location == DropZoneLocation.Right || location == DropZoneLocation.Bottom) { branchItem.FirstItem = Content; branchItem.SecondItem = newContent; } else { branchItem.FirstItem = newContent; branchItem.SecondItem = Content; } SetCurrentValue(ContentProperty, branchItem); }
public static object GetIcon(DragablzItem item) { return(item.GetValue(IconProperty)); }