Beispiel #1
0
        public override void AddChildren(GumpControl c, int page = 0)
        {
            ScrollAreaItem item = new ScrollAreaItem();

            item.AddChildren(c);
            base.AddChildren(item, page);
        }
Beispiel #2
0
 protected GumpControl(GumpControl parent = null)
 {
     Parent           = parent;
     _children        = new List <GumpControl>();
     AllowedToDraw    = true;
     AcceptMouseInput = true;
     Page             = 0;
     UIManager        = Service.Get <UIManager>();
     Debug            = false;
 }
Beispiel #3
0
        public override bool Draw(SpriteBatchUI spriteBatch, Point position, Vector3?hue = null)
        {
            Children[0].Draw(spriteBatch, new Point(position.X + Children[0].X, position.Y + Children[0].Y));
            _rect.X      = position.X;
            _rect.Y      = position.Y;
            _rect.Width  = Width;
            _rect.Height = Height;
            Rectangle scissor = ScissorStack.CalculateScissors(spriteBatch.TransformMatrix, _rect);

            if (ScissorStack.PushScissors(scissor))
            {
                spriteBatch.EnableScissorTest(true);
                int  height    = 0;
                int  maxheight = _scrollBar.Value + _scrollBar.Height;
                bool drawOnly1 = true;

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

                    if (!child.IsVisible)
                    {
                        continue;
                    }
                    child.Y = height - _scrollBar.Value;

                    if (height + child.Height <= _scrollBar.Value)
                    {
                        // do nothing
                    }
                    else if (height + child.Height <= maxheight)
                    {
                        child.Draw(spriteBatch, new Point(position.X + child.X, position.Y + child.Y));
                    }
                    else
                    {
                        if (drawOnly1)
                        {
                            child.Draw(spriteBatch, new Point(position.X + child.X, position.Y + child.Y));
                            drawOnly1 = false;
                        }
                    }

                    height += child.Height;
                }

                spriteBatch.EnableScissorTest(false);
                ScissorStack.PopScissors();
            }

            return(true);
        }
Beispiel #4
0
 public override void RemoveChildren(GumpControl c)
 {
     if (c is ScrollAreaItem)
     {
         base.RemoveChildren(c);
     }
     else
     {
         // Try to find the wrapped control
         var wrapper = Children.OfType <ScrollAreaItem>().FirstOrDefault(o => o.Children.Contains(c));
         base.RemoveChildren(wrapper);
     }
 }
Beispiel #5
0
        public override bool Draw(SpriteBatchUI spriteBatch, Vector3 position, Vector3?hue = null)
        {
            int height    = 0;
            int maxheight = _scrollBar.Value + _scrollBar.Height;

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

                if (child is IScrollBar)
                {
                    child.Draw(spriteBatch, new Vector3(position.X + child.X, position.Y + child.Y, 0));
                }
                else
                {
                    child.Y = height - _scrollBar.Value;

                    if (height + child.Height <= _scrollBar.Value)
                    {
                        // do nothing
                    }
                    else if (height + child.Height <= maxheight)
                    {
                        if (child.Y < 0)
                        {
                            // TODO: Future implementation
                        }
                        else
                        {
                            child.Draw(spriteBatch, new Vector3(position.X + child.X, position.Y + child.Y, 0));
                        }
                    }

                    height += child.Height;
                }
            }

            return(true);
        }
Beispiel #6
0
 public ScrollFlag(GumpControl parent) : base(parent)
 {
     AcceptMouseInput = true;
 }
Beispiel #7
0
 public ScrollFlag(GumpControl parent, int x, int y, int height) : this(parent)
 {
     Location            = new Point(x, y);
     _sliderExtentTop    = y;
     _sliderExtentHeight = height;
 }
Beispiel #8
0
 public ScrollBar(GumpControl parent, int x, int y, int height) : base(parent)
 {
     Height           = height;
     Location         = new Point(x, y);
     AcceptMouseInput = true;
 }