Beispiel #1
0
		void PopulateArrayItems (CommandArrayInfo infos, NSMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			foreach (CommandInfo ci in infos) {
				if (ci.IsArraySeparator) {
					var n = NSMenuItem.SeparatorItem;
					n.Hidden = true;
					n.Target = this;
					lastSeparator = n;
					parent.InsertItem (n, index++);
					continue;
				}

				var item = new MDExpandedArrayItem {
					Info = ci,
					Target = this,
					Action = ActionSel,
				};

				if (ci is CommandInfoSet) {
					item.Submenu = new NSMenu ();
					int i = 0;
					NSMenuItem sep = null;
					PopulateArrayItems (((CommandInfoSet)ci).CommandInfos, item.Submenu, ref sep, ref i);
				}
				SetItemValues (item, ci);

				if (!item.Hidden)
					MDMenu.ShowLastSeparator (ref lastSeparator);
				parent.InsertItem (item, index++);
			}
		}
Beispiel #2
0
        void PopulateArrayItems(CommandArrayInfo infos, NSMenu parent, ref int index)
        {
            if (infos == null)
            {
                return;
            }

            foreach (CommandInfo ci in infos)
            {
                if (ci.IsArraySeparator)
                {
                    var n = NSMenuItem.SeparatorItem;
                    n.Hidden = true;
                    n.Target = this;
                    if (parent.Count > index)
                    {
                        parent.InsertItem(n, index);
                    }
                    else
                    {
                        parent.AddItem(n);
                    }
                    index++;
                    continue;
                }

                var item = new MDExpandedArrayItem {
                    Info   = ci,
                    Target = this
                };
                if (ci is CommandInfoSet)
                {
                    item.Submenu = new NSMenu();
                    int i = 0;
                    PopulateArrayItems(((CommandInfoSet)ci).CommandInfos, item.Submenu, ref i);
                }
                SetItemValues(item, ci, true);
                if (item.Enabled)
                {
                    item.Action = ActionSel;
                }

                if (parent.Count > index)
                {
                    parent.InsertItem(item, index);
                }
                else
                {
                    parent.AddItem(item);
                }
                index++;
            }
            index--;
        }
Beispiel #3
0
		void PopulateArrayItems (CommandArrayInfo infos, NSMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			foreach (CommandInfo ci in infos) {
				if (ci.IsArraySeparator) {
					var n = NSMenuItem.SeparatorItem;
					n.Hidden = true;
					n.Target = this;
					lastSeparator = n;
					parent.InsertItem (n, index++);
					continue;
				}

				var item = new MDExpandedArrayItem {
					Info = ci,
					Target = this,
					Action = ActionSel,
				};

				if (ci is CommandInfoSet) {
					item.Submenu = new NSMenu ();
					int i = 0;
					NSMenuItem sep = null;
					PopulateArrayItems (((CommandInfoSet)ci).CommandInfos, item.Submenu, ref sep, ref i);
				}
				SetItemValues (item, ci);

				if (!item.Hidden)
					MDMenu.ShowLastSeparator (ref lastSeparator);
				parent.InsertItem (item, index++);
			}
		}