Example #1
0
        private void RenameMenuItems(XmlDocument configuration, XmlNode menuNode, CommandBarItem menuItem)
        {
            string sLabel = XmlUtils.GetManditoryAttributeValue(menuNode, "label");

            SetMenuItem(sLabel, menuItem);
#if CanRecursivelySearhMenus
            XmlNodeList subNodes  = menuNode.ChildNodes;
            int         iMenuItem = 0;
            foreach (XmlNode node in subNodes)
            {
                string sName = node.LocalName;
                if (sName == "menu")
                {
                    //RenameMenuItems(configuration, node, menuItem..MenuItems[iMenuItem]);
                }
                else if (sName == "item")
                {
                    string sCommand = XmlUtils.GetOptionalAttributeValue(node, "command");
                    if (!string.IsNullOrEmpty(sCommand))
                    {
                        XmlNode command = configuration.SelectSingleNode("//command[@id='" + sCommand + "']");
                        if (command != null)
                        {
                            string sCommandLabel = XmlUtils.GetManditoryAttributeValue(command, "label");
                            //		MenuItem mi = menuItem.MenuItems[iMenuItem];
                            //		SetMenuItem(sCommandLabel, mi);
                        }
                    }
                }
                iMenuItem++;
            }
#endif
        }
Example #2
0
		protected override void Dispose(bool disposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			if (disposing)
			{
				IsDisposing = true;
				try
				{
					if (contextMenu != null)
						contextMenu.Dispose();

					if (items != null)
					{
						// Disposing the item might remove it from the collection, so we better work on
						// a copy of the collection.
						var copiedItems = new CommandBarItem[items.Count];
						items.CopyTo(copiedItems, 0);
						foreach (var item in copiedItems)
							item.Dispose();

						this.items.Clear();
					}
				}
				finally
				{
					IsDisposing = false;
				}
			}
			this.items = null;
			this.contextMenu = null;

			base.Dispose(disposing);
		}
Example #3
0
 private void SetMenuItem(string sLabel, CommandBarItem menuItem)
 {
     if (!string.IsNullOrEmpty(sLabel))
     {
         menuItem.Text = sLabel.Replace("_", "&");
     }
     ;
 }
		public void Add(CommandBarItem item)
		{
			this.items.Add(item);

			if (this.commandBar != null)
			{
				this.commandBar.AddItem(item);
			}
		}
Example #5
0
        public void Add(CommandBarItem item, int group, bool isChecked)
        {
            MergableItem mergeItem = new MergableItem();

            mergeItem.Item    = item;
            mergeItem.Group   = group;
            mergeItem.Checked = isChecked;
            List.Add(mergeItem);
        }
Example #6
0
        public bool HasItem(string groupId, string itemId)
        {
            CommandBarMenu menu = GetMenu(groupId);

            //need to simulate the user clicking on this in order to actually get populated.
            ((ChoiceGroup)menu.Tag).OnDisplay(null, null);
            CommandBarItem item = GetMenuItem(menu, itemId);

            return(item != null);
        }
Example #7
0
        public void OnClick(object something, System.EventArgs args)
        {
            CommandBarItem item = (CommandBarItem)something;

            //			ToolBarButton button = args.Button;
            ChoiceBase control = (ChoiceBase)item.Tag;

            Debug.Assert(control != null);
            control.OnClick(item, null);
        }
		public void Add(CommandBarItem item)
		{
			this.items.Add(item);

			if (this.commandBar != null)
			{
				this.commandBar.AddItem(item);
			}
//// clear hashes
			keyItems.Clear();
		}
