Example #1
0
		public Form2(ImageList largeImages, ImageList smallImages)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			// Set properties for sidebar
			m_sideBar.ImageListLarge = largeImages;
			m_sideBar.ImageListSmall = smallImages;
			m_sideBar.Persist = false;

			// Create first side bar tab - each button has own click handler method
			SideBarTab tab = new SideBarTab();
			m_sideBar.Tabs.Add(tab);
			tab.Title = "Tab";

			// First button on first tab
			m_btn1 = new SideBarButton();
			m_btn1.Text = "First button";
			m_btn1.Click += new EventHandler(OnButton1Click);
			m_btn1.ImageIndex = 1;
			tab.Buttons.Add(m_btn1);

			// Second button on first tab
			m_btn2 = new SideBarButton();
			m_btn2.Text = "Second button";
			m_btn2.Click += new EventHandler(OnButton2Click);
			m_btn2.ImageIndex = 2;
			tab.Buttons.Add(m_btn2);

			// Second side bar tab - one click handler method for all buttons
			// This tab supports multiple selections with an off button
			tab = new SideBarTab();
			m_sideBar.Tabs.Add(tab);
			tab.Title = "Other tab";
			tab.MultipleSelections = true;
			tab.FirstButtonExclusive = true;
			tab.ButtonClickEvent += new EventHandler(OnGenericButtonClick);

			// First button on second tab
			m_btn3 = new SideBarButton();
			m_btn3.Text = "Off";
			m_btn3.ImageIndex = 3;
			tab.Buttons.Add(m_btn3);

			// Second button on second tab
			m_btn4 = new SideBarButton();
			m_btn4.Text = "Button 2";
			m_btn4.ImageIndex = 4;
			tab.Buttons.Add(m_btn4);

			// Third button on second tab
			m_btn5 = new SideBarButton();
			m_btn5.Text = "Button 3";
			m_btn5.ImageIndex = 5;
			tab.Buttons.Add(m_btn5);
		}
		/// <summary>
		///     <para>
		///       Initializes a new instance of <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> containing any array of <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> objects.
		///    </para>
		/// </summary>
		/// <param name='value'>
		///       A array of <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> objects with which to intialize the collection
		/// </param>
		public SideBarTabCollection(SideBarTab[] value)
		{
			this.AddRange(value);
		}
