private void OnIndexSelected(UIComponent Component) { if (selectedButton != null) { selectedButton.Selected = false; } selectedButton = (TextureButton)Component; selectedButton.Selected = true; indexProperty.SetValue(indexPropertyContainingObject, int.Parse(((TextureButton)Component).Text)); }
/// <summary> /// Called when a color is clicked by that collor. /// </summary> /// <param name="Component">Button containing the color.</param> private void OnColorClick(UIComponent Component) { if (selectedButton != null) { selectedButton.Selected = false; } selectedButton = (TextureButton)Component; selectedButton.Selected = true; ColorProperty.SetValue(colorPropertyContainingObject, ((TextureButton)Component).Color); }
/// <summary> /// Creates a button for selecting the specified color /// </summary> /// <param name="location">The location for the button</param> /// <param name="index">The index that this button is for</param> /// <param name="isSelected">Whether the button is the selected one by default</param> /// <returns></returns> private TextureButton CreateIndexButton(Location location, int index, bool isSelected) { TextureButton indexButton = new IndexButton(location, index); if (isSelected) { selectedButton = indexButton; indexButton.Selected = true; } indexButton.Click += OnIndexSelected; return(indexButton); }
/// <summary> /// Creates a button for selecting the specified color /// </summary> /// <param name="location">The location for the button</param> /// <param name="color">The color that this button is for</param> /// <param name="isSelected">Whether the button is the selected one by default</param> /// <returns></returns> private TextureButton CreateColorButton(Location location, Color color, bool isSelected) { TextureButton colorButton = new ColorButton(location, color); if (isSelected) { selectedButton = colorButton; colorButton.Selected = true; } colorButton.Click += OnColorClick; return(colorButton); }