public void RemoveElement(IIntegrableMenu pElement) { base.RemoveElement((Element)pElement); // Non non, cette ligne n'est pas inutile ! // Quand on supprime un élément, si la CurrentSelection pointait vers le dernier élément, la CurrentSelection doit être recalculée. // Voir dans le setter de CurrentSelection. CurrentSelection = CurrentSelection; }
public void RefreshColors() { for (int i = 0; i < Elements.Count; i++) { IIntegrableMenu integrable = (IIntegrableMenu)Elements[i]; integrable.ApplyColor(UnselectedTextColor, UnselectedTextColorBck); integrable.Color_Selected = SelectedTextColor; integrable.ColorBck_Selected = SelectedTextColorBck; } }
private void RefreshSelection() { if (Elements.Count > 0) { for (int i = 0; i < Elements.Count; i++) { IIntegrableMenu e = (IIntegrableMenu)Elements[i]; e.Selected = (i == CurrentSelection); } } }
public void AddElement(IIntegrableMenu pElement) { base.AddElement((Element)pElement); RefreshColors(); }