// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-// Copyright (c) 2004 Novell, Inc.
+// Copyright (c) 2004-2005 Novell, Inc.
//
// Authors:
// Peter Bartok pbartok@novell.com
-//
-//
-// $Revision: 1.1 $
-// $Modtime: $
-// $Log: BindingsCollection.cs,v $
-// Revision 1.1 2004/07/09 05:21:25 pbartok
-// - Initial check-in
-//
+// Jackson Harper jackson@ximian.com
//
+
// COMPLETE
using System.Collections;
using System.ComponentModel;
namespace System.Windows.Forms {
+ [DefaultEvent("CollectionChanged")]
public class BindingsCollection : BaseCollection {
- #region Public Constructors
- internal BindingsCollection () {
+
+#region Public Constructors
+ internal BindingsCollection ()
+ {
}
#endregion // Public Constructors
AddCore(binding);
}
- protected virtual void AddCore(Binding dataBinding) {
+ protected virtual void AddCore (Binding dataBinding)
+ {
+ CollectionChangeEventArgs args = new CollectionChangeEventArgs (CollectionChangeAction.Add, dataBinding);
+#if NET_2_0
+ OnCollectionChanging (args);
+#endif
base.List.Add(dataBinding);
- OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, base.List));
+ OnCollectionChanged (args);
}
protected internal void Clear() {
ClearCore();
}
- protected virtual void ClearCore() {
+ protected virtual void ClearCore()
+ {
+ CollectionChangeEventArgs args = new CollectionChangeEventArgs(CollectionChangeAction.Refresh, null);
+#if NET_2_0
+ OnCollectionChanging (args);
+#endif
base.List.Clear();
- OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Refresh, base.List));
+ OnCollectionChanged (args);
}
protected virtual void OnCollectionChanged(System.ComponentModel.CollectionChangeEventArgs ccevent) {
if (CollectionChanged!=null) CollectionChanged(this, ccevent);
}
+#if NET_2_0
+ protected virtual void OnCollectionChanging (CollectionChangeEventArgs e)
+ {
+ if (CollectionChanging != null)
+ CollectionChanging (this, e);
+ }
+#endif
+
protected internal void Remove(Binding binding) {
RemoveCore(binding);
}
OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, base.List));
}
- protected virtual void RemoveCore(Binding dataBinding) {
+ protected virtual void RemoveCore(Binding dataBinding)
+ {
+ CollectionChangeEventArgs args = new CollectionChangeEventArgs(CollectionChangeAction.Remove, dataBinding);
+#if NET_2_0
+ OnCollectionChanging (args);
+#endif
base.List.Remove(dataBinding);
- OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, base.List));
+ OnCollectionChanged (args);
}
protected internal bool ShouldSerializeMyAll() {
}
#endregion // Public Instance Methods
+ internal bool Contains (Binding binding)
+ {
+ return List.Contains (binding);
+ }
+
#region Events
public event CollectionChangeEventHandler CollectionChanged;
+#if NET_2_0
+ public event CollectionChangeEventHandler CollectionChanging;
+#endif
#endregion // Events
}
}