Exemplo n.º 1
0
        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;
                    }
                }
            }
            
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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;
                    }
                }
            }
        }
Exemplo n.º 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;
                    }
                }
            }
        }
Exemplo n.º 6
0
 internal void UnregisterFloatingWindow(FloatingWindow floatingWindow)
 {
     if (_floatingWindows != null)
         _floatingWindows.Remove(floatingWindow);
 }
Exemplo n.º 7
0
 internal void RegisterFloatingWindow(FloatingWindow floatingWindow)
 {
     if (_floatingWindows != null)
     {
         floatingWindow.FlowDirection = this.FlowDirection;
         if (!_floatingWindows.Contains(floatingWindow))
             _floatingWindows.Add(floatingWindow);
     }
 }
Exemplo n.º 8
0
        /// <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;
 }
Exemplo n.º 10
0
 public FloatingDockablePane(FloatingWindow floatingWindow)
 {
     //_referencedPane = referencedPane;
     _floatingWindow = floatingWindow;
 }
Exemplo n.º 11
0
 public FloatingDockablePane(FloatingWindow floatingWindow)
 {
     _floatingWindow = floatingWindow;
 }
Exemplo n.º 12
0
        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;
        }