Esempio n. 1
0
            public override Widget GetHoveredWidget(MouseContext m)
            {
                (int x, int y) = m.Mouse;

                int yIndex = 0;

                foreach (Widget w in Items)
                {
                    if (yIndex + w.Height > y)
                    {
                        if (x < w.Width)
                        {
                            m.SetRelativeMouse(0, -yIndex);

                            return(w);
                        }
                        break;
                    }

                    yIndex += w.Height;
                }

                // if nothing is hovered over
                return(this);
            }
Esempio n. 2
0
        public override Widget GetHoveredWidget(MouseContext m)
        {
            (int x, int y) = m.Mouse;

            if (Content.HitTest(x - 1, y - 1))
            {
                m.SetRelativeMouse(-1, -1);
                return(Content);
            }
            else
            {
                return(this);
            }
        }
Esempio n. 3
0
        public override Widget GetHoveredWidget(MouseContext m)
        {
            (int x, int y) = m.Mouse;

            foreach (WidgetWithLocation w in Children)
            {
                if (x >= w.X && y >= w.Y && w.Widget.HitTest(x - w.X, y - w.Y))
                {
                    m.SetRelativeMouse(-w.X, -w.Y);
                    return(w.Widget);
                }
            }

            return(this);
        }
Esempio n. 4
0
        public override Widget GetHoveredWidget(MouseContext m)
        {
            (int x, int y) = m.Mouse;

            if (x == ViewportWidth && y == ViewportHeight)
            {
                return(this);
            }
            else if (IsVScrollBarVisible() && x == ViewportWidth)
            {
                return(VScrollBar);
            }
            else if (IsHScrollBarVisible() && y == ViewportHeight)
            {
                return(HScrollBar);
            }
            else
            {
                m.SetRelativeMouse(HorizontalStart, VerticalStart);
                return(Content);
            }
        }