protected virtual void GetTickedMenuItems(List <PopupMenuItem> rootItems, ref List <PopupMenuItem> results) { var find = PopupMenuUtility.FindMenuItemByIdentifyingObject(rootItems, Value); if (find != null) { results.Add(find); } }
/// <inheritdoc /> protected override void GetTickedMenuItems(List <PopupMenuItem> rootItems, ref List <PopupMenuItem> results) { #if DEV_MODE Debug.Assert(results.Count == 0); #endif if (hasFlagsAttribute) { var value = Value; var defaultValue = (Enum)DefaultValue(); if (value.Equals(defaultValue)) { if (!AddClearAllMenuItem()) { FindMenuItemsForFlag(rootItems, Value, ref results, defaultValue); } #if TICK_CLEAR_ALL_ITEM_IN_MENU else { results.Add(rootItems[SelectNoneMenuItemIndex]); } #endif return; } var allFlags = Value.GetFlags(); for (int n = allFlags.Count - 1; n >= 0; n--) { int count = results.Count; var flag = allFlags[n]; if (flag.Equals(defaultValue)) { continue; } FindMenuItemsForFlag(rootItems, allFlags[n], ref results, defaultValue); } } else { var find = PopupMenuUtility.FindMenuItemByIdentifyingObject(rootItems, Value); if (find != null) { results.Add(find); } } }