Example #9
0
        public void ClickItem(string groupId, string itemId)
        {
            CommandBarMenu menu = GetMenu(groupId);

            if (menu == null)
            {
                throw new ConfigurationException("Could not find the menu with an Id of '" + groupId + "'.");
            }
            CommandBarItem item = GetMenuItem(menu, itemId);

            if (item == null)
            {
                throw new ConfigurationException("Could not find the item with an Id of '" + itemId + "' in the menu '" + groupId + "'.");
            }

            OnClick(item, null);
        }
        public EndUserDesignerForm(string reportName, string reportTemplatePath)
        {
            System.Diagnostics.Debug.Assert(!string.IsNullOrEmpty(reportTemplatePath));

            InitializeComponent();

            // Create new report instance and assign to Report Explorer
            this.arDesigner.Toolbox      = this.arToolbox;
            this.arDesigner.PropertyGrid = this.arPropertyGrid;

            // Add Menu and CommandBar to Form
            this.commandBarManager = this.arDesigner.CommandBarManager;

            // Edit CommandBar
            // NOTE: need check after each used version of ActiveReports - can be changed
            this.commandBarManager.CommandBars.RemoveAt(0);                                                                      // NOTE: remove menu
            CommandBarItem item = this.commandBarManager.CommandBars[0].Items[2];                                                // NOTE: get SaveAs button

            this.commandBarManager.CommandBars[0].Items.Clear();                                                                 // NOTE: remove New, Open, SaveAs buttons
            this.commandBarManager.CommandBars[0].Items.AddButton(item.Image, item.Text, new CommandEventHandler(OnSaveNew), 0); // NOTE: set customize Save routine

            this.Controls.Add(this.commandBarManager);

            // Fill Toolbox
            LoadTools(this.arToolbox);
            // Activate default group on the toolbox
            this.arToolbox.SelectedCategory = "ActiveReports 3.0";

            // Setup Status Bar
            this.arStatus.Panels.Add(new StatusBarPanel());
            this.arStatus.Panels.Add(new StatusBarPanel());
            this.arStatus.Panels[0].AutoSize = StatusBarPanelAutoSize.Spring;
            this.arStatus.Panels[1].AutoSize = StatusBarPanelAutoSize.Spring;
            this.arStatus.ShowPanels         = true;

            ActiveReport3 rpt = new ActiveReport3();

            rpt.LoadLayout(reportTemplatePath);
            arDesigner.Report = rpt;
            if (!string.IsNullOrEmpty(reportName))
            {
                this.Text = reportName;
            }
            templatePath = reportTemplatePath;
        }
