/// <summary> /// Constructor for creator node. The object can be of any type that is supported by the engine view as a drop target. /// </summary> /// <param name="nodename"></param> /// <param name="creator"></param> /// <param name="iIcon"></param> public ShapeCreatorTreeNode(string nodename, object creator, int iIcon, string helpKey) : base(nodename, iIcon, iIcon) { CreatorObject = creator; _sHelpKey = helpKey; if (!string.IsNullOrEmpty(_sHelpKey)) { _helpButton = new HelpToolStripMenuItem(_sHelpKey, "shapes"); if (iIcon < EditorManager.GUI.ShapeTreeImages.ImageList.Images.Count && iIcon >= 0) { _helpButton.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[iIcon]; } ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); // This is a workaround for 'ContextMenuStrip.Items.Add' being incredibly slow so // we can't call it in every constructor. Therefore, we listen to the opening of the // context menu and only add the item if we actually need to show it. ContextMenuStrip.Opening += new CancelEventHandler(ContextMenuStrip_Opening); } }
/// <summary> /// Constructor for creator node. The object can be of any type that is supported by the engine view as a drop target. /// </summary> /// <param name="nodename"></param> /// <param name="creator"></param> /// <param name="iIcon"></param> public ShapeCreatorTreeNode(string nodename, object creator, int iIcon, string helpKey) : base(nodename, iIcon, iIcon) { CreatorObject = creator; _sHelpKey = helpKey; if (!string.IsNullOrEmpty(_sHelpKey)) { _helpButton = new HelpToolStripMenuItem(_sHelpKey, "shapes"); if (iIcon < EditorManager.GUI.ShapeTreeImages.ImageList.Images.Count && iIcon >= 0) _helpButton.Image = EditorManager.GUI.ShapeTreeImages.ImageList.Images[iIcon]; ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(); // This is a workaround for 'ContextMenuStrip.Items.Add' being incredibly slow so // we can't call it in every constructor. Therefore, we listen to the opening of the // context menu and only add the item if we actually need to show it. ContextMenuStrip.Opening += new CancelEventHandler(ContextMenuStrip_Opening); } }