void MenuOnProcessCmdKey(object sender, FreeCL.UI.ProcessCmdKeyEventArgs e) { e.Handled = ProcessKey(e.KeyData); }
void OnMergeMenu(FreeCL.UI.MainMenu owner, System.Windows.Forms.Menu src) { foreach (System.Windows.Forms.MenuItem item in src.MenuItems) HandleChildMenuItems(item); }
public ToolStripItem AddMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator) { if(action != null) return AddMenuItem(owner, (int)index, action, separator, action.Text); else return AddMenuItem(owner, (int)index, action, separator, ""); }
public void SetAction(Component comp, FreeCL.UI.Actions.Action value) { Debug.Assert(comp != null && value != null); if(inInit) { componentsForInit[comp] = value; return; } Action res = null; if (_components.TryGetValue(comp, out res)) { if (value == res) { return; } res.SetComponent(comp, false); _components.Remove(comp); } if (value != Actions.Null) { value._owner = this; value.SetComponent(comp, true); _components.Add(comp, value); } }
public ToolStripItem AddMenuItem(CommonMenusEnum menu, CommonItemsEnum index, FreeCL.UI.Actions.Action action) { return AddMenuItem(menu, (int)index, action); }
public ToolStripItem AddMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action) { return AddMenuItem(owner, (int)index, action, true); }
public ToolStripMenuItem GetOrCreateMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator, string caption) { if(owner == null) throw new ArgumentNullException("owner"); foreach(ToolStripItem mi in owner.DropDownItems) { if(mi.Text == caption) { return (ToolStripMenuItem)mi; } } return (ToolStripMenuItem)this.AddMenuItem(owner, index, action, separator, caption); }
public ToolStripItem AddMenuItem(CommonMenusEnum menu, int index, FreeCL.UI.Actions.Action action) { return AddMenuItem(GetTopMenuItem(menu), index, action); }
public ToolStripItem GetMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator) { if(owner == null) throw new ArgumentNullException("owner"); if(action == null) throw new ArgumentNullException("action"); foreach(ToolStripItem mi in owner.DropDownItems) { if(mi.MergeIndex == index && ((separator && mi is ToolStripSeparator) || action.Parent.GetAction(mi) == action)) { return mi; } } return null; }
public ToolStripItem AddToolStripButton(System.Windows.Forms.ToolStrip owner, int index, FreeCL.UI.Actions.Action action, Type buttonType) { if(owner == null) throw new ArgumentNullException("owner"); ToolStripItem netsb = (ToolStripItem)Activator.CreateInstance(buttonType); if(action != null) { action.Parent.SetAction(netsb, action); } netsb.DisplayStyle = ToolStripItemDisplayStyle.Image; netsb.MergeIndex = index; netsb.MergeAction = MergeAction.Insert; if(index < owner.Items.Count) owner.Items.Insert(index, netsb); else owner.Items.Add(netsb); SortItems(owner.Items); return netsb; }
public ToolStripItem AddToolStripButton(CommonToolStripsEnum toolStrip, CommonItemsEnum index, FreeCL.UI.Actions.Action action, Type buttonType) { return AddToolStripButton(toolStrip, (int)index, action, buttonType); }
public ToolStripItem AddToolStripButton(CommonToolStripsEnum toolStrip, int index, FreeCL.UI.Actions.Action action, Type buttonType) { return AddToolStripButton(GetToolStrip(toolStrip), index, action, buttonType); }
public ToolStripItem AddMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator, string caption) { if(owner == null) throw new ArgumentNullException("owner"); ToolStripItem newmi = new ToolStripMenuItem(); if(action != null) { action.Parent.SetAction(newmi, action); } else if(separator) newmi = new ToolStripSeparator(); else newmi.Text = caption; newmi.MergeIndex = index; newmi.MergeAction = MergeAction.Insert; if(index < owner.DropDownItems.Count && index >= 0) owner.DropDownItems.Insert(index, newmi); else owner.DropDownItems.Add(newmi); SortItems(owner.DropDownItems); return newmi; }