Beispiel #1
0
        void UpdateHoveredRow()
        {
            int iRowY            = (mHoverPoint.Y - (LayoutRect.Y + Padding.Top + (DisplayColumnHeaders ? Style.RowHeight : 0) - (int)Scrollbar.LerpOffset));
            int iHoveredRowIndex = Math.Max(-1, iRowY / (Style.RowHeight + Style.RowSpacing));

            var oldHoveredRow = HoveredRow;

            HoveredRow = null;

            bool bWasHoveringNewRow = mbIsHoveringNewRow;

            mbIsHoveringNewRow = false;

            int iOffset = iRowY % (Style.RowHeight + Style.RowSpacing);

            mbInsertAfter = iOffset >= (Style.RowHeight + Style.RowSpacing) / 2;

            if (iHoveredRowIndex >= Rows.Count)
            {
                mbInsertAfter = true;

                if (mbIsHoveredActionButtonDown)
                {
                    mHoveredActionButton.ResetPressState();
                    mbIsHoveredActionButtonDown = false;
                }
                mHoveredActionButton = null;

                if (iHoveredRowIndex == Rows.Count && NewRowText != null)
                {
                    mbIsHoveringNewRow = true;
                }
            }
            else
            if (iHoveredRowIndex >= 0)
            {
                HoveredRow = Rows[iHoveredRowIndex];

                if (HoverHandler != null && oldHoveredRow != HoveredRow)
                {
                    HoverHandler(this);
                }

                if (mHoveredActionButton != null)
                {
                    if (mHoveredActionButton.HitTest(mHoverPoint) != null)
                    {
                        mHoveredActionButton.OnMouseMove(mHoverPoint);
                    }
                    else
                    {
                        mHoveredActionButton.OnMouseOut(mHoverPoint);

                        if (mbIsHoveredActionButtonDown)
                        {
                            mHoveredActionButton.ResetPressState();
                            mbIsHoveredActionButtonDown = false;
                        }

                        mHoveredActionButton = null;
                    }
                }

                if (mHoveredActionButton == null)
                {
                    mbIsHoveredActionButtonDown = false;

                    foreach (Button button in ActionButtons)
                    {
                        if (button.HitTest(mHoverPoint) != null)
                        {
                            mHoveredActionButton = button;
                            mHoveredActionButton.OnMouseEnter(mHoverPoint);
                            break;
                        }
                    }
                }
            }

            if (bWasHoveringNewRow && !mbIsHoveringNewRow)
            {
                Screen.Game.SetCursor(MouseCursor.Default);
            }
            else
            if (!bWasHoveringNewRow && mbIsHoveringNewRow)
            {
                Screen.Game.SetCursor(MouseCursor.Hand);
            }
        }