public void StartDrag(FloatingWindow wnd, Point point, Point offset)
        {
            Offset = offset;

            _wnd = wnd;

            if (Offset.X >= _wnd.Width)
                Offset.X = _wnd.Width / 2;


            _wnd.Left = point.X - Offset.X;
            _wnd.Top = point.Y - Offset.Y;
            _wnd.Show();

            int surfaceCount = 0;
            restart:
            surfaceCount = Surfaces.Count;
            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    SurfacesWithDragOver.Add(surface);
                    surface.OnDragEnter(point);
                    Debug.WriteLine("Enter " + surface.ToString());
                    if (surfaceCount != Surfaces.Count)
                    { 
                        //Surfaces list has been changed restart cycle
                        SurfacesWithDragOver.Clear();
                        goto restart;
                    }
                }
            }
            
        }
Beispiel #2
0
        protected override void CheckItems(System.Collections.IList newItems)
        {
            foreach (object newItem in newItems)
            {
                if (!(newItem is DocumentContent))
                {
                    throw new InvalidOperationException("FloatingDocumentPane can contain only DocumentContents!");
                }
            }

            if (Items.Count == 0 && FloatingWindow != null)
            {
                FloatingWindow.Close(true);
            }
        }
Beispiel #3
0
        public void EndDrag(Point point)
        {
            IDropSurface dropSufrace = null;

            foreach (var surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    if (surface.OnDrop(point))
                    {
                        dropSufrace = surface;
                        break;
                    }
                }
            }

            foreach (var surface in SurfacesWithDragOver)
            {
                if (surface != dropSufrace)
                {
                    surface.OnDragLeave(point);
                }
            }

            SurfacesWithDragOver.Clear();

            _wnd.OnEndDrag(); //notify floating window that drag operation is coming to end

            if (dropSufrace != null)
            {
                _wnd.Close();
            }
            else
            {
                _wnd.Visibility = Visibility.Visible;
                _wnd.Activate();
            }

            _wnd = null;

            IsDragging = false;
        }
Beispiel #4
0
        public void StartDrag(FloatingWindow wnd, Point point, Point offset)
        {
            Debug.Assert(!IsDragging);

            IsDragging = true;

            Offset = offset;

            _wnd = wnd;

            if (Offset.X >= _wnd.Width)
            {
                var ox = _wnd.Width / 2;
                Offset = new Point(ox, Offset.Y);
            }

            _wnd.Position = new Point(point.X - Offset.X,
                                      point.Y - Offset.Y);
            _wnd.Show();

            int surfaceCount = 0;

restart:
            surfaceCount = Surfaces.Count;
            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    SurfacesWithDragOver.Add(surface);
                    surface.OnDragEnter(point);
                    Debug.WriteLine("Enter " + surface.ToString());
                    if (surfaceCount != Surfaces.Count)
                    {
                        //Surfaces list has been changed restart cycle
                        SurfacesWithDragOver.Clear();
                        goto restart;
                    }
                }
            }
        }
Beispiel #5
0
        public void StartDrag(FloatingWindow wnd, Point point, Point offset)
        {
            Debug.Assert(!IsDragging);

            IsDragging = true;

            Offset = offset;

            _wnd = wnd;

            if (Offset.X >= _wnd.Width)
            {
                Offset.X = _wnd.Width / 2;
            }


            _wnd.Left = point.X - Offset.X;
            _wnd.Top  = point.Y - Offset.Y;
            _wnd.Show();

            var surfaceCount = 0;

restart:
            surfaceCount = Surfaces.Count;
            foreach (var surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    SurfacesWithDragOver.Add(surface);
                    surface.OnDragEnter(point);
                    Debug.WriteLine("Enter " + surface);
                    if (surfaceCount != Surfaces.Count)
                    {
                        //Surfaces list has been changed restart cycle
                        SurfacesWithDragOver.Clear();
                        goto restart;
                    }
                }
            }
        }
 internal void UnregisterFloatingWindow(FloatingWindow floatingWindow)
 {
     if (_floatingWindows != null)
         _floatingWindows.Remove(floatingWindow);
 }
 internal void RegisterFloatingWindow(FloatingWindow floatingWindow)
 {
     if (_floatingWindows != null)
     {
         floatingWindow.FlowDirection = this.FlowDirection;
         if (!_floatingWindows.Contains(floatingWindow))
             _floatingWindows.Add(floatingWindow);
     }
 }
        /// <summary>
        /// Begins dragging operations
        /// </summary>
        /// <param name="floatingWindow">Floating window containing pane which is dragged by user</param>
        /// <param name="point">Current mouse position</param>
        /// <param name="offset">Offset to be use to set floating window screen position</param>
        /// <returns>Retruns True is drag is completed, false otherwise</returns>
        internal bool Drag(FloatingWindow floatingWindow, Point point, Point offset)
        {
            bool mouseCaptured = IsMouseCaptured;

            if (!mouseCaptured)
                mouseCaptured = CaptureMouse();

            if (mouseCaptured)
            {
                floatingWindow.Owner = Window.GetWindow(this);

                DragPaneServices.StartDrag(floatingWindow, point, offset);
                return true;
            }

            return false;
        }
 public FloatingDockablePane(FloatingWindow floatingWindow)
 {
     _floatingWindow = floatingWindow;
 }
Beispiel #10
0
 public FloatingDockablePane(FloatingWindow floatingWindow)
 {
     //_referencedPane = referencedPane;
     _floatingWindow = floatingWindow;
 }
 public FloatingDockablePane(FloatingWindow floatingWindow)
 {
     _floatingWindow = floatingWindow;
 }
        public void EndDrag(Point point)
        {
            IDropSurface dropSufrace = null;
            foreach (IDropSurface surface in Surfaces)
            {
                if (surface.SurfaceRectangle.Contains(point))
                {
                    if (surface.OnDrop(point))
                    {
                        dropSufrace = surface;
                        break;
                    }
                }
            }

            foreach (IDropSurface surface in SurfacesWithDragOver)
            {
                if (surface != dropSufrace)
                {
                    surface.OnDragLeave(point);
                }
            }

            SurfacesWithDragOver.Clear();

            _wnd.OnEndDrag();//notify floating window that drag operation is coming to end

            if (dropSufrace != null)
                _wnd.Close();
            else
            {
                _wnd.Visibility = Visibility.Visible;
                _wnd.Activate();
            }

            _wnd = null;

            IsDragging = false;
        }