/// <summary> /// Loads the plugin menus. /// </summary> /// <param name="sender"> Sender object.</param> /// <param name="e"> LoadPluginMenuEventArgs arguments.</param> public void inspector_LoadPluginMenusEvent(object sender, LoadPluginMenuEventArgs e) { // Root Menus MenuRootHashtable ht = e.MenuRoot; SortedList root = new SortedList(ht,null); this.SuspendLayout(); //1: For each MenuRoot, add MenuItems foreach (DictionaryEntry de in root) { MenuRoot r = (MenuRoot)de.Value; // Create Menu Root CommandBarMenu menuRoot = new CommandBarMenu(r.Text); menuRoot.MenuShortcut = r.Shortcut; // add MenuRoot menubar.Items.Add(menuRoot); // if null then exit if ( r.MenuItems == null ) break; #region Create commands and commandlinks //2: Add Menu Children for (int i=0;i<r.MenuItems.Count;i++) { Ecyware.GreenBlue.Controls.MenuItem mn = (Ecyware.GreenBlue.Controls.MenuItem)r.MenuItems[r.MenuItems.GetKey(i)]; if ( mn is Ecyware.GreenBlue.Controls.ToolbarItem ) { #region Add Toolbar item // Create Command and add to CommandHolder Ecyware.GreenBlue.Controls.ToolbarItem tbItem = (Ecyware.GreenBlue.Controls.ToolbarItem)mn; // add any submenu toolbar if ( tbItem.IsDropDown ) { /* // for command with submenu if ( tbItem.ImageIndex > -1 ) { Image img = this.imgToolbar24.Images[tbItem.ImageIndex]; } CommandBarMenu m = toolbar.Items.AddMenu(img, tbItem.Text); m.DropDown += tbItem.DropDownDelegate; */ } else { if ( tbItem.Toggle ) { #region Single Command for toggle or checked type CommandBarCheckBox toolbarItem = new CommandBarCheckBox(tbItem.Text); toolbarItem.IsEnabled = tbItem.Enabled; toolbarItem.IsVisible = tbItem.Visible; toolbarItem.MenuShortcut = tbItem.Shortcut; if ( tbItem.ImageIndex > -1 ) toolbarItem.Image = this.imgToolbar24.Images[tbItem.ImageIndex]; toolbarItem.Click += tbItem.CheckedChangedDelegate; toolbar.Items.Add(toolbarItem); #endregion } else { #region Single Command not checked CommandBarButton toolbarItem = new CommandBarButton(tbItem.Text); toolbarItem.IsEnabled = tbItem.Enabled; toolbarItem.IsVisible = tbItem.Visible; toolbarItem.MenuShortcut = tbItem.Shortcut; if ( tbItem.ImageIndex > -1 ) toolbarItem.Image = this.imgToolbar24.Images[tbItem.ImageIndex]; toolbarItem.Click += tbItem.ClickDelegate; toolbar.Items.Add(toolbarItem); #endregion } // Add delimiter if ( mn.Delimiter ) { toolbar.Items.AddSeparator(); } } #endregion } else { if ( mn.Toggle ) { #region Add menu with checked CommandBarCheckBox menuItem = new CommandBarCheckBox(mn.Text); menuItem.IsVisible = mn.Visible; menuItem.IsEnabled = mn.Enabled; //if ( mn.ImageIndex > -1 ) // menuItem.Image = this.imgToolbar16.Images[mn.ImageIndex]; menuItem.MenuShortcut = mn.Shortcut; menuItem.Click += mn.CheckedChangedDelegate; #endregion // Add delimiter if ( mn.Delimiter ) { menuRoot.Items.AddSeparator(); } menuRoot.Items.Add(menuItem); } else { #region Add Menu CommandBarButton menuItem = new CommandBarButton(mn.Text); menuItem.IsVisible = mn.Visible; menuItem.IsEnabled = mn.Enabled; if ( mn.ImageIndex > -1 ) menuItem.Image = this.imgToolbar16.Images[mn.ImageIndex]; menuItem.MenuShortcut = mn.Shortcut; menuItem.Click += mn.ClickDelegate; #endregion // Add delimiter if ( mn.Delimiter ) { menuRoot.Items.AddSeparator(); } menuRoot.Items.Add(menuItem); } } } #endregion } this.ResumeLayout(false); }
/// <summary> /// Initializes the start form. /// </summary> void InitializeStartForm() { //SetStyle(ControlStyles.DoubleBuffer, true); //SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.stStatus.Controls.Add(this.pgBrowserProgress); this.SuspendLayout(); // Add menu, toolbar and address toolbar to command bar manager this.commandBarManager.CommandBars.Add(this.menubar); this.commandBarManager.CommandBars.Add(this.toolbar); // this.commandBarManager.CommandBars.Add(this.addressToolbar); this.Controls.Add(this.commandBarManager); // GBInspectorWorkspace inspector = new GBInspectorWorkspace(); // this.StartEvent += inspector.StartEventDelegate; // this.CancelEvent += inspector.CancelEventDelegate; // // inspector.GBExit += new EventHandler(this.mnuExit_Click); // inspector.DisableAddressBar += new DisableAddressBarEventHandler(inspector_DisableAddressBar); // inspector.EnableAddressBar += new EnableAddressBarEventHandler(inspector_EnableAddressBar); // inspector.UpdateAddressEvent += new UpdateAddressEventHandler(inspector_UpdateAddressEvent); // inspector.StartProgressBarEvent += new StartProgressBarEventHandler(inspector_StartProgressBarEvent); // inspector.StopProgressBarEvent += new StopProgressBarEventHandler(inspector_StopProgressBarEvent); // inspector.ChangeStatusBarPanelEvent += new ChangeStatusBarEventHandler(inspector_ChangeStatusBarPanelEvent); // inspector.LoadPluginMenusEvent += new LoadPluginMenusEventHandler(inspector_LoadPluginMenusEvent); // inspector.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(inspector_ApplyToolbarSettingsEvent); // inspector.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(inspector_ApplyMenuSettingsEvent); // inspector.ApplyMenuRootSettingsEvent += new ApplyMenuRootSettingsEventHandler(inspector_ApplyMenuRootSettingsEvent); scriptingDataDesigner = new ScriptingDataDesigner(); // scriptingDataDesigner.HttpGetPageEvent += new HttpGetPageEventHandler(GetPageFromSessionDesigner); scriptingDataDesigner.ApplyMenuSettingsEvent += new ApplyMenuSettingsEventHandler(inspector_ApplyMenuSettingsEvent); scriptingDataDesigner.ApplyToolbarSettingsEvent += new ApplyToolbarSettingsEventHandler(inspector_ApplyToolbarSettingsEvent); DocumentManager.Document inspectorDoc; inspectorDoc = new DocumentManager.Document(scriptingDataDesigner,"Scripting Application Designer"); dmPanels.AddDocument(inspectorDoc); // set focused doc dmPanels.FocusedDocument = inspectorDoc; this.ResumeLayout(true); LoadPluginMenuEventArgs args = new LoadPluginMenuEventArgs(LoadWorkspaceMenu()); inspector_LoadPluginMenusEvent(this, args); }
/// <summary> /// Loads the workspace menus. /// </summary> public void LoadWorkspaceMenu() { LoadPluginMenuEventArgs e = new LoadPluginMenuEventArgs(this.BuildPluginMenuRoot()); LoadPluginMenusEvent(this,e); }