public DragablzDragDeltaEventArgs(DragablzItem dragablzItem, DragDeltaEventArgs dragDeltaEventArgs)
            : base(dragablzItem)
        {
            if (dragDeltaEventArgs == null) throw new ArgumentNullException("dragDeltaEventArgs");

            _dragDeltaEventArgs = dragDeltaEventArgs;
        }
        public DragablzDragDeltaEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragDeltaEventArgs dragDeltaEventArgs) 
            : base(routedEvent, source, dragablzItem)
        {
            if (dragDeltaEventArgs == null) throw new ArgumentNullException("dragDeltaEventArgs");

            _dragDeltaEventArgs = dragDeltaEventArgs;
        }
 public LocationInfo(DragablzItem item, double start, double mid, double end)
 {
     _item = item;
     _start = start;
     _mid = mid;
     _end = end;
 }
 public DragablzDragCompletedEventArgs(DragablzItem dragablzItem, DragCompletedEventArgs dragCompletedEventArgs)
 {
     if (dragablzItem == null) throw new ArgumentNullException("dragablzItem");
     if (dragCompletedEventArgs == null) throw new ArgumentNullException("dragCompletedEventArgs");
     
     _dragablzItem = dragablzItem;
     _dragCompletedEventArgs = dragCompletedEventArgs;
 }
Beispiel #5
0
        public void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Size measureBounds, List<DragablzItem> siblingItems, DragablzItem dragablzItem)
        {
            var zIndex = int.MaxValue;
            foreach (var source in siblingItems.OrderByDescending(Panel.GetZIndex))
            {
                Panel.SetZIndex(source, --zIndex);

            }
            Panel.SetZIndex(dragablzItem, int.MaxValue);
        }
        public DragablzDragDeltaEventArgs(DragablzItem dragablzItem, DragDeltaEventArgs dragDeltaEventArgs)
            : base(dragablzItem)
        {
            if (dragDeltaEventArgs == null)
            {
                throw new ArgumentNullException("dragDeltaEventArgs");
            }

            _dragDeltaEventArgs = dragDeltaEventArgs;
        }
Beispiel #7
0
        private LocationInfo GetLocationInfo(DragablzItem item)
        {
            var size = _getDesiredSize(item);

            if (!_activeStoryboardTargetLocations.TryGetValue(item, out var startLocation))
            {
                startLocation = _getLocation(item);
            }
            var midLocation = startLocation + size / 2;
            var endLocation = startLocation + size;

            return(new LocationInfo(item, startLocation, midLocation, endLocation));
        }
        public void OrganiseOnDragStarted(DragablzItemsControl requestor, Size measureBounds,
                                          IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException("siblingItems");
            }
            if (dragItem == null)
            {
                throw new ArgumentNullException("dragItem");
            }

            _siblingItemLocationOnDragStart = siblingItems.Select(GetLocationInfo).ToDictionary(loc => loc.Item);
        }
Beispiel #9
0
        public DragablzDragCompletedEventArgs(DragablzItem dragablzItem, DragCompletedEventArgs dragCompletedEventArgs)
        {
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException("dragCompletedEventArgs");
            }

            _dragablzItem           = dragablzItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }
Beispiel #10
0
        public DragablzDragCompletedEventArgs(DragablzItem dragablzItem, DragCompletedEventArgs dragCompletedEventArgs)
        {
            if (dragablzItem == null)
            {
                throw new ArgumentNullException(nameof(dragablzItem));
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException(nameof(dragCompletedEventArgs));
            }

            m_dragablzItem           = dragablzItem;
            m_dragCompletedEventArgs = dragCompletedEventArgs;
        }
Beispiel #11
0
        public DragablzDragCompletedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragCompletedEventArgs dragCompletedEventArgs)
            : base(routedEvent, source)
        {
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }
            if (dragCompletedEventArgs == null)
            {
                throw new ArgumentNullException("dragCompletedEventArgs");
            }

            _dragablzItem           = dragablzItem;
            _dragCompletedEventArgs = dragCompletedEventArgs;
        }
