コード例 #1
0
ファイル: MDMenuItem.cs プロジェクト: jeroldhaas/monodevelop
        public void Update(MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
        {
            var info = manager.GetCommandInfo(ce.CommandId, new CommandTargetRoute(initialCommandTarget));

            if (!isArrayItem)
            {
                SetItemValues(this, info, ce.DisabledVisible);
                if (!Hidden)
                {
                    MDMenu.ShowLastSeparator(ref lastSeparator);
                }
                return;
            }

            Hidden = true;

            if (index < parent.Count - 1)
            {
                for (int i = index + 1; i < parent.Count; i++)
                {
                    var nextItem = parent.ItemAt(i);
                    if (nextItem == null || nextItem.Target != this)
                    {
                        break;
                    }
                    parent.RemoveItemAt(i);
                    i--;
                }
            }

            PopulateArrayItems(info.ArrayInfo, parent, ref lastSeparator, ref index);
        }
コード例 #2
0
ファイル: MDMenuItem.cs プロジェクト: Kalnor/monodevelop
		public void Update (MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			var info = manager.GetCommandInfo (ce.CommandId);

			if (!isArrayItem) {
				SetItemValues (this, info);
				if (!Hidden)
					MDMenu.ShowLastSeparator (ref lastSeparator);
				return;
			}

			Hidden = true;

			if (index < parent.Count - 1) {
				for (int i = index + 1; i < parent.Count; i++) {
					var nextItem = parent.ItemAt (i);
					if (nextItem == null || nextItem.Target != this)
						break;
					parent.RemoveItemAt (i);
					i--;
				}
			}

			PopulateArrayItems (info.ArrayInfo, parent, ref lastSeparator, ref index);
		}
コード例 #3
0
		public void Update (MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			Enabled = true;
			Hidden = Submenu != NSApplication.SharedApplication.ServicesMenu;
			if (!Hidden)
				MDMenu.ShowLastSeparator (ref lastSeparator);
		}
コード例 #4
0
ファイル: MDMenuItem.cs プロジェクト: rcorre/monodevelop
		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++);
			}
		}
コード例 #5
0
 public void Update(MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
 {
     Enabled = true;
     Hidden  = Submenu != NSApplication.SharedApplication.ServicesMenu;
     if (!Hidden)
     {
         MDMenu.ShowLastSeparator(ref lastSeparator);
     }
 }
コード例 #6
0
		public void Update (MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			if (ces.AutoHide) {
				((MDMenu)Submenu).UpdateCommands ();
				Hidden = Submenu.ItemArray ().All (item => item.Hidden);
			}
			if (!Hidden) {
				MDMenu.ShowLastSeparator (ref lastSeparator);
			}
		}
コード例 #7
0
ファイル: MDSubMenuItem.cs プロジェクト: slagusev/monodevelop
 public void Update(MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
 {
     if (ces.AutoHide)
     {
         ((MDMenu)Submenu).UpdateCommands();
         Hidden = Submenu.ItemArray().All(item => item.Hidden);
     }
     if (!Hidden)
     {
         MDMenu.ShowLastSeparator(ref lastSeparator);
     }
 }
コード例 #8
0
ファイル: MacPlatform.cs プロジェクト: sheff146/monodevelop
		public override bool ShowContextMenu (CommandManager commandManager, Gtk.Widget widget, double x, double y, CommandEntrySet entrySet, object initialCommandTarget = null)
		{
			Gtk.Application.Invoke (delegate {
				// Explicitly release the grab because the menu is shown on the mouse position, and the widget doesn't get the mouse release event
				Gdk.Pointer.Ungrab (Gtk.Global.CurrentEventTime);
				var menu = new MDMenu (commandManager, entrySet, CommandSource.ContextMenu, initialCommandTarget);
				var nsview = MacInterop.GtkQuartz.GetView (widget);
				var toplevel = widget.Toplevel as Gtk.Window;
				int trans_x, trans_y;
				widget.TranslateCoordinates (toplevel, (int)x, (int)y, out trans_x, out trans_y);

				// Window coordinates in gtk are the same for cocoa, with the exception of the Y coordinate, that has to be flipped.
				var pt = new PointF ((float)trans_x, (float)trans_y);
				int w,h;
				toplevel.GetSize (out w, out h);
				pt.Y = h - pt.Y;

				var tmp_event = NSEvent.MouseEvent (NSEventType.LeftMouseDown,
					pt,
					0, 0,
					MacInterop.GtkQuartz.GetWindow (toplevel).WindowNumber,
					null, 0, 0, 0);

				NSMenu.PopUpContextMenu (menu, tmp_event, nsview);
			});

			return true;
		}
コード例 #9
0
 public void Update(MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
 {
     MDMenu.ShowLastSeparator(ref lastSeparator);
 }
コード例 #10
0
ファイル: MDLinkMenuItem.cs プロジェクト: Kalnor/monodevelop
		public void Update (MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			MDMenu.ShowLastSeparator (ref lastSeparator);
		}
コード例 #11
0
 public void Update(MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
 {
     Enabled = !MDMenuItem.IsGloballyDisabled;
     MDMenu.ShowLastSeparator(ref lastSeparator);
 }
コード例 #12
0
		public override bool ShowContextMenu (CommandManager commandManager, Gtk.Widget widget, double x, double y, CommandEntrySet entrySet)
		{
			Gtk.Application.Invoke (delegate {
				var menu = new MDMenu (commandManager, entrySet);
				var nsview = MacInterop.GtkQuartz.GetView (widget);
				var toplevel = widget.Toplevel as Gtk.Window;
				int trans_x, trans_y;
				widget.TranslateCoordinates (toplevel, (int)x, (int)y, out trans_x, out trans_y);

				var pt = nsview.ConvertPointFromBase (new PointF ((float)trans_x, (float)trans_y));

				var tmp_event = NSEvent.MouseEvent (NSEventType.LeftMouseDown,
					pt,
					0, 0,
					MacInterop.GtkQuartz.GetWindow (toplevel).WindowNumber,
					null, 0, 0, 0);

				NSMenu.PopUpContextMenu (menu, tmp_event, nsview);
			});

			return true;
		}
コード例 #13
0
ファイル: MDLinkMenuItem.cs プロジェクト: segaman/monodevelop
		public void Update (MDMenu parent, ref NSMenuItem lastSeparator, ref int index)
		{
			Enabled = !MDMenuItem.IsGloballyDisabled;
			MDMenu.ShowLastSeparator (ref lastSeparator);
		}