diff options
Diffstat (limited to 'mcs/class/System/System.ComponentModel')
75 files changed, 5148 insertions, 0 deletions
diff --git a/mcs/class/System/System.ComponentModel/AttributeCollection.cs b/mcs/class/System/System.ComponentModel/AttributeCollection.cs new file mode 100644 index 00000000000..fb8c7937d2a --- /dev/null +++ b/mcs/class/System/System.ComponentModel/AttributeCollection.cs @@ -0,0 +1,130 @@ +// +// System.ComponentModel.AttributeCollection.cs +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc. (http://www.ximian.com) +// + +using System; +using System.Collections; +using System.Reflection; + +namespace System.ComponentModel +{ + public class AttributeCollection : ICollection, IEnumerable + { + private ArrayList attrList = new ArrayList (); + public static readonly AttributeCollection Empty = new AttributeCollection (null); + + public AttributeCollection (Attribute[] attributes) + { + if (attributes != null) + for (int i = 0; i < attributes.Length; i++) + attrList.Add (attributes[i]); + } + + public bool Contains (Attribute attr) + { + return attrList.Contains (attr); + } + + public bool Contains (Attribute [] attributes) + { + if (attributes == null) + return true; + + foreach (Attribute attr in attributes) + if (!Contains (attr)) + return false; + + return true; + } + + public void CopyTo (Array array, int index) + { + attrList.CopyTo (array, index); + } + + public IEnumerator GetEnumerator () + { + return attrList.GetEnumerator (); + } + + public bool Matches (Attribute attr) + { + foreach (Attribute a in attrList) + if (a.Match (attr)) + return true; + return false; + } + + public bool Matches (Attribute [] attributes) + { + foreach (Attribute a in attributes) + if (!(Matches (a))) + return false; + return true; + } + + protected Attribute GetDefaultAttribute (Type attributeType) + { + Attribute attr; + BindingFlags bf = BindingFlags.Public | BindingFlags.Static; + + FieldInfo def = attributeType.GetField ("Default", bf); + if (def == null) { + attr = Activator.CreateInstance (attributeType) as Attribute; + if (attr != null && !attr.IsDefaultAttribute ()) + attr = null; + } else { + attr = (Attribute) def.GetValue (null); + } + + return attr; + } + + public bool IsSynchronized { + get { + return attrList.IsSynchronized; + } + } + + public object SyncRoot { + get { + return attrList.SyncRoot; + } + } + + public int Count { + get { + return attrList.Count; + } + } + + public virtual Attribute this[Type type] { + get { + Attribute attr = null; + foreach (Attribute a in attrList) { + if (a.GetType () == type){ + attr = a; + break; + } + } + + if (attr == null) + attr = GetDefaultAttribute (type); + + return attr; + } + } + + public virtual Attribute this[int index] { + get { + return (Attribute) attrList [index]; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs b/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs new file mode 100644 index 00000000000..5aac55e7e56 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs @@ -0,0 +1,9 @@ +// +// System.ComponentModel.BaseNumberConverter.cs +// +// + +namespace System.ComponentModel { + public class BaseNumberConverter : TypeConverter { + } +} diff --git a/mcs/class/System/System.ComponentModel/BindableAttribute.cs b/mcs/class/System/System.ComponentModel/BindableAttribute.cs new file mode 100755 index 00000000000..ef48152bd48 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/BindableAttribute.cs @@ -0,0 +1,71 @@ +// +// System.ComponentModel.BindableAttribute.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// +// + +namespace System.ComponentModel { + [AttributeUsage (AttributeTargets.All)] + public sealed class BindableAttribute : Attribute { + + #region Fields + + BindableSupport flags; + bool bindable; + + #endregion // Fields + + public static readonly BindableAttribute No = new BindableAttribute (BindableSupport.No); + public static readonly BindableAttribute Yes = new BindableAttribute (BindableSupport.Yes); + public static readonly BindableAttribute Default = new BindableAttribute (BindableSupport.Default); + + #region Constructors + + public BindableAttribute (BindableSupport flags) + { + this.flags = flags; + this.bindable = false; + } + + public BindableAttribute (bool bindable) + { + this.bindable = bindable; + } + + #endregion // Constructors + + #region Properties + + public bool Bindable { + get { return bindable; } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override int GetHashCode () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool IsDefaultAttribute () + { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System/System.ComponentModel/BindableSupport.cs b/mcs/class/System/System.ComponentModel/BindableSupport.cs new file mode 100644 index 00000000000..e11e9a1920b --- /dev/null +++ b/mcs/class/System/System.ComponentModel/BindableSupport.cs @@ -0,0 +1,18 @@ +// +// System.ComponentModel.BindableSupport.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +namespace System.ComponentModel +{ + [Serializable] + public enum BindableSupport { + No, + Yes, + Default + } +} diff --git a/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs new file mode 100755 index 00000000000..e56beb2f809 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs @@ -0,0 +1,38 @@ +// +// System.ComponentModel.BrowsableAttribute.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +namespace System.ComponentModel { + + [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)] + public sealed class BrowsableAttribute : Attribute { + bool browsable; + + public static readonly BrowsableAttribute No; + public static readonly BrowsableAttribute Yes; + + static BrowsableAttribute () + { + No = new BrowsableAttribute (false); + Yes = new BrowsableAttribute (false); + } + + public BrowsableAttribute (bool browsable) + { + this.browsable = browsable; + } + + public bool Browsable { + get { + return browsable; + } + } + + } +} diff --git a/mcs/class/System/System.ComponentModel/CancelEventArgs.cs b/mcs/class/System/System.ComponentModel/CancelEventArgs.cs new file mode 100644 index 00000000000..f09da6d64db --- /dev/null +++ b/mcs/class/System/System.ComponentModel/CancelEventArgs.cs @@ -0,0 +1,38 @@ +//------------------------------------------------------------------------------ +// +// System.ComponentModel.CancelEventArgs. +// +// Author: Asier Llano Palacios, asierllano@infonegocio.com +// +//------------------------------------------------------------------------------ + +using System; + +namespace System.ComponentModel { + + public class CancelEventArgs : EventArgs + { + private bool cancel; + + public CancelEventArgs() { + cancel = false; + } + + public CancelEventArgs( bool cancel ) + { + this.cancel = cancel; + } + + public bool Cancel { + get { + return cancel; + } + set { + cancel = value; + } + } + } + +} + + diff --git a/mcs/class/System/System.ComponentModel/CancelEventHandler.cs b/mcs/class/System/System.ComponentModel/CancelEventHandler.cs new file mode 100644 index 00000000000..10ef8bc2aa3 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/CancelEventHandler.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// +// System.ComponentModel.CancelEventHandler. +// +// Author: Asier Llano Palacios, asierllano@infonegocio.com +// +//------------------------------------------------------------------------------ + +using System; + +namespace System.ComponentModel { + + [Serializable] + public delegate void CancelEventHandler( object sender, CancelEventArgs e ); +} + + diff --git a/mcs/class/System/System.ComponentModel/CategoryAttribute.cs b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs new file mode 100755 index 00000000000..c68b49cda50 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs @@ -0,0 +1,227 @@ +// +// System.ComponentModel.CategoryAttribute.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +namespace System.ComponentModel { + + [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)] + public class CategoryAttribute : Attribute { + string category; + + static CategoryAttribute action, appearance, behaviour, data, def; + static CategoryAttribute design, drag_drop, focus, format, key; + static CategoryAttribute layout, mouse, window_style; + + public CategoryAttribute (string category) + { + this.category = category; + } + + public CategoryAttribute () + { + this.category = "Misc"; + } + + [MonoTODO] + protected virtual string GetLocalizedString (string value) + { + // FIXME: IMPLEMENT + + return category; + } + + public string Category { + get { + return category; + } + } + + public static CategoryAttribute Action { + get { + if (action != null) + return action; + + lock (typeof (CategoryAttribute)){ + if (action == null) + action = new CategoryAttribute ("Action"); + } + + return action; + } + } + + public static CategoryAttribute Appearance { + get { + if (appearance != null) + return appearance; + + lock (typeof (CategoryAttribute)){ + if (appearance == null) + appearance = new CategoryAttribute ("Appearance"); + } + + return appearance; + } + } + + public static CategoryAttribute Behaviour { + get { + if (behaviour != null) + return behaviour; + + lock (typeof (CategoryAttribute)){ + if (behaviour == null) + behaviour = new CategoryAttribute ("Action"); + } + + return behaviour; + } + } + + public static CategoryAttribute Data { + get { + if (data != null) + return data; + + lock (typeof (CategoryAttribute)){ + if (data == null) + data = new CategoryAttribute ("Data"); + } + + return data; + } + } + + public static CategoryAttribute Default { + get { + if (def != null) + return def; + + lock (typeof (CategoryAttribute)){ + if (def == null) + def = new CategoryAttribute ("Default"); + } + + return def; + } + } + + public static CategoryAttribute Design { + get { + if (design != null) + return design; + + lock (typeof (CategoryAttribute)){ + if (design == null) + design = new CategoryAttribute ("Design"); + } + + return design; + } + } + + public static CategoryAttribute DragDrop { + get { + if (drag_drop != null) + return drag_drop; + + lock (typeof (CategoryAttribute)){ + if (drag_drop == null) + drag_drop = new CategoryAttribute ("Drag Drop"); + } + + return drag_drop; + } + } + + public static CategoryAttribute Focus { + get { + if (focus != null) + return focus; + + lock (typeof (CategoryAttribute)){ + if (focus == null) + focus = new CategoryAttribute ("Focus"); + } + + return focus; + } + } + + public static CategoryAttribute Format { + get { + if (format != null) + return format; + + lock (typeof (CategoryAttribute)){ + if (format == null) + format = new CategoryAttribute ("Format"); + } + + return format; + } + } + + public static CategoryAttribute Key { + get { + if (key != null) + return key; + + lock (typeof (CategoryAttribute)){ + if (key == null) + key = new CategoryAttribute ("Key"); + } + + return key; + } + } + + public static CategoryAttribute Layout { + get { + if (layout != null) + return layout; + + lock (typeof (CategoryAttribute)){ + if (layout == null) + layout = new CategoryAttribute ("Layout"); + } + + return layout; + } + } + + public static CategoryAttribute Mouse { + get { + if (mouse != null) + return mouse; + + lock (typeof (CategoryAttribute)){ + if (mouse == null) + mouse = new CategoryAttribute ("Mouse"); + } + + return mouse; + } + } + + public static CategoryAttribute WindowStyle { + get { + if (window_style != null) + return window_style; + + lock (typeof (CategoryAttribute)){ + if (window_style == null) + window_style = new CategoryAttribute ("Window Style"); + } + + return window_style; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog new file mode 100644 index 00000000000..8c073ea121b --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ChangeLog @@ -0,0 +1,340 @@ +2003-01-08 Dick Porter <dick@ximian.com> + + * Win32Exception.cs (ComponentModel): Added EWOULDBLOCK + +2003-01-08 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TypeDescriptor.cs: use ICustomTypeDescriptor if the component + implements it. It's done for GetProperties and should be done for the + rest of methods present in ICustomTypeDescriptor. + +2003-01-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TypeDescriptor.cs: moved code from GetProperties (object) to (Type). + +2002-11-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultValueAttribute.cs: the attribute applies to All. + +2002-11-19 Duncan Mak <duncan@ximian.com> + + * DesignerAttribute.cs: + * EditorAttribute: Style changes. Gonzalo committed the build + fixes before I did. + +2002-11-19 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DesignerAttribute.cs: + * EditorAttribute.cs: fixed the build. + +2002-11-19 Alejandro Sánchez Acosta <raciel@es.gnu.org> + + * EditorAttribute: implemented. + * DesignerAttribute: implemented. + +2002-11-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Win32Exception.cs: added 10107 -> WASSYSCALLFAILURE. + +2002-11-04 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ListBindableAttribute.cs: implemented. + +2002-11-02 Duncan Mak <duncan@ximian.com> + + * InvalidEnumArgumentException.cs: Added. + +2002-10-30 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * EventHandlerList.cs: fixed bug #29535. + +2002-10-03 Dick Porter <dick@ximian.com> + + * Win32Exception.cs: Added ETIMEDOUT + +2002-09-30 Dick Porter <dick@ximian.com> + + * Win32Exception.cs: Sorted the errors, added EINPROGRESS + +2002-09-17 Asier Llano Palacios <asierllano@infonegocio.com> + + * CancelEventArgs.cs + * WarningException.cs + * CancelEventHandler.cs + * PropertyChangedEventHandler.cs + * IExtenderProvider.cs: Implemented + +2002-08-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * Component.cs: + * ComponentCollection.cs: + * Container.cs: + * MarshalByValueComponent.cs: IDisposable fixes. + +2002-08-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * BindableSupport.cs: + * Component.cs: + * EventDescriptorCollection.cs: + * ITypeDescriptorContext.cs: + * TypeConverter.cs: + * TypeDescriptor.cs: class status based fixes. + + * StringConverter.cs: implemented a couple of methods. + +2002-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * EnumConverter.cs: new file. + + * TypeConverter.cs: implemented a few simple methods. + + * TypeDescriptor.cs: + (GetConverter): initial support for converters of well-known types. + +2002-07-28 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DerivedPropertyDescriptor.cs: New file. Internal class. + + * PropertyDescriptorCollection.cs: almost fully implemented. + + * TypeDescriptor.cs: implemented a couple of GetProperties (). + +Wed Jul 24 13:14:30 CEST 2002 Paolo Molaro <lupus@ximian.com> + + * Component.cs: don't die if Disposed is null. + +2002-07-22 Tim Coleman <tim@timcoleman.com> + * RecommendedAsConfigurableAttribute.cs: new file added + for System.Web.Services build + +2002-07-22 Tim Coleman <tim@timcoleman.com> + * ExpandableObjectConverter.cs: Fix error with constructor + +2002-07-22 Tim Coleman <tim@timcoleman.com> + * TypeConverter.cs: Fixed bad stubb function + GetConvertToException () + +2002-07-22 Tim Coleman <tim@timcoleman.com> + * ComponentCollection.cs: Added reference to + ReadOnlyCollectionBase to make sure + that we inherit the appropriate methods. + Not sure why the Dispose() method is + required, but left for now. + +2002-07-22 Tim Coleman <tim@timcoleman.com> + * TypeConverter.cs: Added new stubbs + * BindableAttribute.cs: Added + * BindableSupport.cs: Added + * NotifyParentPropertyAttribute.cs: Added + * ExpandableObjectConverter.cs: Added + +2002-07-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * MemberDescriptor.cs: implemented Attributes and Category. + + * PropertyDescriptor.cs: implemented Converter. Declared GetValue (). + + * PropertyDescriptorCollection.cs: fixed indexers declaration. + + * ReadOnlyAttribute.cs: GetHashCoder (), Equals (), IsDefault () and + fixed value for Yes. + + * ToolboxItemAttribute.cs: fixed declaration of IsDefaultAttribute. + + * TypeConverter.cs: added SimplePropertyDescriptor class. + +2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * ToolboxItemAttribute.cs: New file. + +2002-07-13 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultEventAttribute.cs: new file. + +2002-07-12 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AttributeCollection.cs: fixlet. + +2002-07-07 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AttributeCollection.cs: finished implementation. + * TypeDescriptor.cs: implemented GetAttributes (object). + +2002-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * AttributeCollection.cs: initialize member variables. + + * RefreshEventArgs.cs: implemented. + * RefreshEventHandler.cs: New file. + + * TypeDescriptor.cs: fully stubbed out the remaining method. + +2002-07-06 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * DefaultPropertyAttribute.cs: New file. + +2002-06-23 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TypeConverter.cs: flushed local changes. + +2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * StringConverter.cs: stubbed out. + * TypeConverter.cs: stubbed the rest out and added some implementation. + + Five errors left when compiling System.Web in linux. + +2002-06-20 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TypeConverterAttribute.cs: attribute used by + TypeDescriptor.Getconverter (). + + * TypeDescriptor.cs: implemented GetConverter in the right way. + +2002-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * TypeConverter.cs: + * ITypeDescriptorContext.cs: + * TypeDescriptor.cs: implemented minimal set of features needed by xsp, + which uses ColorConverter. + +2002-05-12 Daniel Morgan <danmorg@sc.rr.com> + + * IComponent.cs + * ISite.cs: added using System + + * MarshalByValueComponent.cs: changed all throwing of Not ImplementedException + to // TODOs and added using System. The throwing of the exceptions prevented + System.Data from running. + +2002-05-10 Rodrigo Moya <rodrigo@ximian.com> + + * EventDescriptorCollection.cs (this[index]): call eventList[index], + not this[index], which issues an 'ambigous call' error on Linux. + +2002-05-07 Rodrigo Moya <rodrigo@ximian.com> + + * EventDescriptor.cs: added missing constructors. + + * EventDescriptorCollection.cs: fixed interface methods implementation + + * IDataErrorInfo.cs: + * IEditableObject.cs: new interfaces. + +2002-05-05 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * System.ComponentModel/AttributeCollection.cs: added a cast to make + it compile. + +2002-05-03 Rodrigo Moya <rodrigo@ximian.com> + + * AttributeCollection.cs: + * EventDescriptor.cs: + * EventDescriptorCollection.cs: + * ICustomTypeDescriptor.cs: new files. + +2002-05-01 Duncan Mak <duncan@ximian.com> + + * ListChangedType.cs: + * ListChangedEventHandler.cs: + * ListChangedEventArgs.cs: Added to fix build. + +2002-05-01 Miguel de Icaza <miguel@ximian.com> + + * PropertyDescriptorCollection.cs: Added the IList explicit + implementation methods. + + lots of bug fixes to get the build to compile again. + +2002-05-01 Duncan Mak <duncan@ximian.com> + + * ListSortDirection.cs: EnumChecked. + +2002-05-01 Rodrigo Moya <rodrigo@ximian.com> + + * ListSortDirection.cs: new enumeration. Please, somebody run + EnumCheck on it, as I don't have a windows machine. + + * PropertyDescriptorCollection.cs: new class. + + * ITypedList.cs: + * IBindingList.cs: new interfaces. + +2002-04-28 Duncan Mak <duncan@ximian.com> + + * CollectionChangeAction.cs: Changed enum layout to fit the MS + implementation. Please use EnumCheck! + +2002-04-28 Rodrigo Moya <rodrigo@ximian.com> + + * CollectionChangeAction.cs: new enumeration. + + * CategoryAttribute.cs: moved the 'return' keyword to the + end of the method, to avoid compilation errors on Linux for + all CategoryAttribute properties. + +2002-04-28 Rodrigo Moya <rodrigo@ximian.com> + + * IListSource.cs: + * ISupportInitialize.cs: + * MarshalByValueComponent.cs: new stubs, needed for System.Data + compilation. + + * PropertyChangedEventArgs.cs: + * CollectionChangeEventHandler.cs: + * CollectionChangeEventArgs.cs: implemented. + +2002-04-28 Lawrence Pit <loz@cable.a2000.nl> + + * Added error code 11001 to Win32Exception, used by Dns.c + +2002-04-04 Dick Porter <dick@ximian.com> + + * ISynchronizeInvoke.cs: Needed by Process + +2002-01-23 Dick Porter <dick@ximian.com> + + * Win32Exception.cs: implement, with support for looking up + runtime errors. + +2002-01-17 Miguel de Icaza <miguel@ximian.com> + + * Win32Exception.cs: Add. + +2002-01-05 Ravi Pratap <ravi@ximian.com> + + * CategoryAttribute.cs, Component.cs, ComponentCollection.cs: MonoTODO. + + * Container.cs, MemberDescriptor.cs, PropertyDescriptor.cs : Ditto. + +2001-10-27 Miguel de Icaza <miguel@ximian.com> + + * DesignerSerializationVisibilityAttribute.cs: Implemented. + + * DesignerSerializationVisibility.cs: New enumeration. + + * LocalizableAttribute.cs: Implemented. + + * BrowsableAttribute.cs: Implemented. + + * DesignOnlyAttribute.cs: Implemented. + + * DescriptionAttribute.cs: Implement. + + * MemberDescriptor.cs: Implemented. + + * CategoryAttribute.cs: implemented. + +2001-08-21 Nick Drochak <ndrochak@gol.com> + + * Component.cs: Eliminated compile errors by removing redundant fields and + using the ISite member instead. Also raised the Disposed event, but not + sure if it's correct now. Look for FIXME in the comments. + +2001-08-02 Miguel de Icaza <miguel@ximian.com> + + * EventHandlerList.cs: New file. + + * Container.cs, Component.cs, IContainer.cs, IComponent.cs, + ComponentCollection.cs, ISite.cs: New classes + diff --git a/mcs/class/System/System.ComponentModel/CollectionChangeAction.cs b/mcs/class/System/System.ComponentModel/CollectionChangeAction.cs new file mode 100644 index 00000000000..640e36e11ae --- /dev/null +++ b/mcs/class/System/System.ComponentModel/CollectionChangeAction.cs @@ -0,0 +1,20 @@ +// +// System.ComponentModel.CollectionChangeAction.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +namespace System.ComponentModel +{ + /// <summary> + /// Specifies how the collection is changed. + /// </summary> + public enum CollectionChangeAction { + Add = 1, + Remove = 2, + Refresh = 3 + } +} diff --git a/mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs b/mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs new file mode 100644 index 00000000000..6ace57b02b7 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/CollectionChangeEventArgs.cs @@ -0,0 +1,38 @@ +// +// System.ComponentModel.CollectionChangeEventArgs.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +namespace System.ComponentModel +{ + /// <summary> + /// Provides data for the CollectionChanged event. + /// </summary> + public class CollectionChangeEventArgs : EventArgs + { + private CollectionChangeAction changeAction; + private object theElement; + + public CollectionChangeEventArgs (CollectionChangeAction action, + object element) { + changeAction = action; + theElement = element; + } + + public virtual CollectionChangeAction Action { + get { + return changeAction; + } + } + + public virtual object Element { + get { + return theElement; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs b/mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs new file mode 100644 index 00000000000..6194af6f11e --- /dev/null +++ b/mcs/class/System/System.ComponentModel/CollectionChangeEventHandler.cs @@ -0,0 +1,14 @@ +// +// System.ComponentModel.CollectionChangeEventHandler.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +namespace System.ComponentModel +{ + public delegate void CollectionChangeEventHandler (object sender, + CollectionChangeEventArgs e); +} diff --git a/mcs/class/System/System.ComponentModel/Component.cs b/mcs/class/System/System.ComponentModel/Component.cs new file mode 100644 index 00000000000..f52975abd66 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/Component.cs @@ -0,0 +1,141 @@ +// +// System.ComponentModel.Component.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +using System; + +namespace System.ComponentModel { + + // <summary> + // Component class. + // </summary> + // + // <remarks> + // Longer description + // </remarks> + public class Component : MarshalByRefObject, IComponent, IDisposable { + + EventHandlerList event_handlers; + ISite mySite; + object disposedEvent = new object (); + + // <summary> + // Component Constructor + // </summary> + public Component () + { + event_handlers = null; + } + + // <summary> + // Get IContainer of this Component + // </summary> + public IContainer Container { + get { + return mySite.Container; + } + } + + protected bool DesignMode { + get { + return mySite.DesignMode; + } + } + + protected EventHandlerList Events { + get { + // Note: space vs. time tradeoff + // We create the object here if it's never be accessed before. This potentially + // saves space. However, we must check each time the propery is accessed to + // determine whether we need to create the object, which increases overhead. + // We could put the creation in the contructor, but that would waste space + // if it were never used. However, accessing this property would be faster. + if (null == event_handlers)
+ { + event_handlers = new EventHandlerList(); + } + return event_handlers; + } + } + + public virtual ISite Site { + get { + return mySite; + } + + set { + mySite = value; + } + } + + ~Component() + { + Dispose (false); + } + + // <summary> + // Dispose resources used by this component + // </summary> + public void Dispose () + { + Dispose (true); + GC.SuppressFinalize (this); + } + + // <summary> + // Controls disposal of resources used by this. + // </summary> + // + // <param name="release_all"> Controls which resources are released</param> + // + // <remarks> + // if release_all is set to true, both managed and unmanaged + // resources should be released. If release_all is set to false, + // only unmanaged resources should be disposed + // </remarks> + protected virtual void Dispose (bool release_all) + { + if (release_all) { + EventHandler eh = (EventHandler) Events [disposedEvent]; + if (eh != null) + eh (this, EventArgs.Empty); + } + mySite = null; + } + + // <summary> + // Implements the IServiceProvider interface + // </summary> + [MonoTODO] + protected virtual object GetService (Type service) + { + // FIXME: Not sure what this should do. + return null; + } + + public override string ToString () + { + if (mySite == null) + return GetType ().ToString (); + return String.Format ("{0} [{1}]", mySite.Name, GetType ().ToString ()); + } + // <summary> + // This event is called when the component is explicitly disposed. + // </summary> + public event EventHandler Disposed + { + add { + Events.AddHandler (disposedEvent, value); + } + remove { + Events.RemoveHandler (disposedEvent, value); + } + } + } + +} diff --git a/mcs/class/System/System.ComponentModel/ComponentCollection.cs b/mcs/class/System/System.ComponentModel/ComponentCollection.cs new file mode 100644 index 00000000000..80b85cf616d --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ComponentCollection.cs @@ -0,0 +1,55 @@ +// +// System.ComponentModel.ComponentCollection.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// Tim Coleman (tim@timcoleman.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// Copyright (C) Tim Coleman, 2002 +// + +using System.Collections; +using System.Runtime.InteropServices; + +namespace System.ComponentModel { + [ComVisible (true)] + public class ComponentCollection : ReadOnlyCollectionBase { + + #region Constructors + + [MonoTODO] + public ComponentCollection (IComponent[] components) + { + throw new NotImplementedException (); + } + + #endregion // Constructors + + #region Properties + + public virtual IComponent this [string name] { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + public virtual IComponent this [int index] { + [MonoTODO] + get { throw new NotImplementedException (); } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public void CopyTo (IComponent[] array, int index) + { + throw new NotImplementedException (); + } + + #endregion // Methods + + } +} + diff --git a/mcs/class/System/System.ComponentModel/Container.cs b/mcs/class/System/System.ComponentModel/Container.cs new file mode 100644 index 00000000000..d7eab7390ff --- /dev/null +++ b/mcs/class/System/System.ComponentModel/Container.cs @@ -0,0 +1,164 @@ +// +// System.ComponentModel.Container.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +namespace System.ComponentModel { + + // <summary> + // Container class: encapsulates components. + // </summary> + // + // <remarks> + // + // </remarks> + public class Container : IContainer, IDisposable { + ComponentCollection cc; + + // <summary> + // Auxiliary class to support the default behaviour of CreateSite + // </summary> + // + // <remarks> + // This is an internal class that is used to provide a + // default implementation of an ISite class. Container + // is just a default implementation of IContainer, and + // provides this as a way of getting started + // </remarks> + + class DefaultSite : ISite { + IComponent component; + IContainer container; + string name; + + public DefaultSite (string name, IComponent component, IContainer container) + { + this.component = component; + this.container = container; + this.name = name; + } + + public IComponent Component { + get { + return component; + } + } + + public IContainer Container { + get { + return container; + } + } + + [MonoTODO] + public bool DesignMode { + get { + // FIXME: should we provide a way to set + // this value? + return false; + } + } + + public string Name { + get { + return name; + } + + set { + name = value; + } + } + + [MonoTODO] + public virtual object GetService (Type t) + { + // FIXME: do not know what this is supposed to do. + return null; + } + } + + // <summary> + // Container constructor + // </summary> + public Container () + { + } + + public virtual ComponentCollection Components { + get { + return cc; + } + } + + // <summary> + // Adds an IComponent to the Container + // </summary> + [MonoTODO] + public virtual void Add (IComponent component) + { + // FIXME: Add this component to the ComponentCollection.cc + } + + // <summary> + // Adds an IComponent to the Container. With a name binding. + // </summary> + [MonoTODO] + public virtual void Add (IComponent component, string name) + { + // FIXME: Add this component to the ComponentCollection.cc + } + + // <summary> + // Returns an ISite for a component. + // <summary> + protected virtual ISite CreateSite (IComponent component, string name) + { + return new DefaultSite (name, component, this); + } + + public void Dispose () + { + Dispose (true); + GC.SuppressFinalize (this); + } + + bool disposed = false; + + protected virtual void Dispose (bool release_all) + { + if (disposed) + return; + disposed = true; + + if (release_all){ + //?? + } + + cc = null; + } + + ~Container () + { + Dispose (false); + } + + [MonoTODO] + protected virtual object GetService (Type service) + { + // FIXME: Not clear what GetService does. + + return null; + } + + [MonoTODO] + public virtual void Remove (IComponent component) + { + // FIXME: Add this component to the ComponentCollection.cc + } + } + +} diff --git a/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs b/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs new file mode 100644 index 00000000000..29495b6fb1d --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DefaultEventAttribute.cs @@ -0,0 +1,43 @@ +// +// System.ComponentModel.DefaultEventAttribute +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; + +namespace System.ComponentModel +{ + [AttributeUsage(AttributeTargets.Class)] + public sealed class DefaultEventAttribute : Attribute + { + private string eventName; + + public DefaultEventAttribute (string name) + { + eventName = name; + } + + public string Name + { + get { return eventName; } + } + + public override bool Equals (object o) + { + if (!(o is DefaultEventAttribute)) + return false; + + return (((DefaultEventAttribute) o).eventName == eventName); + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + } +} + diff --git a/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs b/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs new file mode 100644 index 00000000000..0e4b3c351f3 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DefaultPropertyAttribute.cs @@ -0,0 +1,43 @@ +// +// System.ComponentModel.DefaultPropertyAttribute +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; + +namespace System.ComponentModel +{ + [AttributeUsage(AttributeTargets.Class)] + public sealed class DefaultPropertyAttribute : Attribute + { + private string property_name; + + public DefaultPropertyAttribute (string name) + { + property_name = name; + } + + public string Name + { + get { return property_name; } + } + + public override bool Equals (object o) + { + if (!(o is DefaultPropertyAttribute)) + return false; + + return (((DefaultPropertyAttribute) o).Name == property_name); + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + } +} + diff --git a/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs b/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs new file mode 100755 index 00000000000..9997d994224 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DefaultValueAttribute.cs @@ -0,0 +1,133 @@ +using System;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Specifies the default value for a property.
+ /// </summary>
+
+ [MonoTODO("Needs testing. DefaultValueAttribute(System.Type type, string value) is not implemented. Value has no description.")]
+ [AttributeUsage(AttributeTargets.All)]
+ public sealed class DefaultValueAttribute : Attribute
+ {
+
+ private object defaultValue;
+
+ /// <summary>
+ /// FIXME: Summary description for Value.
+ /// </summary>
+ public object Value
+ {
+ get
+ {
+ return defaultValue;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class.
+ /// </summary>
+ /// <param name="value">An System.Object that represents the default value.</param>
+ public DefaultValueAttribute(object value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a System.Boolean value.
+ /// </summary>
+ /// <param name="value">An System.Boolean that represents the default value.</param>
+ public DefaultValueAttribute(bool value)
+ {
+ defaultValue = value;
+ }
+
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using an 8-bit unsigned integer.
+ /// </summary>
+ /// <param name="value">An 8-bit unsigned integer that is the default value.</param>
+ public DefaultValueAttribute(byte value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a Unicode character.
+ /// </summary>
+ /// <param name="value">A Unicode character that is the default value.</param>
+ public DefaultValueAttribute(char value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a double-precision floating point number.
+ /// </summary>
+ /// <param name="value">A double-precision floating point number that is the default value.</param>
+ public DefaultValueAttribute(double value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a 32-bit signed integer.
+ /// </summary>
+ /// <param name="value">A 32-bit signed integer that is the default value.</param>
+ public DefaultValueAttribute(int value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a 64-bit signed integer.
+ /// </summary>
+ /// <param name="value">A 64-bit signed integer that is the default value.</param>
+ public DefaultValueAttribute(long value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a 16-bit signed integer.
+ /// </summary>
+ /// <param name="value">A 16-bit signed integer that is the default value.</param>
+ public DefaultValueAttribute(short value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a single-precision floating point number.
+ /// </summary>
+ /// <param name="value">A single-precision floating point number that is the default value.</param>
+ public DefaultValueAttribute(System.Single value)
+ {
+ defaultValue = value;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class using a System.String.
+ /// </summary>
+ /// <param name="value">A System.String that is the default value.</param>
+ public DefaultValueAttribute(string value)
+ {
+ defaultValue = value;
+ }
+
+ /*
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.DefaultValueAttribute class, converting the specified value to the specified type, and using an invariant culture as the translation context.
+ /// </summary>
+ /// <param name="type">A System.Type that represents the type to convert the value to.</param>
+ /// <param name="value">A System.String that can be converted to the type using the System.ComponentModel.TypeConverter for the type and the U.S. English culture.</param>
+ public DefaultValueAttribute(System.Type type, string value)
+ {
+ //FIXME
+ throw new NotImplementedException();
+ }
+ */
+ }
+
+}
+
diff --git a/mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs b/mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs new file mode 100644 index 00000000000..60ba9006477 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DerivedPropertyDescriptor.cs @@ -0,0 +1,106 @@ +// +// System.ComponentModel.DerivedPropertyDescriptor +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// +using System; +using System.Reflection; + +namespace System.ComponentModel +{ + class DerivedPropertyDescriptor : PropertyDescriptor + { + bool readOnly; + Type componentType; + Type propertyType; + PropertyInfo prop; + + protected DerivedPropertyDescriptor (string name, Attribute [] attrs) + : base (name, attrs) + { + } + + public DerivedPropertyDescriptor (string name, Attribute [] attrs, int dummy) + : this (name, attrs) + { + } + + public void SetReadOnly (bool value) + { + readOnly = value; + } + + public void SetComponentType (Type type) + { + componentType = type; + } + + public void SetPropertyType (Type type) + { + propertyType = type; + } + + public override object GetValue (object component) + { + if (prop == null) + prop = componentType.GetProperty (Name); + + return prop.GetValue (component, null); + } + + public override void SetValue(object component, object value) { + + if (prop == null) + prop = componentType.GetProperty (Name); + + prop.SetValue (component, value, null); + } + + [MonoTODO] + public override void ResetValue(object component) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool CanResetValue(object component) { + + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool ShouldSerializeValue(object component) { + + throw new NotImplementedException (); + } + + public override Type ComponentType + { + get { + return componentType; + } + + } + + public override bool IsReadOnly + { + get { + return readOnly; + + } + + } + + public override Type PropertyType + { + get { + return propertyType; + } + + } + } +} + diff --git a/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs b/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs new file mode 100755 index 00000000000..03e6f411d78 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DescriptionAttribute.cs @@ -0,0 +1,46 @@ +// +// System.ComponentModel.DescriptionAttribute.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +namespace System.ComponentModel { + + [AttributeUsage (AttributeTargets.Property | AttributeTargets.Event)] + public class DescriptionAttribute : Attribute { + string desc; + + public DescriptionAttribute (string name) + { + desc = name; + } + + public DescriptionAttribute () + { + desc = ""; + } + + public virtual string Description { + get { + return DescriptionValue; + } + } + + // + // Notice that the default Description implementation uses this by default + // + protected string DescriptionValue { + get { + return desc; + } + + set { + desc = value; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs b/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs new file mode 100755 index 00000000000..81b39db62f1 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DesignOnlyAttribute.cs @@ -0,0 +1,37 @@ +// +// System.ComponentModel.DesignOnlyAttribute.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +namespace System.ComponentModel { + + [AttributeUsage (AttributeTargets.Property)] + public sealed class DesignOnlyAttribute : Attribute { + bool design_only; + + public static readonly DesignOnlyAttribute No; + public static readonly DesignOnlyAttribute Yes; + + static DesignOnlyAttribute () + { + No = new DesignOnlyAttribute (false); + Yes = new DesignOnlyAttribute (false); + } + + public DesignOnlyAttribute (bool design_only) + { + this.design_only = design_only; + } + + public bool IsDesignOnly { + get { + return design_only; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs b/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs new file mode 100644 index 00000000000..6f5868fedc3 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DesignTimeVisibleAttribute.cs @@ -0,0 +1,68 @@ +// +// System.ComponentModel.DesignTimeVisibleAttribute.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +namespace System.ComponentModel { + [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface)] + public sealed class DesignTimeVisibleAttribute : Attribute + { + #region Fields + + bool visible; + + public static readonly DesignTimeVisibleAttribute Default = new DesignTimeVisibleAttribute (true); + public static readonly DesignTimeVisibleAttribute No = new DesignTimeVisibleAttribute (false); + public static readonly DesignTimeVisibleAttribute Yes = new DesignTimeVisibleAttribute (true); + + #endregion // Fields + + #region Constructors + + public DesignTimeVisibleAttribute () + : this (true) + { + } + + public DesignTimeVisibleAttribute (bool visible) + { + this.visible = visible; + } + + #endregion // Constructors + + #region Properties + + public bool Visible { + get { return visible; } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override bool Equals (object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override int GetHashCode () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool IsDefaultAttribute () + { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System/System.ComponentModel/DesignerAttribute.cs b/mcs/class/System/System.ComponentModel/DesignerAttribute.cs new file mode 100644 index 00000000000..7bb14ce35e1 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DesignerAttribute.cs @@ -0,0 +1,88 @@ +// +// System.ComponentModel.DesignerAttribute.cs +// +// Author: +// Alejandro Sánchez Acosta (raciel@es.gnu.org) +// +// (C) Alejandro Sánchez Acosta +// + +namespace System.ComponentModel { + + /// <summary> + /// Designer Attribute for classes. + /// </summary> + + /// <remarks> + /// </remarks> + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] + public sealed class DesignerAttribute : Attribute + { + string name; + string basetypename; + Type type; + Type basetype; + + public DesignerAttribute (string designerTypeName) + { + name = designerTypeName; + } + + public DesignerAttribute (Type designerType) + { + type = designerType; + } + + public DesignerAttribute (string designerTypeName, string designerBaseTypeName) + { + name = designerTypeName; + basetypename = designerBaseTypeName; + } + + public DesignerAttribute (string designerTypeName, Type designerBaseType) + { + name = designerTypeName; + basetype = designerBaseType; + } + + public DesignerAttribute (Type designerType, Type designerBaseType) + { + type = designerType; + basetype = designerBaseType; + } + + public string DesignerBaseTypeName { + get { + return basetypename; + } + } + + public string DesignerTypeName { + get { + return name; + } + } + + public override object TypeId { + get { + return this.GetType (); + } + } + + public override bool Equals (object obj) + { + if (!(obj is DesignerAttribute)) + return false; + return (((DesignerAttribute) obj).name == name) && + (((DesignerAttribute) obj).basetype == basetype) && + (((DesignerAttribute) obj).type == type) && + (((DesignerAttribute) obj).basetypename == basetypename); + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + } +} diff --git a/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs new file mode 100755 index 00000000000..d4291a842c8 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibility.cs @@ -0,0 +1,16 @@ +// +// System.ComponentModel.DesignerSerializationVisibility.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +namespace System.ComponentModel { + + public enum DesignerSerializationVisibility { + Hidden, Visible, Content + } +} diff --git a/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs new file mode 100755 index 00000000000..fd2fffec348 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/DesignerSerializationVisibilityAttribute.cs @@ -0,0 +1,42 @@ +// +// System.ComponentModel.DesignerSerializationVisibilityAttribute.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +namespace System.ComponentModel { + + [AttributeUsage (AttributeTargets.Property)] + public sealed class DesignerSerializationVisibilityAttribute : Attribute { + DesignerSerializationVisibility visibility; + + static DesignerSerializationVisibilityAttribute () + { + Content = new DesignerSerializationVisibilityAttribute ( + DesignerSerializationVisibility.Content); + Hidden = new DesignerSerializationVisibilityAttribute ( + DesignerSerializationVisibility.Hidden); + Visible = new DesignerSerializationVisibilityAttribute ( + DesignerSerializationVisibility.Visible); + } + + public DesignerSerializationVisibilityAttribute (DesignerSerializationVisibility vis) + { + visibility = vis; + } + + public static readonly DesignerSerializationVisibilityAttribute Content; + public static readonly DesignerSerializationVisibilityAttribute Hidden; + public static readonly DesignerSerializationVisibilityAttribute Visible; + + public DesignerSerializationVisibility Visibility { + get { + return visibility; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/EditorAttribute.cs b/mcs/class/System/System.ComponentModel/EditorAttribute.cs new file mode 100644 index 00000000000..3f3913b172f --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EditorAttribute.cs @@ -0,0 +1,85 @@ +// +// System.ComponentModel.EditorAttribute.cs +// +// Author: +// Alejandro Sánchez Acosta (raciel@es.gnu.org) +// +// (C) Alejandro Sánchez Acosta +// + +namespace System.ComponentModel { + + /// <summary> + /// Editor Attribute for classes. + /// </summary> + + [AttributeUsage (AttributeTargets.All)] + public sealed class EditorAttribute : Attribute { + + string name; + string basename; + Type baseType; + Type nametype; + + public EditorAttribute () + { + this.name = ""; + } + + public EditorAttribute (string typeName, string baseTypeName) + { + name = typeName; + basename = baseTypeName; + } + + public EditorAttribute (string typeName, Type baseType) + { + name = typeName; + this.baseType = baseType; + } + + public EditorAttribute (Type type, Type baseType) + { + nametype = type; + this.baseType = baseType; + } + + public string EditorBaseTypeName { + get { + return basename; + } + } + + public string EditorTypeName { + get { + return name; + } + } + + public override object TypeId { + get { + return this.GetType (); + } + } + + public override bool Equals (object obj) + { + if (!(obj is EditorAttribute)) + return false; + + return (((EditorAttribute) obj).name == name) && + (((EditorAttribute) obj).basename == basename) && + (((EditorAttribute) obj).baseType == baseType) && + (((EditorAttribute) obj).nametype == nametype); + + } + + public override int GetHashCode () + { + if (name == null) + return 0; + + return name.GetHashCode (); + } + } +} diff --git a/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs b/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs new file mode 100755 index 00000000000..912cdb13eed --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EditorBrowsableAttribute.cs @@ -0,0 +1,53 @@ +using System;
+
+namespace System.ComponentModel
+{
+
+ /// <summary>
+ /// Specifies that a property or method is viewable in an editor. This class cannot be inherited.
+ /// </summary>
+ [MonoTODO("Missing description for State. Only minimal testing.")]
+ [AttributeUsage(
+ AttributeTargets.Class|
+ AttributeTargets.Constructor|
+ AttributeTargets.Delegate|
+ AttributeTargets.Enum|
+ AttributeTargets.Event|
+ AttributeTargets.Field|
+ AttributeTargets.Interface|
+ AttributeTargets.Method|
+ AttributeTargets.Property|
+ AttributeTargets.Struct)]
+ public sealed class EditorBrowsableAttribute : Attribute
+ {
+ private System.ComponentModel.EditorBrowsableState state;
+
+ /// <summary>
+ /// FIXME: Summary description for State.
+ /// </summary>
+ public System.ComponentModel.EditorBrowsableState State
+ {
+ get
+ {
+ return state;
+ }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.EditorBrowsableAttribute class with an System.ComponentModel.EditorBrowsableState.
+ /// </summary>
+ /// <param name="state">The System.ComponentModel.EditorBrowsableState to set System.ComponentModel.EditorBrowsableAttribute.State to.</param>
+ public EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState state)
+ {
+ this.state = state;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the System.ComponentModel.EditorBrowsableAttribute class with an System.ComponentModel.EditorBrowsableState == System.ComponentModel.EditorBrowsableState.Always.
+ /// </summary>
+ public EditorBrowsableAttribute()
+ {
+ this.state = System.ComponentModel.EditorBrowsableState.Always;
+ }
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/EditorBrowsableState.cs b/mcs/class/System/System.ComponentModel/EditorBrowsableState.cs new file mode 100755 index 00000000000..eab0d651bb8 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EditorBrowsableState.cs @@ -0,0 +1,34 @@ +//
+// ProjectData.cs
+//
+// Author:
+// Martin Adoue (martin@cwanet.com)
+//
+// (C) 2002 Martin Adoue
+//
+
+using System;
+
+namespace System.ComponentModel
+{
+
+ /// <summary>
+ /// Specifies the browsable state of a property or method from within an editor.
+ /// </summary>
+ public enum EditorBrowsableState
+ {
+ /// <summary>
+ /// The property or method is always browsable from within an editor.
+ /// </summary>
+ Always = 0,
+ /// <summary>
+ /// The property or method is never browsable from within an editor.
+ /// </summary>
+ Never = 1,
+ /// <summary>
+ /// The property or method is a feature that only advanced users should see. An editor can either show or hide such properties.
+ /// </summary>
+ Advanced = 2
+ }
+
+}
diff --git a/mcs/class/System/System.ComponentModel/EnumConverter.cs b/mcs/class/System/System.ComponentModel/EnumConverter.cs new file mode 100644 index 00000000000..46f43f41757 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EnumConverter.cs @@ -0,0 +1,92 @@ +// +// System.ComponentModel.EnumConverter +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// +using System; +using System.Globalization; + +namespace System.ComponentModel +{ + public class EnumConverter : TypeConverter + { + private Type type; + private StandardValuesCollection stdValues; + + public EnumConverter (Type type) + { + this.type = type; + } + + [MonoTODO] + public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return base.CanConvertTo (context, destinationType); + } + + [MonoTODO] + public override object ConvertTo (ITypeDescriptorContext context, + CultureInfo culture, + object value, + Type destinationType) + { + if (destinationType == typeof (string)) + return value.ToString (); + return base.ConvertTo (context, culture, value, destinationType); + } + + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof (string)) + return true; + return base.CanConvertFrom (context, sourceType); + } + + public override object ConvertFrom (ITypeDescriptorContext context, + CultureInfo culture, + object value) + { + string val = value as string; + if (val == null) + return base.ConvertFrom(context, culture, value); + + string [] subValues = val.Split (new char [] {','}); + + long longResult = 0; + foreach (string s in subValues) + longResult |= (long) Enum.Parse (type, s, true); + + return Enum.ToObject (type, longResult); + } + + public override bool IsValid (ITypeDescriptorContext context, object value) + { + return Enum.IsDefined (type, value); + } + + public override bool GetStandardValuesSupported (ITypeDescriptorContext context) + { + return true; + } + + public override bool GetStandardValuesExclusive (ITypeDescriptorContext context) + { + return !(type.IsDefined (typeof (FlagsAttribute), false)); + } + + public override StandardValuesCollection GetStandardValues (ITypeDescriptorContext context) + { + if (stdValues == null) { + Array values = Enum.GetValues (type); + Array.Sort (values); + stdValues = new StandardValuesCollection (values); + } + return stdValues; + } + } + +} + diff --git a/mcs/class/System/System.ComponentModel/EventDescriptor.cs b/mcs/class/System/System.ComponentModel/EventDescriptor.cs new file mode 100644 index 00000000000..211c07dac9d --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EventDescriptor.cs @@ -0,0 +1,26 @@ +// +// System.ComponentModel.EventDescriptor.cs +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc. 2002 +// + +namespace System.ComponentModel +{ + public abstract class EventDescriptor : MemberDescriptor + { + protected EventDescriptor (MemberDescriptor desc) : base (desc) + { + } + + protected EventDescriptor (MemberDescriptor desc, Attribute[] attrs) : base (desc, attrs) + { + } + + protected EventDescriptor(string str, Attribute[] attrs) : base (str, attrs) + { + } + } +} diff --git a/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs b/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs new file mode 100644 index 00000000000..67ab149d9ea --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs @@ -0,0 +1,167 @@ +// +// System.ComponentModel.EventDescriptorCollection.cs +// +// Author: Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc. +// + +using System.Collections; + +namespace System.ComponentModel +{ + public class EventDescriptorCollection : IList, ICollection, IEnumerable + { + private ArrayList eventList; + + public static readonly EventDescriptorCollection Empty; + + public EventDescriptorCollection (EventDescriptor[] events) { + for (int i = 0; i < events.Length; i++) + this.Add (events[i]); + } + + public int Add (EventDescriptor value) { + return eventList.Add (value); + } + + public void Clear () { + eventList.Clear (); + } + + public bool Contains (EventDescriptor value) { + return eventList.Contains (value); + } + + [MonoTODO] + public virtual EventDescriptor Find (string name, bool ignoreCase) { + throw new NotImplementedException (); + } + + public IEnumerator GetEnumerator () { + return eventList.GetEnumerator (); + } + + public int IndexOf (EventDescriptor value) { + return eventList.IndexOf (value); + } + + public void Insert (int index, EventDescriptor value) { + eventList.Insert (index, value); + } + + public void Remove (EventDescriptor value) { + eventList.Remove (value); + } + + public void RemoveAt (int index) { + eventList.RemoveAt (index); + } + + + [MonoTODO] + public virtual EventDescriptorCollection Sort () { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual EventDescriptorCollection Sort (IComparer comparer) { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual EventDescriptorCollection Sort (string[] order) { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual EventDescriptorCollection Sort (string[] order, + IComparer comparer) { + throw new NotImplementedException (); + } + + [MonoTODO] + protected virtual EventDescriptorCollection InternalSort (IComparer comparer) { + throw new NotImplementedException (); + } + + [MonoTODO] + protected virtual EventDescriptorCollection InternalSort (string[] order) { + throw new NotImplementedException (); + } + + public int Count { + get { + return eventList.Count; + } + } + + public virtual EventDescriptor this[string name] { + [MonoTODO] + get { + throw new NotImplementedException (); + } + } + + public virtual EventDescriptor this[int index] { + get { + return (EventDescriptor) eventList[index]; + } + } + + // IList methods + + int IList.Add (object value) { + return Add ((EventDescriptor) value); + } + + bool IList.Contains (object value) { + return Contains ((EventDescriptor) value); + } + + int IList.IndexOf (object value) { + return IndexOf ((EventDescriptor) value); + } + + void IList.Insert (int index, object value) { + Insert (index, (EventDescriptor) value); + } + + void IList.Remove (object value) { + Remove ((EventDescriptor) value); + } + + bool IList.IsFixedSize { + get { return false; } + } + + bool IList.IsReadOnly { + get { return false; } + } + + object IList.this[int index] { + get { + return eventList[index]; + } + [MonoTODO] + set { + throw new NotImplementedException (); + } + } + + // ICollection methods + + [MonoTODO] + void ICollection.CopyTo (Array array, int index) { + throw new NotImplementedException (); + } + + bool ICollection.IsSynchronized { + get { return false; } + } + + object ICollection.SyncRoot { + get { return null; } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/EventHandlerList.cs b/mcs/class/System/System.ComponentModel/EventHandlerList.cs new file mode 100644 index 00000000000..48e48a0e8d7 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/EventHandlerList.cs @@ -0,0 +1,69 @@ +// +// System.ComponentModel.EventHandlerList.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +using System; +using System.Collections; + +namespace System.ComponentModel { + + // <summary> + // List of Event delegates. + // </summary> + // + // <remarks> + // Longer description + // </remarks> + public sealed class EventHandlerList : IDisposable { + Hashtable table; + + public EventHandlerList () + { + } + + public Delegate this [object key] { + get { + if (table == null) + return null; + + return table [key] as Delegate; + } + + set { + AddHandler (key, value); + } + } + + public void AddHandler (object key, Delegate value) + { + if (table == null) + table = new Hashtable (); + + Delegate prev = table [key] as Delegate; + prev = Delegate.Combine (prev, value); + table [key] = prev; + } + + public void RemoveHandler (object key, Delegate value) + { + if (table == null) + return; + + Delegate prev = table [key] as Delegate; + prev = Delegate.Remove (prev, value); + table [key] = prev; + } + + public void Dispose () + { + table = null; + } + } + +} diff --git a/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs b/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs new file mode 100644 index 00000000000..1db14cd4fdd --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ExpandableObjectConverter.cs @@ -0,0 +1,41 @@ +// +// System.ComponentModel.ExpandableObjectConverter.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +using System; + +namespace System.ComponentModel { + public class ExpandableObjectConverter : TypeConverter { + + #region Constructors + + [MonoTODO] + public ExpandableObjectConverter () + { + throw new NotImplementedException (); + } + + #endregion // Constructors + + #region Methods + + [MonoTODO] + public override PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value, Attribute[] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool GetPropertiesSupported (ITypeDescriptorContext context) + { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System/System.ComponentModel/IBindingList.cs b/mcs/class/System/System.ComponentModel/IBindingList.cs new file mode 100644 index 00000000000..8de1b197f17 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IBindingList.cs @@ -0,0 +1,69 @@ +// +// System.ComponentModel.IBindingList.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +using System.Collections; + +namespace System.ComponentModel +{ + /// <summary> + /// Provides the features required to support both complex and simple scenarios when binding to a data source. + /// </summary> + public interface IBindingList : IList, ICollection, IEnumerable + { + void AddIndex (PropertyDescriptor property); + + object AddNew (); + + void ApplySort (PropertyDescriptor property, ListSortDirection direction); + + int Find (PropertyDescriptor property, object key); + + void RemoveIndex (PropertyDescriptor property); + + void RemoveSort (); + + bool AllowEdit { + get; + } + + bool AllowNew { + get; + } + + bool AllowRemove { + get; + } + + bool IsSorted { + get; + } + + ListSortDirection SortDirection { + get; + } + + PropertyDescriptor SortProperty { + get; + } + + bool SupportsChangeNotification { + get; + } + + bool SupportsSearching { + get; + } + + bool SupportsSorting { + get; + } + + event ListChangedEventHandler ListChanged; + } +} diff --git a/mcs/class/System/System.ComponentModel/IComponent.cs b/mcs/class/System/System.ComponentModel/IComponent.cs new file mode 100644 index 00000000000..347bd2beed7 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IComponent.cs @@ -0,0 +1,22 @@ +// +// System.ComponentModel.IComponent.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +using System; + +namespace System.ComponentModel { + + public interface IComponent : IDisposable { + + ISite Site { + get; set; + } + + event EventHandler Disposed; + } +} diff --git a/mcs/class/System/System.ComponentModel/IContainer.cs b/mcs/class/System/System.ComponentModel/IContainer.cs new file mode 100644 index 00000000000..7bab5da610d --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IContainer.cs @@ -0,0 +1,24 @@ +// +// System.ComponentModel.IContainer.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +namespace System.ComponentModel { + + public interface IContainer : IDisposable { + + ComponentCollection Components { + get; + } + + void Add (IComponent component); + + void Add (IComponent component, string name); + + void Remove (IComponent component); + } +} diff --git a/mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs b/mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs new file mode 100644 index 00000000000..c716355a601 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ICustomTypeDescriptor.cs @@ -0,0 +1,38 @@ +// +// System.ComponentModel.ICustomTypeDescriptor.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// + +namespace System.ComponentModel +{ + public interface ICustomTypeDescriptor + { + AttributeCollection GetAttributes(); + + string GetClassName(); + + string GetComponentName(); + + TypeConverter GetConverter(); + + EventDescriptor GetDefaultEvent(); + + PropertyDescriptor GetDefaultProperty(); + + object GetEditor(Type editorBaseType); + + EventDescriptorCollection GetEvents(); + + EventDescriptorCollection GetEvents(Attribute[] arr); + + PropertyDescriptorCollection GetProperties(); + + PropertyDescriptorCollection GetProperties(Attribute[] arr); + + object GetPropertyOwner(PropertyDescriptor pd); + } +} diff --git a/mcs/class/System/System.ComponentModel/IDataErrorInfo.cs b/mcs/class/System/System.ComponentModel/IDataErrorInfo.cs new file mode 100644 index 00000000000..a37627d07ca --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IDataErrorInfo.cs @@ -0,0 +1,18 @@ +// +// System.ComponentModel.IDataErrorInfo.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// + +namespace System.ComponentModel +{ + public interface IDataErrorInfo + { + string Error { get; } + + string this[string columnName] { get; } + } +} diff --git a/mcs/class/System/System.ComponentModel/IEditableObject.cs b/mcs/class/System/System.ComponentModel/IEditableObject.cs new file mode 100644 index 00000000000..40e4d105c17 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IEditableObject.cs @@ -0,0 +1,20 @@ +// +// System.ComponentModel.IEditableObject.cs +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// +// Authors: +// Rodrigo Moya (rodrigo@ximian.com) +// + +namespace System.ComponentModel +{ + public interface IEditableObject + { + void BeginEdit(); + + void CancelEdit(); + + void EndEdit(); + } +} diff --git a/mcs/class/System/System.ComponentModel/IExtenderProvider.cs b/mcs/class/System/System.ComponentModel/IExtenderProvider.cs new file mode 100644 index 00000000000..6e3440d4d25 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IExtenderProvider.cs @@ -0,0 +1,18 @@ +//------------------------------------------------------------------------------ +// +// System.ComponentModel.IExtenderProvider. +// +// Author: Asier Llano Palacios, asierllano@infonegocio.com +// +//------------------------------------------------------------------------------ + +using System; + +namespace System.ComponentModel { + + public interface IExtenderProvider { + bool CanExtend( object extendee ); + } +} + + diff --git a/mcs/class/System/System.ComponentModel/IListSource.cs b/mcs/class/System/System.ComponentModel/IListSource.cs new file mode 100644 index 00000000000..f0d27cfec9b --- /dev/null +++ b/mcs/class/System/System.ComponentModel/IListSource.cs @@ -0,0 +1,23 @@ +// +// System.ComponentModel.IListSource.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +using System.Collections; + +namespace System.ComponentModel +{ + /// <summary> + /// Provides functionality to an object to return a list that can be bound to a data source. + /// </summary> + public interface IListSource + { + IList GetList (); + + bool ContainsListCollection { get; } + } +} diff --git a/mcs/class/System/System.ComponentModel/ISite.cs b/mcs/class/System/System.ComponentModel/ISite.cs new file mode 100644 index 00000000000..dca26662b6f --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ISite.cs @@ -0,0 +1,23 @@ +// +// System.ComponentModel.Component.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +using System; + +namespace System.ComponentModel { + + public interface ISite : IServiceProvider { + IComponent Component { get; } + + IContainer Container { get; } + + bool DesignMode { get; } + + string Name { get; set; } + } +} diff --git a/mcs/class/System/System.ComponentModel/ISupportInitialize.cs b/mcs/class/System/System.ComponentModel/ISupportInitialize.cs new file mode 100644 index 00000000000..d5b15f6ee6d --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ISupportInitialize.cs @@ -0,0 +1,23 @@ +// +// System.ComponentModel.ISupportInitialize.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +namespace System.ComponentModel +{ + /// <summary> + /// Specifies that this object supports a simple, transacted notification for batch initialization. + /// </summary> + public interface ISupportInitialize + { + void BeginInit (); + + void EndInit (); + } + +} + diff --git a/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs b/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs new file mode 100755 index 00000000000..e5cad4e0739 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ISynchronizeInvoke.cs @@ -0,0 +1,26 @@ +// +// System.ComponentModel.ISynchronizeInvoke.cs +// +// Authors: +// Dick Porter (dick@ximian.com) +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// + +using System; + +namespace System.ComponentModel +{ + public interface ISynchronizeInvoke + { + bool InvokeRequired { + get; + } + + IAsyncResult BeginInvoke(Delegate method, object[] args); + + object EndInvoke(IAsyncResult result); + + object Invoke(Delegate method, object[] args); + } +} diff --git a/mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs b/mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs new file mode 100644 index 00000000000..1da741e37f2 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ITypeDescriptorContext.cs @@ -0,0 +1,29 @@ +// +// System.ComponentModel.ITypeDescriptorContext +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; + +namespace System.ComponentModel +{ + +public interface ITypeDescriptorContext : IServiceProvider +{ + IContainer Container { get; } + + object Instance { get; } + + PropertyDescriptor PropertyDescriptor { get; } + + void OnComponentChanged (); + + bool OnComponentChanging (); +} + +} + diff --git a/mcs/class/System/System.ComponentModel/ITypedList.cs b/mcs/class/System/System.ComponentModel/ITypedList.cs new file mode 100644 index 00000000000..8ecdeeef7eb --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ITypedList.cs @@ -0,0 +1,24 @@ +// +// System.ComponentModel.ITypedList.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +using System.Collections; + +namespace System.ComponentModel +{ + /// <summary> + /// Provides functionality to discover the schema for a bindable list, where the properties available for binding differ from the public properties of the object to bind to. For instance, using a DataView object that represents a customer table, you want to bind to the properties on the customer object that the DataView represents, not the properties of the DataView. + /// </summary> + public interface ITypedList + { + PropertyDescriptorCollection GetItemProperties ( + PropertyDescriptor[] listAccessors); + + string GetListName (PropertyDescriptor[] listAccessors); + } +} diff --git a/mcs/class/System/System.ComponentModel/Int32Converter.cs b/mcs/class/System/System.ComponentModel/Int32Converter.cs new file mode 100644 index 00000000000..3fd5e94e0c4 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/Int32Converter.cs @@ -0,0 +1,10 @@ +// +// System.ComponentModel.Int32Converter +// +// + +namespace System.ComponentModel { + public class Int32Converter : BaseNumberConverter { + + } +} diff --git a/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs b/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs new file mode 100644 index 00000000000..6a66b871e87 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/InvalidEnumArgumentException.cs @@ -0,0 +1,42 @@ +// +// System.ComponentModel.InvalidEnumArgumentException.cs +// +// Author: +// Duncan Mak (duncan@ximian.com) +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// + +using System; + +namespace System.ComponentModel +{ + [Serializable] + public class InvalidEnumArgumentException : ArgumentException + { + string msg = String.Empty; + + public InvalidEnumArgumentException () : base () + { + } + + public InvalidEnumArgumentException (string message) + { + msg = message; + } + + public InvalidEnumArgumentException (string argumentName, int invalidValue, Type enumClass) + { + msg = argumentName + " is invalid because this value, " + invalidValue + " is not of type " + enumClass.Name; + } + + public override string Message { + get { + if (ParamName == String.Empty) + return msg; + else + return ParamName + ": " + msg; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs b/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs new file mode 100644 index 00000000000..d09bd565471 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ListBindableAttribute.cs @@ -0,0 +1,69 @@ +// +// System.ComponentModel.ListBindableAttribute +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; + +namespace System.ComponentModel +{ + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public sealed class ListBindableAttribute : Attribute + { + public static readonly ListBindableAttribute Default = new ListBindableAttribute (true, true); + public static readonly ListBindableAttribute No = new ListBindableAttribute (false, true); + public static readonly ListBindableAttribute Yes = new ListBindableAttribute (true, true); + + bool deflt; + bool bindable; + + private ListBindableAttribute (bool listBindable, bool deflt) + { + this.deflt = deflt; + bindable = listBindable; + } + + public ListBindableAttribute (bool listBindable) + { + deflt = false; + bindable = true; + } + + public ListBindableAttribute (BindableSupport flags) + { + bindable = (flags == BindableSupport.Yes); + deflt = (flags == BindableSupport.Default); + } + + public override bool Equals (object obj) + { + if (!(obj is ListBindableAttribute)) + return false; + + return (((ListBindableAttribute) obj).bindable == bindable && + ((ListBindableAttribute) obj).deflt == deflt); + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + + public override bool IsDefaultAttribute () + { + return deflt; + } + + public bool ListBindable + { + get { + return bindable; + } + } + } +} + diff --git a/mcs/class/System/System.ComponentModel/ListChangedEventArgs.cs b/mcs/class/System/System.ComponentModel/ListChangedEventArgs.cs new file mode 100755 index 00000000000..6004144b880 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ListChangedEventArgs.cs @@ -0,0 +1,53 @@ +// +// System.ComponentModel.ListChangedEventArgs.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// (C) Ximian, Inc. +// + +using System.ComponentModel; + +namespace System.ComponentModel { + public class ListChangedEventArgs : EventArgs + { + + ListChangedType changedType; + int oldIndex; + int newIndex; + + public ListChangedEventArgs (ListChangedType listChangedType, + int newIndex) + { + this.changedType = listChangedType; + this.newIndex = newIndex; + } + + [MonoTODO] + public ListChangedEventArgs (ListChangedType listChangedType, + PropertyDescriptor propDesc) + { + this.changedType = listChangedType; + } + + public ListChangedEventArgs (ListChangedType listChangedType, + int newIndex, int oldIndex) + { + this.changedType = listChangedType; + this.newIndex = newIndex; + this.oldIndex = oldIndex; + } + + public ListChangedType ListChangedType { + get { return changedType; } + } + + public int OldIndex { + get { return oldIndex; } + } + + public int NewIndex { + get { return newIndex; } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/ListChangedEventHandler.cs b/mcs/class/System/System.ComponentModel/ListChangedEventHandler.cs new file mode 100755 index 00000000000..02f5065b886 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ListChangedEventHandler.cs @@ -0,0 +1,15 @@ +// +// System.ComponentModel.ListChangedEventHandler.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// (C) Ximian, Inc. +// + +using System; + +namespace System.ComponentModel { + [Serializable] + public delegate void ListChangedEventHandler(object sender, + ListChangedEventArgs e); +} diff --git a/mcs/class/System/System.ComponentModel/ListChangedType.cs b/mcs/class/System/System.ComponentModel/ListChangedType.cs new file mode 100755 index 00000000000..b7eff8aa1fe --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ListChangedType.cs @@ -0,0 +1,23 @@ +// +// System.ComponentModel.ListChangedType.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// (C) Ximian, Inc. +// + +namespace System.ComponentModel { + public enum ListChangedType { + Reset = 0, + ItemAdded = 1, + ItemDeleted = 2, + ItemMoved = 3, + ItemChanged = 4, + PropertyDescriptorAdded = 5, + PropertyDescriptorDeleted = 6, + PropertyDescriptorChanged = 7 + } +} + + + diff --git a/mcs/class/System/System.ComponentModel/ListSortDirection.cs b/mcs/class/System/System.ComponentModel/ListSortDirection.cs new file mode 100644 index 00000000000..b58a39a4170 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ListSortDirection.cs @@ -0,0 +1,20 @@ +// +// System.ComponentModel.ListSortDirection.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Rodrigo Moya, 2002 +// + +namespace System.ComponentModel +{ + /// <summary> + /// Specifies the direction of a sort operation. + /// </summary> + [Serializable] + public enum ListSortDirection { + Ascending = 0, + Descending = 1 + } +} diff --git a/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs b/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs new file mode 100755 index 00000000000..b5425ef8e53 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/LocalizableAttribute.cs @@ -0,0 +1,40 @@ +// +// System.ComponentModel.LocalizableAttribute.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// +// + +using System; + +namespace System.ComponentModel { + + [AttributeUsage (AttributeTargets.Property)] + public sealed class LocalizableAttribute : Attribute { + bool localizable; + + public static readonly LocalizableAttribute No; + public static readonly LocalizableAttribute Yes; + + static LocalizableAttribute () + { + No = new LocalizableAttribute (false); + Yes = new LocalizableAttribute (false); + } + + public LocalizableAttribute (bool localizable) + { + this.localizable = localizable; + } + + public bool IsLocalizable { + get { + return localizable; + } + } + + } +} diff --git a/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs b/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs new file mode 100644 index 00000000000..0a701ff45d7 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/MarshalByValueComponent.cs @@ -0,0 +1,90 @@ +// +// System.ComponentModel.MarshalByValueComponent.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +using System; + +namespace System.ComponentModel +{ + /// <summary> + /// Implements IComponent and provides the base implementation for remotable components that are marshaled by value (a copy of the serialized object is passed). + /// </summary> + public class MarshalByValueComponent : IComponent, IDisposable, IServiceProvider + { + [MonoTODO] + public MarshalByValueComponent () { + // TODO: need to implement for some component model + // but do not throw a NotImplementedException + } + + public void Dispose () + { + Dispose (true); + GC.SuppressFinalize (this); + } + + [MonoTODO] + protected virtual void Dispose (bool disposing) + { + if (disposing) { + // free managed objects contained here + } + + // Free unmanaged objects + // Set fields to null + } + + ~MarshalByValueComponent () + { + Dispose (false); + } + + [MonoTODO] + public virtual object GetService (Type service) { + return null; + } + + public virtual IContainer Container { + [MonoTODO] + get { + return null; + } + } + + public virtual bool DesignMode { + [MonoTODO] + get { + return false; + } + } + + public virtual ISite Site { + [MonoTODO] + get { + // TODO: need to get Site + return null; + } + + [MonoTODO] + set { + // TODO: need to set Site + } + } + + protected EventHandlerList Events { + [MonoTODO] + get { + // TODO: need to do, but do not + // throw a NotImplementedException + return null; + } + } + + public event EventHandler Disposed; + } +} diff --git a/mcs/class/System/System.ComponentModel/MemberDescriptor.cs b/mcs/class/System/System.ComponentModel/MemberDescriptor.cs new file mode 100755 index 00000000000..3250a8a07b8 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/MemberDescriptor.cs @@ -0,0 +1,120 @@ +// +// System.ComponentModel.MemberDescriptor.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +namespace System.ComponentModel { + + public abstract class MemberDescriptor { + string name; + Attribute [] attrs; + AttributeCollection attrCollection; + + protected MemberDescriptor (string name, Attribute [] attrs) + { + this.name = name; + this.attrs = attrs; + } + + protected MemberDescriptor (MemberDescriptor reference, Attribute [] attrs) + { + name = reference.name; + this.attrs = attrs; + } + + protected MemberDescriptor (string name) + { + this.name = name; + } + + protected MemberDescriptor (MemberDescriptor reference) + { + name = reference.name; + attrs = reference.attrs; + } + + protected virtual Attribute [] AttributeArray { + get { + return attrs; + } + + set { + attrs = value; + } + } + + public virtual AttributeCollection Attributes + { + get { + if (attrCollection == null) + attrCollection = new AttributeCollection (attrs); + return attrCollection; + } + } + + public virtual string Category { + get { + return ((CategoryAttribute) Attributes [typeof (CategoryAttribute)]).Category; + } + } + + public virtual string Description { + get { + foreach (Attribute attr in attrs){ + if (attr is DescriptionAttribute) + return ((DescriptionAttribute) attr).Description; + } + + return ""; + } + } + + public virtual bool DesignTimeOnly { + get { + foreach (Attribute attr in attrs){ + if (attr is DesignOnlyAttribute) + return ((DesignOnlyAttribute) attr).IsDesignOnly; + } + + return false; + } + } + + // + // FIXME: Is there any difference between DisplayName and Name? + // + [MonoTODO ("Does this diff from Name ?")] + public virtual string DisplayName { + get { + return name; + } + } + + public virtual string Name { + get { + return name; + } + } + + public virtual bool IsBrowsable { + get { + foreach (Attribute attr in attrs){ + if (attr is BrowsableAttribute) + return ((BrowsableAttribute) attr).Browsable; + } + + return false; + } + } + + protected virtual int NameHashCode { + get { + return name.GetHashCode (); + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs b/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs new file mode 100755 index 00000000000..327dee061c1 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/NotifyParentPropertyAttribute.cs @@ -0,0 +1,64 @@ +// +// System.ComponentModel.NotifyParentPropertyAttribute.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// +// + +namespace System.ComponentModel { + [AttributeUsage (AttributeTargets.Property)] + public sealed class NotifyParentPropertyAttribute : Attribute { + + #region Fields + + bool notifyParent; + + #endregion // Fields + + public static readonly NotifyParentPropertyAttribute No = new NotifyParentPropertyAttribute (false); + public static readonly NotifyParentPropertyAttribute Yes = new NotifyParentPropertyAttribute (true); + public static readonly NotifyParentPropertyAttribute Default = new NotifyParentPropertyAttribute (false); + + #region Constructors + + public NotifyParentPropertyAttribute (bool notifyParent) + { + this.notifyParent = notifyParent; + } + + #endregion // Constructors + + #region Properties + + public bool NotifyParent { + get { return notifyParent; } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override int GetHashCode () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override bool IsDefaultAttribute () + { + throw new NotImplementedException (); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs b/mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs new file mode 100644 index 00000000000..d456a807a7b --- /dev/null +++ b/mcs/class/System/System.ComponentModel/PropertyChangedEventArgs.cs @@ -0,0 +1,29 @@ +// +// System.ComponentModel.PropertyChangedEventArgs.cs +// +// Author: +// Rodrigo Moya (rodrigo@ximian.com) +// +// (C) Ximian, Inc +// + +namespace System.ComponentModel +{ + /// <summary> + /// Provides data for the PropertyChanged event. + /// </summary> + public class PropertyChangedEventArgs : EventArgs + { + private string propertyName; + + public PropertyChangedEventArgs (string name) { + propertyName = name; + } + + public virtual string PropertyName { + get { + return propertyName; + } + } + } +} diff --git a/mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs b/mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs new file mode 100644 index 00000000000..9dd845ef5c1 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/PropertyChangedEventHandler.cs @@ -0,0 +1,17 @@ +//------------------------------------------------------------------------------ +// +// System.ComponentModel.PropertyChangedEventHandler. +// +// Author: Asier Llano Palacios, asierllano@infonegocio.com +// +//------------------------------------------------------------------------------ + +using System; + +namespace System.ComponentModel { + + [Serializable] + public delegate void PropertyChangedEventHandler( object sender, PropertyChangedEventArgs e ); +} + + diff --git a/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs b/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs new file mode 100755 index 00000000000..b426fe29afc --- /dev/null +++ b/mcs/class/System/System.ComponentModel/PropertyDescriptor.cs @@ -0,0 +1,121 @@ +// +// System.ComponentModel.PropertyDescriptor.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +using System; +using System.Collections; + +namespace System.ComponentModel { + + public abstract class PropertyDescriptor : MemberDescriptor { + + protected PropertyDescriptor (MemberDescriptor reference) + : base (reference) + { + } + + protected PropertyDescriptor (MemberDescriptor reference, Attribute [] attrs) + : base (reference, attrs) + { + } + + protected PropertyDescriptor (string name, Attribute [] attrs) + : base (name, attrs) + { + } + + public abstract Type ComponentType { get; } + + public virtual TypeConverter Converter { + get { + return TypeDescriptor.GetConverter (PropertyType); + } + } + + public virtual bool IsLocalizable { + get { + foreach (Attribute attr in AttributeArray){ + if (attr is LocalizableAttribute){ + return ((LocalizableAttribute) attr).IsLocalizable; + } + } + + return false; + } + } + + public abstract bool IsReadOnly { get; } + + public abstract Type PropertyType { get; } + + public DesignerSerializationVisibility SerializationVisibility { + get { + foreach (Attribute attr in AttributeArray){ + if (attr is DesignerSerializationVisibilityAttribute){ + DesignerSerializationVisibilityAttribute a; + + a = (DesignerSerializationVisibilityAttribute) attr; + + return a.Visibility; + } + } + + // + // Is this a good default if we cant find the property? + // + return DesignerSerializationVisibility.Hidden; + } + } + + Hashtable notifiers; + + public virtual void AddValueChanged (object component, EventHandler handler) + { + EventHandler component_notifiers; + + if (component == null) + throw new ArgumentNullException ("component"); + + if (handler == null) + throw new ArgumentNullException ("handler"); + + if (notifiers == null) + notifiers = new Hashtable (); + + component_notifiers = (EventHandler) notifiers [component]; + + if (component_notifiers != null) + component_notifiers += handler; + else + notifiers [component] = handler; + } + + protected virtual void OnValueChanged (object component, EventArgs e) + { + if (notifiers == null) + return; + + EventHandler component_notifiers = (EventHandler) notifiers [component]; + + if (component_notifiers == null) + return; + + component_notifiers (component, e); + } + + public abstract object GetValue (object component); + + public abstract void SetValue (object component, object value); + + public abstract void ResetValue (object component); + + public abstract bool CanResetValue (object component); + + public abstract bool ShouldSerializeValue (object component); + } +} diff --git a/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs b/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs new file mode 100644 index 00000000000..0c230abf66c --- /dev/null +++ b/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs @@ -0,0 +1,283 @@ +//
+// System.ComponentModel.PropertyDescriptorCollection.cs
+//
+// Authors:
+// Rodrigo Moya (rodrigo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) Rodrigo Moya, 2002
+// (c) 2002 Ximian, Inc. (http://www.ximian.com)
+//
+
+using System.Collections;
+
+namespace System.ComponentModel
+{
+ /// <summary>
+ /// Represents a collection of PropertyDescriptor objects.
+ /// </summary>
+ public class PropertyDescriptorCollection : IList, ICollection, IEnumerable, IDictionary
+ {
+ public static readonly PropertyDescriptorCollection Empty =
+ new PropertyDescriptorCollection (null);
+
+ ArrayList properties;
+ bool readOnly;
+
+ public PropertyDescriptorCollection (PropertyDescriptor[] properties)
+ {
+ this.properties = new ArrayList ();
+ if (properties == null)
+ return;
+
+ foreach (PropertyDescriptor p in properties)
+ this.properties.Add (p);
+ }
+
+ public int Add (PropertyDescriptor value)
+ {
+ properties.Add (value);
+ return properties.Count - 1;
+ }
+
+ int IList.Add (object value)
+ {
+ return Add ((PropertyDescriptor) value);
+ }
+
+ void IDictionary.Add (object key, object value)
+ {
+ Add ((PropertyDescriptor) value);
+ }
+
+ public void Clear ()
+ {
+ properties.Clear ();
+ }
+
+ void IList.Clear ()
+ {
+ Clear ();
+ }
+
+ void IDictionary.Clear ()
+ {
+ Clear ();
+ }
+
+ public bool Contains (PropertyDescriptor value)
+ {
+ return properties.Contains (value);
+ }
+
+ bool IList.Contains (object value)
+ {
+ return Contains ((PropertyDescriptor) value);
+ }
+
+ bool IDictionary.Contains (object value)
+ {
+ return Contains ((PropertyDescriptor) value);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ properties.CopyTo (array, index);
+ }
+
+ public virtual PropertyDescriptor Find (string name, bool ignoreCase)
+ {
+ foreach (PropertyDescriptor p in properties) {
+ if (0 == String.Compare (name, p.Name, ignoreCase))
+ return p;
+ }
+ return null;
+ }
+
+ public virtual IEnumerator GetEnumerator ()
+ {
+ return properties.GetEnumerator ();
+ }
+
+ [MonoTODO]
+ IDictionaryEnumerator IDictionary.GetEnumerator ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public int IndexOf (PropertyDescriptor value)
+ {
+ return properties.IndexOf (value);
+ }
+
+ int IList.IndexOf (object value)
+ {
+ return IndexOf ((PropertyDescriptor) value);
+ }
+
+ [MonoTODO]
+ public void Insert (int index, PropertyDescriptor value)
+ {
+ throw new NotImplementedException ();
+ }
+
+ void IList.Insert (int index, object value)
+ {
+ Insert (index, (PropertyDescriptor) value);
+ }
+
+ public void Remove (PropertyDescriptor value)
+ {
+ properties.Remove (value);
+ }
+
+ void IDictionary.Remove (object value)
+ {
+ Remove ((PropertyDescriptor) value);
+ }
+
+ void IList.Remove (object value)
+ {
+ Remove ((PropertyDescriptor) value);
+ }
+
+ public void RemoveAt (int index)
+ {
+ properties.RemoveAt (index);
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ RemoveAt (index);
+ }
+
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection Sort ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ public virtual PropertyDescriptorCollection Sort (IComparer ic)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InternalSort (IComparer ic)
+ {
+ throw new NotImplementedException ();
+ }
+
+ [MonoTODO]
+ protected void InternalSort (string [] order)
+ {
+ throw new NotImplementedException ();
+ }
+
+ bool IDictionary.IsFixedSize
+ {
+ get {
+ return !readOnly;
+ }
+ }
+
+ bool IList.IsFixedSize
+ {
+ get {
+ return !readOnly;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get {
+ return readOnly;
+ }
+ }
+
+ public bool IsSynchronized
+ {
+ get {
+ return false;
+ }
+ }
+
+ public int Count
+ {
+ get {
+ return properties.Count;
+ }
+ }
+
+ object ICollection.SyncRoot
+ {
+ get {
+ return null;
+ }
+ }
+
+ ICollection IDictionary.Keys
+ {
+ get {
+ string [] keys = new string [properties.Count];
+ int i = 0;
+ foreach (PropertyDescriptor p in properties)
+ keys [i++] = p.Name;
+ return keys;
+ }
+ }
+
+ ICollection IDictionary.Values
+ {
+ get {
+ return (ICollection) properties.Clone ();
+ }
+ }
+
+ object IDictionary.this [object key]
+ {
+ get {
+ if (!(key is string))
+ return null;
+ return this [(string) key];
+ }
+ set {
+ if (!(key is string) || (value as PropertyDescriptor) == null)
+ throw new ArgumentException ();
+
+ int idx = properties.IndexOf (value);
+ if (idx == -1)
+ Add ((PropertyDescriptor) value);
+ else
+ properties [idx] = value;
+
+ }
+ }
+ public virtual PropertyDescriptor this [string s]
+ {
+ get {
+ return Find (s, false);
+ }
+ }
+
+ object IList.this [int index]
+ {
+ get {
+ return properties [index];
+ }
+
+ set {
+ properties [index] = value;
+ }
+ }
+
+ public virtual PropertyDescriptor this [int index]
+ {
+ get {
+ return (PropertyDescriptor) properties [index];
+ }
+ }
+ }
+}
+
diff --git a/mcs/class/System/System.ComponentModel/PropertyTabScope.cs b/mcs/class/System/System.ComponentModel/PropertyTabScope.cs new file mode 100644 index 00000000000..d138940df2c --- /dev/null +++ b/mcs/class/System/System.ComponentModel/PropertyTabScope.cs @@ -0,0 +1,9 @@ +namespace System.ComponentModel { + + public enum PropertyTabScope { + Static, + Global, + Document, + Component + } +} diff --git a/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs b/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs new file mode 100755 index 00000000000..e04ad8bbb94 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ReadOnlyAttribute.cs @@ -0,0 +1,54 @@ +// +// ReadOnlyAttribute.cs +// +// Author: +// Chris J Breisch (cjbreisch@altavista.net) +// +// (C) 2002 Chris J Breisch +// +namespace System.ComponentModel { + [AttributeUsage (AttributeTargets.All)] + sealed public class ReadOnlyAttribute : Attribute { + bool read_only; + + public static readonly ReadOnlyAttribute No; + public static readonly ReadOnlyAttribute Yes; + public static readonly ReadOnlyAttribute Default; + + static ReadOnlyAttribute () + { + No = new ReadOnlyAttribute (false); + Yes = new ReadOnlyAttribute (true); + Default = new ReadOnlyAttribute (false); + } + + public ReadOnlyAttribute (bool read_only) + { + this.read_only = read_only; + } + + public bool IsReadOnly { + get { + return read_only; + } + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + + public override bool Equals (object o) + { + if (!(o is ReadOnlyAttribute)) + return false; + + return (((ReadOnlyAttribute) o).read_only == read_only); + } + + public override bool IsDefaultAttribute () + { + return Equals (Default); + } + } +} diff --git a/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs b/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs new file mode 100644 index 00000000000..1e3cd7be92f --- /dev/null +++ b/mcs/class/System/System.ComponentModel/RecommendedAsConfigurableAttribute.cs @@ -0,0 +1,65 @@ +//
+// System.ComponentModel.RecommendedAsConfigurableAttribute
+//
+// Authors:
+// Tim Coleman (tim@timcoleman.com)
+//
+// Copyright (C) Tim Coleman, 2002
+//
+
+using System;
+
+namespace System.ComponentModel {
+ [AttributeUsage (AttributeTargets.Property)]
+ public class RecommendedAsConfigurableAttribute : Attribute {
+
+ #region Fields
+
+ bool recommendedAsConfigurable;
+
+ public static readonly RecommendedAsConfigurableAttribute Default = new RecommendedAsConfigurableAttribute (false);
+ public static readonly RecommendedAsConfigurableAttribute No = new RecommendedAsConfigurableAttribute (false);
+ public static readonly RecommendedAsConfigurableAttribute Yes = new RecommendedAsConfigurableAttribute (true);
+
+ #endregion // Fields
+
+ #region Constructors
+
+ public RecommendedAsConfigurableAttribute (bool recommendedAsConfigurable)
+ {
+ this.recommendedAsConfigurable = recommendedAsConfigurable;
+ }
+
+ #endregion // Constructors
+
+ #region Properties
+
+ public bool RecommendedAsConfigurable {
+ get { return recommendedAsConfigurable; }
+ }
+
+ #endregion // Properties
+
+ #region Methods
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is RecommendedAsConfigurableAttribute))
+ return false;
+
+ return ((RecommendedAsConfigurableAttribute) obj).RecommendedAsConfigurable == recommendedAsConfigurable;
+ }
+
+ [MonoTODO]
+ public override int GetHashCode ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public override bool IsDefaultAttribute ()
+ {
+ return (!recommendedAsConfigurable);
+ }
+ #endregion // Methods
+ }
+}
diff --git a/mcs/class/System/System.ComponentModel/RefreshEventArgs.cs b/mcs/class/System/System.ComponentModel/RefreshEventArgs.cs new file mode 100644 index 00000000000..87de49b4592 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/RefreshEventArgs.cs @@ -0,0 +1,44 @@ +// +// System.ComponentModel.RefreshEventArgs +// +// Author: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; + +namespace System.ComponentModel +{ +public class RefreshEventArgs : EventArgs +{ + private object component; + private Type type; + + public RefreshEventArgs (object componentChanged) + { + if (componentChanged == null) + throw new ArgumentNullException ("componentChanged"); + + component = componentChanged; + type = component.GetType (); + } + + public RefreshEventArgs (Type typeChanged) + { + type = typeChanged; + } + + public object ComponentChanged + { + get { return component; } + } + + public Type TypeChanged + { + get { return type; } + } +} +} + diff --git a/mcs/class/System/System.ComponentModel/RefreshEventHandler.cs b/mcs/class/System/System.ComponentModel/RefreshEventHandler.cs new file mode 100644 index 00000000000..d14b5988000 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/RefreshEventHandler.cs @@ -0,0 +1,14 @@ +//
+// System.ComponentModel.RefreshEventHandler
+//
+// Author:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+namespace System.ComponentModel
+{
+ public delegate void RefreshEventHandler (RefreshEventArgs e);
+}
+
diff --git a/mcs/class/System/System.ComponentModel/RefreshProperties.cs b/mcs/class/System/System.ComponentModel/RefreshProperties.cs new file mode 100644 index 00000000000..4a7d7dbc37f --- /dev/null +++ b/mcs/class/System/System.ComponentModel/RefreshProperties.cs @@ -0,0 +1,18 @@ +// +// System.ComponentModel.RefreshProperties.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// + +namespace System.ComponentModel +{ + [Serializable] + public enum RefreshProperties { + All, + None, + Repaint + } +} diff --git a/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs b/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs new file mode 100644 index 00000000000..cadbf29d894 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/RefreshPropertiesAttribute.cs @@ -0,0 +1,63 @@ +// +// System.ComponentModel.RefreshPropertiesAttribute.cs +// +// Author: +// Tim Coleman (tim@timcoleman.com) +// +// Copyright (C) Tim Coleman, 2002 +// +// + +namespace System.ComponentModel { + [AttributeUsage (AttributeTargets.All)] + public sealed class RefreshPropertiesAttribute : Attribute { + + #region Fields + + RefreshProperties refresh; + + #endregion // Fields + + public static readonly RefreshPropertiesAttribute All = new RefreshPropertiesAttribute (RefreshProperties.All); + public static readonly RefreshPropertiesAttribute Default = new RefreshPropertiesAttribute (RefreshProperties.None); + public static readonly RefreshPropertiesAttribute Repaint = new RefreshPropertiesAttribute (RefreshProperties.Repaint); + + #region Constructors + + public RefreshPropertiesAttribute (RefreshProperties refresh) + { + this.refresh = refresh; + } + + #endregion // Constructors + + #region Properties + + public RefreshProperties RefreshProperties { + get { return refresh; } + } + + #endregion // Properties + + #region Methods + + [MonoTODO] + public override bool Equals (object obj) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public override int GetHashCode () + { + throw new NotImplementedException (); + } + + public override bool IsDefaultAttribute () + { + return (this == RefreshPropertiesAttribute.Default); + } + + #endregion // Methods + } +} diff --git a/mcs/class/System/System.ComponentModel/StringConverter.cs b/mcs/class/System/System.ComponentModel/StringConverter.cs new file mode 100644 index 00000000000..351a00ea11c --- /dev/null +++ b/mcs/class/System/System.ComponentModel/StringConverter.cs @@ -0,0 +1,41 @@ +// +// System.ComponentModel.StringConverter +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; +using System.Globalization; + +namespace System.ComponentModel { + +public class StringConverter : TypeConverter +{ + public StringConverter () + { + } + + public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(String)) + return true; + + return base.CanConvertFrom (context, sourceType); + } + + public override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (value == null) + return String.Empty; + + if (value is string) + return (string) value; + + return base.ConvertFrom (context, culture, value); + } +} +} + diff --git a/mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs b/mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs new file mode 100644 index 00000000000..c350c735b2d --- /dev/null +++ b/mcs/class/System/System.ComponentModel/ToolboxItemAttribute.cs @@ -0,0 +1,82 @@ +// +// System.ComponentModel.ToolboxItemAttribute +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; + +namespace System.ComponentModel +{ + [AttributeUsage(AttributeTargets.All)] + public class ToolboxItemAttribute : Attribute + { + private static string defaultItemType = "System.Drawing.Design.ToolboxItem,System.Drawing"; + + public static readonly ToolboxItemAttribute Default = new ToolboxItemAttribute (defaultItemType); + public static readonly ToolboxItemAttribute None = new ToolboxItemAttribute (false); + + private Type itemType; + private string itemTypeName; + + public ToolboxItemAttribute (bool defaultType) + { + if (defaultType) + itemTypeName = defaultItemType; + } + + public ToolboxItemAttribute (string toolboxItemName) + { + itemTypeName = toolboxItemName; + } + + public ToolboxItemAttribute (Type toolboxItemType) + { + itemType = toolboxItemType; + } + + public Type ToolboxItemType + { + get { + if (itemType == null && itemTypeName != null) + itemType = Type.GetType (itemTypeName); + return itemType; + } + } + + public string ToolboxItemTypeName + { + get { + if (itemTypeName == null) { + if (itemType == null) + return ""; + itemTypeName = itemType.AssemblyQualifiedName; + } + + return itemTypeName; + } + } + + public override bool Equals (object o) + { + if (!(o is ToolboxItemAttribute)) + return false; + + return (((ToolboxItemAttribute) o).ToolboxItemTypeName == ToolboxItemTypeName); + } + + public override int GetHashCode () + { + return base.GetHashCode (); + } + + public override bool IsDefaultAttribute () + { + return Equals (Default); + } + } +} + diff --git a/mcs/class/System/System.ComponentModel/TypeConverter.cs b/mcs/class/System/System.ComponentModel/TypeConverter.cs new file mode 100755 index 00000000000..ced08223f99 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/TypeConverter.cs @@ -0,0 +1,318 @@ +// +// System.ComponentModel.TypeConverter +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; +using System.Collections; +using System.Globalization; + +namespace System.ComponentModel { + +public class TypeConverter +{ + public TypeConverter () + { + } + + public bool CanConvertFrom (Type sourceType) + { + return CanConvertFrom (null, sourceType); + } + + [MonoTODO] + public virtual bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType) + { + throw new NotImplementedException (); + } + + public bool CanConvertTo (Type destinationType) + { + return CanConvertTo (null, destinationType); + } + + public virtual bool CanConvertTo (ITypeDescriptorContext context, Type destinationType) + { + return (destinationType == typeof (string)); + } + + public object ConvertFrom (object o) + { + return ConvertFrom (null, CultureInfo.CurrentCulture, o); + } + + [MonoTODO] + public virtual object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value) + { + throw new NotImplementedException (); + } + + public object ConvertFromInvariantString (string text) + { + return ConvertFromInvariantString (null, text); + } + + [MonoTODO] + public object ConvertFromInvariantString (ITypeDescriptorContext context, string text) + { + throw new NotImplementedException (); + } + + public object ConvertFromString (string s) + { + return ConvertFrom (s); + } + + public object ConvertFromString (ITypeDescriptorContext context, string text) + { + return ConvertFromString (context, CultureInfo.CurrentCulture, text); + } + + [MonoTODO] + public object ConvertFromString (ITypeDescriptorContext context, CultureInfo culture, string text) + { + throw new NotImplementedException (); + } + + public object ConvertTo (object value, Type destinationType) + { + return ConvertTo (null, null, value, destinationType); + } + + public virtual object ConvertTo (ITypeDescriptorContext context, + CultureInfo culture, + object value, + Type destinationType) + { + // context? culture? + if (destinationType == null) + throw new ArgumentNullException ("destinationType"); + + if (destinationType == typeof (string)) { + if (value != null) + return value.ToString(); + return String.Empty; + } + + throw new NotSupportedException ("Conversion not supported"); + } + + public string ConvertToInvariantString (object value) + { + return ConvertToInvariantString (null, value); + } + + [MonoTODO] + public string ConvertToInvariantString (ITypeDescriptorContext context, object value) + { + throw new NotImplementedException (); + } + + public string ConvertToString (object value) + { + return (string) ConvertTo (null, CultureInfo.CurrentCulture, value, typeof (string)); + } + + public string ConvertToString (ITypeDescriptorContext context, object value) + { + return (string) ConvertTo (context, CultureInfo.CurrentCulture, value, typeof (string)); + } + + public string ConvertToString (ITypeDescriptorContext context, CultureInfo culture, object value) + { + return (string) ConvertTo (context, culture, value, typeof (string)); + } + + [MonoTODO] + public object CreateInstance (IDictionary propertyValues) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected Exception GetConvertFromException (object value) + { + throw new NotImplementedException (); + } + + [MonoTODO] + protected Exception GetConvertToException (object value, Type destinationType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual object CreateInstance (ITypeDescriptorContext context, IDictionary propertyValues) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public bool GetCreateInstanceSupported () + { + throw new NotImplementedException (); + } + + [MonoTODO] + public virtual bool GetCreateInstanceSupported (ITypeDescriptorContext context) + { + throw new NotImplementedException (); + } + + public PropertyDescriptorCollection GetProperties (object value) + { + return GetProperties (null, value); + } + + public PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, object value) + { + return GetProperties (context, value, null); + } + + public virtual PropertyDescriptorCollection GetProperties (ITypeDescriptorContext context, + object value, + Attribute[] attributes) + { + return null; + } + + public bool GetPropertiesSupported () + { + return GetPropertiesSupported (null); + } + + public virtual bool GetPropertiesSupported (ITypeDescriptorContext context) + { + return false; + } + + public ICollection GetStandardValues () + { + return GetStandardValues (null); + } + + public virtual StandardValuesCollection GetStandardValues (ITypeDescriptorContext context) + { + return null; + } + + public bool GetStandardValuesExclusive () + { + return GetStandardValuesExclusive (null); + } + + public virtual bool GetStandardValuesExclusive (ITypeDescriptorContext context) + { + return false; + } + + public bool GetStandardValuesSupported () + { + return GetStandardValuesSupported (null); + } + + public virtual bool GetStandardValuesSupported (ITypeDescriptorContext context) + { + return false; + } + + public bool IsValid (object value) + { + return IsValid (null, value); + } + + public virtual bool IsValid (ITypeDescriptorContext context, object value) + { + return true; + } + + public class StandardValuesCollection : ICollection, IEnumerable + { + private ICollection values; + + public StandardValuesCollection (ICollection values) + { + this.values = values; + } + + public void CopyTo (Array array, int index) + { + values.CopyTo (array, index); + } + + public IEnumerator GetEnumerator () + { + return values.GetEnumerator (); + } + + bool ICollection.IsSynchronized + { + get { return false; } + } + + object ICollection.SyncRoot + { + get { return null; } + } + + int ICollection.Count + { + get { return this.Count; } + } + + public int Count + { + get { return values.Count; } + } + + public object this [int index] + { + get { return ((IList) values) [index]; } + } + } + + protected abstract class SimplePropertyDescriptor : PropertyDescriptor + { + private Type componentType; + private Type propertyType; + + public SimplePropertyDescriptor (Type componentType, + string name, + Type propertyType) : + this (componentType, name, propertyType, new Attribute [0]) + { + } + + public SimplePropertyDescriptor (Type componentType, + string name, + Type propertyType, + Attribute [] attributes) : base (name, attributes) + { + this.componentType = componentType; + this.propertyType = propertyType; + } + + public override Type ComponentType + { + get { return componentType; } + } + + public override Type PropertyType + { + get { return propertyType; } + } + + public override bool IsReadOnly + { + get { + return Attributes.Contains (ReadOnlyAttribute.Yes); + } + } + } +} +} + diff --git a/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs b/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs new file mode 100644 index 00000000000..21c283db5fd --- /dev/null +++ b/mcs/class/System/System.ComponentModel/TypeConverterAttribute.cs @@ -0,0 +1,53 @@ +//
+// System.ComponentModel.TypeConverterAttribute
+//
+// Authors:
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+//
+// (C) 2002 Ximian, Inc (http://www.ximian.com)
+//
+
+using System;
+
+namespace System.ComponentModel {
+
+[AttributeUsage(AttributeTargets.All)]
+public sealed class TypeConverterAttribute : Attribute
+{
+ private string converter_type;
+
+ public TypeConverterAttribute ()
+ {
+ converter_type = "";
+ }
+
+ public TypeConverterAttribute (string typeName)
+ {
+ converter_type = typeName;
+ }
+
+ public TypeConverterAttribute (Type type)
+ {
+ converter_type = type.AssemblyQualifiedName;
+ }
+
+ public override bool Equals (object obj)
+ {
+ if (!(obj is TypeConverterAttribute))
+ return false;
+
+ return ((TypeConverterAttribute) obj).ConverterTypeName == converter_type;
+ }
+
+ public override int GetHashCode ()
+ {
+ return converter_type.GetHashCode ();
+ }
+
+ public string ConverterTypeName
+ {
+ get { return converter_type; }
+ }
+}
+}
+
diff --git a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs new file mode 100644 index 00000000000..1c6c0118151 --- /dev/null +++ b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs @@ -0,0 +1,350 @@ +// +// System.ComponentModel.TypeDescriptor +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// +// (C) 2002 Ximian, Inc (http://www.ximian.com) +// + +using System; +using System.Collections; +using System.Reflection; + +namespace System.ComponentModel +{ + +public sealed class TypeDescriptor +{ + private static readonly string creatingDefaultConverters = "creatingDefaultConverters"; + private static Hashtable defaultConverters; + + private TypeDescriptor () + { + } + + [MonoTODO] + public static void AddEditorTable (Type editorBaseType, Hashtable table) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptor CreateEvent (Type componentType, + string name, + Type type, + Attribute [] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptor CreateEvent (Type componentType, + EventDescriptor oldEventDescriptor, + Attribute [] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PropertyDescriptor CreateProperty (Type componentType, + string name, + Type type, + Attribute [] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PropertyDescriptor CreateProperty (Type componentType, + PropertyDescriptor oldPropertyDescriptor, + Attribute [] attributes) + { + throw new NotImplementedException (); + } + + public static AttributeCollection GetAttributes (Type componentType) + { + if (componentType == null) + return AttributeCollection.Empty; + + object [] atts = componentType.GetCustomAttributes (false); + return new AttributeCollection ((Attribute []) atts); + } + + public static AttributeCollection GetAttributes (object component) + { + return GetAttributes (component.GetType ()); + } + + [MonoTODO] + public static AttributeCollection GetAttributes (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static string GetClassName (object component) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static string GetClassName (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static string GetComponentName (object component) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static string GetComponentName (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + public static TypeConverter GetConverter (object component) + { + return GetConverter (component.GetType ()); + } + + [MonoTODO] + public static TypeConverter GetConverter (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + private static Hashtable DefaultConverters + { + get { + if (defaultConverters != null) + return defaultConverters; + + lock (creatingDefaultConverters) { + if (defaultConverters != null) + return defaultConverters; + + //FIXME: add more converters as we implement them + defaultConverters = new Hashtable (); + defaultConverters.Add (typeof (Enum), typeof (EnumConverter)); + defaultConverters.Add (typeof (string), typeof (StringConverter)); + } + return defaultConverters; + } + } + + public static TypeConverter GetConverter (Type type) + { + Type t = DefaultConverters [type] as Type; + if (t == null && type.IsEnum) + t = (Type) DefaultConverters [typeof (Enum)]; + + string converter_name = null; + if (t == null) { + object [] attrs = type.GetCustomAttributes (false); + foreach (object o in attrs){ + if (o is TypeConverterAttribute){ + TypeConverterAttribute tc = (TypeConverterAttribute) o; + converter_name = tc.ConverterTypeName; + break; + } + } + } else { + converter_name = t.FullName; + } + + + if (converter_name == null) + return null; + + object converter = null; + try { + converter = Activator.CreateInstance (Type.GetType (converter_name)); + } catch (Exception){ + } + + return converter as TypeConverter; + } + + [MonoTODO] + public static EventDescriptor GetDefaultEvent (object component) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptor GetDefaultEvent (Type componentType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptor GetDefaultEvent (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PropertyDescriptor GetDefaultProperty (object component) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PropertyDescriptor GetDefaultProperty (Type componentType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PropertyDescriptor GetDefaultProperty (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static object GetEditor (object component, Type editorBaseType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static object GetEditor (Type componentType, Type editorBaseType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static object GetEditor (object component, Type editorBaseType, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptorCollection GetEvents (object component) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptorCollection GetEvents (Type componentType) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptorCollection GetEvents (object component, Attribute [] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptorCollection GetEvents (object component, bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptorCollection GetEvents (Type componentType, Attribute [] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static EventDescriptorCollection GetEvents (object component, + Attribute [] attributes, + bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + public static PropertyDescriptorCollection GetProperties (object component) + { + return GetProperties (component, false); + } + + public static PropertyDescriptorCollection GetProperties (Type componentType) + { + PropertyInfo [] props = componentType.GetProperties (); + DerivedPropertyDescriptor [] propsDescriptor = new DerivedPropertyDescriptor [props.Length]; + int i = 0; + foreach (PropertyInfo prop in props) { + DerivedPropertyDescriptor propDescriptor = new DerivedPropertyDescriptor (prop.Name, + null, 0); + propDescriptor.SetReadOnly (!prop.CanWrite); + propDescriptor.SetComponentType (componentType); + propDescriptor.SetPropertyType (prop.PropertyType); + propsDescriptor [i++] = propDescriptor; + } + + return new PropertyDescriptorCollection (propsDescriptor); + } + + [MonoTODO] + public static PropertyDescriptorCollection GetProperties (object component, Attribute [] attributes) + { + Type type = component.GetType (); + if (typeof (ICustomTypeDescriptor).IsAssignableFrom (type)) + return ((ICustomTypeDescriptor) component).GetProperties (attributes); + + throw new NotImplementedException (); + } + + [MonoTODO("noCustomTypeDesc")] + public static PropertyDescriptorCollection GetProperties (object component, bool noCustomTypeDesc) + { + Type type = component.GetType (); + if (typeof (ICustomTypeDescriptor).IsAssignableFrom (type)) + return ((ICustomTypeDescriptor) component).GetProperties (); + + return GetProperties (type); + } + + [MonoTODO] + public static PropertyDescriptorCollection GetProperties (Type componentType, + Attribute [] attributes) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static PropertyDescriptorCollection GetProperties (Type componentType, + Attribute [] attributes, + bool noCustomTypeDesc) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static void Refresh (Assembly assembly) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static void Refresh (Module module) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static void Refresh (object component) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static void Refresh (Type type) + { + throw new NotImplementedException (); + } + + [MonoTODO] + public static event RefreshEventHandler Refreshed; +} +} + diff --git a/mcs/class/System/System.ComponentModel/WarningException.cs b/mcs/class/System/System.ComponentModel/WarningException.cs new file mode 100644 index 00000000000..14e7aff65cf --- /dev/null +++ b/mcs/class/System/System.ComponentModel/WarningException.cs @@ -0,0 +1,49 @@ +//------------------------------------------------------------------------------ +// +// System.ComponentModel.WarningException. +// +// Author: Asier Llano Palacios, asierllano@infonegocio.com +// +//------------------------------------------------------------------------------ + +using System; + +namespace System.ComponentModel { + + public class WarningException : SystemException + { + private string helpUrl; + private string helpTopic; + + public WarningException( string message ) + : base( message ) { + helpUrl = null; + helpTopic = null; + } + + public WarningException( string message, string helpUrl ) + : base( message ) { + this.helpUrl = helpUrl; + this.helpTopic = null; + } + + public WarningException( string message, string helpUrl, string helpTopic ) { + this.helpUrl = helpUrl; + this.helpTopic = helpTopic; + } + + public string HelpTopic { + get { + return helpTopic; + } + } + + public string HelpUrl { + get { + return helpUrl; + } + } + } + +} + diff --git a/mcs/class/System/System.ComponentModel/Win32Exception.cs b/mcs/class/System/System.ComponentModel/Win32Exception.cs new file mode 100755 index 00000000000..653d76d227a --- /dev/null +++ b/mcs/class/System/System.ComponentModel/Win32Exception.cs @@ -0,0 +1,126 @@ +// +// System.ComponentModel.Win32Exceptioncs +// +// Author: +// Dick Porter (dick@ximian.com) +// +// (C) 2002 Ximian, Inc. http://www.ximian.com +// + +using System.Runtime.InteropServices; +using System.Runtime.Serialization; +using System.Collections; +using System.Globalization; + +namespace System.ComponentModel +{ + [Serializable] + public class Win32Exception : ExternalException + { + private int native_error_code; + + public Win32Exception () + : base (W32ErrorMessage(Marshal.GetLastWin32Error()), + Marshal.GetLastWin32Error()) { + native_error_code=Marshal.GetLastWin32Error(); + } + + public Win32Exception(int error) + : base (W32ErrorMessage(error), error) { + native_error_code=error; + } + + public Win32Exception(int error, string message) + : base (message, error) { + native_error_code=error; + } + + protected Win32Exception(SerializationInfo info, + StreamingContext context) + : base (info, context) { + } + + public int NativeErrorCode { + get { + return(native_error_code); + } + } + + [MonoTODO] + public override void GetObjectData(SerializationInfo info, + StreamingContext context) { + if(info==null) { + throw new ArgumentNullException(); + } + + throw new NotImplementedException(); + } + + private static Hashtable w32_errors = new Hashtable(); + + /* Initialise the list of error strings */ + static Win32Exception() { + /* No need to list everything, just the ones + * the runtime can throw. A list of the errors + * can be found in class System.IO.MonoIOError. + */ + w32_errors.Add(10004, + Locale.GetText("interrupted")); + w32_errors.Add(10013, + Locale.GetText("Access denied")); + w32_errors.Add(10022, + Locale.GetText("Invalid arguments")); + w32_errors.Add(10035, + Locale.GetText("Operation on non-blocking socket would block")); + w32_errors.Add(10036, + Locale.GetText("Operation in progress")); + w32_errors.Add(10038, + Locale.GetText("The descriptor is not a socket")); + w32_errors.Add(10043, + Locale.GetText("proto no supported")); + w32_errors.Add(10044, + Locale.GetText("socket not supproted")); + w32_errors.Add(10045, + Locale.GetText("Operation not supported")); + w32_errors.Add(10047, + Locale.GetText("AF not supported")); + w32_errors.Add(10048, + Locale.GetText("Address already in use")); + w32_errors.Add(10050, + Locale.GetText("Network subsystem is down")); + w32_errors.Add(10051, + Locale.GetText("Network is unreachable")); + w32_errors.Add(10055, + Locale.GetText("Not enough buffer space is available")); + w32_errors.Add(10056, + Locale.GetText("Socket is already connected")); + w32_errors.Add(10057, + Locale.GetText("The socket is not connected")); + w32_errors.Add(10058, + Locale.GetText("The socket has been shut down")); + w32_errors.Add(10060, + Locale.GetText("Connection timed out")); + w32_errors.Add(10061, + Locale.GetText("Connection refused")); + w32_errors.Add(10093, + Locale.GetText("Winsock not initialized")); + w32_errors.Add(10107, + Locale.GetText("System call failed")); + + w32_errors.Add(11001, + Locale.GetText("No such host is known")); + w32_errors.Add(11002, + Locale.GetText("A temporary error occurred on an authoritative name server. Try again later.")); + } + + private static string W32ErrorMessage(int error_code) { + string message=(string)w32_errors[error_code]; + + if(message==null) { + return(Locale.GetText("Some sort of w32 error occurred")); + } else { + return(message); + } + } + } +} |