/// <summary>
		/// The Column has changed.
		/// </summary>
		/// <param name="sender">Who sent the event</param>
		/// <param name="e">What parameters where sent</param>
		private void OnColumnChange(object sender, EventArgs e)
		{
			SmartColumn sc = sender as SmartColumn;
			if ( sc != null && OnModified != null)
			{
				SmartColumnCollectionEventArgs args = new SmartColumnCollectionEventArgs(sc, SmartChangeType.Modified);
				OnModified(this, args);
			}
		}
		/// <summary>
		/// Add the new column to the collection
		/// </summary>
		/// <param name="column">The column to be collected</param>
		/// <returns>The index position it was added to.</returns>
		public int Add(SmartColumn column)
		{
			int idx = -1;
			idx = List.Add(column);
			column.OnTextChange += new EventHandler(OnColumnChange);
			column.OnWidthChange += new EventHandler(OnColumnChange);
			if ( OnNew != null )
			{
				SmartColumnCollectionEventArgs args = new SmartColumnCollectionEventArgs(column, SmartChangeType.New);
				OnNew(this, args);
			}			
			return idx;
		}
示例#3
0
		private void scc_OnNew(object sender, SmartColumnCollectionEventArgs args)
		{
			Assert.IsNotNull(args, "The Smart Column Events object is null!");
		}
示例#4
0
		/// <summary>
		/// A column has been added to the collection.
		/// </summary>
		/// <param name="sender">Who sent the event</param>
		/// <param name="args">What parameters where sent</param>
		private void OnColumnsChange(object sender, SmartColumnCollectionEventArgs args)
		{
			switch( args.ChangeType )
			{
				case SmartChangeType.New:
					ColumnAdded(args.Entry);
					break;
				case SmartChangeType.Removed:
					ColumnRemoved(args.Entry);
					break;
				case SmartChangeType.Modified:
					ColumnModified(args.Entry);
					break;
			}
		}
		/// <summary>
		/// Remove the specified column using the name provided
		/// </summary>
		/// <param name="name">Name to remove</param>
		public void Remove( string name )
		{
			int idx = IndexOf(name);
			if ( idx > -1 )
			{
				SmartColumn sc = this[name];
				List.RemoveAt(idx);
				if ( OnRemoved != null )
				{
					SmartColumnCollectionEventArgs args = new SmartColumnCollectionEventArgs(sc, SmartChangeType.Removed);
					OnRemoved(this, args);
				}
			}
		}
		/// <summary>
		/// Remove the specified column
		/// </summary>
		/// <param name="value">Column to be removed</param>
		public void Remove( SmartColumn value )  
		{
			List.Remove( value );
			if ( OnRemoved != null )
			{
				SmartColumnCollectionEventArgs args = new SmartColumnCollectionEventArgs(value, SmartChangeType.Removed);
				OnRemoved(this, args);
			}
		}
		/// <summary>
		/// Insert the column at the specified position
		/// </summary>
		/// <param name="index">Index position</param>
		/// <param name="value">The column to insearch</param>
		public void Insert( int index, SmartColumn value )  
		{
			List.Insert( index, value );
			value.OnTextChange += new EventHandler(OnColumnChange);
			value.OnWidthChange += new EventHandler(OnColumnChange);
			if ( OnInserted != null )
			{
				SmartColumnCollectionEventArgs args = new SmartColumnCollectionEventArgs(value, SmartChangeType.New);
				OnInserted(this, args);
			}
		}