Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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);
		}
Ejemplo n.º 3
0
        /// <summary>
        /// Remove the button from the Controls collection and adjust window
        /// </summary>
        /// <param name="btn">Button to remove</param>
        internal void RemoveButton(SideBarButton btn)
        {
            CheckDisposed();

            if (btn == null)
            {
                return;
            }

            Controls.Remove(btn);

            ShowButtons();
        }
Ejemplo n.º 4
0
		/// <summary>
		/// <para>Inserts a <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> into the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> 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.SideBarButton'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.Add'/>
		public void Insert(int index, SideBarButton value)
		{
			CheckDisposed();

			List.Insert(index, value);
		}
Ejemplo n.º 5
0
		/// <summary>
		///    <para>Returns the index of a <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> in
		///       the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> of <paramref name='value'/> in the
		/// <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.Contains'/>
		public int IndexOf(SideBarButton value)
		{
			CheckDisposed();

			return List.IndexOf(value);
		}
Ejemplo n.º 6
0
		/// <summary>
		/// <para>Copies the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> 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.SideBarButtonCollection'/> .</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.SideBarButtonCollection'/> 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(SideBarButton[] array, int index)
		{
			CheckDisposed();

			List.CopyTo(array, index);
		}
Ejemplo n.º 7
0
		/// <summary>
		/// <para>Gets a value indicating whether the
		///    <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> contains the specified <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/>.</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> is contained in the collection;
		///   otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.IndexOf'/>
		public bool Contains(SideBarButton value)
		{
			CheckDisposed();

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

            return(List.Add(value));
        }
Ejemplo n.º 9
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);

		}
Ejemplo n.º 10
0
		/// <summary>
		/// Remove the button from the Controls collection and adjust window
		/// </summary>
		/// <param name="btn">Button to remove</param>
		internal void RemoveButton(SideBarButton btn)
		{
			CheckDisposed();

			if (btn == null)
				return;

			Controls.Remove(btn);

			ShowButtons();
		}
Ejemplo n.º 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();
		}
