Exemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            _hrefOver = -1; // this value is changed every frame if we mouse over a region.

            if (_textChanged)
            {
                _textChanged = false;
                _textRenderer.Text = Text;
            }

            HandlesMouseInput = (_textRenderer.HREFRegions.Count > 0);

            if (HasScrollbar)
            {
                if (_scrollbar == null)
                    AddControl(_scrollbar = new ScrollBar(this, 0));
                _scrollbar.X = Width - 15;
                _scrollbar.Y = 0;
                _scrollbar.Width = 15;
                _scrollbar.Height = Height;
                _scrollbar.MinValue = 0;
                _scrollbar.MaxValue = _textRenderer.Height - Height;
                ScrollY = _scrollbar.Value;
            }

            base.Update(gameTime);
        }
Exemplo n.º 2
0
 void onClickClosedList(int x, int y, MouseButton button)
 {
     _listOpen = true;
     _openResizePic = new ResizePic(_owner, Page, X, Y, 3000, _width, Data.ASCIIText.Fonts[1].Height * _visibleItems + 8);
     _openResizePic.OnMouseClick = onClickOpenList;
     _openResizePic.OnMouseOver = onMouseOverOpenList;
     _openResizePic.OnMouseOut = onMouseOutOpenList;
     ((Gump)_owner).AddControl(_openResizePic);
     // only show the scrollbar if we need to scroll
     if (_visibleItems < _items.Count)
     {
         _openScrollBar = new ScrollBar(_owner, Page, X + _width - 20, Y + 4, Data.ASCIIText.Fonts[1].Height * _visibleItems, (_canBeNull ? -1 : 0), _items.Count - _visibleItems, Index);
         ((Gump)_owner).AddControl(_openScrollBar);
     }
     _openLabels = new TextLabelAscii[_visibleItems];
     for (int i = 0; i < _visibleItems; i++)
     {
         _openLabels[i] = new TextLabelAscii(_owner, Page, X + 4, Y + 5 + Data.ASCIIText.Fonts[1].Height * i, 1107, 1, string.Empty);
         ((Gump)_owner).AddControl(_openLabels[i]);
     }
 }