Beyond_Beyaan.BBComboBox.Initialize C# (CSharp) Метод

Initialize() публичный Метод

public Initialize ( List items, int xPos, int yPos, int width, int height, int maxVisible, Random r, string &reason ) : bool
items List
xPos int
yPos int
width int
height int
maxVisible int
r System.Random
reason string
Результат bool
        public bool Initialize(List<string> items, int xPos, int yPos, int width, int height, int maxVisible, Random r, out string reason)
        {
            _items = items;
            _xPos = xPos;
            _yPos = yPos;
            _width = width;
            _height = height;

            _selectedIndex = 0;
            Dropped = false;
            _downArrowSprite = SpriteManager.GetSprite("ScrollDownBGButton", r);

            if (items.Count < maxVisible)
            {
                _haveScroll = false;
                maxVisible = items.Count;
            }
            else if (items.Count > maxVisible)
            {
                _haveScroll = true;
            }

            Enabled = true;

            _buttons = new List<BBInvisibleStretchButton>();
            _dropBackground = new BBStretchableImage();
            _scrollBar = new BBScrollBar();

            for (int i = 0; i <= maxVisible; i++)
            {
                BBInvisibleStretchButton button = new BBInvisibleStretchButton();
                if (!button.Initialize(string.Empty, ButtonTextAlignment.LEFT, StretchableImageType.ThinBorderBG, StretchableImageType.ThinBorderFG, _xPos, _yPos + (i * height), _width, _height, r, out reason))
                {
                    return false;
                }
                _buttons.Add(button);
            }
            if (!_dropBackground.Initialize(_xPos, _yPos, width, height, StretchableImageType.ThinBorderBG, r, out reason))
            {
                return false;
            }
            if (!_scrollBar.Initialize(_xPos + _width, _yPos + _height, maxVisible * _height, maxVisible, items.Count, false, false, r, out reason))
            {
                return false;
            }
            RefreshSelection();
            RefreshLabels();
            return true;
        }