Example #11
0
    public HelloWorld()
    {
        this.Icon = SystemIcons.Application;
            this.Text = "Hello World";
            this.Size = new Size(500, 500);
            this.Controls.Add(new StatusBar());

            this.commandBarManager = new CommandBarManager();
            this.menuBar = new CommandBar(this.commandBarManager, CommandBarStyle.Menu);
            this.toolBar = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);

            // Menu and toolbar
            CommandBarButton newButton = new CommandBarButton(Images.New, "&New", null, Keys.Control | Keys.N);
            CommandBarButton openButton = new CommandBarButton(Images.Open, "&Open...", null, Keys.Control | Keys.O);
            CommandBarButton saveButton = new CommandBarButton(Images.Save, "&Save", null, Keys.Control | Keys.S);

            toolBar.Items.Add(newButton);
            toolBar.Items.Add(openButton);
            toolBar.Items.Add(saveButton);
            toolBar.Items.AddSeparator();

            CommandBarButton cutButton = new CommandBarButton(Images.Cut, "Cu&t", null, Keys.Control | Keys.X);
            CommandBarItem copyButton = new CommandBarButton(Images.Copy, "&Copy", null, Keys.Control | Keys.C);
            CommandBarItem pasteButton = new CommandBarButton(Images.Paste, "&Paste", null, Keys.Control | Keys.V);
            CommandBarItem deleteButton = new CommandBarButton(Images.Delete, "&Delete", null, Keys.Delete);

            this.toolBar.Items.Add(cutButton);
            this.toolBar.Items.Add(copyButton);
            this.toolBar.Items.Add(pasteButton);
            this.toolBar.Items.Add(deleteButton);
            this.toolBar.Items.AddSeparator();

            CommandBarButton undoButton = new CommandBarButton(Images.Undo, "&Undo", null, Keys.Control | Keys.Z);
            CommandBarButton redoButton = new CommandBarButton(Images.Redo, "&Redo", null, Keys.Control | Keys.Y);

            this.toolBar.Items.Add(undoButton);
            this.toolBar.Items.Add(redoButton);
            this.toolBar.Items.AddSeparator();

            CommandBarMenu fileMenu = menuBar.Items.AddMenu("&File");
            fileMenu.Items.Add(newButton);
            fileMenu.Items.Add(openButton);
            fileMenu.Items.Add(saveButton);
            fileMenu.Items.AddButton("&Save As...", null);
            fileMenu.Items.AddSeparator();
            fileMenu.Items.AddButton(Images.Preview, "Print Pre&view", null);
            fileMenu.Items.AddButton(Images.Print, "&Print", null, Keys.Control | Keys.P);
            fileMenu.Items.AddSeparator();
            fileMenu.Items.AddButton("E&xit", new EventHandler(this.Exit_Click));

            CommandBarMenu editMenu = this.menuBar.Items.AddMenu("&Edit");
            editMenu.Items.Add(undoButton);
            editMenu.Items.Add(redoButton);
            editMenu.Items.AddSeparator();
            editMenu.Items.Add(cutButton);
            editMenu.Items.Add(copyButton);
            editMenu.Items.Add(pasteButton);
            editMenu.Items.Add(deleteButton);
            editMenu.Items.AddSeparator();
            editMenu.Items.AddButton("Select &All", null, Keys.Control | Keys.A);

            CommandBarMenu viewMenu = this.menuBar.Items.AddMenu("&View");
            CommandBarMenu goToMenu = viewMenu.Items.AddMenu("&Go To");
            goToMenu.Items.AddButton(Images.Back, "&Back", null, Keys.Alt | Keys.Left);
            goToMenu.Items.AddButton(Images.Forward, "&Forward", null, Keys.Alt | Keys.Right);
            goToMenu.Items.AddSeparator();
            goToMenu.Items.AddButton(Images.Home, "&Home", null);

            viewMenu.Items.AddButton(Images.Stop, "&Stop", null, Keys.Escape);
            viewMenu.Items.AddButton(Images.Refresh, "&Refresh", null, Keys.F5);

            this.enabledButton = new CommandBarButton(Images.Tiles, "&Enabled", null);
            this.enabledButton.Enabled = false;
            this.visibleButton = new CommandBarButton(Images.Icons, "&Visible", null);
            this.visibleButton.Visible = false;
            CommandBarCheckBox checkedPlainCheckBox = new CommandBarCheckBox("&Checked Plain");
            checkedPlainCheckBox.IsChecked = true;
            CommandBarCheckBox checkedBitmapCheckBox = new CommandBarCheckBox(Images.List, "&Checked Bitmap");
            checkedBitmapCheckBox.IsChecked = true;

            toolBar.Items.Add(enabledButton);
            toolBar.Items.Add(visibleButton);
            toolBar.Items.Add(checkedPlainCheckBox);
            toolBar.Items.Add(checkedBitmapCheckBox);

            toolBar.Items.AddSeparator();

            ComboBox comboBox = new ComboBox();
            comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBox.Width = 100;
            toolBar.Items.AddComboBox("Combo Box", comboBox);

            toolBar.Items.AddSeparator();

            CommandBarMenu testMenu = menuBar.Items.AddMenu("&Test");
            testMenu.Items.AddButton("&Enabled On/Off", new EventHandler(ToggleEnabled_Click));
            testMenu.Items.Add(this.enabledButton);
            testMenu.Items.AddSeparator();
            testMenu.Items.AddButton("&Visible On/Off", new EventHandler(ToggleVisible_Click));
            testMenu.Items.Add(this.visibleButton);
            testMenu.Items.AddSeparator();
            testMenu.Items.Add(checkedPlainCheckBox);
            testMenu.Items.Add(checkedBitmapCheckBox);
            testMenu.Items.AddSeparator();
            testMenu.Items.AddButton("Change Font", new EventHandler(this.ChangeFont_Click));

            CommandBarMenu helpMenu = menuBar.Items.AddMenu("&Help");
            helpMenu.Items.AddButton(Images.Mail, "&Your Feedback", null);
            helpMenu.Items.AddSeparator();
            helpMenu.Items.AddButton("&About", null);

            this.commandBarManager.CommandBars.Add(this.menuBar);
            this.commandBarManager.CommandBars.Add(this.toolBar);
            this.Controls.Add(this.commandBarManager);

            // Context menu
            CommandBarContextMenu contextMenu = new CommandBarContextMenu();
            contextMenu.Items.Add(undoButton);
            contextMenu.Items.Add(redoButton);
            contextMenu.Items.AddSeparator();
            contextMenu.Items.Add(cutButton);
            contextMenu.Items.Add(copyButton);
            contextMenu.Items.Add(pasteButton);
            contextMenu.Items.Add(deleteButton);
            this.ContextMenu = contextMenu;
    }