Example #3
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.sideBar1 = new SIL.FieldWorks.Common.Controls.SideBar();
			this.sideBarTab1 = new SIL.FieldWorks.Common.Controls.SideBarTab();
			this.sideBarButton1 = new SIL.FieldWorks.Common.Controls.SideBarButton();
			this.imageListLarge = new System.Windows.Forms.ImageList(this.components);
			this.imageListSmall = new System.Windows.Forms.ImageList(this.components);
			this.sideBarButton2 = new SIL.FieldWorks.Common.Controls.SideBarButton();
			this.sideBarButton3 = new SIL.FieldWorks.Common.Controls.SideBarButton();
			this.sideBarTab2 = new SIL.FieldWorks.Common.Controls.SideBarTab();
			this.sideBarTab3 = new SIL.FieldWorks.Common.Controls.SideBarTab();
			this.sideBarButton4 = new SIL.FieldWorks.Common.Controls.SideBarButton();
			this.sideBarButton5 = new SIL.FieldWorks.Common.Controls.SideBarButton();
			this.sideBarButton6 = new SIL.FieldWorks.Common.Controls.SideBarButton();
			this.contextMenu1 = new System.Windows.Forms.ContextMenu();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.menuItem8 = new System.Windows.Forms.MenuItem();
			this.menuItem9 = new System.Windows.Forms.MenuItem();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuItem11 = new System.Windows.Forms.MenuItem();
			this.menuItem12 = new System.Windows.Forms.MenuItem();
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.contextMenu2 = new System.Windows.Forms.ContextMenu();
			this.menuItem13 = new System.Windows.Forms.MenuItem();
			this.contextMenu3 = new System.Windows.Forms.ContextMenu();
			this.menuItem14 = new System.Windows.Forms.MenuItem();
			this.menuItem15 = new System.Windows.Forms.MenuItem();
			this.menuItem17 = new System.Windows.Forms.MenuItem();
			this.menuItem16 = new System.Windows.Forms.MenuItem();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.splitter1 = new System.Windows.Forms.Splitter();
			this.mnuOtherForm = new System.Windows.Forms.MenuItem();
			this.sideBar1.SuspendLayout();
			this.SuspendLayout();
			//
			// sideBar1
			//
			this.sideBar1.Controls.Add(this.sideBarTab1);
			this.sideBar1.Controls.Add(this.sideBarTab2);
			this.sideBar1.Controls.Add(this.sideBarTab3);
			this.sideBar1.DockPadding.All = 2;
			this.sideBar1.ImageListLarge = this.imageListLarge;
			this.sideBar1.ImageListSmall = this.imageListSmall;
			this.sideBar1.Location = new System.Drawing.Point(0, 0);
			this.sideBar1.Name = "sideBar1";
			this.sideBar1.Persist = false;
			this.sideBar1.Size = new System.Drawing.Size(85, 273);
			this.sideBar1.TabIndex = 0;
			this.sideBar1.Tabs.AddRange(new SIL.FieldWorks.Common.Controls.SideBarTab[] {
																							this.sideBarTab1,
																							this.sideBarTab2,
																							this.sideBarTab3});
			//
			// sideBarTab1
			//
			this.sideBarTab1.Buttons.AddRange(new SIL.FieldWorks.Common.Controls.SideBarButton[] {
																									 this.sideBarButton1,
																									 this.sideBarButton2,
																									 this.sideBarButton3});
			this.sideBarTab1.Enabled = true;
			this.sideBarTab1.Name = "sideBarTab1";
			this.sideBarTab1.Title = "Static Buttons";
			this.sideBarTab1.ButtonClickEvent += new System.EventHandler(this.OnStaticButtonClicked);
			//
			// sideBarButton1
			//
			this.sideBarButton1.ImageIndex = 0;
			this.sideBarButton1.ImageListLarge = this.imageListLarge;
			this.sideBarButton1.ImageListSmall = this.imageListSmall;
			this.sideBarButton1.Name = "sideBarButton1";
			this.sideBarButton1.Text = "sideBarButton1";
			//
			// imageListLarge
			//
			this.imageListLarge.ImageSize = new System.Drawing.Size(32, 32);
			this.imageListLarge.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListLarge.ImageStream")));
			this.imageListLarge.TransparentColor = System.Drawing.Color.Magenta;
			//
			// imageListSmall
			//
			this.imageListSmall.ImageSize = new System.Drawing.Size(16, 16);
			this.imageListSmall.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListSmall.ImageStream")));
			this.imageListSmall.TransparentColor = System.Drawing.Color.Magenta;
			//
			// sideBarButton2
			//
			this.sideBarButton2.ImageIndex = 1;
			this.sideBarButton2.ImageListLarge = this.imageListLarge;
			this.sideBarButton2.ImageListSmall = this.imageListSmall;
			this.sideBarButton2.Name = "sideBarButton2";
			this.sideBarButton2.Text = "sideBarButton2";
			//
			// sideBarButton3
			//
			this.sideBarButton3.ImageIndex = 2;
			this.sideBarButton3.ImageListLarge = this.imageListLarge;
			this.sideBarButton3.ImageListSmall = this.imageListSmall;
			this.sideBarButton3.Name = "sideBarButton3";
			this.sideBarButton3.Text = "sideBarButton3";
			//
			// sideBarTab2
			//
			this.sideBarTab2.Enabled = true;
			this.sideBarTab2.Name = "sideBarTab2";
			this.sideBarTab2.Title = "Dynamic Buttons";
			//
			// sideBarTab3
			//
			this.sideBarTab3.Buttons.AddRange(new SIL.FieldWorks.Common.Controls.SideBarButton[] {
																									 this.sideBarButton4,
																									 this.sideBarButton5,
																									 this.sideBarButton6});
			this.sideBarTab3.Enabled = true;
			this.sideBarTab3.Name = "sideBarTab3";
			this.sideBarTab3.Title = "Context Menus";
			//
			// sideBarButton4
			//
			this.sideBarButton4.ImageIndex = 3;
			this.sideBarButton4.ImageListLarge = this.imageListLarge;
			this.sideBarButton4.ImageListSmall = this.imageListSmall;
			this.sideBarButton4.Name = "sideBarButton4";
			this.sideBarButton4.Text = "sideBarButton4";
			//
			// sideBarButton5
			//
			this.sideBarButton5.ImageIndex = 4;
			this.sideBarButton5.ImageListLarge = this.imageListLarge;
			this.sideBarButton5.ImageListSmall = this.imageListSmall;
			this.sideBarButton5.Name = "sideBarButton5";
			this.sideBarButton5.Text = "sideBarButton5";
			//
			// sideBarButton6
			//
			this.sideBarButton6.ImageIndex = 0;
			this.sideBarButton6.ImageListLarge = this.imageListLarge;
			this.sideBarButton6.ImageListSmall = this.imageListSmall;
			this.sideBarButton6.Name = "sideBarButton6";
			this.sideBarButton6.Text = "sideBarButton6";
			//
			// contextMenu1
			//
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem4,
																						 this.menuItem5,
																						 this.menuItem6,
																						 this.menuItem7,
																						 this.menuItem8,
																						 this.menuItem9,
																						 this.menuItem10,
																						 this.menuItem11,
																						 this.menuItem12});
			//
			// menuItem4
			//
			this.menuItem4.Index = 0;
			this.menuItem4.Text = "This";
			//
			// menuItem5
			//
			this.menuItem5.Index = 1;
			this.menuItem5.Text = "is";
			//
			// menuItem6
			//
			this.menuItem6.Index = 2;
			this.menuItem6.Text = "a";
			//
			// menuItem7
			//
			this.menuItem7.Index = 3;
			this.menuItem7.Text = "different";
			//
			// menuItem8
			//
			this.menuItem8.Index = 4;
			this.menuItem8.Text = "context ";
			//
			// menuItem9
			//
			this.menuItem9.Index = 5;
			this.menuItem9.Text = "menu ";
			//
			// menuItem10
			//
			this.menuItem10.Index = 6;
			this.menuItem10.Text = "for";
			//
			// menuItem11
			//
			this.menuItem11.Index = 7;
			this.menuItem11.Text = "this";
			//
			// menuItem12
			//
			this.menuItem12.Index = 8;
			this.menuItem12.Text = "tab";
			//
			// mainMenu1
			//
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1});
			//
			// menuItem1
			//
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem2,
																					  this.mnuOtherForm,
																					  this.menuItem3});
			this.menuItem1.Text = "All";
			//
			// menuItem2
			//
			this.menuItem2.Index = 0;
			this.menuItem2.Text = "&Toggle Side Bar";
			this.menuItem2.Click += new System.EventHandler(this.OnToggleSideBar);
			//
			// menuItem3
			//
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "&Exit";
			this.menuItem3.Click += new System.EventHandler(this.OnClose);
			//
			// contextMenu2
			//
			this.contextMenu2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem13});
			//
			// menuItem13
			//
			this.menuItem13.Index = 0;
			this.menuItem13.Text = "Click here!";
			this.menuItem13.Click += new System.EventHandler(this.OnClickHere);
			//
			// contextMenu3
			//
			this.contextMenu3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem14,
																						 this.menuItem15,
																						 this.menuItem17,
																						 this.menuItem16});
			//
			// menuItem14
			//
			this.menuItem14.Index = 0;
			this.menuItem14.Text = "Large Icons";
			this.menuItem14.Click += new System.EventHandler(this.OnShowLargeIcons);
			//
			// menuItem15
			//
			this.menuItem15.Index = 1;
			this.menuItem15.Text = "Small Icons";
			this.menuItem15.Click += new System.EventHandler(this.OnShowSmallIcons);
			//
			// menuItem17
			//
			this.menuItem17.Index = 2;
			this.menuItem17.Text = "-";
			//
			// menuItem16
			//
			this.menuItem16.Index = 3;
			this.menuItem16.Text = "Hello World";
			this.menuItem16.Click += new System.EventHandler(this.OnHelloWorld);
			//
			// button1
			//
			this.button1.Location = new System.Drawing.Point(168, 16);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(96, 32);
			this.button1.TabIndex = 1;
			this.button1.Text = "Add button";
			this.button1.Click += new System.EventHandler(this.OnAddButton);
			//
			// button2
			//
			this.button2.Location = new System.Drawing.Point(168, 56);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(96, 32);
			this.button2.TabIndex = 2;
			this.button2.Text = "Clear Buttons";
			this.button2.Click += new System.EventHandler(this.OnRemoveButtons);
			//
			// button3
			//
			this.button3.Location = new System.Drawing.Point(168, 104);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(96, 32);
			this.button3.TabIndex = 2;
			this.button3.Text = "Remove 1st Button";
			this.button3.Click += new System.EventHandler(this.OnRemoveFirstButton);
			//
			// splitter1
			//
			this.splitter1.Location = new System.Drawing.Point(85, 0);
			this.splitter1.MinSize = 50;
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(3, 273);
			this.splitter1.TabIndex = 3;
			this.splitter1.TabStop = false;
			//
			// mnuOtherForm
			//
			this.mnuOtherForm.Index = 1;
			this.mnuOtherForm.Text = "Other Form...";
			this.mnuOtherForm.Click += new System.EventHandler(this.OnOtherForm);
			//
			// Form1
			//
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Controls.Add(this.splitter1);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.sideBar1);
			this.Controls.Add(this.button3);
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "Hello World";
			this.sideBar1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		/// <summary>
		/// <para>Inserts a <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> into the <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> at the specified index.</para>
		/// </summary>
		/// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param>
		/// <param name=' value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection.Add'/>
		public void Insert(int index, SideBarTab value)
		{
			CheckDisposed();

			List.Insert(index, value);
		}
		/// <summary>
		///    <para> Removes a specific <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> from the
		///    <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> to remove from the <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
		public void Remove(SideBarTab value)
		{
			CheckDisposed();

			List.Remove(value);
		}
		/// <summary>
		/// <para>Copies the <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the
		///    specified index.</para>
		/// </summary>
		/// <param name='array'><para>The one-dimensional <see cref='System.Array'/> that is the destination of the values copied from <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> .</para></param>
		/// <param name='index'>The index in <paramref name='array'/> where copying begins.</param>
		/// <returns>
		///   <para>None.</para>
		/// </returns>
		/// <exception cref='System.ArgumentException'><para><paramref name='array'/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> is greater than the available space between <paramref name='arrayIndex'/> and the end of <paramref name='array'/>.</para></exception>
		/// <exception cref='System.ArgumentNullException'><paramref name='array'/> is <see langword='null'/>. </exception>
		/// <exception cref='System.ArgumentOutOfRangeException'><paramref name='arrayIndex'/> is less than <paramref name='array'/>'s lowbound. </exception>
		/// <seealso cref='System.Array'/>
		public void CopyTo(SideBarTab[] array, int index)
		{
			CheckDisposed();

			List.CopyTo(array, index);
		}
		/// <summary>
		///    <para>Returns the index of a <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> in
		///       the <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> of <paramref name='value'/> in the
		/// <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection.Contains'/>
		public int IndexOf(SideBarTab value)
		{
			CheckDisposed();

			return List.IndexOf(value);
		}
		/// <summary>
		/// <para>Copies the elements of an array to the end of the <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/>.</para>
		/// </summary>
		/// <param name='value'>
		///    An array of type <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		///   <para>None.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection.Add'/>
		public void AddRange(SideBarTab[] value)
		{
			CheckDisposed();

			for (int i = 0; (i < value.Length); i = (i + 1))
			{
				this.Add(value[i]);
			}
		}
		/// <summary>
		/// <para>Gets a value indicating whether the
		///    <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> contains the specified <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/>.</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> is contained in the collection;
		///   otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection.IndexOf'/>
		public bool Contains(SideBarTab value)
		{
			CheckDisposed();

			return List.Contains(value);
		}
