/*
         * InsertNavigationPane
         */

        private void InsertNavigationPane(int index, NuGenNavigationPane navigationPaneToInsert)
        {
            Debug.Assert(navigationPaneToInsert != null, "navigationPaneToInsert != null");
            this.InsertNavigationButton(index, this.InitializeNavigationPane(navigationPaneToInsert));
            this.OnNavigationPaneAdded(
                new NuGenCollectionEventArgs <NuGenNavigationPane>(index, navigationPaneToInsert)
                );
        }
        /*
         * AddNavigationPane
         */

        private void AddNavigationPane(NuGenNavigationPane navigationPaneToAdd)
        {
            Debug.Assert(navigationPaneToAdd != null, "navigationPaneToAdd != null");
            this.AddNavigationButton(this.InitializeNavigationPane(navigationPaneToAdd));
            this.OnNavigationPaneAdded(
                new NuGenCollectionEventArgs <NuGenNavigationPane>(this.NavigationPanes.Count - 1, navigationPaneToAdd)
                );
        }
        private void _navigationPane_NavigationButtonImageChanged(object sender, EventArgs e)
        {
            Debug.Assert(sender is NuGenNavigationPane, "sender is NuGenNavigationPane");
            NuGenNavigationPane navigationPane = (NuGenNavigationPane)sender;

            Debug.Assert(_paneButtonDictionary != null, "_paneButtonDictionary != null");
            Debug.Assert(_paneButtonDictionary.ContainsKey(navigationPane), "_paneButtonDictionary.ContainsKey(navigationPane)");
            _paneButtonDictionary[navigationPane].Image = navigationPane.NavigationButtonImage;
        }
Example #4
0
            /*
             * Remove
             */

            /// <summary>
            /// </summary>
            public bool Remove(NuGenNavigationPane navigationPaneToRemove)
            {
                if (_list.Contains(navigationPaneToRemove))
                {
                    Debug.Assert(_navigationBar != null, "_navigationBar != null");
                    _navigationBar.Controls.Remove(navigationPaneToRemove);
                    return(_list.Remove(navigationPaneToRemove));
                }

                return(false);
            }
Example #5
0
            /// <summary>
            /// </summary>
            /// <param name="index"></param>
            /// <param name="text"></param>
            /// <param name="navigationButtonImage">Can be <see langword="null"/>.</param>
            /// <exception cref="ArgumentOutOfRangeException">
            /// <para>
            ///		<paramref name="index"/> must be within the bounds of the collection.
            /// </para>
            /// </exception>
            public NuGenNavigationPane Insert(int index, string text, Image navigationButtonImage)
            {
                Debug.Assert(_navigationBar != null, "_navigationBar != null");
                Debug.Assert(_navigationBar.ServiceProvider != null, "_navigationBar.ServiceProvider != null");

                NuGenNavigationPane navigationPane = new NuGenNavigationPane(_navigationBar.ServiceProvider);

                navigationPane.NavigationButtonImage = navigationButtonImage;
                this.Insert(index, navigationPane);
                navigationPane.Text = text;

                return(navigationPane);
            }
Example #6
0
            /// <summary>
            /// </summary>
            /// <exception cref="ArgumentNullException">
            /// <para><paramref name="navigationPaneToAdd"/> is <see langword="null"/>.</para>
            /// </exception>
            public int Add(NuGenNavigationPane navigationPaneToAdd)
            {
                if (navigationPaneToAdd == null)
                {
                    throw new ArgumentNullException("navigationPaneToAdd");
                }

                Debug.Assert(_navigationBar != null, "_navigationBar != null");
                _list.Add(navigationPaneToAdd);
                _navigationBar.AddNavigationPane(navigationPaneToAdd);

                return(_list.Count - 1);
            }
        private void _navigationPane_TextChanged(object sender, EventArgs e)
        {
            Debug.Assert(sender is NuGenNavigationPane, "sender is NuGenNavigationPane");
            NuGenNavigationPane navigationPane = (NuGenNavigationPane)sender;

            Debug.Assert(_paneButtonDictionary != null, "_paneButtonDictionary != null");
            Debug.Assert(_paneButtonDictionary.ContainsKey(navigationPane), "_paneButtonDictionary.ContainsKey(navigationPane)");
            NuGenNavigationButton navigationButton = _paneButtonDictionary[navigationPane];

            navigationButton.Text = navigationPane.Text;

            if (navigationButton == _buttonBlock.SelectedButton)
            {
                _title.SetSelectedButton(navigationButton);
            }
        }