Example #12
0
 internal void AddItem(CommandBarItem item)
 {
     this.items.Add(item);
 }
		internal CommandBarItem[] this[Keys shortcut]
		{
			get
			{
//// try to get result immediately
				if (keyItems[shortcut] == null) {
					ArrayList list = new ArrayList();

					foreach (CommandBarItem item in items)
					{
						CommandBarButtonBase buttonBase = item as CommandBarButtonBase;
						if (buttonBase != null)
						{
							if ((buttonBase.Shortcut == shortcut) && (buttonBase.IsEnabled) && (buttonBase.IsVisible))
							{
								list.Add(buttonBase);
							}
						}
//// combine array lookup - better to make hashtable to speed up lookup - now it is too long
						CommandBarMenu menu = item as CommandBarMenu;
						if (menu != null)
						{
							list.AddRange(menu.Items[shortcut]);
						}
					}
//// too many calls - for every possible message in underlying windows
					/*
					foreach (CommandBarItem item in items)
					{
						CommandBarMenu menu = item as CommandBarMenu;
						if (menu != null)
						{
							list.AddRange(menu.Items[shortcut]);
						}
					}
					*/
					CommandBarItem[] array = new CommandBarItem[list.Count];
					list.CopyTo(array, 0);
//// add new array to list
					keyItems.Add(shortcut, array);	
				}
				return (CommandBarItem[])keyItems[shortcut];
			}
		}
        public void Insert(int index, CommandBarItem item)
        {
            items.Insert(index, item);

            if (this.commandBar != null)
            {
                this.commandBar.AddItem(item);
            }
        }
 public void CopyTo(CommandBarItem[] array, int index)
 {
     this.items.CopyTo(array, index);
 }
        // TODO Only used in CommandBar.PreProcessMnemonic
        internal CommandBarItem[] this[char mnemonic]
        {
            get
            {
                ArrayList list = new ArrayList();

                foreach (CommandBarItem item in items)
                {
                    if ((item.Visible) && (item.Enabled))
                    {
                        string text = item.Text;
                        for (int i = 0; i < text.Length; i++)
                        {
                            if ((text[i] == '&') && (i + 1 < text.Length) && (text[i + 1] != '&'))
                            {
                                if (mnemonic == Char.ToUpper(text[i + 1], CultureInfo.InvariantCulture))
                                {
                                    list.Add(item);
                                }
                            }
                        }
                    }
                }

                CommandBarItem[] array = new CommandBarItem[list.Count];
                list.CopyTo(array, 0);
                return array;
            }
        }
            public MenuBarItem(CommandBarItem item, Size imageSize, Font font, bool mnemonics)
            {
                this.item = item;
                this.imageSize = imageSize;
                this.font = font;
                this.mnemonics = mnemonics;

                this.UpdateItems();
            }
		public void Insert(int index, CommandBarItem item)
		{
			items.Insert(index, item);

			if (this.commandBar != null)
			{
				this.commandBar.AddItem(item);
			}
//// clear hashes
			keyItems.Clear();
		}
Example #19
0
 internal void RemoveItem(CommandBarItem item)
 {
     this.items.Remove(item);
 }
Example #20
0
 internal void AddItem(CommandBarItem item)
 {
     this.items.Add(item);
 }
