Esempio n. 1
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ScrollBarBase scrollbar = (ScrollBarBase)Children[0];

            scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y);

            if (batcher.ClipBegin(x + ScissorRectangle.X, y + ScissorRectangle.Y, Width - 14 + ScissorRectangle.Width, Height + ScissorRectangle.Height))
            {
                for (int i = 1; i < Children.Count; i++)
                {
                    Control child = Children[i];

                    if (!child.IsVisible)
                    {
                        continue;
                    }

                    int finalY = y + child.Y - scrollbar.Value + ScissorRectangle.Y;

                    child.Draw(batcher, x + child.X, finalY);
                }

                batcher.ClipEnd();
            }

            return(true);
        }
Esempio n. 2
0
        public ScrollArea(int x, int y, int w, int h, bool normalScrollbar, int scroll_max_height = -1)
        {
            X               = x;
            Y               = y;
            Width           = w;
            Height          = h;
            _isNormalScroll = normalScrollbar;

            if (normalScrollbar)
            {
                _scrollBar = new ScrollBar(Width - 14, 0, Height);
            }
            else
            {
                _scrollBar = new ScrollFlag
                {
                    X = Width - 19, Height = h
                };
                Width += 15;
            }

            _scroll_max_height = scroll_max_height;

            _scrollBar.MinValue = 0;
            _scrollBar.MaxValue = scroll_max_height >= 0 ? scroll_max_height : Height;
            //Add((Control)_scrollBar);

            _scrollBar.Parent = this;

            AcceptMouseInput   = true;
            WantUpdateSize     = false;
            CanMove            = true;
            ScrollbarBehaviour = ScrollbarBehaviour.ShowWhenDataExceedFromView;
        }
Esempio n. 3
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            ScrollBarBase scrollbar = (ScrollBarBase)Children[0];

            scrollbar.Draw(batcher, x + scrollbar.X, y + scrollbar.Y);

            Rectangle scissor = ScissorStack.CalculateScissors
                                (
                Matrix.Identity,
                x + ScissorRectangle.X,
                y + ScissorRectangle.Y,
                Width - 14 + ScissorRectangle.Width,
                Height + ScissorRectangle.Height
                                );

            if (ScissorStack.PushScissors(batcher.GraphicsDevice, scissor))
            {
                batcher.EnableScissorTest(true);

                for (int i = 1; i < Children.Count; i++)
                {
                    Control child = Children[i];

                    if (!child.IsVisible)
                    {
                        continue;
                    }

                    int finalY = y + child.Y - scrollbar.Value + ScissorRectangle.Y;

                    //if (finalY + child.Bounds.Height >= scissor.Y && finalY - child.Height < scissor.Bottom)
                    {
                        child.Draw(batcher, x + child.X, finalY);
                    }
                }

                batcher.EnableScissorTest(false);
                ScissorStack.PopScissors(batcher.GraphicsDevice);
            }

            return(true);
        }