Exemple #1
0
        void onClickClosedList(AControl control, int x, int y, MouseButton button)
        {
            _listOpen      = true;
            _openResizePic = new ResizePic(Parent, X, Y, 3000, _width, _font.Height * _visibleItems + 8);
            _openResizePic.MouseClickEvent += onClickOpenList;
            _openResizePic.MouseOverEvent  += onMouseOverOpenList;
            _openResizePic.MouseOutEvent   += onMouseOutOpenList;
            ((Gump)Parent).AddControl(_openResizePic, this.Page);

            if (_visibleItems > _items.Count)
            {
                _visibleItems = _items.Count;
            }

            // only show the scrollbar if we need to scroll
            if (_visibleItems < _items.Count)
            {
                _openScrollBar = new ScrollBar(Parent, X + _width - 20, Y + 4, _font.Height * _visibleItems, (_canBeNull ? -1 : 0), _items.Count - _visibleItems, Index);
                ((Gump)Parent).AddControl(_openScrollBar, this.Page);
            }
            _openLabels = new TextLabelAscii[_visibleItems];
            for (var i = 0; i < _visibleItems; i++)
            {
                _openLabels[i] = new TextLabelAscii(Parent, X + 4, Y + 5 + _font.Height * i, 1, 1106, string.Empty);
                ((Gump)Parent).AddControl(_openLabels[i], this.Page);
            }
        }
Exemple #2
0
        void BuildGumpling(int x, int y, int width, string[] items, int itemsVisible, int index, bool canBeNull)
        {
            Position      = new Vector2Int(x, y);
            _items        = new List <string>(items);
            _width        = width;
            Index         = index;
            _visibleItems = itemsVisible;
            _canBeNull    = canBeNull;

            _resize = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, _width, _font.Height + 8), 0);
            _resize.MouseClickEvent += onClickClosedList;
            _resize.MouseOverEvent  += onMouseOverClosedList;
            _resize.MouseOutEvent   += onMouseOutClosedList;
            _label = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0);
            AddControl(new GumpPic(this, width - 22, 5, 2086, 0), 0);
        }
 public void CreateVisual()
 {
     if (_resizePic != null || _label != null || ScrollButton != null)
     {
         return;
     }
     _resizePic                  = (ResizePic)AddControl(new ResizePic(this, 0, 0, 3000, _width, _font.Height + 8), 0);
     _resizePic.GumpLocalID      = GumpLocalID;
     _resizePic.MouseClickEvent += onClickClosedList;
     _resizePic.MouseOverEvent  += onMouseOverClosedList;
     _resizePic.MouseOutEvent   += onMouseOutClosedList;
     _resizePic.IsEnabled        = false;
     _label             = (TextLabelAscii)AddControl(new TextLabelAscii(this, 4, 5, 1, hue_Text, string.Empty), 0);
     _label.GumpLocalID = GumpLocalID;
     ScrollButton       = (GumpPic)AddControl(new GumpPic(this, _width - 22, 5, 2086, 0), 0);
     IsFirstvisible     = true;//for invisible create control
 }