Example #21
0
    public Example()
    {
        Icon = SystemIcons.Application;
        Text = "Example";
        Size = new Size(400, 350);
        Controls.Add(new StatusBar());

        // Menu and toolbar
        CommandBarItem newItem  = new CommandBarItem(Images.New, "&New", null, Keys.Control | Keys.N);
        CommandBarItem openItem = new CommandBarItem(Images.Open, "&Open...", null, Keys.Control | Keys.O);
        CommandBarItem saveItem = new CommandBarItem(Images.Save, "&Save", null, Keys.Control | Keys.S);

        toolBar.Items.Add(newItem);
        toolBar.Items.Add(openItem);
        toolBar.Items.Add(saveItem);
        toolBar.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));

        CommandBarItem cutItem    = new CommandBarItem(Images.Cut, "Cu&t", null, Keys.Control | Keys.X);
        CommandBarItem copyItem   = new CommandBarItem(Images.Copy, "&Copy", null, Keys.Control | Keys.C);
        CommandBarItem pasteItem  = new CommandBarItem(Images.Paste, "&Paste", null, Keys.Control | Keys.V);
        CommandBarItem deleteItem = new CommandBarItem(Images.Delete, "&Delete", null, Keys.Delete);

        toolBar.Items.Add(cutItem);
        toolBar.Items.Add(copyItem);
        toolBar.Items.Add(pasteItem);
        toolBar.Items.Add(deleteItem);
        toolBar.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));

        CommandBarItem undoItem = new CommandBarItem(Images.Undo, "&Undo", null, Keys.Control | Keys.Z);
        CommandBarItem redoItem = new CommandBarItem(Images.Redo, "&Redo", null, Keys.Control | Keys.Y);

        toolBar.Items.Add(undoItem);
        toolBar.Items.Add(redoItem);
        toolBar.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));

        CommandBarItem fileItem = new CommandBarItem("&File");

        menuBar.Items.Add(fileItem);
        fileItem.Style = CommandBarItemStyle.DropDown;
        fileItem.Items.Add(newItem);
        fileItem.Items.Add(openItem);
        fileItem.Items.Add(saveItem);
        fileItem.Items.Add(new CommandBarItem("&Save As...", null));
        fileItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        fileItem.Items.Add(new CommandBarItem(Images.Preview, "Print Pre&view", null));
        fileItem.Items.Add(new CommandBarItem(Images.Print, "&Print", null, Keys.Control | Keys.P));
        fileItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        fileItem.Items.Add(new CommandBarItem("E&xit", new EventHandler(Exit_Click)));

        CommandBarItem editItem = new CommandBarItem("&Edit");

        menuBar.Items.Add(editItem);
        editItem.Items.Add(undoItem);
        editItem.Items.Add(redoItem);
        editItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        editItem.Items.Add(cutItem);
        editItem.Items.Add(copyItem);
        editItem.Items.Add(pasteItem);
        editItem.Items.Add(deleteItem);
        editItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        editItem.Items.Add(new CommandBarItem("Select &All", null, Keys.Control | Keys.A));

        CommandBarItem viewItem = new CommandBarItem("&View");
        CommandBarItem goToItem = new CommandBarItem("&Go To");

        goToItem.Items.Add(new CommandBarItem(Images.Back, "&Back", null, Keys.Alt | Keys.Left));
        goToItem.Items.Add(new CommandBarItem(Images.Forward, "&Forward", null, Keys.Alt | Keys.Right));
        goToItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        goToItem.Items.Add(new CommandBarItem(Images.Home, "&Home", null));
        viewItem.Items.Add(goToItem);

        viewItem.Items.Add(new CommandBarItem(Images.Stop, "&Stop", null, Keys.Escape));
        viewItem.Items.Add(new CommandBarItem(Images.Refresh, "&Refresh", null, Keys.F5));
        menuBar.Items.Add(viewItem);

        enabledItem         = new CommandBarItem(Images.Tiles, "&Enabled", null);
        enabledItem.Enabled = false;
        visibleItem         = new CommandBarItem(Images.Icons, "&Visible", null);
        visibleItem.Visible = false;
        CommandBarItem checkedPlainItem = new CommandBarItem("&Checked Plain", new EventHandler(ToggleCheck_Click));

        checkedPlainItem.Checked = true;
        CommandBarItem checkedBitmapItem = new CommandBarItem(Images.List, "&Checked Bitmap", new EventHandler(ToggleCheck_Click));

        checkedBitmapItem.Checked = true;

        toolBar.Items.Add(enabledItem);
        toolBar.Items.Add(visibleItem);
        toolBar.Items.Add(checkedPlainItem);
        toolBar.Items.Add(checkedBitmapItem);

        CommandBarItem testItem = new CommandBarItem("&Test");

        menuBar.Items.Add(testItem);
        testItem.Items.Add(new CommandBarItem("&Enabled On/Off", new EventHandler(ToggleEnabled_Click)));
        testItem.Items.Add(enabledItem);
        testItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        testItem.Items.Add(new CommandBarItem("&Visible On/Off", new EventHandler(ToggleVisible_Click)));
        testItem.Items.Add(visibleItem);
        testItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        testItem.Items.Add(checkedPlainItem);
        testItem.Items.Add(checkedBitmapItem);
        testItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        testItem.Items.Add(new CommandBarItem("Change Font", new EventHandler(ChangeFont_Click)));

        CommandBarItem helpItem = new CommandBarItem("&Help");

        menuBar.Items.Add(helpItem);
        helpItem.Items.Add(new CommandBarItem(Images.Mail, "&Your Feedback", null));
        helpItem.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        helpItem.Items.Add(new CommandBarItem("&About", null));

        reBar.Bands.Add(menuBar);
        reBar.Bands.Add(toolBar);
        Controls.Add(reBar);

        // Context menu
        CommandContextMenu contextMenu = new CommandContextMenu();

        contextMenu.Items.Add(undoItem);
        contextMenu.Items.Add(redoItem);
        contextMenu.Items.Add(new CommandBarItem(CommandBarItemStyle.Separator));
        contextMenu.Items.Add(cutItem);
        contextMenu.Items.Add(copyItem);
        contextMenu.Items.Add(pasteItem);
        contextMenu.Items.Add(deleteItem);
        contextMenu.Items = contextMenu.Items;         // $TODO triggers update.
        ContextMenu       = contextMenu;
    }
Example #22
0
    void ToggleCheck_Click(Object s, EventArgs e)
    {
        CommandBarItem item = (s as CommandBarItem);

        item.Checked = !item.Checked;
    }
