using System;
using System.Collections.Generic;
namespace NovaSamples.UIControls
{
///
/// A data structure used to store the state of a dropdown UI control.
///
[Serializable]
public class DropdownData
{
public const string NothingSelected = "None";
///
/// The index into the list of of the selected value.
///
public int SelectedIndex;
///
/// The list of selectable options the end-user can choose from for this given dropdown.
///
public List Options = new List();
///
/// The currently selected item, if one is selected, otherwise .
///
public string CurrentSelection
{
get
{
if (Options == null || SelectedIndex < 0 || SelectedIndex >= Options.Count)
{
// If the dropdown doesn't have any options or the
// SelectedIndex is out of range, indicate nothing selected.
return NothingSelected;
}
// Return the selected option
return Options[SelectedIndex];
}
}
}
}