Example #8
0
            /// <summary>
            /// </summary>
            /// <exception cref="ArgumentOutOfRangeException">
            /// <para>
            ///		<paramref name="index"/> must be within the bounds of the collection.
            /// </para>
            /// </exception>
            /// <exception cref="ArgumentNullException">
            /// <para>
            ///		<paramref name="navigationPaneToInsert"/> is <see langword="null"/>.
            /// </para>
            /// </exception>
            public void Insert(int index, NuGenNavigationPane navigationPaneToInsert)
            {
                if (navigationPaneToInsert == null)
                {
                    throw new ArgumentNullException("navigationPaneToInsert");
                }

                try
                {
                    _list.Insert(index, navigationPaneToInsert);
                    _navigationBar.InsertNavigationPane(index, navigationPaneToInsert);
                }
                catch (ArgumentOutOfRangeException e)
                {
                    throw e;
                }
            }
        private void _buttonBlock_SelectedButtonChanged(object sender, EventArgs e)
        {
            NuGenNavigationButton selectedButton = _buttonBlock.SelectedButton;

            _title.SetSelectedButton(selectedButton);

            if (selectedButton != null)
            {
                Debug.Assert(_buttonPaneDictionary != null, "_buttonPaneDictionary != null");
                Debug.Assert(_buttonPaneDictionary.ContainsKey(selectedButton), "_buttonPaneDictionary.ContainsKey(selectedButton)");
                NuGenNavigationPane activeNavigationPane = _buttonPaneDictionary[selectedButton];
                Debug.Assert(activeNavigationPane != null, "activeNavigationPane != null");
                activeNavigationPane.BringToFront();
            }

            this.OnSelectedButtonChanged(e);
        }
Example #10
0
        /*
         * RemoveNavigationPane
         */

        private void RemoveNavigationPane(NuGenNavigationPane navigationPaneToRemove)
        {
            Debug.Assert(navigationPaneToRemove != null, "navigationPaneToRemove != null");
            Debug.Assert(_buttonPaneDictionary != null, "_buttonPaneDictionary != null");
            Debug.Assert(_paneButtonDictionary != null, "_paneButtonDictionary != null");

            NuGenNavigationButton associatedButton = _paneButtonDictionary[navigationPaneToRemove];

            Debug.Assert(associatedButton != null, "associatedButton != null");

            navigationPaneToRemove.NavigationButtonImageChanged -= _navigationPane_NavigationButtonImageChanged;
            navigationPaneToRemove.TextChanged -= _navigationPane_TextChanged;

            _buttonPaneDictionary.Remove(associatedButton);
            _paneButtonDictionary.Remove(navigationPaneToRemove);

            this.RemoveNavigationButton(associatedButton);
        }
Example #11
0
        /*
         * OnControlRemoved
         */

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.ControlRemoved"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.ControlEventArgs"></see> that contains the event data.</param>
        protected override void OnControlRemoved(ControlEventArgs e)
        {
            base.OnControlRemoved(e);

            if (e.Control is NuGenNavigationPane)
            {
                NuGenNavigationPane navigationPane = e.Control as NuGenNavigationPane;
                int index = this.NavigationPanes.IndexOf(navigationPane);
                this.RemoveNavigationPane(navigationPane);

                if (this.NavigationPanes.ListInternal.Remove(navigationPane))
                {
                    this.OnNavigationPaneRemoved(
                        new NuGenCollectionEventArgs <NuGenNavigationPane>(index, navigationPane)
                        );
                }
            }
        }
Example #12
0
            /// <summary>
            /// </summary>
            /// <exception cref="ArgumentOutOfRangeException">
            ///		<paramref name="zeroBasedIndex"/> should be within the bounds of the collection.
            /// </exception>
            public NuGenNavigationPane this[int zeroBasedIndex]
            {
                get
                {
                    NuGenNavigationPane navigationPane = null;

                    try
                    {
                        navigationPane = _list[zeroBasedIndex];
                    }
                    catch (ArgumentOutOfRangeException e)
                    {
                        throw e;
                    }

                    return(navigationPane);
                }
            }
