////////////////////////////////////////////////////////////////////////// public ActionStripItem DefineMainToolbar() { ActionStripItem Root = new ActionStripItem(); Root.AddItem("File.New"); Root.AddItem("File.Open"); Root.AddItem("File.Save"); Root.AddItem(); Root.AddItem("Edit.Undo"); Root.AddItem("Edit.Redo"); Root.AddItem(); Root.AddItem("Edit.Cut"); Root.AddItem("Edit.Copy"); Root.AddItem("Edit.Paste"); Root.AddItem("Document.DeleteItem"); Root.AddItem(); Root.AddItem("Document.AddNone"); Root.AddItem(); Root.AddItem("Document.AddButton"); Root.AddItem("Document.AddStatic"); Root.AddItem("Document.AddEditor"); Root.AddItem("Document.AddEntity"); Root.AddItem(); Root.AddItem("Document.AddWindow"); Root.AddItem(); Root.AddItem(); Root.AddItem("Document.Refresh"); return(Root); }
////////////////////////////////////////////////////////////////////////// private void OnLoad(object sender, EventArgs e) { this.MinimumSize = this.Size; AppMgr.Settings.LoadFromXmlFile(); LoadLayout(AppMgr.Settings); LoadSettings(AppMgr.Settings); // build menus and toolbars ActionStripItem MainMenuDef = DefineMainMenu(); ActContext.StripBuilder.AddToolStrip(MainMenuDef, MainMenu.Items, true); ActionStripItem MainToolbarDef = DefineMainToolbar(); ActContext.StripBuilder.AddToolStrip(MainToolbarDef, MainToolbar.Items, false); ActContext.ActivateObject(ActiveObjectSlot.Application, this); ActContext.StripBuilder.SetManagedToolStripsState(); // handle command-line if (Environment.GetCommandLineArgs().Length > 1) { OpenFile(Environment.GetCommandLineArgs()[1]); } }
private void button1_Click(object sender, EventArgs e) { ActionStripItem i = ActContext.StripBuilder.DefineTestMenu(); ActContext.StripBuilder.AddToolStrip(i, menuStrip1.Items, true); ActContext.StripBuilder.AddToolStrip(i, contextMenuStrip1.Items, true); ActContext.StripBuilder.AddToolStrip(i, toolStrip1.Items, false); ActContext.StripBuilder.RefreshManagedToolStrips(); }
////////////////////////////////////////////////////////////////////////// public ActionStripItem DefineMainMenu() { ActionStripItem Root = new ActionStripItem(); ActionStripItem FileMenu = Root.AddSub("FileMenu", "File"); FileMenu.AddItem("File.New"); FileMenu.AddItem("File.Open"); FileMenu.AddItem("File.Save"); FileMenu.AddItem("File.SaveAs"); FileMenu.AddItem(); FileMenu.AddItem("File.RecentFiles"); FileMenu.AddItem(); FileMenu.AddItem("File.AppClose"); ActionStripItem EditMenu = Root.AddSub("EditMenu", "Edit"); EditMenu.AddItem("Edit.Undo"); EditMenu.AddItem("Edit.Redo"); EditMenu.AddItem(); EditMenu.AddItem("Edit.Cut"); EditMenu.AddItem("Edit.Copy"); EditMenu.AddItem("Edit.Paste"); EditMenu.AddItem("Document.DeleteItem"); ActionStripItem ControlMenu = Root.AddSub("ControlMenu", "Controls"); ControlMenu.AddItem("Document.AddNone"); ControlMenu.AddItem(); ControlMenu.AddItem("Document.AddButton"); ControlMenu.AddItem("Document.AddStatic"); ControlMenu.AddItem("Document.AddEditor"); ControlMenu.AddItem("Document.AddEntity"); ControlMenu.AddItem(); ControlMenu.AddItem("Document.AddWindow"); ActionStripItem ToolsMenu = Root.AddSub("ToolsMenu", "Tools"); ToolsMenu.AddItem("Tools.Options"); ActionStripItem HelpMenu = Root.AddSub("HelpMenu", "Help"); HelpMenu.AddItem("Help.Contents"); HelpMenu.AddItem(); HelpMenu.AddItem("Help.About"); return(Root); }