Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// The button is about to be inserted to the button control. Set's the button's properties.
        /// </summary>
        /// TODO: Delete most code and set button size and position.
        /// ------------------------------------------------------------------------------------
        private void OnButtonInserting(int index, object value)
        {
            InformationBarButton btn = value as InformationBarButton;

            if (btn != null)
            {
                btn.SuspendLayout();
                btn.Dock  = System.Windows.Forms.DockStyle.Right;
                btn.Width = ButtonWidth;
                btn.Text  = "";
                // Setting all the colors to 'ControlDark' so the button will behave like an icon.
                btn.BackColor           = System.Drawing.SystemColors.ControlDark;
                btn.BorderDarkColor     = System.Drawing.SystemColors.ControlDark;
                btn.BorderDarkestColor  = System.Drawing.SystemColors.ControlDark;
                btn.BorderLightColor    = System.Drawing.SystemColors.ControlDark;
                btn.BorderLightestColor = System.Drawing.SystemColors.ControlDark;
                btn.ResumeLayout();
                this.InfoBarPanel.Controls.Add(btn);
                btn.AccessibilityObject.Name = "InformationBarButton";
            }
        }
		/// <summary>
		///     <para>
		///       Initializes a new instance of <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> containing any array of <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> objects.
		///    </para>
		/// </summary>
		/// <param name='value'>
		///       A array of <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> objects with which to intialize the collection
		/// </param>
		public InformationBarButtonCollection(InformationBarButton[] value)
		{
			this.AddRange(value);
		}
		/// <summary>
		///    <para> Removes a specific <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> from the
		///    <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> to remove from the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</param>
		/// <returns><para>None.</para></returns>
		/// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
		public void Remove(InformationBarButton value)
		{
			List.Remove(value);
		}
		/// <summary>
		/// <para>Inserts a <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> into the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> 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.InformationBarButton'/> to insert.</param>
		/// <returns><para>None.</para></returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.Add'/>
		public void Insert(int index, InformationBarButton value)
		{
			List.Insert(index, value);
		}
		/// <summary>
		///    <para>Returns the index of a <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> in
		///       the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> to locate.</param>
		/// <returns>
		/// <para>The index of the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> of <paramref name='value'/> in the
		/// <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/>, if found; otherwise, -1.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.Contains'/>
		public int IndexOf(InformationBarButton value)
		{
			return List.IndexOf(value);
		}
		/// <summary>
		/// <para>Copies the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> 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.InformationBarButtonCollection'/> .</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.InformationBarButtonCollection'/> 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(InformationBarButton[] array, int index)
		{
			List.CopyTo(array, index);
		}
		/// <summary>
		/// <para>Gets a value indicating whether the
		///    <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> contains the specified <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/>.</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> to locate.</param>
		/// <returns>
		/// <para><see langword='true'/> if the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> is contained in the collection;
		///   otherwise, <see langword='false'/>.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.IndexOf'/>
		public bool Contains(InformationBarButton value)
		{
			return List.Contains(value);
		}
		/// <summary>
		/// <para>Copies the elements of an array to the end of the <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/>.</para>
		/// </summary>
		/// <param name='value'>
		///    An array of type <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> containing the objects to add to the collection.
		/// </param>
		/// <returns>
		///   <para>None.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.Add'/>
		public void AddRange(InformationBarButton[] value)
		{
			for (int i = 0; (i < value.Length); i = (i + 1))
			{
				this.Add(value[i]);
			}
		}
		/// <summary>
		///    <para>Adds a <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> with the specified value to the
		///    <see cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</para>
		/// </summary>
		/// <param name='value'>The <see cref='SIL.FieldWorks.Common.Controls.InformationBarButton'/> to add.</param>
		/// <returns>
		///    <para>The index at which the new element was inserted.</para>
		/// </returns>
		/// <seealso cref='SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.AddRange(SIL.FieldWorks.Common.Controls.InformationBarButton[])'/>
		public int Add(InformationBarButton value)
		{
			return List.Add(value);
		}
Пример #10
0
 /// <summary>
 ///    <para> Removes a specific <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> from the
 ///    <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</para>
 /// </summary>
 /// <param name='value'>The <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> to remove from the <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</param>
 /// <returns><para>None.</para></returns>
 /// <exception cref='T:System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception>
 public void Remove(InformationBarButton value)
 {
     List.Remove(value);
 }
Пример #11
0
 /// <summary>
 /// <para>Inserts a <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> into the <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> 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='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> to insert.</param>
 /// <returns><para>None.</para></returns>
 /// <seealso cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.Add'/>
 public void Insert(int index, InformationBarButton value)
 {
     List.Insert(index, value);
 }
Пример #12
0
 /// <summary>
 ///    <para>Returns the index of a <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> in
 ///       the <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</para>
 /// </summary>
 /// <param name='value'>The <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> to locate.</param>
 /// <returns>
 /// <para>The index of the <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> of <paramref name='value'/> in the
 /// <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/>, if found; otherwise, -1.</para>
 /// </returns>
 /// <seealso cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.Contains'/>
 public int IndexOf(InformationBarButton value)
 {
     return(List.IndexOf(value));
 }
Пример #13
0
 /// <summary>
 /// <para>Gets a value indicating whether the
 ///    <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> contains the specified <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/>.</para>
 /// </summary>
 /// <param name='value'>The <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> to locate.</param>
 /// <returns>
 /// <para><see langword='true'/> if the <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> is contained in the collection;
 ///   otherwise, <see langword='false'/>.</para>
 /// </returns>
 /// <seealso cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.IndexOf'/>
 public bool Contains(InformationBarButton value)
 {
     return(List.Contains(value));
 }
Пример #14
0
 /// <summary>
 ///    <para>Adds a <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> with the specified value to the
 ///    <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection'/> .</para>
 /// </summary>
 /// <param name='value'>The <see cref='T:SIL.FieldWorks.Common.Controls.InformationBarButton'/> to add.</param>
 /// <returns>
 ///    <para>The index at which the new element was inserted.</para>
 /// </returns>
 /// <seealso cref='T:SIL.FieldWorks.Common.Controls.InformationBarButtonCollection.AddRange(SIL.FieldWorks.Common.Controls.InformationBarButton[])'/>
 public int Add(InformationBarButton value)
 {
     return(List.Add(value));
 }
Пример #15
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Build information bar buttons based on the sideBar tabs.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		public void BuildInfoBarButtons()
		{
			if (m_mnuView == null || informationBar == null ||
				sideBarFw == null || sideBarFw.Tabs.Count == 0)
			{
				return;
			}

			// First, clear all the buttons from the info bar..
			informationBar.Buttons.Clear();

			foreach (SideBarTab tab in sideBarFw.Tabs)
			{
				// Add event handlers for adding and removing tab buttons
				tab.Buttons.AfterInsert +=
					new SideBarButtonCollection.CollectionChange(tabButton_AddOrRemove);
				tab.Buttons.BeforeRemove +=
					new SideBarButtonCollection.CollectionChange(tabButton_AddOrRemove);

				// Add a 'Button Click' event to each tab
				tab.ButtonClickEvent += new EventHandler(tabButton_Click);

				// Create an information button based on the tab and add it to the info bar
				InformationBarButton infoButton = new InformationBarButton();
				infoButton.Text = tab.Title;
				infoButton.Tag = tab;
				infoButton.ImageList = sideBarFw.ImageListSmall;
				informationBar.Buttons.Add(infoButton);
				infoButton.Click += new EventHandler(infoButton_Click);
				infoButton.MouseHover += new EventHandler(infoButton_MouseHover);
			}
		}