Example #13
0
        /*
         * InitializeNavigationPane
         */

        private NuGenNavigationButton InitializeNavigationPane(NuGenNavigationPane navigationPaneToInitialize)
        {
            Debug.Assert(navigationPaneToInitialize != null, "navigationPaneToInitialize != null");
            NuGenNavigationButton navigationButtonToAssociate = new NuGenNavigationButton();

            navigationButtonToAssociate.Image = navigationPaneToInitialize.NavigationButtonImage;
            navigationButtonToAssociate.Text  = navigationPaneToInitialize.Text;

            Debug.Assert(_buttonPaneDictionary != null, "_buttonPaneDictionary != null");
            Debug.Assert(_paneButtonDictionary != null, "_paneButtonDictionary != null");
            _buttonPaneDictionary.Add(navigationButtonToAssociate, navigationPaneToInitialize);
            _paneButtonDictionary.Add(navigationPaneToInitialize, navigationButtonToAssociate);

            navigationPaneToInitialize.NavigationButtonImageChanged += _navigationPane_NavigationButtonImageChanged;
            navigationPaneToInitialize.TextChanged += _navigationPane_TextChanged;

            this.Controls.Add(navigationPaneToInitialize);
            navigationPaneToInitialize.BringToFront();

            return(navigationButtonToAssociate);
        }
			/*
			 * Contains
			 */

			/// <summary>
			/// </summary>
			public bool Contains(NuGenNavigationPane navigationPane)
			{
				return _list.Contains(navigationPane);
			}
		/*
		 * InitializeNavigationPane
		 */

		private NuGenNavigationButton InitializeNavigationPane(NuGenNavigationPane navigationPaneToInitialize)
		{
			Debug.Assert(navigationPaneToInitialize != null, "navigationPaneToInitialize != null");
			NuGenNavigationButton navigationButtonToAssociate = new NuGenNavigationButton();
			navigationButtonToAssociate.Image = navigationPaneToInitialize.NavigationButtonImage;
			navigationButtonToAssociate.Text = navigationPaneToInitialize.Text;

			Debug.Assert(_buttonPaneDictionary != null, "_buttonPaneDictionary != null");
			Debug.Assert(_paneButtonDictionary != null, "_paneButtonDictionary != null");
			_buttonPaneDictionary.Add(navigationButtonToAssociate, navigationPaneToInitialize);
			_paneButtonDictionary.Add(navigationPaneToInitialize, navigationButtonToAssociate);

			navigationPaneToInitialize.NavigationButtonImageChanged += _navigationPane_NavigationButtonImageChanged;
			navigationPaneToInitialize.TextChanged += _navigationPane_TextChanged;

			this.Controls.Add(navigationPaneToInitialize);
			navigationPaneToInitialize.BringToFront();

			return navigationButtonToAssociate;
		}
		/*
		 * AddNavigationPane
		 */

		private void AddNavigationPane(NuGenNavigationPane navigationPaneToAdd)
		{
			Debug.Assert(navigationPaneToAdd != null, "navigationPaneToAdd != null");
			this.AddNavigationButton(this.InitializeNavigationPane(navigationPaneToAdd));
			this.OnNavigationPaneAdded(
				new NuGenCollectionEventArgs<NuGenNavigationPane>(this.NavigationPanes.Count - 1, navigationPaneToAdd)
			);
		}
Example #17
0
            /*
             * IndexOf
             */

            /// <summary>
            /// </summary>
            public int IndexOf(NuGenNavigationPane navigationPane)
            {
                return(_list.IndexOf(navigationPane));
            }
Example #18
0
            /*
             * Contains
             */

            /// <summary>
            /// </summary>
            public bool Contains(NuGenNavigationPane navigationPane)
            {
                return(_list.Contains(navigationPane));
            }
		/*
		 * InsertNavigationPane
		 */

		private void InsertNavigationPane(int index, NuGenNavigationPane navigationPaneToInsert)
		{
			Debug.Assert(navigationPaneToInsert != null, "navigationPaneToInsert != null");
			this.InsertNavigationButton(index, this.InitializeNavigationPane(navigationPaneToInsert));
			this.OnNavigationPaneAdded(
				new NuGenCollectionEventArgs<NuGenNavigationPane>(index, navigationPaneToInsert)
			);
		}
