/**
         * Creates a context menu from the specified xml file
         */
        public CommandBarContextMenu GenerateContextMenu(string contextMenuXmlFile)
        {
            CommandBarContextMenu contextMenu = new CommandBarContextMenu();
            XmlNode rootNode = this.LoadXMLFile(contextMenuXmlFile);
            int     count    = rootNode.ChildNodes.Count;

            for (int i = 0; i < count; i++)
            {
                if (rootNode.ChildNodes[i].Name == "button")
                {
                    contextMenu.Items.Add(this.GetButton(rootNode.ChildNodes[i]));
                }
                else if (rootNode.ChildNodes[i].Name == "menu")
                {
                    contextMenu.Items.Add(this.GetMenu(rootNode.ChildNodes[i]));
                }
                else if (rootNode.ChildNodes[i].Name == "checkbox")
                {
                    contextMenu.Items.Add(this.GetCheckBox(rootNode.ChildNodes[i]));
                }
                else if (rootNode.ChildNodes[i].Name == "separator")
                {
                    contextMenu.Items.AddSeparator();
                }
            }
            return(contextMenu);
        }
Esempio n. 2
0
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				this.items.Clear();
				this.items = null;

				this.contextMenu = null;
			}

			base.Dispose(disposing);
		}
Esempio n. 3
0
            protected override void OnSelect(EventArgs e)
            {
                CommandBarContextMenu contextMenu = this.GetContextMenu() as CommandBarContextMenu;

                if (contextMenu == null)
                {
                    throw new NotSupportedException();
                }

                contextMenu.SelectedMenuItem = this;
                base.OnSelect(e);
            }
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                this.items.Clear();
                this.items = null;

                this.contextMenu = null;
            }

            base.Dispose(disposing);
        }
Esempio n. 5
0
		/**
		* Creates a context menu from the specified xml file
		*/
		public CommandBarContextMenu GenerateContextMenu(string contextMenuXmlFile)
		{
			CommandBarContextMenu contextMenu = new CommandBarContextMenu();
			XmlNode rootNode = this.LoadXMLFile(contextMenuXmlFile);
			int count = rootNode.ChildNodes.Count;
			for (int i = 0; i<count; i++)
			{
				if (rootNode.ChildNodes[i].Name == "button")
				{
					contextMenu.Items.Add(this.GetButton(rootNode.ChildNodes[i]));
				}
				else if (rootNode.ChildNodes[i].Name == "menu")
				{
					contextMenu.Items.Add(this.GetMenu(rootNode.ChildNodes[i]));
				}
				else if (rootNode.ChildNodes[i].Name == "checkbox")
				{
					contextMenu.Items.Add(this.GetCheckBox(rootNode.ChildNodes[i]));
				}
				else if (rootNode.ChildNodes[i].Name == "separator")
				{
					contextMenu.Items.AddSeparator();
				}
			}
			return contextMenu;
		}
Esempio n. 6
0
		/**
		* Builds the main menu and toolbar from xml file
		*/
		public void InitializeCommandBarMenus()
		{
			try 
			{
				this.images = new Images(FilePaths.Images, 16);
				this.xmlBuilder = new XmlBuilder(this, this.images);
				this.itemFinder = new ItemFinder(this.xmlBuilder);
				this.commandBarManager = new CommandBarManager();
				this.editorMenu = this.xmlBuilder.GenerateContextMenu(FilePaths.ScintillaMenu);
				this.tabMenu = this.xmlBuilder.GenerateContextMenu(FilePaths.TabMenu);
				this.commandBarManager.CommandBars.Add(this.xmlBuilder.GenerateMainMenu(FilePaths.MainMenu));
				if (this.settings.GetBool("FlashDevelop.ViewToolBar"))
				{
					this.commandBarManager.CommandBars.Add(this.xmlBuilder.GenerateToolBar(FilePaths.ToolBar));
				}
				this.Controls.Add(this.commandBarManager);
			} 
			catch (Exception ex)
			{
				ErrorHandler.ShowError("Error while building menus.", ex);
			}
		}