Exemplo n.º 1
0
        protected virtual void GetTickedMenuItems(List <PopupMenuItem> rootItems, ref List <PopupMenuItem> results)
        {
            var find = PopupMenuUtility.FindMenuItemByIdentifyingObject(rootItems, Value);

            if (find != null)
            {
                results.Add(find);
            }
        }
Exemplo n.º 2
0
        /// <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);
                }
            }
        }