Ejemplo n.º 12
0
        /// <summary>
        ///    <para> Removes a specific <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> from the
        ///    <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</para>
        /// </summary>
        /// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to remove from the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</param>
        /// <returns><para>None.</para></returns>
        /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
        public void Remove(SideBarButton value)
        {
            CheckDisposed();

            List.Remove(value);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// <para>Inserts a <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> into the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> 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.SideBarButton'/> to insert.</param>
        /// <returns><para>None.</para></returns>
        /// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.Add'/>
        public void Insert(int index, SideBarButton value)
        {
            CheckDisposed();

            List.Insert(index, value);
        }
Ejemplo n.º 14
0
        /// <summary>
        ///    <para>Returns the index of a <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> in
        ///       the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</para>
        /// </summary>
        /// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to locate.</param>
        /// <returns>
        /// <para>The index of the <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> of <paramref name='value'/> in the
        /// <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/>, if found; otherwise, -1.</para>
        /// </returns>
        /// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.Contains'/>
        public int IndexOf(SideBarButton value)
        {
            CheckDisposed();

            return(List.IndexOf(value));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// <para>Gets a value indicating whether the
        ///    <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> contains the specified <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/>.</para>
        /// </summary>
        /// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to locate.</param>
        /// <returns>
        /// <para><see langword='true'/> if the <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> is contained in the collection;
        ///   otherwise, <see langword='false'/>.</para>
        /// </returns>
        /// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.IndexOf'/>
        public bool Contains(SideBarButton value)
        {
            CheckDisposed();

            return(List.Contains(value));
        }
Ejemplo n.º 16
0
		/// <summary>
		///    <para> Removes a specific <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> from the
		///    <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to remove from the <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
		public void Remove(SideBarButton value)
		{
			CheckDisposed();

			List.Remove(value);
		}
Ejemplo n.º 17
0
		/// <summary>
		///     <para>
		///       Initializes a new instance of <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> containing any array of <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> objects.
		///    </para>
		/// </summary>
		/// <param name='value'>
		///       A array of <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> objects with which to intialize the collection
		/// </param>
		public SideBarButtonCollection(SideBarButton[] value)
		{
			this.AddRange(value);
		}
Ejemplo n.º 18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// User has clicked on a button. Release all other buttons that might be pressed.
		/// </summary>
		/// <param name="sender">The button that was clicked</param>
		/// <param name="e">Event arguments</param>
		/// ------------------------------------------------------------------------------------
		protected void OnButtonClicked(object sender, EventArgs e)
		{
			SideBarButton pressedBtn = sender as SideBarButton;

			if (pressedBtn == null)
				return;


//			// If the button is already pushed in, then don't bother doing anything.
//			if (pressedBtn.ButtonToggleState == FwButton.ButtonToggleStates.Pushed)
//				return;

			bool isFirstButtonPressed = (Buttons.IndexOf(pressedBtn) == 0);
			int nPressedButtons = 0;
			pressedBtn.PressButton(true);
			if (!MultipleSelections)
			{
				m_pressedBtn = pressedBtn;
				for (int i = 0; i < Buttons.Count; i++)
				{
					// This will make sure all the buttons that weren't clicked
					// are not pushed in.
					if (Buttons[i] != pressedBtn)
						Buttons[i].PressButton(false);
				}
			}
			else
			{
				int i = 0;
				if (FirstButtonExclusive)
				{
					i = 1;
					if (isFirstButtonPressed)
					{
						// In multiple selection and FirstButtonExclusive mode,
						// pressing the first button should unpress all other buttons.
						Buttons[0].PressButton(true);
						nPressedButtons++;
					}
					else
					{
						// We have to unpress the first button, because it can't stay
						// pressed when other buttons are selected.
						Buttons[0].PressButton(false);
					}
				}
				for (; i < Buttons.Count; i++)
				{
					if (Buttons[i].Pressed)
						nPressedButtons++;
				}
			}

			// If no other button is selected we should select the first one
			if (MultipleSelections && FirstButtonExclusive && nPressedButtons == 0 &&
				Buttons[0].ButtonToggleState != FwButton.ButtonToggleStates.Pushed)
			{
				Buttons[0].PressButton(true);
			}
		}
Ejemplo n.º 19
0
		private void OnAddButton(object sender, System.EventArgs e)
		{
			m_nAddedButtons++;
			SideBarButton btn = new SideBarButton();
			btn.ImageIndex = m_nAddedButtons % 5;
			btn.Text = string.Format("Button {0}", m_nAddedButtons);
			switch (m_nAddedButtons % 5)
			{
				case 0:
					btn.ContextMenu = contextMenu1;
					btn.Click += new System.EventHandler(OnMethod1);
					break;
				case 1:
					btn.ContextMenu = contextMenu2;
					btn.Click += new System.EventHandler(OnMethod2);
					break;
				case 2:
					btn.ContextMenu = contextMenu3;
					btn.Click += new System.EventHandler(OnMethod3);
					break;
				default:
					btn.Click += new System.EventHandler(OnMethod3);
					break;
			}

			sideBarTab2.Buttons.Add(btn);
			sideBar1.Invalidate();
		}
Ejemplo n.º 20
0
		/// <summary>
		///    <para>Adds a <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> with the specified value to the
		///    <see cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.SideBarButton'/> to add.</param>
		/// <returns>
		///    <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.SideBarButtonCollection.AddRange(SIL.FieldWorks.Common.Controls.SideBarButton[])'/>
		public int Add(SideBarButton value)
		{
			CheckDisposed();

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

			for (int i = 0; (i < value.Length); i = (i + 1))
			{
				this.Add(value[i]);
			}
		}
Ejemplo n.º 22
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);
 }