Example #10
0
		/// <summary>
		///    <para>Adds a <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> with the specified value to the
		///    <see cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarTab'/> to add.</param>
		/// <returns>
		///    <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarTabCollection.AddRange(SIL.FieldWorks.Common.Controls.SideBarTab[])'/>
		public int Add(SideBarTab value)
		{
			CheckDisposed();

			return List.Add(value);
		}
Example #11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Activates the given SideBarButton and perhaps the SideBarTab, if appropriate. This
		/// is called when the View menu item is clicked.
		/// </summary>
		/// <param name="tab">The SideBarTab to make active, if appropriate</param>
		/// <param name="button">The SideBarButton to make active</param>
		/// ------------------------------------------------------------------------------------
		public void ActivateTabAndButton(SideBarTab tab, SideBarButton button)
		{
			CheckDisposed();

			int iTab = Tabs.IndexOf(tab);

			// if we're in ActiveTabIsExclusive mode...
			if (ActiveTabIsExclusive)
			{
				if (m_iActive != iTab)
				{
					// Collapse the previous tab and expand the new tab.
					int iActivePrevious = m_iActive;
					m_iActive = iTab;

					SuspendLayout();
					Tabs[iActivePrevious].Collapse();
					PositionTabs();
					ResumeLayout(true);
				}

			}

			// Press the specified button in this tab and clear all others.
			// REVIEW: What should this do in multiSelect mode when we
			//  want to preserve the state of all the buttons? We would
			//  want to press only the specified button.
			foreach(SideBarButton btn in Tabs[m_iActive].Buttons)
				btn.PressButton(btn == button);

			button.PerformClick();
		}
