Пример #1
0
        public void UpdateTargets(DragAbsoluteEventArgs args)
        {
            FloatingWindow ancestor = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestor <FloatingWindow>((Visual)args.OriginalSource);

            this.UpdateDockPreview(args, (FloatingElement)ancestor);
            this.UpdateAdorners(args, ancestor);
            this.UpdateIsFloatingWindowDragWithin(args, ancestor);
        }
Пример #2
0
        private static void OnWindowStyleChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            FloatingWindow floatingWindow = (FloatingWindow)obj;
            HwndSource     hwndSource     = PresentationSource.FromVisual(floatingWindow) as HwndSource;

            if (hwndSource != null)
            {
                floatingWindow.UpdateWindowStyle(hwndSource.Handle);
            }
        }
Пример #3
0
        private void UpdateAdorners(DragAbsoluteEventArgs args, FloatingWindow floatingWindow)
        {
            List <DockSiteType> list = new List <DockSiteType>();

            list.Add(DockSiteType.Default);
            list.Add(DockSiteType.NonDraggable);
            FloatSite floatSite = floatingWindow.DataContext as FloatSite;

            if (floatSite == null)
            {
                return;
            }
            ViewElement child = floatSite.Child;

            if (child == null)
            {
                return;
            }
            this.UpdateAdorners(args, (FloatingElement)floatingWindow, (IList <DockSiteType>)list, child);
        }
Пример #4
0
 private void UpdateIsFloatingWindowDragWithin(DragAbsoluteEventArgs args, FloatingWindow floatingWindow)
 {
     FloatingWindow.SetIsFloatingWindowDragWithin((IEnumerable <DependencyObject>) this.currentlyDragWithin, false);
     DockManager.DockSiteHitTestResult hitElement = this.FindHitElement(args.ScreenPoint, (Predicate <DockManager.DockSite>)(s =>
     {
         if (s.Visual != floatingWindow)
         {
             return(s.Visual is DockAdornerWindow);
         }
         return(false);
     }));
     if (hitElement != null)
     {
         this.currentlyDragWithin = new List <DependencyObject>(this.GetHierarchy((DependencyObject)hitElement.VisualHit, (DependencyObject)null));
         FloatingWindow.SetIsFloatingWindowDragWithin((IEnumerable <DependencyObject>) this.currentlyDragWithin, true);
     }
     else
     {
         this.currentlyDragWithin.Clear();
     }
 }
Пример #5
0
        public FloatingWindow()
        {
            base.WindowStyle = WindowStyle.None;
            base.ResizeMode  = ResizeMode.NoResize;
            FloatingWindow.SetIsFloating(this, true);
            AutomationProperties.SetName(this, "FloatingWindow");
            DependencyProperty leftProperty = Window.LeftProperty;
            Binding            binding      = new Binding()
            {
                Path = new PropertyPath("FloatingLeft", new object[0]),
                Mode = BindingMode.TwoWay
            };

            base.SetBinding(leftProperty, binding);
            DependencyProperty topProperty = Window.TopProperty;
            Binding            binding1    = new Binding()
            {
                Path = new PropertyPath("FloatingTop", new object[0]),
                Mode = BindingMode.TwoWay
            };

            base.SetBinding(topProperty, binding1);
            DependencyProperty widthProperty = FrameworkElement.WidthProperty;
            Binding            binding2      = new Binding()
            {
                Path = new PropertyPath("FloatingWidth", new object[0]),
                Mode = BindingMode.TwoWay
            };

            base.SetBinding(widthProperty, binding2);
            DependencyProperty heightProperty = FrameworkElement.HeightProperty;
            Binding            binding3       = new Binding()
            {
                Path = new PropertyPath("FloatingHeight", new object[0]),
                Mode = BindingMode.TwoWay
            };

            base.SetBinding(heightProperty, binding3);
            base.SizeChanged += new SizeChangedEventHandler((object argument0, SizeChangedEventArgs argument1) => this.UpdateCornerRadius());
        }
Пример #6
0
 private IntPtr HwndSourceHook(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
 {
     if (msg == 274 && wParam.ToInt32() == 61536)
     {
         if (lParam.ToInt32() == 0)
         {
             IntPtr owner = (new WindowInteropHelper(this)).Owner;
             if (owner != IntPtr.Zero)
             {
                 NativeMethods.SendMessage(owner, msg, wParam, lParam);
                 handled = true;
                 return(IntPtr.Zero);
             }
         }
     }
     else if (msg == 36)
     {
         FloatingWindow.WmGetMinMaxInfo(hWnd, lParam);
         handled = true;
     }
     return(IntPtr.Zero);
 }
Пример #7
0
        public void PerformDrop(DragAbsoluteEventArgs args)
        {
            DragUndockHeader dragUndockHeader = args.OriginalSource as DragUndockHeader;
            FloatingWindow   floatingWindow   = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestor <FloatingWindow>((Visual)dragUndockHeader);

            DockManager.DockSiteHitTestResult hitElement = this.FindHitElement(args.ScreenPoint, (Predicate <DockManager.DockSite>)(s => s.Visual != floatingWindow));
            if (hitElement != null)
            {
                DockSiteAdorner   ancestorOrSelf1 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockSiteAdorner>(hitElement.VisualHit);
                DockAdornerWindow ancestorOrSelf2 = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockAdornerWindow>(hitElement.VisualHit);
                DockTarget        dockTarget      = Microsoft.VisualStudio.PlatformUI.ExtensionMethods.FindAncestorOrSelf <DockTarget>(hitElement.VisualHit);
                DockDirection     dockDirection   = DockDirection.Fill;
                bool flag = false;
                bool createDocumentGroup = false;
                if (floatingWindow != null && this.IsValidFillPreviewOperation(dockTarget, dragUndockHeader.ViewElement))
                {
                    dockDirection = DockDirection.Fill;
                    flag          = true;
                }
                if (ancestorOrSelf1 != null && ancestorOrSelf2 != null && ancestorOrSelf2.AdornedElement != null)
                {
                    dockDirection = ancestorOrSelf1.DockDirection;
                    dockTarget    = ancestorOrSelf2.AdornedElement as DockTarget;
                    if (DockOperations.AreDockRestrictionsFulfilled(dragUndockHeader.ViewElement, dockTarget.TargetElement))
                    {
                        flag = true;
                        createDocumentGroup = ancestorOrSelf1.CreatesDocumentGroup;
                    }
                }
                if (flag)
                {
                    PerformanceUtility.MeasurePerformanceUntilRender(PerformanceEvent.DockPalette);
                    dockTarget.RaiseEvent((RoutedEventArgs) new FloatingElementDockedEventArgs(DockManager.FloatingElementDockedEvent, dragUndockHeader.ViewElement, dockDirection, createDocumentGroup));
                }
            }
            this.ClearAdorners();
        }
 internal FloatingWindowAutomationPeer(FloatingWindow floatingWindow)
     : base((Window)floatingWindow)
 {
 }