Beispiel #12
0
        internal object RemoveItem(DragablzItem dragablzItem)
        {
            var item             = _dragablzItemsControl.ItemContainerGenerator.ItemFromContainer(dragablzItem);
            var contentPresenter = FindChildContentPresenter(item);

            RemoveFromSource(item);
            _itemsHolder.Children.Remove(contentPresenter);
            var window = Window.GetWindow(this);

            if (window != null &&
                InterTabController.InterTabClient.TabEmptiedHandler(this, window) == TabEmptiedResponse.CloseWindow)
            {
                window.Close();
            }
            return(item);
        }
        public ClosingItemCallbackArgs(Window window, TOwner owner, DragablzItem dragablzItem)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }

            _window       = window;
            _owner        = owner;
            _dragablzItem = dragablzItem;
        }
        public ItemActionCallbackArgs(Window window, TOwner owner, DragablzItem dragablzItem)
        {
            if (window == null)
            {
                throw new ArgumentNullException(nameof(window));
            }
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }
            if (dragablzItem == null)
            {
                throw new ArgumentNullException(nameof(dragablzItem));
            }

            m_window       = window;
            m_owner        = owner;
            m_dragablzItem = dragablzItem;
        }
        public ClosingItemCallbackArgs(Window window, TabablzControl tabablzControl, DragablzItem dragablzItem)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (tabablzControl == null)
            {
                throw new ArgumentNullException("tabablzControl");
            }
            if (dragablzItem == null)
            {
                throw new ArgumentNullException("dragablzItem");
            }

            _window         = window;
            _tabablzControl = tabablzControl;
            _dragablzItem   = dragablzItem;
        }
Beispiel #16
0
        private void SendToLocation(DragablzItem dragablzItem, double location)
        {
            double activeTarget;

            if (Math.Abs(_getLocation(dragablzItem) - location) < 1.0
                ||
                _activeStoryboardTargetLocations.TryGetValue(dragablzItem, out activeTarget) &&
                Math.Abs(activeTarget - location) < 1.0)
            {
                return;
            }

            _activeStoryboardTargetLocations[dragablzItem] = location;

            var storyboard = new Storyboard {
                FillBehavior = FillBehavior.Stop
            };

            storyboard.WhenComplete(sb =>
            {
                _setLocation(dragablzItem, location);
                sb.Remove(dragablzItem);
                _activeStoryboardTargetLocations.Remove(dragablzItem);
            });

            var timeline = new DoubleAnimationUsingKeyFrames();

            timeline.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(_canvasDependencyProperty));
            timeline.KeyFrames.Add(
                new EasingDoubleKeyFrame(location, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200)))
            {
                EasingFunction = new CubicEase()
                {
                    EasingMode = EasingMode.EaseOut
                }
            });
            storyboard.Children.Add(timeline);
            storyboard.Begin(dragablzItem, true);
        }
        private void ExecuteMoveItemToNewWindow(DragablzItem dragablzItem)
        {
            if (!CanExecuteMoveItemToNewWindow(dragablzItem))
            {
                return;
            }

            var interTabController = InterTabController;

            var newHost = interTabController.InterTabClient.GetNewHost(interTabController.InterTabClient,
                                                                       interTabController.Partition,
                                                                       this);

            newHost.Container.Show( );

            var minSize = EmptyHeaderSizingHint == EmptyHeaderSizingHint.PreviousTab ? new Size(_dragablzItemsControl.ActualWidth,
                                                                                                _dragablzItemsControl.ActualHeight) :
                          new Size( );

            var item = dragablzItem.DataContext;

            var contentPresenter = FindChildContentPresenter(item);

            RemoveFromSource(item);

            _itemsHolder.Children.Remove(contentPresenter);

            if (Items.Count == 0)
            {
                _dragablzItemsControl.MinHeight = minSize.Height;
                _dragablzItemsControl.MinWidth  = minSize.Width;
                Layout.ConsolidateBranch(this);
            }

            newHost.TabablzControl.AddToSource(item);
            newHost.TabablzControl.SelectedItem = item;
        }
 public TabablzControlItemLocation(TabablzControl tabControl, DragablzItem container, object item)
 {
     TabControl = tabControl ?? throw new ArgumentNullException(nameof(tabControl));
     Item       = item ?? throw new ArgumentNullException(nameof(item));
     Container  = container;
 }
 public DragablzItemEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem)
     : base(routedEvent)
 {
     _dragablzItem = dragablzItem;
 }