Example #12
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Activates the given SideBarTab. This method is an event handler for a SideBarTab's
		/// Activate event (a custom event).
		/// </summary>
		/// <param name="tab">The new active SideBarTab</param>
		/// ------------------------------------------------------------------------------------
		public void ActivateTab(SideBarTab tab)
		{
			CheckDisposed();

			int nTab = Tabs.IndexOf(tab);
			ActivateTab(nTab);
		}
Example #13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Builds a menu collection for the specified sidebar tab. The collection contains a
		/// menu item for each button plus a configure item at the end.
		/// </summary>
		/// <param name="tab">given sidebar tab</param>
		/// <returns>array of menu items from sidebar tab</returns>
		/// ------------------------------------------------------------------------------------
		public MenuItem[] BuildMenusForSideBarTab(SideBarTab tab)
		{
			List<MenuItem> mnuList = new List<MenuItem>();

			// Create a menu item for each button on the sidebar tab.
			foreach (SideBarButton button in tab.Buttons)
			{
				MenuItem menuItem = new MenuItem(button.Text);
				MenuExtender.AddMenuItem(menuItem);
				MenuExtender.SetTag(menuItem, button);
				MenuExtender.SetCommandId(menuItem, "SideBarButtonMenu");
				mnuList.Add(menuItem);
			}

			// Create the separator
			MenuItem mnuSepr = new MenuItem("-");
			MenuExtender.AddMenuItem(mnuSepr);
			MenuExtender.SetCommandId(mnuSepr, tab.ConfigureMenuCommandId);
			MenuExtender.SetTag(mnuSepr, tab);
			mnuList.Add(mnuSepr);

			// Create the configure menu item.
			MenuItem cfgMenuItem = new MenuItem(tab.ConfigureMenuText);
			MenuExtender.AddMenuItem(cfgMenuItem);
			MenuExtender.SetCommandId(cfgMenuItem, tab.ConfigureMenuCommandId);
			MenuExtender.SetImageList(cfgMenuItem, tab.ConfigureMenuImageList);
			MenuExtender.SetImageIndex(cfgMenuItem, tab.ConfigureMenuImageIndex);
			MenuExtender.SetTag(cfgMenuItem, tab);
			mnuList.Add(cfgMenuItem);

			return mnuList.ToArray();
		}
