Esempio n. 1
0
        /// <summary>
        /// Function called when dragged window enters already docked window</summary>
        /// <param name="sender">Dockable window being dragged</param>
        /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param>
        public void DockDragEnter(object sender, DockDragDropEventArgs e)
        {
            Point center          = new Point(ActualWidth / 2, ActualHeight / 2);
            int   space           = (int)Root.DockIconSize.Width / 4;
            ResourceDictionary rd = new ResourceDictionary();

            rd.Source = new Uri("/Atf.Gui.Wpf;component/Resources/DockIcons.xaml", UriKind.Relative);
            if (m_dockLeftIcon == null)
            {
                m_dockLeftIcon   = new DockIcon((Style)rd["DockLeftIcon"], Root.DockIconSize);
                m_dockRightIcon  = new DockIcon((Style)rd["DockRightIcon"], Root.DockIconSize);
                m_dockTopIcon    = new DockIcon((Style)rd["DockTopIcon"], Root.DockIconSize);
                m_dockBottomIcon = new DockIcon((Style)rd["DockBottomIcon"], Root.DockIconSize);
                m_dockTabIcon    = new DockIcon((Style)rd["DockTabIcon"], Root.DockIconSize);
            }
            Window owner  = Window.GetWindow(this);
            Point  offset = ((UIElement)Root).PointFromScreen(PointToScreen(new Point(0, 0)));

            m_dockLeftIcon.Offset   = new Point(offset.X + center.X - Root.DockIconSize.Width / 2 - Root.DockIconSize.Width - space, offset.Y + center.Y - Root.DockIconSize.Height / 2);
            m_dockRightIcon.Offset  = new Point(offset.X + center.X + Root.DockIconSize.Width / 2 + space, offset.Y + center.Y - Root.DockIconSize.Height / 2);
            m_dockTopIcon.Offset    = new Point(offset.X + center.X - Root.DockIconSize.Width / 2, offset.Y + center.Y - Root.DockIconSize.Height / 2 - Root.DockIconSize.Height - space);
            m_dockBottomIcon.Offset = new Point(offset.X + center.X - Root.DockIconSize.Width / 2, offset.Y + center.Y + Root.DockIconSize.Height / 2 + space);
            m_dockTabIcon.Offset    = new Point(offset.X + center.X - Root.DockIconSize.Width / 2, offset.Y + center.Y - Root.DockIconSize.Height / 2);

            DockIconsLayer dockIconLayer = Root.DockIconsLayer;

            dockIconLayer.AddChild(m_dockLeftIcon);
            dockIconLayer.AddChild(m_dockRightIcon);
            dockIconLayer.AddChild(m_dockTopIcon);
            dockIconLayer.AddChild(m_dockBottomIcon);
            dockIconLayer.AddChild(m_dockTabIcon);
        }
Esempio n. 2
0
 /// <summary>
 /// Function called when dragged window leaves already docked window</summary>
 /// <param name="sender">Dockable window being dragged</param>
 /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param>
 public void DockDragLeave(object sender, DockDragDropEventArgs e)
 {
     DockIconsLayer.RemoveChild(m_dockTabIcon);
     if (m_dockPreviewShape != null)
     {
         DockIconsLayer.RemoveChild(m_dockPreviewShape);
         m_dockPreviewShape = null;
     }
     DockIconsLayer.CloseIfEmpty();
 }
