public Listbox(int dropDownLength, int width, List <string> initialOptions = null) { _width = width; _dropMaxHeight = dropDownLength; _listboxLeft = _resourceCache.GetSprite("button_left"); _listboxMain = _resourceCache.GetSprite("button_middle"); _listboxRight = _resourceCache.GetSprite("button_right"); _selectedLabel = new TextSprite("", _resourceCache.GetResource <FontResource>(@"Fonts/CALIBRI.TTF").Font) { FillColor = Color.Black }; _dropDown = new ScrollableContainer(new Vector2i(width, dropDownLength)) { Visible = false, Alignment = ControlAlignments.Bottom, LocalPosition = new Vector2i(), Parent = this }; if (initialOptions != null) { _contentStrings = initialOptions; RebuildList(); } }
/// <inheritdoc /> public override void Destroy() { _contentStrings.Clear(); _dropDown.Destroy(); _dropDown = null; _selectedLabel = null; _listboxLeft = null; _listboxMain = null; _listboxRight = null; ItemSelected = null; base.Destroy(); }