This is used to request slice context menus.
Inheritance: System.EventArgs
Ejemplo n.º 1
0
		/// <summary>
		/// Invoked by a DataTree (which is in turn invoked by the slice)
		/// when the context menu for a slice is needed.
		/// </summary>
		public ContextMenu ShowSliceContextMenu(object sender, SliceMenuRequestArgs e)
		{
			Slice slice = e.Slice;
			return MakeSliceContextMenu(slice, e.HotLinksOnly);
			// We want something like the following (See LT-2310), but the following code does not work
			// because the menu returned by MakeSliceContextMenu has no items; they are created by an event handler
			// when the menu pops up. There's no way to get at them until then, which is too late. We will have to
			// refactor so we can merge the configuration nodes for the multiple menus.
			//			int index = slice.IndexInContainer;
			//			int indent = slice.Indent;
			//			while (indent > 0)
			//			{
			//				indent--;
			//				index = slice.Container.PrevFieldAtIndent(indent, index);
			//				Slice parentSlice = (Slice)Parent.Controls[index];
			//				ContextMenu parentMenu = MakeSliceContextMenu(parentSlice);
			//				if (parentMenu == null)
			//					continue;
			//				if (menu == null)
			//				{
			//					menu = parentMenu;
			//					continue;
			//				}
			//				menu.MenuItems.Add("---");
			//				Debug.WriteLine("Added --- to menu");
			//				foreach (MenuItem item in parentMenu.MenuItems)
			//					menu.MenuItems.Add(item.CloneMenu());
			//			}
			//we need to stash away this information so that when we receive a command
			//from the menu system, we can associate it with the slice that sent it
			//m_sourceOfMenuCommandSlice = e.Slice;
			//			return menu;
			//nono, this happens immediately m_sourceOfMenuCommandSlice= null;

		}
Ejemplo n.º 2
0
		/// <summary>
		/// Get the context menu that would be displayed for a right click on the slice.
		/// </summary>
		/// <param name="slice"></param>
		/// <returns></returns>
		public ContextMenu GetSliceContextMenu(Slice slice, bool fHotLinkOnly)
		{
			CheckDisposed();
			Debug.Assert(ShowContextMenuEvent!= null, "this should always be set to something");
			// This is something of a historical artifact. There's probably no reason
			// to pass a point to ShowContextMenuEvent. At an earlier stage, the event was
			// ShowContextMenu, so it needed a point. TreeNodeEventArgs is still used for
			// Slice.ShowContextMenu event, so it was somewhat awkward to change.
			SliceMenuRequestArgs e = new SliceMenuRequestArgs(slice, fHotLinkOnly);
			return ShowContextMenuEvent(this, e);
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Invoked by a slice when the user does something to bring up a context menu
		/// </summary>
		public void OnShowContextMenu(object sender, TreeNodeEventArgs e)
		{
			CheckDisposed();
			//just pass this onto, for example, the XWorks View that owns us,
			//assuming that it has subscribed to this event on this object.
			//If it has not, then this will still point to the "auto menu handler"
			Debug.Assert(ShowContextMenuEvent != null, "this should always be set to something");
			CurrentSlice = e.Slice;
			SliceMenuRequestArgs args = new SliceMenuRequestArgs(e.Slice, false);
			ShowContextMenuEvent(sender, args);
			//			ContextMenu menu = ShowContextMenuEvent(sender, args);
			//			menu.Show(e.Context, e.Location);
		}
Ejemplo n.º 4
0
		public void OnShowContextMenu(object sender, TreeNodeEventArgs e)
		{
			CheckDisposed();
			//just pass this onto, for example, the XWorks View that owns us,
			//assuming that it has subscribed to this event on this object.
			//If it has not, then this will still point to the "auto menu handler"
			Debug.Assert(ShowContextMenuEvent != null, "this should always be set to something");
			CurrentSlice = e.Slice;
			var args = new SliceMenuRequestArgs(e.Slice, false);
			// TODO: ShowContextMenuEvent returns a ContextMenu that we should dispose. However,
			// we can't do that right here (because that destroys the menu before being shown).
			// Ideally we would store the context menu in a member variable and dispose this later
			// on. However, it is unlikely that not disposing this context menu will cause any
			// problems, so we leave it as is for now.
			ShowContextMenuEvent(sender, args);
			//			ContextMenu menu = ShowContextMenuEvent(sender, args);
			//			menu.Show(e.Context, e.Location);
		}