Example #23
0
 // overloads
 public void Add(CommandBarItem item, int group)
 {
     Add(item, group, false);
 }
        // TODO
        internal CommandBarItem[] this[Keys shortcut]
        {
            get
            {
                ArrayList list = new ArrayList();

                foreach (CommandBarItem item in items)
                {
                    CommandBarButtonBase buttonBase = item as CommandBarButtonBase;
                    if (buttonBase != null)
                    {
                        if ((buttonBase.Shortcut == shortcut) && (buttonBase.Enabled) && (buttonBase.Visible))
                        {
                            list.Add(buttonBase);
                        }
                    }
                }

                foreach (CommandBarItem item in items)
                {
                    CommandBarMenu menu = item as CommandBarMenu;
                    if (menu != null)
                    {
                        list.AddRange(menu.Items[shortcut]);
                    }
                }

                CommandBarItem[] array = new CommandBarItem[list.Count];
                list.CopyTo(array, 0);
                return array;
            }
        }
		private void SetupCommandBarButtons() {
			cbiRunTemplate =
				new CommandBarButton(
					Images.DocumentArrowGreen, "&Preview Template Output", new EventHandler(RunTemplate_Click), Keys.F5);
		}
Example #26
0
 internal void RemoveItem(CommandBarItem item)
 {
     item.PropertyChanged -= new PropertyChangedEventHandler(this.CommandBarItem_PropertyChanged);
     this.UpdateItems();
 }
 public bool Contains(CommandBarItem item)
 {
     return this.items.Contains(item);
 }
Example #28
0
 private void SetMenuItem(string sLabel, CommandBarItem menuItem)
 {
     if (!string.IsNullOrEmpty(sLabel))
         menuItem.Text = sLabel.Replace("_", "&"); ;
 }
 public int IndexOf(CommandBarItem item)
 {
     return this.items.IndexOf(item);
 }
Example #30
0
 internal void RemoveItem(CommandBarItem item)
 {
     this.items.Remove(item);
 }
        public void Remove(CommandBarItem item)
        {
            if (this.items.Contains(item))
            {
                this.items.Remove(item);

                if (this.commandBar != null)
                {
                    this.commandBar.RemoveItem(item);
                }
            }
        }
		public void Remove(CommandBarItem item)
		{
			if (this.items.Contains(item))
			{
				this.items.Remove(item);

				if (this.commandBar != null)
				{
					this.commandBar.RemoveItem(item);
				}
//// clear our hashes to simplify things - they will be reconstructed
				keyItems.Clear();
			}
		}
Example #33
0
		private void SetupCommandBarButtons() {
			cbiSaveDocument =
				new CommandBarButton(
					Images.Save, "&Save Active Document", new EventHandler(SaveDocument_Click), Keys.Control | Keys.S);
			cbiNewProject =
				new CommandBarButton(Images.New, "&New Project", new EventHandler(NewProject_Click), Keys.Control | Keys.N);
			cbiOpenProject =
				new CommandBarButton(Images.Open, "&Open Project", new EventHandler(OpenProject_Click), Keys.Control | Keys.O);
			cbiSaveProject =
				new CommandBarButton(
					Images.Save, "Save &Project", new EventHandler(SaveProject_Click), Keys.Control | Keys.Shift | Keys.S);
			cbiSaveProjectAs = new CommandBarButton("Save Project &As", new EventHandler(SaveProjectAs_Click), Keys.F12);
			cbiRunProject =
				new CommandBarButton(
					Images.ArrowGreen, "&Run Project", new EventHandler(RunProject_Click), Keys.Control | Keys.F5);
			cbiCancelGeneration =
				new CommandBarButton(Images.Stop, "Cancel Generation", new EventHandler(CancelGeneration_Click));

			cbiAddExistingMetadataFile =
				new CommandBarButton("Add &Existing Metadata File(s)", new EventHandler(AddExistingMetadataFile_Click));
			cbiAddNewMetadataFile =
				new CommandBarButton(Images.New, "Add New &Metadata File", new EventHandler(AddNewMetadataFile_Click));
			cbiAddCodeGenCommand =
				new CommandBarButton(
					Images.DocumentArrowGreen, "Add New Code Generation Command", new EventHandler(AddNCodeGenCommand_Click));
			cbiAddDataSource =
				new CommandBarButton(Images.DataSourceNew, "Add New Data Source", new EventHandler(AddDataSource_Click));
			cbiEditProjectParameters =
				new CommandBarButton(
					"Edit Code Generation &Parameters", new EventHandler(EditProjectParameters_Click),
					Keys.Control | Keys.Shift | Keys.P);

			cbiViewProjectExplorer =
				new CommandBarButton(
					Images.Ch3Etah, "&Project Explorer", new EventHandler(ViewProjectExplorer_Click), Keys.Control | Keys.Alt | Keys.L);
			cbiViewPropertiesWindow =
				new CommandBarButton(Images.Properties, "&Properties", new EventHandler(ViewProperties_Click), Keys.F4);
			cbiViewOutputWindow =
				new CommandBarButton(Images.Output, "&Output", new EventHandler(ViewOutput_Click));

			cbiWebSite = new CommandBarButton(Images.Home, "CH3ETAH &Web Site", new EventHandler(WebSite_Click));
			cbiRunTests = new CommandBarButton(Images.Properties, "&Run Tests", new EventHandler(RunTests_Click));
			cbiFixFileAssociations =
				new CommandBarButton(Images.Tools, "Fi&x file associations", new EventHandler(FixFileAssociations_Click));
			cbiAbout = new CommandBarButton(Images.Help, "&About", new EventHandler(About_Click));

			cbiExit = new CommandBarButton("E&xit", new EventHandler(Exit_Click));
		}
