コード例 #1
0
        public void UpdateActionStatus(DropdownMenuEventInfo eventInfo)
        {
            this.eventInfo = eventInfo;
            Func <DropdownMenuAction, DropdownMenuAction.Status> expr_10 = this.actionStatusCallback;

            this.status = ((expr_10 != null) ? expr_10(this) : DropdownMenuAction.Status.Hidden);
        }
コード例 #2
0
        /// <summary>
        /// Update the status of all items by calling their status callback and remove the separators in excess. This is called just before displaying the menu.
        /// </summary>
        public void PrepareForDisplay(EventBase e)
        {
            m_DropdownMenuEventInfo = e != null ? new DropdownMenuEventInfo(e) : null;

            if (menuItems.Count == 0)
            {
                return;
            }

            foreach (DropdownMenuItem item in menuItems)
            {
                DropdownMenuAction action = item as DropdownMenuAction;
                if (action != null)
                {
                    action.UpdateActionStatus(m_DropdownMenuEventInfo);
                }
            }

            if (menuItems[menuItems.Count - 1] is DropdownMenuSeparator)
            {
                menuItems.RemoveAt(menuItems.Count - 1);
            }
        }
コード例 #3
0
        public void PrepareForDisplay(EventBase e)
        {
            this.m_DropdownMenuEventInfo = ((e != null) ? new DropdownMenuEventInfo(e) : null);
            bool flag = this.menuItems.Count == 0;

            if (!flag)
            {
                foreach (DropdownMenuItem current in this.menuItems)
                {
                    DropdownMenuAction dropdownMenuAction = current as DropdownMenuAction;
                    bool flag2 = dropdownMenuAction != null;
                    if (flag2)
                    {
                        dropdownMenuAction.UpdateActionStatus(this.m_DropdownMenuEventInfo);
                    }
                }
                bool flag3 = this.menuItems[this.menuItems.Count - 1] is DropdownMenuSeparator;
                if (flag3)
                {
                    this.menuItems.RemoveAt(this.menuItems.Count - 1);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// Update the status flag of this item by calling the item status callback.
 /// </summary>
 /// <param name="eventInfo">Information about the event that triggered the display of the drop-down menu, such as the mouse position or the key pressed.</param>
 public void UpdateActionStatus(DropdownMenuEventInfo eventInfo)
 {
     this.eventInfo = eventInfo;
     status         = actionStatusCallback?.Invoke(this) ?? Status.Hidden;
 }