Example #14
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
     this.sideBar1       = new SIL.FieldWorks.Common.Controls.SideBar();
     this.sideBarTab1    = new SIL.FieldWorks.Common.Controls.SideBarTab();
     this.sideBarButton1 = new SIL.FieldWorks.Common.Controls.SideBarButton();
     this.imageListLarge = new System.Windows.Forms.ImageList(this.components);
     this.imageListSmall = new System.Windows.Forms.ImageList(this.components);
     this.sideBarButton2 = new SIL.FieldWorks.Common.Controls.SideBarButton();
     this.sideBarButton3 = new SIL.FieldWorks.Common.Controls.SideBarButton();
     this.sideBarTab2    = new SIL.FieldWorks.Common.Controls.SideBarTab();
     this.sideBarTab3    = new SIL.FieldWorks.Common.Controls.SideBarTab();
     this.sideBarButton4 = new SIL.FieldWorks.Common.Controls.SideBarButton();
     this.sideBarButton5 = new SIL.FieldWorks.Common.Controls.SideBarButton();
     this.sideBarButton6 = new SIL.FieldWorks.Common.Controls.SideBarButton();
     this.contextMenu1   = new System.Windows.Forms.ContextMenu();
     this.menuItem4      = new System.Windows.Forms.MenuItem();
     this.menuItem5      = new System.Windows.Forms.MenuItem();
     this.menuItem6      = new System.Windows.Forms.MenuItem();
     this.menuItem7      = new System.Windows.Forms.MenuItem();
     this.menuItem8      = new System.Windows.Forms.MenuItem();
     this.menuItem9      = new System.Windows.Forms.MenuItem();
     this.menuItem10     = new System.Windows.Forms.MenuItem();
     this.menuItem11     = new System.Windows.Forms.MenuItem();
     this.menuItem12     = new System.Windows.Forms.MenuItem();
     this.mainMenu1      = new System.Windows.Forms.MainMenu();
     this.menuItem1      = new System.Windows.Forms.MenuItem();
     this.menuItem2      = new System.Windows.Forms.MenuItem();
     this.menuItem3      = new System.Windows.Forms.MenuItem();
     this.contextMenu2   = new System.Windows.Forms.ContextMenu();
     this.menuItem13     = new System.Windows.Forms.MenuItem();
     this.contextMenu3   = new System.Windows.Forms.ContextMenu();
     this.menuItem14     = new System.Windows.Forms.MenuItem();
     this.menuItem15     = new System.Windows.Forms.MenuItem();
     this.menuItem17     = new System.Windows.Forms.MenuItem();
     this.menuItem16     = new System.Windows.Forms.MenuItem();
     this.button1        = new System.Windows.Forms.Button();
     this.button2        = new System.Windows.Forms.Button();
     this.button3        = new System.Windows.Forms.Button();
     this.splitter1      = new System.Windows.Forms.Splitter();
     this.mnuOtherForm   = new System.Windows.Forms.MenuItem();
     this.sideBar1.SuspendLayout();
     this.SuspendLayout();
     //
     // sideBar1
     //
     this.sideBar1.Controls.Add(this.sideBarTab1);
     this.sideBar1.Controls.Add(this.sideBarTab2);
     this.sideBar1.Controls.Add(this.sideBarTab3);
     this.sideBar1.DockPadding.All = 2;
     this.sideBar1.ImageListLarge  = this.imageListLarge;
     this.sideBar1.ImageListSmall  = this.imageListSmall;
     this.sideBar1.Location        = new System.Drawing.Point(0, 0);
     this.sideBar1.Name            = "sideBar1";
     this.sideBar1.Persist         = false;
     this.sideBar1.Size            = new System.Drawing.Size(85, 273);
     this.sideBar1.TabIndex        = 0;
     this.sideBar1.Tabs.AddRange(new SIL.FieldWorks.Common.Controls.SideBarTab[] {
         this.sideBarTab1,
         this.sideBarTab2,
         this.sideBarTab3
     });
     //
     // sideBarTab1
     //
     this.sideBarTab1.Buttons.AddRange(new SIL.FieldWorks.Common.Controls.SideBarButton[] {
         this.sideBarButton1,
         this.sideBarButton2,
         this.sideBarButton3
     });
     this.sideBarTab1.Enabled           = true;
     this.sideBarTab1.Name              = "sideBarTab1";
     this.sideBarTab1.Title             = "Static Buttons";
     this.sideBarTab1.ButtonClickEvent += new System.EventHandler(this.OnStaticButtonClicked);
     //
     // sideBarButton1
     //
     this.sideBarButton1.ImageIndex     = 0;
     this.sideBarButton1.ImageListLarge = this.imageListLarge;
     this.sideBarButton1.ImageListSmall = this.imageListSmall;
     this.sideBarButton1.Name           = "sideBarButton1";
     this.sideBarButton1.Text           = "sideBarButton1";
     //
     // imageListLarge
     //
     this.imageListLarge.ImageSize        = new System.Drawing.Size(32, 32);
     this.imageListLarge.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListLarge.ImageStream")));
     this.imageListLarge.TransparentColor = System.Drawing.Color.Magenta;
     //
     // imageListSmall
     //
     this.imageListSmall.ImageSize        = new System.Drawing.Size(16, 16);
     this.imageListSmall.ImageStream      = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListSmall.ImageStream")));
     this.imageListSmall.TransparentColor = System.Drawing.Color.Magenta;
     //
     // sideBarButton2
     //
     this.sideBarButton2.ImageIndex     = 1;
     this.sideBarButton2.ImageListLarge = this.imageListLarge;
     this.sideBarButton2.ImageListSmall = this.imageListSmall;
     this.sideBarButton2.Name           = "sideBarButton2";
     this.sideBarButton2.Text           = "sideBarButton2";
     //
     // sideBarButton3
     //
     this.sideBarButton3.ImageIndex     = 2;
     this.sideBarButton3.ImageListLarge = this.imageListLarge;
     this.sideBarButton3.ImageListSmall = this.imageListSmall;
     this.sideBarButton3.Name           = "sideBarButton3";
     this.sideBarButton3.Text           = "sideBarButton3";
     //
     // sideBarTab2
     //
     this.sideBarTab2.Enabled = true;
     this.sideBarTab2.Name    = "sideBarTab2";
     this.sideBarTab2.Title   = "Dynamic Buttons";
     //
     // sideBarTab3
     //
     this.sideBarTab3.Buttons.AddRange(new SIL.FieldWorks.Common.Controls.SideBarButton[] {
         this.sideBarButton4,
         this.sideBarButton5,
         this.sideBarButton6
     });
     this.sideBarTab3.Enabled = true;
     this.sideBarTab3.Name    = "sideBarTab3";
     this.sideBarTab3.Title   = "Context Menus";
     //
     // sideBarButton4
     //
     this.sideBarButton4.ImageIndex     = 3;
     this.sideBarButton4.ImageListLarge = this.imageListLarge;
     this.sideBarButton4.ImageListSmall = this.imageListSmall;
     this.sideBarButton4.Name           = "sideBarButton4";
     this.sideBarButton4.Text           = "sideBarButton4";
     //
     // sideBarButton5
     //
     this.sideBarButton5.ImageIndex     = 4;
     this.sideBarButton5.ImageListLarge = this.imageListLarge;
     this.sideBarButton5.ImageListSmall = this.imageListSmall;
     this.sideBarButton5.Name           = "sideBarButton5";
     this.sideBarButton5.Text           = "sideBarButton5";
     //
     // sideBarButton6
     //
     this.sideBarButton6.ImageIndex     = 0;
     this.sideBarButton6.ImageListLarge = this.imageListLarge;
     this.sideBarButton6.ImageListSmall = this.imageListSmall;
     this.sideBarButton6.Name           = "sideBarButton6";
     this.sideBarButton6.Text           = "sideBarButton6";
     //
     // contextMenu1
     //
     this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem4,
         this.menuItem5,
         this.menuItem6,
         this.menuItem7,
         this.menuItem8,
         this.menuItem9,
         this.menuItem10,
         this.menuItem11,
         this.menuItem12
     });
     //
     // menuItem4
     //
     this.menuItem4.Index = 0;
     this.menuItem4.Text  = "This";
     //
     // menuItem5
     //
     this.menuItem5.Index = 1;
     this.menuItem5.Text  = "is";
     //
     // menuItem6
     //
     this.menuItem6.Index = 2;
     this.menuItem6.Text  = "a";
     //
     // menuItem7
     //
     this.menuItem7.Index = 3;
     this.menuItem7.Text  = "different";
     //
     // menuItem8
     //
     this.menuItem8.Index = 4;
     this.menuItem8.Text  = "context ";
     //
     // menuItem9
     //
     this.menuItem9.Index = 5;
     this.menuItem9.Text  = "menu ";
     //
     // menuItem10
     //
     this.menuItem10.Index = 6;
     this.menuItem10.Text  = "for";
     //
     // menuItem11
     //
     this.menuItem11.Index = 7;
     this.menuItem11.Text  = "this";
     //
     // menuItem12
     //
     this.menuItem12.Index = 8;
     this.menuItem12.Text  = "tab";
     //
     // mainMenu1
     //
     this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem1
     });
     //
     // menuItem1
     //
     this.menuItem1.Index = 0;
     this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem2,
         this.mnuOtherForm,
         this.menuItem3
     });
     this.menuItem1.Text = "All";
     //
     // menuItem2
     //
     this.menuItem2.Index  = 0;
     this.menuItem2.Text   = "&Toggle Side Bar";
     this.menuItem2.Click += new System.EventHandler(this.OnToggleSideBar);
     //
     // menuItem3
     //
     this.menuItem3.Index  = 2;
     this.menuItem3.Text   = "&Exit";
     this.menuItem3.Click += new System.EventHandler(this.OnClose);
     //
     // contextMenu2
     //
     this.contextMenu2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem13
     });
     //
     // menuItem13
     //
     this.menuItem13.Index  = 0;
     this.menuItem13.Text   = "Click here!";
     this.menuItem13.Click += new System.EventHandler(this.OnClickHere);
     //
     // contextMenu3
     //
     this.contextMenu3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
         this.menuItem14,
         this.menuItem15,
         this.menuItem17,
         this.menuItem16
     });
     //
     // menuItem14
     //
     this.menuItem14.Index  = 0;
     this.menuItem14.Text   = "Large Icons";
     this.menuItem14.Click += new System.EventHandler(this.OnShowLargeIcons);
     //
     // menuItem15
     //
     this.menuItem15.Index  = 1;
     this.menuItem15.Text   = "Small Icons";
     this.menuItem15.Click += new System.EventHandler(this.OnShowSmallIcons);
     //
     // menuItem17
     //
     this.menuItem17.Index = 2;
     this.menuItem17.Text  = "-";
     //
     // menuItem16
     //
     this.menuItem16.Index  = 3;
     this.menuItem16.Text   = "Hello World";
     this.menuItem16.Click += new System.EventHandler(this.OnHelloWorld);
     //
     // button1
     //
     this.button1.Location = new System.Drawing.Point(168, 16);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(96, 32);
     this.button1.TabIndex = 1;
     this.button1.Text     = "Add button";
     this.button1.Click   += new System.EventHandler(this.OnAddButton);
     //
     // button2
     //
     this.button2.Location = new System.Drawing.Point(168, 56);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(96, 32);
     this.button2.TabIndex = 2;
     this.button2.Text     = "Clear Buttons";
     this.button2.Click   += new System.EventHandler(this.OnRemoveButtons);
     //
     // button3
     //
     this.button3.Location = new System.Drawing.Point(168, 104);
     this.button3.Name     = "button3";
     this.button3.Size     = new System.Drawing.Size(96, 32);
     this.button3.TabIndex = 2;
     this.button3.Text     = "Remove 1st Button";
     this.button3.Click   += new System.EventHandler(this.OnRemoveFirstButton);
     //
     // splitter1
     //
     this.splitter1.Location = new System.Drawing.Point(85, 0);
     this.splitter1.MinSize  = 50;
     this.splitter1.Name     = "splitter1";
     this.splitter1.Size     = new System.Drawing.Size(3, 273);
     this.splitter1.TabIndex = 3;
     this.splitter1.TabStop  = false;
     //
     // mnuOtherForm
     //
     this.mnuOtherForm.Index  = 1;
     this.mnuOtherForm.Text   = "Other Form...";
     this.mnuOtherForm.Click += new System.EventHandler(this.OnOtherForm);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(292, 273);
     this.Controls.Add(this.splitter1);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.Controls.Add(this.sideBar1);
     this.Controls.Add(this.button3);
     this.Menu = this.mainMenu1;
     this.Name = "Form1";
     this.Text = "Hello World";
     this.sideBar1.ResumeLayout(false);
     this.ResumeLayout(false);
 }