Example #34
0
    public HelloWorld()
    {
        this.Icon = SystemIcons.Application;
        this.Text = "Hello World";
        this.Size = new Size(500, 500);
        this.Controls.Add(new StatusBar());

        this.commandBarManager = new CommandBarManager();
        this.menuBar           = new CommandBar(this.commandBarManager, CommandBarStyle.Menu);
        this.toolBar           = new CommandBar(this.commandBarManager, CommandBarStyle.ToolBar);

        // Menu and toolbar
        CommandBarButton newButton  = new CommandBarButton(Images.New, "&New", null, Keys.Control | Keys.N);
        CommandBarButton openButton = new CommandBarButton(Images.Open, "&Open...", null, Keys.Control | Keys.O);
        CommandBarButton saveButton = new CommandBarButton(Images.Save, "&Save", null, Keys.Control | Keys.S);

        toolBar.Items.Add(newButton);
        toolBar.Items.Add(openButton);
        toolBar.Items.Add(saveButton);
        toolBar.Items.AddSeparator();

        CommandBarButton cutButton    = new CommandBarButton(Images.Cut, "Cu&t", null, Keys.Control | Keys.X);
        CommandBarItem   copyButton   = new CommandBarButton(Images.Copy, "&Copy", null, Keys.Control | Keys.C);
        CommandBarItem   pasteButton  = new CommandBarButton(Images.Paste, "&Paste", null, Keys.Control | Keys.V);
        CommandBarItem   deleteButton = new CommandBarButton(Images.Delete, "&Delete", null, Keys.Delete);

        this.toolBar.Items.Add(cutButton);
        this.toolBar.Items.Add(copyButton);
        this.toolBar.Items.Add(pasteButton);
        this.toolBar.Items.Add(deleteButton);
        this.toolBar.Items.AddSeparator();

        CommandBarButton undoButton = new CommandBarButton(Images.Undo, "&Undo", null, Keys.Control | Keys.Z);
        CommandBarButton redoButton = new CommandBarButton(Images.Redo, "&Redo", null, Keys.Control | Keys.Y);

        this.toolBar.Items.Add(undoButton);
        this.toolBar.Items.Add(redoButton);
        this.toolBar.Items.AddSeparator();

        CommandBarMenu fileMenu = menuBar.Items.AddMenu("&File");

        fileMenu.Items.Add(newButton);
        fileMenu.Items.Add(openButton);
        fileMenu.Items.Add(saveButton);
        fileMenu.Items.AddButton("&Save As...", null);
        fileMenu.Items.AddSeparator();
        fileMenu.Items.AddButton(Images.Preview, "Print Pre&view", null);
        fileMenu.Items.AddButton(Images.Print, "&Print", null, Keys.Control | Keys.P);
        fileMenu.Items.AddSeparator();
        fileMenu.Items.AddButton("E&xit", new EventHandler(this.Exit_Click));

        CommandBarMenu editMenu = this.menuBar.Items.AddMenu("&Edit");

        editMenu.Items.Add(undoButton);
        editMenu.Items.Add(redoButton);
        editMenu.Items.AddSeparator();
        editMenu.Items.Add(cutButton);
        editMenu.Items.Add(copyButton);
        editMenu.Items.Add(pasteButton);
        editMenu.Items.Add(deleteButton);
        editMenu.Items.AddSeparator();
        editMenu.Items.AddButton("Select &All", null, Keys.Control | Keys.A);

        CommandBarMenu viewMenu = this.menuBar.Items.AddMenu("&View");
        CommandBarMenu goToMenu = viewMenu.Items.AddMenu("&Go To");

        goToMenu.Items.AddButton(Images.Back, "&Back", null, Keys.Alt | Keys.Left);
        goToMenu.Items.AddButton(Images.Forward, "&Forward", null, Keys.Alt | Keys.Right);
        goToMenu.Items.AddSeparator();
        goToMenu.Items.AddButton(Images.Home, "&Home", null);

        viewMenu.Items.AddButton(Images.Stop, "&Stop", null, Keys.Escape);
        viewMenu.Items.AddButton(Images.Refresh, "&Refresh", null, Keys.F5);

        this.enabledButton         = new CommandBarButton(Images.Tiles, "&Enabled", null);
        this.enabledButton.Enabled = false;
        this.visibleButton         = new CommandBarButton(Images.Icons, "&Visible", null);
        this.visibleButton.Visible = false;
        CommandBarCheckBox checkedPlainCheckBox = new CommandBarCheckBox("&Checked Plain");

        checkedPlainCheckBox.IsChecked = true;
        CommandBarCheckBox checkedBitmapCheckBox = new CommandBarCheckBox(Images.List, "&Checked Bitmap");

        checkedBitmapCheckBox.IsChecked = true;

        toolBar.Items.Add(enabledButton);
        toolBar.Items.Add(visibleButton);
        toolBar.Items.Add(checkedPlainCheckBox);
        toolBar.Items.Add(checkedBitmapCheckBox);

        toolBar.Items.AddSeparator();

        ComboBox comboBox = new ComboBox();

        comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
        comboBox.Width         = 100;
        toolBar.Items.AddComboBox("Combo Box", comboBox);

        toolBar.Items.AddSeparator();

        CommandBarMenu testMenu = menuBar.Items.AddMenu("&Test");

        testMenu.Items.AddButton("&Enabled On/Off", new EventHandler(ToggleEnabled_Click));
        testMenu.Items.Add(this.enabledButton);
        testMenu.Items.AddSeparator();
        testMenu.Items.AddButton("&Visible On/Off", new EventHandler(ToggleVisible_Click));
        testMenu.Items.Add(this.visibleButton);
        testMenu.Items.AddSeparator();
        testMenu.Items.Add(checkedPlainCheckBox);
        testMenu.Items.Add(checkedBitmapCheckBox);
        testMenu.Items.AddSeparator();
        testMenu.Items.AddButton("Change Font", new EventHandler(this.ChangeFont_Click));

        CommandBarMenu helpMenu = menuBar.Items.AddMenu("&Help");

        helpMenu.Items.AddButton(Images.Mail, "&Your Feedback", null);
        helpMenu.Items.AddSeparator();
        helpMenu.Items.AddButton("&About", null);

        this.commandBarManager.CommandBars.Add(this.menuBar);
        this.commandBarManager.CommandBars.Add(this.toolBar);
        this.Controls.Add(this.commandBarManager);

        // Context menu
        CommandBarContextMenu contextMenu = new CommandBarContextMenu();

        contextMenu.Items.Add(undoButton);
        contextMenu.Items.Add(redoButton);
        contextMenu.Items.AddSeparator();
        contextMenu.Items.Add(cutButton);
        contextMenu.Items.Add(copyButton);
        contextMenu.Items.Add(pasteButton);
        contextMenu.Items.Add(deleteButton);
        this.ContextMenu = contextMenu;
    }