Beispiel #20
0
        private Point ConfigureNewHostSizeAndGetDragStartWindowOffset(Window currentWindow, INewTabHost<Window> newTabHost, DragablzItem dragablzItem)
        {
            var layout = this.VisualTreeAncestory().OfType<Layout>().FirstOrDefault();
            Point dragStartWindowOffset;
            if (layout != null)
            {
                newTabHost.Container.Width = ActualWidth + Math.Max(0, currentWindow.RestoreBounds.Width - layout.ActualWidth);
                newTabHost.Container.Height = ActualHeight + Math.Max(0, currentWindow.RestoreBounds.Height - layout.ActualHeight);
                dragStartWindowOffset = dragablzItem.TranslatePoint(new Point(), this);
                //dragStartWindowOffset.Offset(currentWindow.RestoreBounds.Width - layout.ActualWidth, currentWindow.RestoreBounds.Height - layout.ActualHeight);
            }
            else
            {
                if (newTabHost.Container.GetType() == currentWindow.GetType())
                {
                    newTabHost.Container.Width = currentWindow.RestoreBounds.Width;
                    newTabHost.Container.Height = currentWindow.RestoreBounds.Height;
                    dragStartWindowOffset = dragablzItem.TranslatePoint(new Point(), currentWindow);
                }
                else
                {
                    newTabHost.Container.Width = ActualWidth;
                    newTabHost.Container.Height = ActualHeight;
                    dragStartWindowOffset = dragablzItem.TranslatePoint(new Point(), this);
                    dragStartWindowOffset.Offset(dragablzItem.MouseAtDragStart.X, dragablzItem.MouseAtDragStart.Y);
                    return dragStartWindowOffset;
                }
            }

            dragStartWindowOffset.Offset(dragablzItem.MouseAtDragStart.X, dragablzItem.MouseAtDragStart.Y);
            var borderVector = currentWindow.WindowState == WindowState.Maximized
                ? currentWindow.PointToScreen(new Point()).ToWpf() - new Point()
                : currentWindow.PointToScreen(new Point()).ToWpf() - new Point(currentWindow.Left, currentWindow.Top);
            dragStartWindowOffset.Offset(borderVector.X, borderVector.Y);
            return dragStartWindowOffset;
        }
Beispiel #21
0
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, source, dragablzItem)
 {
     DragStartedEventArgs = dragStartedEventArgs;
 }
Beispiel #22
0
 public DragablzDragStartedEventArgs(DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(dragablzItem)
 {
     DragStartedEventArgs = dragStartedEventArgs ?? throw new ArgumentNullException(nameof(dragStartedEventArgs));
 }
 private void SetLocation(DragablzItem dragablzItem, double location)
 {                     
     _setLocation(dragablzItem, location);
 }
        private LocationInfo GetLocationInfo(DragablzItem item)
        {
            var size = _getDesiredSize(item);
            double startLocation;
            if (!_activeStoryboardTargetLocations.TryGetValue(item, out startLocation))
                startLocation = _getLocation(item);
            var midLocation = startLocation + size / 2;
            var endLocation = startLocation + size;

            return new LocationInfo(item, startLocation, midLocation, endLocation);
        }
Beispiel #25
0
 private void SetLocation(DragablzItem dragablzItem, double location)
 {
     _setLocation(dragablzItem, location);
 }
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, dragablzItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, source, dragablzItem)
 {
     _dragStartedEventArgs = dragStartedEventArgs;
 }
        internal object RemoveItem(DragablzItem dragablzItem)
        {
            var item = _dragablzItemsControl.ItemContainerGenerator.ItemFromContainer(dragablzItem);

            //stop the header shrinking if the tab stays open when empty
            var minSize = EmptyHeaderSizingHint == EmptyHeaderSizingHint.PreviousTab
                ? new Size(_dragablzItemsControl.ActualWidth, _dragablzItemsControl.ActualHeight)
                : new Size();
            System.Diagnostics.Debug.WriteLine("A " + minSize);
            _dragablzItemsControl.MinHeight = 0;
            _dragablzItemsControl.MinWidth = 0;

            var contentPresenter = FindChildContentPresenter(item);
            RemoveFromSource(item);
            _itemsHolder.Children.Remove(contentPresenter);

            if (Items.Count != 0) return item;

            var window = Window.GetWindow(this);
            if (window != null
                && InterTabController != null
                && InterTabController.InterTabClient.TabEmptiedHandler(this, window) == TabEmptiedResponse.CloseWindowOrLayoutBranch)
            {
                if (Layout.ConsolidateBranch(this)) return item;

                try
                {
                    SetIsClosingAsPartOfDragOperation(window, true);
                    window.Close();
                }
                finally
                {
                    SetIsClosingAsPartOfDragOperation(window, false);
                }
            }
            else
            {
                _dragablzItemsControl.MinHeight = minSize.Height;
                _dragablzItemsControl.MinWidth = minSize.Width;
            }
            return item;
        }