Example #20
0
            /*
             * RemoveAt
             */

            /// <summary>
            /// Removes the <see cref="T:System.Collections.IList"></see> item at the specified index.
            /// </summary>
            /// <param name="index">The zero-based index of the item to remove.</param>
            /// <exception cref="ArgumentOutOfRangeException">
            ///		<paramref name="zeroBasedIndex"/> should be within the bounds of the collection.
            /// </exception>
            public void RemoveAt(int index)
            {
                NuGenNavigationPane navigationPane = this[index];

                this.Remove(navigationPane);
            }
			/*
			 * Remove
			 */

			/// <summary>
			/// </summary>
			public bool Remove(NuGenNavigationPane navigationPaneToRemove)
			{
				if (_list.Contains(navigationPaneToRemove))
				{
					Debug.Assert(_navigationBar != null, "_navigationBar != null");
					_navigationBar.Controls.Remove(navigationPaneToRemove);
					return _list.Remove(navigationPaneToRemove);
				}

				return false;
			}
			/// <summary>
			/// </summary>
			/// <exception cref="ArgumentOutOfRangeException">
			/// <para>
			///		<paramref name="index"/> must be within the bounds of the collection.
			/// </para>
			/// </exception>
			/// <exception cref="ArgumentNullException">
			/// <para>
			///		<paramref name="navigationPaneToInsert"/> is <see langword="null"/>.
			/// </para>
			/// </exception>
			public void Insert(int index, NuGenNavigationPane navigationPaneToInsert)
			{
				if (navigationPaneToInsert == null)
				{
					throw new ArgumentNullException("navigationPaneToInsert");
				}

				try
				{
					_list.Insert(index, navigationPaneToInsert);
					_navigationBar.InsertNavigationPane(index, navigationPaneToInsert);
				}
				catch (ArgumentOutOfRangeException e)
				{
					throw e;
				}
			}
			/// <summary>
			/// </summary>
			/// <param name="index"></param>
			/// <param name="text"></param>
			/// <param name="navigationButtonImage">Can be <see langword="null"/>.</param>
			/// <exception cref="ArgumentOutOfRangeException">
			/// <para>
			///		<paramref name="index"/> must be within the bounds of the collection.
			/// </para>
			/// </exception>
			public NuGenNavigationPane Insert(int index, string text, Image navigationButtonImage)
			{
				Debug.Assert(_navigationBar != null, "_navigationBar != null");
				Debug.Assert(_navigationBar.ServiceProvider != null, "_navigationBar.ServiceProvider != null");

				NuGenNavigationPane navigationPane = new NuGenNavigationPane(_navigationBar.ServiceProvider);
				navigationPane.NavigationButtonImage = navigationButtonImage;
				this.Insert(index, navigationPane);
				navigationPane.Text = text;

				return navigationPane;
			}
			/*
			 * IndexOf
			 */

			/// <summary>
			/// </summary>
			public int IndexOf(NuGenNavigationPane navigationPane)
			{
				return _list.IndexOf(navigationPane);
			}
			/*
			 * CopyTo
			 */

			/// <summary>
			/// Copies the entire contents of this collection to a compatible one-dimensional
			/// <see cref="T:System.Array"></see>, starting at the specified index of the target array.
			/// </summary>
			/// <exception cref="T:System.InvalidCastException">
			/// The type of the source element cannot be cast automatically to the type of array.
			/// </exception>
			/// <exception cref="T:System.ArgumentOutOfRangeException">
			/// index is less than 0.
			/// </exception>
			/// <exception cref="T:System.ArgumentException">
			/// <para>
			///		<paramref name="destination"/> is multidimensional.
			/// </para>
			/// -or-
			/// <para>
			///		<paramref name="zeroBasedIndexToStartAt"/> is equal to or greater than the length of
			///		the destination array.
			/// </para>
			/// -or-
			/// <para>
			///		The number of elements in the source collection is greater
			///		than the available space from index to the end of the destination array.
			/// </para>
			/// </exception>
			/// <exception cref="T:System.ArgumentNullException">
			/// <paramref name="destination"/> is <see langword="null"/>.
			/// </exception>
			public void CopyTo(NuGenNavigationPane[] destination, int zeroBasedIndexToStartAt)
			{
				_list.CopyTo(destination, zeroBasedIndexToStartAt);
			}
			/// <summary>
			/// </summary>
			/// <exception cref="ArgumentNullException">
			/// <para><paramref name="navigationPaneToAdd"/> is <see langword="null"/>.</para>
			/// </exception>
			public int Add(NuGenNavigationPane navigationPaneToAdd)
			{
				if (navigationPaneToAdd == null)
				{
					throw new ArgumentNullException("navigationPaneToAdd");
				}

				Debug.Assert(_navigationBar != null, "_navigationBar != null");
				_list.Add(navigationPaneToAdd);
				_navigationBar.AddNavigationPane(navigationPaneToAdd);

				return _list.Count - 1;
			}
		/*
		 * RemoveNavigationPane
		 */

		private void RemoveNavigationPane(NuGenNavigationPane navigationPaneToRemove)
		{
			Debug.Assert(navigationPaneToRemove != null, "navigationPaneToRemove != null");
			Debug.Assert(_buttonPaneDictionary != null, "_buttonPaneDictionary != null");
			Debug.Assert(_paneButtonDictionary != null, "_paneButtonDictionary != null");

			NuGenNavigationButton associatedButton = _paneButtonDictionary[navigationPaneToRemove];
			Debug.Assert(associatedButton != null, "associatedButton != null");

			navigationPaneToRemove.NavigationButtonImageChanged -= _navigationPane_NavigationButtonImageChanged;
			navigationPaneToRemove.TextChanged -= _navigationPane_TextChanged;

			_buttonPaneDictionary.Remove(associatedButton);
			_paneButtonDictionary.Remove(navigationPaneToRemove);

			this.RemoveNavigationButton(associatedButton);
		}