Esempio n. 3
0
        /// <summary>
        /// Function called when dragged window is moved over already docked window</summary>
        /// <param name="sender">Dockable window being dragged</param>
        /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param>
        public void DockDragOver(object sender, DockDragDropEventArgs e)
        {
            Point pos = e.MouseEventArgs.GetPosition(this);
            bool  b   = m_dockTabIcon.HitTest(pos);

            if (b && !m_dockTabIcon.Highlight)
            {
                m_dockTabIcon.Highlight = b;
                DockIconsLayer.RemoveChild(m_dockPreviewShape);
                m_dockPreviewShape = null;
                Window    owner = Window.GetWindow(this);
                Rectangle rect  = new Rectangle();
                rect.Fill          = Brushes.RoyalBlue;
                rect.Opacity       = 0.3;
                m_dockPreviewShape = rect;
                double space = 2;
                Point  p     = PointFromScreen(PointToScreen(new Point(space, space)));
                Canvas c     = new Canvas();
                c.SnapsToDevicePixels = true;
                c.Width  = DockedContent.ActualWidth;
                c.Height = DockedContent.ActualHeight;
                Canvas.SetLeft(c, p.X);
                Canvas.SetTop(c, p.Y);
                m_dockPreviewShape.Width  = DockedContent.ActualWidth - space * 2;
                m_dockPreviewShape.Height = DockedContent.ActualHeight - 20 - space * 2;
                Canvas.SetLeft(m_dockPreviewShape, 0);
                Canvas.SetTop(m_dockPreviewShape, 0);
                c.Children.Add(m_dockPreviewShape);

                rect         = new Rectangle();
                rect.Fill    = Brushes.RoyalBlue;
                rect.Opacity = 0.3;
                rect.Width   = Math.Min(DockedContent.ActualWidth / 4, 50);
                rect.Height  = 20;
                Canvas.SetLeft(rect, 0);
                Canvas.SetTop(rect, DockedContent.ActualHeight - 20 - space * 2);
                c.Children.Add(rect);
                m_dockPreviewShape = c;

                DockIconsLayer.InsertChild(0, m_dockPreviewShape);
            }
            else if (!b)
            {
                if (m_dockPreviewShape != null)
                {
                    DockIconsLayer.RemoveChild(m_dockPreviewShape);
                    m_dockPreviewShape = null;
                }
                m_dockTabIcon.Highlight = false;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Function called when dragged window enters already docked window</summary>
        /// <param name="sender">Dockable window being dragged</param>
        /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param>
        public void DockDragEnter(object sender, DockDragDropEventArgs e)
        {
            Point center          = new Point(ActualWidth / 2, ActualHeight / 2);
            ResourceDictionary rd = new ResourceDictionary();

            rd.Source = new Uri("/Atf.Gui.Wpf;component/Resources/DockIcons.xaml", UriKind.Relative);
            if (m_dockTabIcon == null)
            {
                m_dockTabIcon = new DockIcon((Style)rd["DockTabIcon"], Root.DockIconSize);
            }
            m_dockTabIcon.Offset    = new Point(center.X - Root.DockIconSize.Width / 2, center.Y - Root.DockIconSize.Height / 2);
            m_dockTabIcon.Highlight = false;
            DockIconsLayer.AddChild(m_dockTabIcon);
        }
Esempio n. 5
0
        /// <summary>
        /// Function called when dragged window leaves already docked window</summary>
        /// <param name="sender">Dockable window being dragged</param>
        /// <param name="e">Drag and drop arguments when window is dropped to be docked to dockpanel</param>
        public void DockDragLeave(object sender, DockDragDropEventArgs e)
        {
            DockIconsLayer dockIconLayer = Root.DockIconsLayer;

            dockIconLayer.RemoveChild(m_dockLeftIcon);
            dockIconLayer.RemoveChild(m_dockRightIcon);
            dockIconLayer.RemoveChild(m_dockTopIcon);
            dockIconLayer.RemoveChild(m_dockBottomIcon);
            dockIconLayer.RemoveChild(m_dockTabIcon);
            if (m_dockPreviewShape != null)
            {
                Root.DockIconsLayer.RemoveChild(m_dockPreviewShape);
                m_dockPreviewShape = null;
            }
            dockIconLayer.CloseIfEmpty();
        }
Esempio n. 6
0
 void DockIconsLayer_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     m_dockIconsLayer = null;
 }
Esempio n. 7
0
 void DockIconsLayer_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     m_dockIconsLayer = null;
 }