Beispiel #29
0
 public void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds, IEnumerable<DragablzItem> siblingItems, DragablzItem dragItem)
 {
     
 }
        public virtual void OrganiseOnDragStarted(DragablzItemsControl requestor, Size measureBounds,
            IEnumerable<DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null) throw new ArgumentNullException("siblingItems");
            if (dragItem == null) throw new ArgumentNullException("dragItem");

            _siblingItemLocationOnDragStart = siblingItems.Select(GetLocationInfo).ToDictionary(loc => loc.Item);
        }
 private bool CanExecuteMoveItemToNewWindow(DragablzItem dragablzItem)
 {
     return(dragablzItem != null && !IsFixedItem(dragablzItem) && (Layout.IsContainedWithinBranch(_dragablzItemsControl) || Items.Count > 1));
 }
Beispiel #32
0
        public void OrganiseOnDragCompleted(Size measureBounds, IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException("siblingItems");
            }
            var currentLocations = siblingItems
                                   .Select(GetLocationInfo)
                                   .Union(new[] { GetLocationInfo(dragItem) })
                                   .OrderBy(loc => loc.Item == dragItem ? loc.Start : _siblingItemLocationOnDragStart[loc.Item].Start);

            var currentCoord = 0.0;
            var z            = int.MaxValue;

            foreach (var location in currentLocations)
            {
                SetLocation(location.Item, currentCoord);
                currentCoord += _getDesiredSize(location.Item) + _itemOffset;
                Panel.SetZIndex(location.Item, --z);
            }
            Panel.SetZIndex(dragItem, int.MaxValue);
        }
        private void SendToLocation(DragablzItem dragablzItem, double location)
        {                        
            double activeTarget;
            if (Math.Abs(_getLocation(dragablzItem) - location) < 1.0
                ||
                _activeStoryboardTargetLocations.TryGetValue(dragablzItem, out activeTarget)
                && Math.Abs(activeTarget - location) < 1.0)
            {             
                return;
            }            

            _activeStoryboardTargetLocations[dragablzItem] = location;

            var storyboard = new Storyboard {FillBehavior = FillBehavior.Stop};
            storyboard.WhenComplete(sb =>
            {
                _setLocation(dragablzItem, location);
                sb.Remove(dragablzItem);
                _activeStoryboardTargetLocations.Remove(dragablzItem);
            });

            var timeline = new DoubleAnimationUsingKeyFrames();
            timeline.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(_canvasDependencyProperty));
            timeline.KeyFrames.Add(
                new EasingDoubleKeyFrame(location, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200)))
                {
                    EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut }
                });
            storyboard.Children.Add(timeline);            
            storyboard.Begin(dragablzItem, true);            
        }
 public static void CloseOtherItems(DragablzItem dragablzItem) => CloseOtherItemsCommand.Execute(dragablzItem, dragablzItem);
 public static void MoveItemToNewWindow(DragablzItem dragablzItem) => MoveItemToNewWindowCommand.Execute(dragablzItem, dragablzItem);
 public static void CloseItem(DragablzItem dragablzItem) => CloseItemCommand.Execute(dragablzItem, dragablzItem);
        public virtual void OrganiseOnDragCompleted(DragablzItemsControl requestor, Size measureBounds,
            IEnumerable<DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null) throw new ArgumentNullException("siblingItems");
            var currentLocations = siblingItems
                .Select(GetLocationInfo)
                .Union(new[] {GetLocationInfo(dragItem)})
                .OrderBy(loc => loc.Item == dragItem ? loc.Start : _siblingItemLocationOnDragStart[loc.Item].Start);

            var currentCoord = 0.0;
            var z = int.MaxValue;
            var logicalIndex = 0;
            foreach (var location in currentLocations)
            {
                SetLocation(location.Item, currentCoord);
                currentCoord += _getDesiredSize(location.Item) + _itemOffset;
                Panel.SetZIndex(location.Item, --z);
                location.Item.LogicalIndex = logicalIndex++;
            }
            Panel.SetZIndex(dragItem, int.MaxValue);
        }
 public static void CloseFollowingItems(DragablzItem dragablzItem) => CloseFollowingItemsCommand.Execute(dragablzItem, dragablzItem);
 public DragablzItemEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem)
     : base(routedEvent, source)
 {
     _dragablzItem = dragablzItem;
 }
