Example #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds an item to the specified tab.
        /// </summary>
        /// <param name="itemProps"></param>
        /// ------------------------------------------------------------------------------------
        internal void AddTabItem(SBTabItemProperties itemProps)
        {
            // Add a new item to this tab's item list (which is just a DNB toolbar) and get
            // back the item created for us.
            ButtonItem item = m_itemPanel.AddItem(itemProps);

            if (item == null)
            {
                return;
            }

            item.Click += item_Click;

            // Create a menu item for this tab item and add it to the menu just above the
            // configure menu item.
            ButtonItem menuItem = (ButtonItem)item.Copy();

            menuItem.Text = menuItem.Text.Replace(Environment.NewLine, " ");

            // Make sure the menu text will be visible.
            if (menuItem.ForeColor == Color.White)
            {
                menuItem.ForeColor = SystemColors.MenuText;
            }

            int i = m_menu.SubItems.IndexOf(m_cfgMenuItem);

            m_menu.SubItems.Add(menuItem, i);
            UpdateMenuImages();
        }
Example #2
0
		private void TreeMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			if(e.Button!=MouseButtons.Right)
				return;

			TreeView tree=sender as TreeView;
            
			TreeNode node=tree.GetNodeAt(e.X,e.Y);
			if(node!=null)
				tree.SelectedNode=node;
			else if(tree==treeMenus)
				tree.SelectedNode=null;

			// Popup menu
			ButtonItem popup=dotNetBarManager1.ContextMenus[CONTEXT_MENU] as ButtonItem;
			
			// If MoveTo and CopyTo are visible add items to them
			if(popup.SubItems[COPY_TO].Visible)
			{
				BaseItem itemCopyTo=popup.SubItems[COPY_TO];
				BaseItem itemMoveTo=popup.SubItems[MOVE_TO];
				
				itemCopyTo.SubItems.Clear();
				itemMoveTo.SubItems.Clear();
				bool bBars=true,bCategories=false, bPopups=false;
				// Don't show categories for category items...
				
				if(buttonContext.Visible)
					bPopups=true;
				if(buttonCategories.Visible)
					bCategories=true;

				if(bBars)
				{
					foreach(TreeNode barNode in treeBars.Nodes)
					{
						BaseItem newItem=new ButtonItem();
						newItem.Text=barNode.Text;
						newItem.Tag=barNode;
						newItem.Click+=new System.EventHandler(this.CopyMoveToClick);
						itemCopyTo.SubItems.Add(newItem);
						itemMoveTo.SubItems.Add(newItem.Copy());
					}
				}

				if(bCategories)
				{
					ButtonItem cat=new ButtonItem(TO_CATEGORIES);
					cat.Text="Categories";
					cat.BeginGroup=true;
					cat.Click+=new System.EventHandler(this.CopyMoveToClick);
					itemCopyTo.SubItems.Add(cat);
					itemMoveTo.SubItems.Add(cat.Copy());

					foreach(TreeNode catNode in treeCategories.Nodes)
					{
						BaseItem newItem=new ButtonItem();
						newItem.Text=catNode.Text;
						newItem.Click+=new System.EventHandler(this.CopyMoveToClick);
						newItem.Tag="cat";
						itemCopyTo.SubItems.Add(newItem);
						itemMoveTo.SubItems.Add(newItem.Copy());
					}
				}
				if(bPopups)
				{
					BaseItem pi=new ButtonItem(TO_CONTEXTMENUS);
					pi.BeginGroup=true;
					pi.Text="Popups";
					pi.Click+=new System.EventHandler(this.CopyMoveToClick);
					itemCopyTo.SubItems.Add(pi);
					itemMoveTo.SubItems.Add(pi.Copy());

					foreach(BaseItem objItem in this.GetDesignManager().ContextMenus)
					{
						BaseItem newItem=new ButtonItem();
						newItem.Text=(objItem.Text=="")?objItem.Name:objItem.Text;
						newItem.Tag=objItem;
						newItem.Click+=new System.EventHandler(this.CopyMoveToClick);
						itemCopyTo.SubItems.Add(newItem);
						itemMoveTo.SubItems.Add(newItem.Copy());						
					}
				}
			}

			Point pt=new Point(e.X,e.Y);
			pt=tree.PointToScreen(pt);
			popup.PopupMenu(pt);
		}
Example #3
0
        private void CreateBar()
        {
            // Create a new Bar
            Bar bar = new Bar("Standard");

            bar.CanHide         = true;
            bar.Style           = eDotNetBarStyle.Office2003;
            bar.GrabHandleStyle = eGrabHandleStyle.StripeFlat;
            bar.WrapItemsDock   = true;
            bar.WrapItemsFloat  = false;

            // Add Items to it
            ButtonItem item, fileItem;

            // New
            item            = new ButtonItem("bNew");
            item.ImageIndex = 0;
            item.Text       = "&New";
            item.Shortcuts.Add(eShortcut.CtrlN);
            item.Category = "Standard";
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());                         // This will create Category Entry

            // Open
            item            = new ButtonItem("bOpen");
            item.ImageIndex = 1;
            item.Text       = "&Open";
            item.Shortcuts.Add(eShortcut.CtrlO);
            item.Category = "Standard";
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());
            // Add Sub items to the Open, something like recently used files...
            fileItem      = new ButtonItem("file1");
            fileItem.Text = "&1. File1.txt";
            item.SubItems.Add(fileItem);
            fileItem      = new ButtonItem("file2");
            fileItem.Text = "&2. File2.txt";
            item.SubItems.Add(fileItem);
            fileItem      = new ButtonItem("file3");
            fileItem.Text = "&3. File3.txt";
            item.SubItems.Add(fileItem);
            fileItem      = new ButtonItem("file4");
            fileItem.Text = "&4. File4.txt";
            item.SubItems.Add(fileItem);
            fileItem      = new ButtonItem("file5");
            fileItem.Text = "&5. File5.txt";
            item.SubItems.Add(fileItem);

            // Close
            item            = new ButtonItem("bClose");
            item.ImageIndex = 2;
            item.Text       = "&Close";
            item.Shortcuts.Add(eShortcut.CtrlX);
            item.Category = "Standard";
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());

            // Save
            item            = new ButtonItem("bSave");
            item.ImageIndex = 3;
            item.Text       = "&Save";
            item.Shortcuts.Add(eShortcut.CtrlS);
            item.Category = "Standard";
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());

            // Print Preview
            item            = new ButtonItem("bPrintPreview");
            item.ImageIndex = 6;
            item.Text       = "Print Pre&view";
            item.Category   = "Standard";
            item.BeginGroup = true;
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());

            // Print
            item            = new ButtonItem("bPrint");
            item.ImageIndex = 5;
            item.Text       = "&Print";
            item.Category   = "Standard";
            item.Shortcuts.Add(eShortcut.CtrlP);
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());

            // E-Mail
            item            = new ButtonItem("bEmail");
            item.ImageIndex = 4;
            item.Text       = "&Email";
            item.Category   = "Standard";
            item.BeginGroup = true;
            bar.Items.Add(item);
            m_DotNetBar.Items.Add(item.Copy());

            // Customize Item
            CustomizeItem citem = new CustomizeItem();

            bar.Items.Add(citem);

            // Since we will be using ImageList bar have to be added to the DotNetBar Manager
            m_DotNetBar.Bars.Add(bar);

            bar.DockSide = eDockSide.Top;
        }