protected void InitControl() { base.RenderMode = System.Windows.Forms.ToolStripRenderMode.ManagerRenderMode; base.Renderer = myRenderer; myRenderer.RenderMode = RenderStyle; insPage = new System.ComponentModel.Design.DesignerVerb("Insert tab page", new System.EventHandler(OnInsertPageClicked)); }
/// called to remove global verb public void RemoveVerb(System.ComponentModel.Design.DesignerVerb verb) { if (verb == null) { throw new ArgumentException("verb"); } globalVerbs.Remove(verb); // find the menu item associated with the verb ToolStripMenuItem associatedMenuItem = null; foreach (KeyValuePair <ToolStripMenuItem, DesignerVerb> de in menuItemVerb) { if (de.Value == verb) { associatedMenuItem = de.Key as ToolStripMenuItem; break; } } // if we found the verb's menu item, remove it if (associatedMenuItem != null) { menuItemVerb.Remove(associatedMenuItem); } // remove the verb from the context menu too contextMenu.Items.Remove(associatedMenuItem); }
protected override void GetComponentDesignerActions(IComponent component, DesignerActionListCollection actionLists) { if (component == null) { throw new ArgumentNullException("component"); } if (actionLists == null) { throw new ArgumentNullException("actionLists"); } IServiceContainer site = component.Site as IServiceContainer; if (site != null) { DesignerCommandSet service = (DesignerCommandSet) site.GetService(typeof(DesignerCommandSet)); if (service != null) { DesignerActionListCollection lists = service.ActionLists; if (lists != null) { actionLists.AddRange(lists); } } if ((actionLists.Count == 0) || ((actionLists.Count == 1) && (actionLists[0] is ControlDesigner.ControlDesignerActionList))) { DesignerVerbCollection verbs = service.Verbs; if ((verbs != null) && (verbs.Count != 0)) { DesignerVerb[] array = new DesignerVerb[verbs.Count]; verbs.CopyTo(array, 0); actionLists.Add(new DesignerActionVerbList(array)); } } } }
public DesignerToolStripMenuItem(string text, DesignerVerb verb) : base(text) { if (verb == null) throw new ArgumentNullException("verb"); Verb = verb; }
/// <summary> /// The default constructor. /// </summary> public VerticalTabControlDesigner() : base() { DesignerVerb dvbAddPage = new DesignerVerb("Add Tab Page", new EventHandler(AddTabPage)); DesignerVerb dvbRemovePage = new DesignerVerb("Remove Tab Page", new EventHandler(RemoveTabPage)); m_dvcVerbs.AddRange(new DesignerVerb[] { dvbAddPage, dvbRemovePage }); }
protected void InitControl() { base.RenderMode = ToolStripRenderMode.ManagerRenderMode; base.Renderer = myRenderer; myRenderer.RenderMode = this.RenderStyle; insPage = new DesignerVerb("Insert tab page", new EventHandler(OnInsertPageClicked)); }
protected override DesignerVerb[] GetVerbs() { DesignerVerb[] baseVerbs = base.GetVerbs(); int verbsCount = baseVerbs.Length + 1; if (IsBackstageSet) verbsCount = 1; bool includeClearSubItems = false; MetroAppButton appButton = this.Component as MetroAppButton; if (appButton != null && appButton.BackstageTab != null && appButton.SubItems.Count > 0) { includeClearSubItems = true; verbsCount++; } int verbsOffset = 1; DesignerVerb[] verbs = new DesignerVerb[verbsCount]; verbs[0] = new DesignerVerb((IsBackstageSet ? "Remove Backstage" : "Set Backstage"), new EventHandler(CreateBackstageTab)); if (includeClearSubItems) { verbs[1] = new DesignerVerb("Clear Sub-items", new EventHandler(ClearSubItems)); verbsOffset++; } if (!IsBackstageSet) { for (int i = 0; i < baseVerbs.Length; i++) { verbs[i + verbsOffset] = baseVerbs[i]; } } return verbs; }
private void OnAddDataControl(object sender, System.EventArgs e) { System.ComponentModel.Design.DesignerVerb verb = sender as System.ComponentModel.Design.DesignerVerb; int idx = verb.CommandID.ID; AddDataControl(Type.GetType(ControlsName.DataControlsTypeName[idx], true)); }
/// This is only called by external callers if someone wants to /// remove a verb that is available for all designers. We keep track of /// such verbs to make sure that they are not re-added or removed /// when we frequently manipulate our local verbs. public override void AddVerb(System.ComponentModel.Design.DesignerVerb verb) { if (globalVerbs == null) { globalVerbs = new ArrayList(); } globalVerbs.Add(verb); if (cm == null) { cm = new ContextMenu(); verbsFromMenuItems = new Hashtable(); menuItemsFromVerbs = new Hashtable(); //commandFromMenuItems = new Hashtable(); } // Verbs and MenuItems are dually mapped to each other, so that we can // check for association given either half of the pair. All of our MenuItems // use the same event handler, but we can check the event sender to see // what verb to invoke. We have to have a stable ContextMenu, and we need // to add the MenuItems to it now. If we try to add the MenuItems on-demand // right before we show a ContextMenu, the clicks events won't work. // MenuItem menuItem = new MenuItem(verb.Text); menuItem.Click += new EventHandler(menuItem_Click); verbsFromMenuItems.Add(menuItem, verb); menuItemsFromVerbs.Add(verb, menuItem); cm.MenuItems.Add(menuItem); }
/// The IMenuCommandService deals with two kinds of verbs: 1) local verbs specific /// to each designer (i.e. Add/Remove Tab on a TabControl) which are added /// and removed on-demand, each time a designer is right-clicked, 2) the rarer /// global verbs, which once added are available to all designers, /// until removed. This method (not a standard part of IMenuCommandService) is used /// to add a local verb. If the verb is already in our global list, we don't add it /// again. It is called through IMenuCommandService.ShowContextMenu(). public void AddLocalVerb(DesignerVerb verb) { if ((globalVerbs == null) || (!globalVerbs.Contains(verb))) { if (cm == null) { cm = new ContextMenu(); verbsFromMenuItems = new Hashtable(); menuItemsFromVerbs = new Hashtable(); } // Verbs and MenuItems are dually mapped to each other, so that we can // check for association given either half of the pair. All of our MenuItems // use the same event handler, but we can check the event sender to see // what verb to invoke. MenuItems like to only be assigned to one Menu in their // lifetime, so we have to create a single ContextMenu and use that thereafter. // If we were to instead create a ContextMenu every time we need to show one, // the MenuItems' click events might not work properly. // MenuItem menuItem = new MenuItem(verb.Text); menuItem.Click += new EventHandler(menuItem_Click); verbsFromMenuItems.Add(menuItem, verb); menuItemsFromVerbs.Add(verb, menuItem); cm.MenuItems.Add(menuItem); } }
public InfoDataSetEditor() : base() { DesignerVerb createVerb = new DesignerVerb("Save To Report", new EventHandler(OnCreate)); this.Verbs.Add(createVerb); DesignerVerb createXSDVerb = new DesignerVerb("Create XSD File", new EventHandler(OnCreateXSD)); this.Verbs.Add(createXSDVerb); }
public FAMonthViewDesigner() { showTodayButton = new DesignerVerb("Show/Hide Today Button", (sender, e) => ShowTodayButton()) { Checked = false }; showEmptyButton = new DesignerVerb("Show/Hide Empty Button", (sender, e) => ShowEmptyButton()) { Checked = false }; designerVerbs.Add(showTodayButton); designerVerbs.Add(showEmptyButton); }
public ManagedPanelDesigner() : base() { DesignerVerb verb1 = new DesignerVerb("Select PanelManager", OnSelectManager); m_verbs.Add(verb1); }
/// <summary> /// Adds the specified designer verb to the set of global designer verbs. /// </summary> /// <param name="verb">The System.ComponentModel.Design.DesignerVerb to add.</param> public void AddVerb(System.ComponentModel.Design.DesignerVerb verb) { if (verbs == null) { verbs = new DesignerVerbCollection(); } verbs.Add(verb); }
public DesignerActionVerbItem(DesignerVerb verb) { if (verb == null) { throw new ArgumentNullException(); } this._targetVerb = verb; }
/// <devdoc> /// <para>[To be supplied.]</para> /// </devdoc> public void AddRange(DesignerVerb[] value) { if (value == null) { throw new ArgumentNullException("value"); } for (int i = 0; ((i) < (value.Length)); i = ((i) + (1))) { this.Add(value[i]); } }
public ContextMenuCommand(DesignerVerb verb) : base(verb.Text) { this.Enabled = verb.Enabled; // this.Checked = verb.Checked; this.verb = verb; Click += InvokeCommand; }
//public EasilyReportDesigner() //{ // designerHost = null; //} public EasilyReportDesigner() : base() { DesignerVerb createVerb = new DesignerVerb("Open Design Form", new EventHandler(OnOpen)); this.Verbs.Add(createVerb); //createVerb = new DesignerVerb("Import Table", new EventHandler(OnImport)); //this.Verbs.Add(createVerb); }
private DesignerVerb CreateStandardVerb(string text, CommandID command, EventHandler eventHandler) { var verb = new DesignerVerb(text, (o, e) => this.GlobalInvoke(command)); if (eventHandler != null) { AddCommand(new MenuCommand(eventHandler, command)); } return verb; }
// Add a range of values to this collection. public void AddRange(DesignerVerb[] value) { if(value == null) { throw new ArgumentNullException("value"); } foreach(DesignerVerb verb in value) { Add(verb); } }
public FABaseDesigner() { changeService = null; designerVerbs = new DesignerVerbCollection(); ShowAbout = new DesignerVerb("About Farsi Libraries", OnShowAbout); ShowAbout.Checked = false; designerVerbs.Add(ShowAbout); Designers.Add(this); }
public void AddRange(DesignerVerb[] value) { if (value == null) { throw new ArgumentNullException("value"); } for (int i = 0; i < value.Length; i++) { this.Add(value[i]); } }
public FAMultiViewDesigner() { toDayView = new DesignerVerb("To DayView", (sender, e) => ShowDayView()) { Checked = false }; toMonthView = new DesignerVerb("To MonthView", (sender, e) => ShowMonthView()) { Checked = false }; showTodayButton = new DesignerVerb("Show/Hide Today Button", (sender, e) => ShowTodayButton()) { Checked = false }; showEmptyButton = new DesignerVerb("Show/Hide Empty Button", (sender, e) => ShowEmptyButton()) { Checked = false }; designerVerbs.Add(toDayView); designerVerbs.Add(toMonthView); designerVerbs.Add(showTodayButton); designerVerbs.Add(showEmptyButton); }
public PanelManagerDesigner() : base() { DesignerVerb verb1 = new DesignerVerb("Add MangedPanel", OnAddPanel); DesignerVerb verb2 = new DesignerVerb("Remove ManagedPanel", OnRemovePanel); m_verbs.AddRange(new DesignerVerb[] { verb1, verb2 }); }
public virtual void AddVerb (DesignerVerb verb) { if (verb == null) throw new ArgumentNullException ("verb"); this.EnsureVerbs (); if (!_verbs.Contains (verb)) { if (_globalVerbs == null) _globalVerbs = new DesignerVerbCollection (); _globalVerbs.Add (verb); } this.OnCommandsChanged (new MenuCommandsChangedEventArgs (MenuCommandsChangedType.CommandAdded, verb)); }
/// Remove a local verb, but only if it isn't in our global list. /// It is also called through IMenuCommandService.ShowContextMenu(). public void RemoveLocalVerb(DesignerVerb verb) { if ((globalVerbs == null) || (!globalVerbs.Contains(verb))) { if (cm != null) { // Remove the verb and its mapped MenuItem from our tables and menu. MenuItem key = menuItemsFromVerbs[verb] as MenuItem; verbsFromMenuItems.Remove(key); menuItemsFromVerbs.Remove(verb); cm.MenuItems.Remove(key); } } }
/// called when to add a global verb public void AddVerb(System.ComponentModel.Design.DesignerVerb verb) { if (verb == null) { throw new ArgumentException("verb"); } globalVerbs.Add(verb); // create a menu item for the verb and add it to the context menu ToolStripMenuItem menuItem = new ToolStripMenuItem(verb.Text); menuItem.Click += new EventHandler(MenuItemClickHandler); menuItemVerb.Add(menuItem, verb); contextMenu.Items.Add(menuItem); }
/// <summary> /// Initialize a new instance of the KrpytonDesignerActionVerbItem class. /// </summary> /// <param name="verb">Verb instance to wrap.</param> /// <param name="category">Name of the category the action belongs to.</param> public KryptonDesignerActionItem(DesignerVerb verb, string category) : base(null, null, null) { Debug.Assert(verb != null); Debug.Assert(category != null); // Validate parameters if (verb == null) throw new ArgumentNullException("verb"); if (category == null) throw new ArgumentNullException("category"); // Remember details _verb = verb; _category = category; }
/// This is only called by external callers if someone wants to /// remove a verb that is available for all designers. We keep track of /// such verbs to make sure that they are not re-added or removed /// when we frequently manipulate our local verbs. public override void RemoveVerb(System.ComponentModel.Design.DesignerVerb verb) { if (globalVerbs != null) { globalVerbs.Remove(verb); if (cm != null) { // Remove the verb and its mapped MenuItem from our tables and menu. MenuItem key = menuItemsFromVerbs[verb] as MenuItem; verbsFromMenuItems.Remove(key); menuItemsFromVerbs.Remove(verb); cm.MenuItems.Remove(key); } } }
internal CollectionEditVerbManager(string text, ComponentDesigner designer, PropertyDescriptor prop, bool addToDesignerVerbs) { this._designer = designer; this._targetProperty = prop; if (prop == null) { prop = TypeDescriptor.GetDefaultProperty(designer.Component); if ((prop != null) && typeof(ICollection).IsAssignableFrom(prop.PropertyType)) { this._targetProperty = prop; } } if (text == null) { text = System.Design.SR.GetString("ToolStripItemCollectionEditorVerb"); } this._editItemsVerb = new DesignerVerb(text, new EventHandler(this.OnEditItems)); if (addToDesignerVerbs) { this._designer.Verbs.Add(this._editItemsVerb); } }
public InfoDMDesigner() { // Get language type language = GetClientLanguage(); // Add By Chenjian 2005-12-26 // For Save/Load Component Location // Save Component Location EventHandler saveComponentLocationEventHandler = new EventHandler( delegate(object sender, EventArgs e) { SaveComponentLocation(); } ); DesignerVerb saveComponentLocation = new DesignerVerb("Save Location", saveComponentLocationEventHandler); this.Verbs.Insert(0, saveComponentLocation); // Load Component Location EventHandler loadComponentLocationEventHandler = new EventHandler( delegate(object sender, EventArgs e) { LoadComponentLocation(); } ); DesignerVerb loadComponentLocation = new DesignerVerb("Load Location", loadComponentLocationEventHandler); this.Verbs.Insert(0, loadComponentLocation); // End Add 2005-12-26 // Use a thread to load the design time view and apply Service-Event // because that can not be done in constructor // Thread t = new Thread(new ThreadStart(ViewOperation)); t.Priority = ThreadPriority.Highest; t.Start(); }
public bool Contains(DesignerVerb value) { return(default(bool)); }
public int IndexOf(DesignerVerb value) { return(default(int)); }
public void Insert(int index, DesignerVerb value) { }
public void Remove(DesignerVerb value) { base.List.Remove(value); }
/// <summary> /// Initializes a new instance of the <see cref="NuGenGenericBaseDesigner"/> class. /// </summary> public NuGenGenericBaseDesigner() { this.resetVerb = new DesignerVerb("Reset", new EventHandler(this.Reset_Click)); }
// Get the index of a specific collection element. public int IndexOf(DesignerVerb value) { return(((IList)this).IndexOf(value)); }
public bool Contains(DesignerVerb value) { return(base.List.Contains(value)); }
public void Remove(DesignerVerb value) { }
public WebControlDescriptionEditor() { DesignerVerb editVerb = new DesignerVerb("Edit", new EventHandler(OnEdit)); this.Verbs.Add(editVerb); }
// Retire un verb du service public override void RemoveVerb(System.ComponentModel.Design.DesignerVerb verb) { menuCommandService.RemoveVerb(verb); }
public void AddVerb(DesignerVerb verb) { // TODO: Add DefaultMenuCommandService.AddVerb implementation }
public int Add(DesignerVerb value) { return(base.List.Add(value)); }
/// <summary> /// Removes the specified designer verb from the collection of global designer verbs. /// </summary> /// <param name="verb">The System.ComponentModel.Design.DesignerVerb to remove.</param> public void RemoveVerb(System.ComponentModel.Design.DesignerVerb verb) { Verbs.Remove(verb); }
public void Insert(int index, DesignerVerb value) { base.List.Insert(index, value); }
public int Add(DesignerVerb value) { return(default(int)); }
// Determine if a particular element is contained in this collection. public bool Contains(DesignerVerb value) { return(((IList)this).Contains(value)); }
public void RemoveVerb(System.ComponentModel.Design.DesignerVerb verb) { // No implementation }
public int IndexOf(DesignerVerb value) { return(InnerList.IndexOf(value)); }
public int Add(DesignerVerb value) { return(InnerList.Add(value)); }
public void Remove(DesignerVerb value) { InnerList.Remove(value); }
/// <summary> /// /// </summary> /// <param name="verb"></param> public void RemoveVerb(DesignerVerb verb) { throw new NotImplementedException(); }
public int IndexOf(DesignerVerb value) { return(base.List.IndexOf(value)); }
public override void Initialize(IComponent theComponent) { base.Initialize(theComponent); ISelectionService service = (ISelectionService) this.GetService(typeof(ISelectionService)); if (service != null) { service.SelectionChanged += new EventHandler(this.Handler_SelectionChanged); } IComponentChangeService service2 = (IComponentChangeService) this.GetService(typeof(IComponentChangeService)); if (service2 != null) { service2.ComponentRemoving += new ComponentEventHandler(this.Handler_ComponentRemoving); service2.ComponentChanged += new ComponentChangedEventHandler(this.Handler_ComponentChanged); } this.DesignedControl.SelectedPageChanged += new EventHandler(this.Handler_SelectedPageChanged); this.myAddVerb = new DesignerVerb("Add page", new EventHandler(this.Handler_AddPage)); this.myRemoveVerb = new DesignerVerb("Remove page", new EventHandler(this.Handler_RemovePage)); this.mySwitchVerb = new DesignerVerb("Switch pages...", new EventHandler(this.Handler_SwitchPage)); this.myVerbs = new DesignerVerbCollection(); this.myVerbs.AddRange(new DesignerVerb[] { this.myAddVerb, this.myRemoveVerb, this.mySwitchVerb }); }
// Remove an element from this collection. public void Remove(DesignerVerb value) { ((IList)this).Remove(value); }
/// <summary> /// Ensures that the verb list has been created. /// </summary> protected void EnsureVerbs() { // We apply global verbs only if the base component is the // currently selected object. // bool useGlobalVerbs = false; if (_currentVerbs == null && _serviceProvider != null) { Hashtable buildVerbs = null; ArrayList verbsOrder; if (_selectionService == null) { _selectionService = GetService(typeof(ISelectionService)) as ISelectionService; if (_selectionService != null) { _selectionService.SelectionChanging += new EventHandler(this.OnSelectionChanging); } } int verbCount = 0; DesignerVerbCollection localVerbs = null; DesignerVerbCollection designerActionVerbs = new DesignerVerbCollection(); // we instanciate this one here... IDesignerHost designerHost = GetService(typeof(IDesignerHost)) as IDesignerHost; if (_selectionService != null && designerHost != null && _selectionService.SelectionCount == 1) { object selectedComponent = _selectionService.PrimarySelection; if (selectedComponent is IComponent && !TypeDescriptor.GetAttributes(selectedComponent).Contains(InheritanceAttribute.InheritedReadOnly)) { useGlobalVerbs = (selectedComponent == designerHost.RootComponent); // LOCAL VERBS IDesigner designer = designerHost.GetDesigner((IComponent)selectedComponent); if (designer != null) { localVerbs = designer.Verbs; if (localVerbs != null) { verbCount += localVerbs.Count; _verbSourceType = selectedComponent.GetType(); } else { _verbSourceType = null; } } // DesignerAction Verbs DesignerActionService daSvc = GetService(typeof(DesignerActionService)) as DesignerActionService; if (daSvc != null) { DesignerActionListCollection actionLists = daSvc.GetComponentActions(selectedComponent as IComponent); if (actionLists != null) { foreach (DesignerActionList list in actionLists) { DesignerActionItemCollection dai = list.GetSortedActionItems(); if (dai != null) { for (int i = 0; i < dai.Count; i++) { DesignerActionMethodItem dami = dai[i] as DesignerActionMethodItem; if (dami != null && dami.IncludeAsDesignerVerb) { EventHandler handler = new EventHandler(dami.Invoke); DesignerVerb verb = new DesignerVerb(dami.DisplayName, handler); designerActionVerbs.Add(verb); verbCount++; } } } } } } } } // GLOBAL VERBS if (useGlobalVerbs && _globalVerbs == null) { useGlobalVerbs = false; } if (useGlobalVerbs) { verbCount += _globalVerbs.Count; } // merge all buildVerbs = new Hashtable(verbCount, StringComparer.OrdinalIgnoreCase); verbsOrder = new ArrayList(verbCount); // PRIORITY ORDER FROM HIGH TO LOW: LOCAL VERBS - DESIGNERACTION VERBS - GLOBAL VERBS if (useGlobalVerbs) { for (int i = 0; i < _globalVerbs.Count; i++) { string key = ((DesignerVerb)_globalVerbs[i]).Text; buildVerbs[key] = verbsOrder.Add(_globalVerbs[i]); } } if (designerActionVerbs.Count > 0) { for (int i = 0; i < designerActionVerbs.Count; i++) { string key = designerActionVerbs[i].Text; buildVerbs[key] = verbsOrder.Add(designerActionVerbs[i]); } } if (localVerbs != null && localVerbs.Count > 0) { for (int i = 0; i < localVerbs.Count; i++) { string key = localVerbs[i].Text; buildVerbs[key] = verbsOrder.Add(localVerbs[i]); } } // look for duplicate, prepare the result table DesignerVerb[] result = new DesignerVerb[buildVerbs.Count]; int j = 0; for (int i = 0; i < verbsOrder.Count; i++) { DesignerVerb value = (DesignerVerb)verbsOrder[i]; string key = value.Text; if ((int)buildVerbs[key] == i) { // there's not been a duplicate for this entry result[j] = value; j++; } } _currentVerbs = new DesignerVerbCollection(result); } }
// Add an element to this collection. public int Add(DesignerVerb value) { return(((IList)this).Add(value)); }
internal static DesignerVerb[] GetDesignerActionVerbs(ActivityDesigner designer, ReadOnlyCollection<DesignerAction> designerActions) { List<DesignerVerb> list = new List<DesignerVerb>(); for (int i = 0; i < designerActions.Count; i++) { DesignerVerb item = new DesignerVerb(designerActions[i].Text, new EventHandler(new EventHandler(DesignerHelpers.OnExecuteDesignerAction).Invoke), new CommandID(WorkflowMenuCommands.MenuGuid, WorkflowMenuCommands.VerbGroupDesignerActions + i)); item.Properties[DesignerUserDataKeys.DesignerAction] = designerActions[i]; item.Properties[DesignerUserDataKeys.Designer] = designer; list.Add(item); } return list.ToArray(); }
// Insert an element into this collection. public void Insert(int index, DesignerVerb value) { ((IList)this).Insert(index, value); }