Ejemplo n.º 1
0
 public static bool MouseMove(int X, int Y, MouseButtons mb)
 {
     if (m_Capture != null)
     {
         Point point = m_Capture.PointToClient(new Point(X, Y));
         if (m_LastOver != m_Capture)
         {
             if (m_LastOver != null)
             {
                 m_LastOver.OnMouseLeave();
             }
             m_Capture.OnMouseEnter(point.X, point.Y, mb);
             m_LastOver = m_Capture;
         }
         m_Capture.OnMouseMove(point.X, point.Y, mb);
         return true;
     }
     if ((m_Desktop == null) || (m_Desktop.Children.Count == 0))
     {
         return false;
     }
     if ((m_Drag != null) && m_Drag.m_IsDragging)
     {
         int x = X - m_Drag.m_OffsetX;
         int y = Y - m_Drag.m_OffsetY;
         if ((x + m_Drag.Width) < m_Drag.m_DragClipX)
         {
             x = m_Drag.m_DragClipX - m_Drag.Width;
         }
         else if (x > (Engine.ScreenWidth - m_Drag.m_DragClipX))
         {
             x = Engine.ScreenWidth - m_Drag.m_DragClipX;
         }
         if ((y + m_Drag.Height) < m_Drag.m_DragClipY)
         {
             y = m_Drag.m_DragClipY - m_Drag.Height;
         }
         else if (y > (Engine.ScreenHeight - m_Drag.m_DragClipY))
         {
             y = Engine.ScreenHeight - m_Drag.m_DragClipY;
         }
         Point point2 = m_Drag.Parent.PointToClient(new Point(x, y));
         m_Drag.X = point2.X;
         m_Drag.Y = point2.Y;
         m_Drag.OnDragMove();
         Gump target = null;
         RecurseFindDrop(0, 0, m_Desktop, X, Y, mb, ref target);
         if (target != null)
         {
             if (m_LastDragOver != target)
             {
                 if (m_LastDragOver != null)
                 {
                     m_LastDragOver.OnDragLeave(m_Drag);
                 }
                 target.OnDragEnter(m_Drag);
             }
         }
         else if (m_LastDragOver != null)
         {
             m_LastDragOver.OnDragLeave(m_Drag);
         }
         m_LastDragOver = target;
         if (m_LastOver != m_Drag)
         {
             if (m_LastOver != null)
             {
                 m_LastOver.OnMouseLeave();
             }
             m_LastOver = m_Drag;
             if (m_LastOver != null)
             {
                 point2 = m_LastOver.PointToClient(new Point(X, Y));
                 m_LastOver.OnMouseEnter(point2.X, point2.Y, mb);
             }
         }
         return !IsWorldAt(X, Y, false);
     }
     Gump startDrag = m_StartDrag;
     if (!RecurseMouseMove(0, 0, m_Desktop, X, Y, mb))
     {
         if (((startDrag != null) && startDrag.m_CanDrag) && (mb == MouseButtons.Left))
         {
             m_Drag = startDrag;
             startDrag.m_IsDragging = true;
             startDrag.OnDragStart();
         }
         else if (m_LastOver != null)
         {
             m_LastOver.OnMouseLeave();
             m_LastOver = null;
         }
         return (m_Modal != null);
     }
     if ((((startDrag != m_LastOver) && (startDrag != null)) && (startDrag.m_CanDrag && !startDrag.m_IsDragging)) && (!startDrag.m_QuickDrag && (mb == MouseButtons.Left)))
     {
         m_Drag = startDrag;
         if (m_LastOver != m_Drag)
         {
             if (m_LastOver != null)
             {
                 m_LastOver.OnMouseLeave();
             }
             m_LastOver = m_Drag;
             if (m_LastOver != null)
             {
                 Point p = new Point(X, Y);
                 p = m_LastOver.PointToClient(p);
                 m_LastOver.OnMouseEnter(p.X, p.Y, mb);
             }
         }
         startDrag.m_IsDragging = true;
         startDrag.OnDragStart();
         if ((m_Drag != null) && m_Drag.m_IsDragging)
         {
             MouseMove(X, Y, mb);
         }
         if (m_LastOver != m_Drag)
         {
             if (m_LastOver != null)
             {
                 m_LastOver.OnMouseLeave();
             }
             m_LastOver = m_Drag;
             if (m_LastOver != null)
             {
                 Point point4 = new Point(X, Y);
                 point4 = m_LastOver.PointToClient(point4);
                 m_LastOver.OnMouseEnter(point4.X, point4.Y, mb);
             }
         }
     }
     else if ((((startDrag == m_LastOver) && (startDrag != null)) && (startDrag.m_CanDrag && !startDrag.m_IsDragging)) && ((!startDrag.m_QuickDrag && (mb == MouseButtons.Left)) && ((m_StartDragPoint ^ new Point(X, Y)) >= 2)))
     {
         m_Drag = startDrag;
         if (m_LastOver != m_Drag)
         {
             if (m_LastOver != null)
             {
                 m_LastOver.OnMouseLeave();
             }
             m_LastOver = m_Drag;
             if (m_LastOver != null)
             {
                 Point point5 = new Point(X, Y);
                 point5 = m_LastOver.PointToClient(point5);
                 m_LastOver.OnMouseEnter(point5.X, point5.Y, mb);
             }
         }
         startDrag.m_IsDragging = true;
         startDrag.OnDragStart();
         if ((m_Drag != null) && m_Drag.m_IsDragging)
         {
             MouseMove(X, Y, mb);
         }
         if (m_LastOver != m_Drag)
         {
             if (m_LastOver != null)
             {
                 m_LastOver.OnMouseLeave();
             }
             m_LastOver = m_Drag;
             if (m_LastOver != null)
             {
                 Point point6 = new Point(X, Y);
                 point6 = m_LastOver.PointToClient(point6);
                 m_LastOver.OnMouseEnter(point6.X, point6.Y, mb);
             }
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 private static bool RecurseMouseMove(int X, int Y, Gump g, int mX, int mY, MouseButtons mb)
 {
     if (g.Visible && (g.m_NonRestrictivePicking || (((mX >= X) && (mX < (X + g.Width))) && ((mY >= Y) && (mY < (Y + g.Height))))))
     {
         Gump[] gumpArray = g.Children.ToArray();
         for (int i = gumpArray.Length - 1; i >= 0; i--)
         {
             Gump gump = gumpArray[i];
             if (RecurseMouseMove(X + gump.X, Y + gump.Y, gump, mX, mY, mb))
             {
                 return true;
             }
         }
         if (!g.m_NonRestrictivePicking || (((mX >= X) && (mX < (X + g.Width))) && ((mY >= Y) && (mY < (Y + g.Height)))))
         {
             if ((m_Modal == null) && g.HitTest(mX - X, mY - Y))
             {
                 if (m_LastOver == g)
                 {
                     g.OnMouseMove(mX - X, mY - Y, mb);
                 }
                 else
                 {
                     if (m_LastOver != null)
                     {
                         m_LastOver.OnMouseLeave();
                     }
                     g.OnMouseEnter(mX - X, mY - Y, mb);
                     if (g.Tooltip != null)
                     {
                         m_TipDelay = new TimeDelay(g.Tooltip.Delay);
                     }
                     else
                     {
                         m_TipDelay = null;
                     }
                     m_LastOver = g;
                 }
                 return true;
             }
             if (((m_Modal != null) && g.IsChildOf(m_Modal)) && g.HitTest(mX - X, mY - Y))
             {
                 if (m_LastOver == g)
                 {
                     g.OnMouseMove(mX - X, mY - Y, mb);
                 }
                 else
                 {
                     if (m_LastOver != null)
                     {
                         m_LastOver.OnMouseLeave();
                     }
                     g.OnMouseEnter(mX - X, mY - Y, mb);
                     if (g.Tooltip != null)
                     {
                         m_TipDelay = new TimeDelay(g.Tooltip.Delay);
                     }
                     else
                     {
                         m_TipDelay = null;
                     }
                     m_LastOver = g;
                 }
                 return true;
             }
         }
     }
     return false;
 }