Beispiel #40
0
 public void OrganiseOnDragCompleted(Size bounds, IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
 {
 }
 public DragablzItemEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem)
     : base(routedEvent)
 {
     _dragablzItem = dragablzItem;
 }
Beispiel #42
0
 public DragablzDragStartedEventArgs(RoutedEvent routedEvent, DragablzItem dragablzItem, DragStartedEventArgs dragStartedEventArgs)
     : base(routedEvent, dragablzItem)
 {
     DragStartedEventArgs = dragStartedEventArgs;
 }
        public DragablzItemEventArgs(DragablzItem dragablzItem)
        {
            if (dragablzItem == null) throw new ArgumentNullException("dragablzItem");            

            _dragablzItem = dragablzItem;
        }
Beispiel #44
0
        internal object RemoveItem(DragablzItem dragablzItem)
        {
            var item = _dragablzItemsControl.ItemContainerGenerator.ItemFromContainer(dragablzItem);

            var minSize = new Size(_dragablzItemsControl.ActualWidth, _dragablzItemsControl.ActualHeight);
            _dragablzItemsControl.MinHeight = 0;
            _dragablzItemsControl.MinWidth = 0;

            var contentPresenter = FindChildContentPresenter(item);
            RemoveFromSource(item);
            _itemsHolder.Children.Remove(contentPresenter);
            if (Items.Count == 0)
            {
                var window = Window.GetWindow(this);
                if (window != null
                    && InterTabController != null
                    && InterTabController.InterTabClient.TabEmptiedHandler(this, window) == TabEmptiedResponse.CloseWindowOrLayoutBranch)
                {
                    if (Layout.ConsolidateBranch(this)) return item;

                    try
                    {
                        SetIsClosingAsPartOfDragOperation(window, true);
                        window.Close();
                    }
                    finally
                    {
                        SetIsClosingAsPartOfDragOperation(window, false);
                    }
                }
                else
                {
                    _dragablzItemsControl.MinHeight = minSize.Height;
                    _dragablzItemsControl.MinWidth = minSize.Width;
                }
            }
            return item;
        }
Beispiel #45
0
 public virtual void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Size measureBounds,
                                               List <DragablzItem> siblingItems, DragablzItem dragablzItem)
 {
 }
Beispiel #46
0
 private bool IsMyItem(DragablzItem item)
 {
     return _dragablzItemsControl.DragablzItems().Contains(item);
 }
Beispiel #47
0
        public void OrganiseOnDrag(Size bounds, IEnumerable <DragablzItem> siblingItems, DragablzItem dragItem)
        {
            if (siblingItems == null)
            {
                throw new ArgumentNullException("siblingItems");
            }
            if (dragItem == null)
            {
                throw new ArgumentNullException("dragItem");
            }

            var currentLocations = siblingItems
                                   .Select(GetLocationInfo)
                                   .Union(new [] { GetLocationInfo(dragItem) })
                                   .OrderBy(loc => loc.Item == dragItem ? loc.Start : _siblingItemLocationOnDragStart[loc.Item].Start);

            var currentCoord = 0.0;
            var zIndex       = 0;

            foreach (var location in currentLocations)
            {
                if (!Equals(location.Item, dragItem))
                {
                    SendToLocation(location.Item, currentCoord);
                    Panel.SetZIndex(location.Item, zIndex++);
                }
                currentCoord += _getDesiredSize(location.Item);
            }
            Panel.SetZIndex(dragItem, zIndex);
        }
 public DragablzItemEventArgs(RoutedEvent routedEvent, object source, DragablzItem dragablzItem)
     : base(routedEvent, source)
 {
     _dragablzItem = dragablzItem;
 }
Beispiel #49
0
 public void OrganiseOnMouseDownWithing(Size measureBounds, List <DragablzItem> siblingItems, DragablzItem dragablzItem)
 {
 }
Beispiel #50
0
 public ItemActionCallbackArgs(Window window, TOwner owner, DragablzItem dragablzItem)
 {
     Window       = window ?? throw new ArgumentNullException(nameof(window));
     Owner        = owner ?? throw new ArgumentNullException(nameof(owner));
     DragablzItem = dragablzItem ?? throw new ArgumentNullException(nameof(dragablzItem));
 }
        public virtual void OrganiseOnMouseDownWithin(DragablzItemsControl requestor, Size measureBounds,
            List<DragablzItem> siblingItems, DragablzItem dragablzItem)
        {

        }