Example #35
0
        private bool PerformClick(CommandBarItem item)
        {
            Application.DoEvents();

            CommandBarControl control = item as CommandBarControl;
            if (control != null)
            {
                control.PerformClick(EventArgs.Empty);
                return true;
            }

            return false;
        }
Example #36
0
 private void RenameMenuItems(XmlDocument configuration, XmlNode menuNode, CommandBarItem menuItem)
 {
     string sLabel = XmlUtils.GetManditoryAttributeValue(menuNode, "label");
     SetMenuItem(sLabel, menuItem);
     #if CanRecursivelySearhMenus
     XmlNodeList subNodes = menuNode.ChildNodes;
     int iMenuItem = 0;
     foreach (XmlNode node in subNodes)
     {
         string sName = node.LocalName;
         if (sName == "menu")
         {
             //RenameMenuItems(configuration, node, menuItem..MenuItems[iMenuItem]);
         }
         else if (sName == "item")
         {
             string sCommand = XmlUtils.GetOptionalAttributeValue(node, "command");
             if (!string.IsNullOrEmpty(sCommand))
             {
                 XmlNode command = configuration.SelectSingleNode("//command[@id='" + sCommand + "']");
                 if (command != null)
                 {
                     string sCommandLabel = XmlUtils.GetManditoryAttributeValue(command, "label");
             //		MenuItem mi = menuItem.MenuItems[iMenuItem];
             //		SetMenuItem(sCommandLabel, mi);
                 }
             }
         }
         iMenuItem++;
     }
     #endif
 }