Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Zlatev <ivan@ivanz.com>2007-08-29 23:19:04 +0400
committerIvan Zlatev <ivan@ivanz.com>2007-08-29 23:19:04 +0400
commit03db1d8407d939f55dd11118e0f53fda5730cb60 (patch)
tree7eb808dabf1a56964fbef280fd17f5d5a97fe280 /mcs/class/System
parent3eca38f019b1f6324a98b0dbd996c2de32380ea8 (diff)
2007-08-29 Ivan N. Zlatev <contact@i-nz.net>
* ParentControlDesigner.cs: implemented. * IUISelectionService.cs: implemented. * WndProcRouter.cs: implemented. * SelectionFrame.cs: implemented. * ControlDesigner.cs: implemented. * ControlDataObject.cs: implemented. * ComponentTray.cs: implemented. * ScrollableControlDesigner.cs: implemented. * UISelectionService.cs: implemented. * SplitContainerDesigner.cs: implemented. * IMessageReceiver.cs: implemented. * Native.cs: implemented. * DocumentDesigner.cs: implemented. * DefaultSerializationProviderAttribute.cs: implemented. * ComponentSerializationService.cs: implemented. * MemberRelationship.cs: implemented. * SerializationStore.cs: implemented. * DesignSurfaceManager.cs: implemented. * DesignerEventService.cs: implemented. * ComponentDesigner.cs: implemented. * ActiveDesignSurfaceChangedEventHandler.cs: implemented. * LoadedEventHandler.cs: implemented. * DesignSurfaceCollection.cs: implemented. * DesignerHost.cs: implemented. * ExtenderService.cs: implemented. * DesignModeSite.cs: implemented. * SelectionService.cs: implemented. * DesignSurfaceServiceContainer.cs: implemented. * DesignerActionListCollection.cs: implemented. * ActiveDesignSurfaceChangedEventArgs.cs: implemented. * LoadedEventArgs.cs: implemented. * TypeDescriptorFilterService.cs: implemented. * ReferenceService.cs: implemented. * DesignSurface.cs: implemented. * DesignSurfaceEventHandler.cs: implemented. * DesignModeNestedContainer.cs: implemented. * EventBindingService.cs: implemented. * DesignSurfaceEventArgs.cs: implemented. * DesignerOptionService.cs: implemented. * ITreeDesigner.cs: implemented. * CodeDomComponentSerializationService.cs: implemented. * CollectionCodeDomSerializer.cs: implemented. * CodeDomDesignerLoader.cs: implemented. * CodeDomSerializationProvider.cs: implemented. * ComponentCodeDomSerializer.cs: implemented. * RootContext.cs: implemented. * BasicDesignerLoader.cs: implemented. * DesignerSerializationManager.cs: implemented. * EnumCodeDomSerializer.cs: implemented. * SerializeAbsoluteContext.cs: implemented. * MemberCodeDomSerializer.cs: implemented. * PrimitiveCodeDomSerializer.cs: implemented. * CodeDomSerializerBase.cs: implemented. * CodeDomSerializer.cs: implemented. * ExpressionContext.cs: implemented. * EventCodeDomSerializer.cs: implemented. * TypeCodeDomSerializer.cs: implemented. * ObjectStatementCollection.cs: implemented. * RootCodeDomSerializer.cs: implemented. * PropertyCodeDomSerializer.cs: implemented. * StatementContext.cs: implemented. svn path=/trunk/mcs/; revision=85023
Diffstat (limited to 'mcs/class/System')
-rw-r--r--mcs/class/System/ChangeLog7
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs68
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs67
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs93
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs140
-rw-r--r--mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs58
-rw-r--r--mcs/class/System/System.ComponentModel.Design/Changelog7
-rw-r--r--mcs/class/System/System.ComponentModel.Design/DesignerOptionService.cs331
-rw-r--r--mcs/class/System/System.ComponentModel.Design/ITreeDesigner.cs49
-rw-r--r--mcs/class/System/System.ComponentModel/ChangeLog5
-rw-r--r--mcs/class/System/System.dll.sources7
11 files changed, 832 insertions, 0 deletions
diff --git a/mcs/class/System/ChangeLog b/mcs/class/System/ChangeLog
index 0fcbcbd0786..fa394cdb05c 100644
--- a/mcs/class/System/ChangeLog
+++ b/mcs/class/System/ChangeLog
@@ -1,3 +1,10 @@
+2007-08-29 Ivan N. Zlatev <contact@i-nz.net>
+
+ * System.dll.sources: add DefaultSerializationProviderAttribute.cs,
+ ComponentSerializationService.cs, MemberRelationship.cs,
+ SerializationStore.cs, MemberRelationshipService.cs,
+ DesignerOptionService.cs, ITreeDesigner.cs
+
2007-08-29 Atsushi Enomoto <atsushi@ximian.com>
* System.dll.sources : added Win32NetworkInterfaceMarshal.cs.
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs
new file mode 100644
index 00000000000..ebb76699f75
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/ComponentSerializationService.cs
@@ -0,0 +1,68 @@
+//
+// System.ComponentModel.Design.Serialization.ComponentSerializationService
+//
+// Authors:
+// Ivan N. Zlatev (contact@i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.IO;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public abstract class ComponentSerializationService
+ {
+
+ protected ComponentSerializationService ()
+ {
+ }
+
+ public abstract SerializationStore CreateStore ();
+ public abstract ICollection Deserialize (SerializationStore store);
+ public abstract ICollection Deserialize (SerializationStore store, IContainer container);
+ public abstract SerializationStore LoadStore (Stream stream);
+ public abstract void Serialize (SerializationStore store, object value);
+ public abstract void SerializeAbsolute (SerializationStore store, object value);
+ public abstract void SerializeMember (SerializationStore store, object owningObject, MemberDescriptor member);
+ public abstract void SerializeMemberAbsolute (SerializationStore store, object owningObject, MemberDescriptor member);
+
+ public void DeserializeTo (SerializationStore store, IContainer container)
+ {
+ DeserializeTo (store, container, true);
+ }
+
+ public void DeserializeTo (SerializationStore store, IContainer container, bool validateRecycledTypes)
+ {
+ DeserializeTo (store, container, validateRecycledTypes, true);
+ }
+
+ public abstract void DeserializeTo (SerializationStore store, IContainer container, bool validateRecycledTypes, bool applyDefaults);
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs
new file mode 100644
index 00000000000..4dd9d2bbba6
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs
@@ -0,0 +1,67 @@
+//
+// System.ComponentModel.Design.Serialization.DefaultSerializationProviderAttribute
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+
+namespace System.ComponentModel.Design.Serialization
+{
+
+ [AttributeUsageAttribute (AttributeTargets.Class, Inherited=false)]
+ public sealed class DefaultSerializationProviderAttribute : Attribute
+ {
+
+ private string _providerTypeName;
+
+ public DefaultSerializationProviderAttribute (string providerTypeName)
+ {
+ if (providerTypeName == null)
+ throw new ArgumentNullException ("providerTypeName");
+
+ _providerTypeName = providerTypeName;
+ }
+
+ public DefaultSerializationProviderAttribute (Type providerType)
+ {
+ if (providerType == null)
+ throw new ArgumentNullException ("providerType");
+
+ _providerTypeName = providerType.AssemblyQualifiedName;
+ }
+
+ public string ProviderTypeName {
+ get { return _providerTypeName; }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs
new file mode 100644
index 00000000000..008dba9f1d8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationship.cs
@@ -0,0 +1,93 @@
+//
+// System.ComponentModel.Design.Serialization.MemberRelationship
+//
+// Authors:
+// Ivan N. Zlatev (contact@i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.CodeDom;
+using System.ComponentModel;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public struct MemberRelationship
+ {
+
+ public static readonly MemberRelationship Empty = new MemberRelationship ();
+
+ private object _owner;
+ private MemberDescriptor _member;
+
+ public MemberRelationship (object owner, MemberDescriptor member)
+ {
+ _owner = owner;
+ _member = member;
+ }
+
+ public bool IsEmpty {
+ get { return (_owner == null); }
+ }
+
+ public object Owner {
+ get { return _owner; }
+ }
+
+ public MemberDescriptor Member {
+ get { return _member; }
+ }
+
+ public static bool operator == (MemberRelationship left, MemberRelationship right)
+ {
+ if (left.Owner == right.Owner && left.Member == right.Member)
+ return true;
+ else
+ return false;
+ }
+
+ public static bool operator != (MemberRelationship left, MemberRelationship right)
+ {
+ return !(left == right);
+ }
+
+ public override int GetHashCode ()
+ {
+ if (_owner != null && _member != null)
+ return _member.GetHashCode () ^ _owner.GetHashCode ();
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ if (o is MemberRelationship) {
+ return ((MemberRelationship)o) == this;
+ }
+ return false;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs
new file mode 100644
index 00000000000..107a8e389e8
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/MemberRelationshipService.cs
@@ -0,0 +1,140 @@
+//
+// System.ComponentModel.Design.Serialization.MemberRelationshipService
+//
+// Authors:
+// Ivan N. Zlatev (contact@i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.CodeDom;
+using System.ComponentModel;
+using System.Collections;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public abstract class MemberRelationshipService
+ {
+
+ // MSDN: The default implementation stores relationships in a dictionary using weak references
+ // so the relationship table does not keep objects alive.
+ //
+ private class MemberRelationshipWeakEntry
+ {
+
+ private WeakReference _ownerWeakRef;
+ private MemberDescriptor _member;
+
+ public MemberRelationshipWeakEntry (MemberRelationship relation)
+ {
+ _ownerWeakRef = new WeakReference (relation.Owner);
+ _member = relation.Member;
+ }
+
+ public object Owner {
+ get {
+ if (_ownerWeakRef.IsAlive)
+ return _ownerWeakRef.Target;
+ return null;
+ }
+ }
+
+ public MemberDescriptor Member {
+ get { return _member; }
+ }
+
+ public static bool operator == (MemberRelationshipWeakEntry left, MemberRelationshipWeakEntry right)
+ {
+ if (left.Owner == right.Owner && left.Member == right.Member)
+ return true;
+ else
+ return false;
+ }
+
+ public static bool operator != (MemberRelationshipWeakEntry left, MemberRelationshipWeakEntry right)
+ {
+ return !(left == right);
+ }
+
+ public override int GetHashCode ()
+ {
+ if (this.Owner != null && _member != null)
+ return _member.GetHashCode () ^ _ownerWeakRef.Target.GetHashCode ();
+ return base.GetHashCode ();
+ }
+
+ public override bool Equals (object o)
+ {
+ if (o is MemberRelationshipWeakEntry) {
+ return ((MemberRelationshipWeakEntry) o) == this;
+ }
+ return false;
+ }
+ }
+
+ private Hashtable _relations;
+
+ protected MemberRelationshipService ()
+ {
+ _relations = new Hashtable ();
+ }
+
+ public abstract bool SupportsRelationship (MemberRelationship source, MemberRelationship relationship);
+
+ protected virtual MemberRelationship GetRelationship (MemberRelationship source)
+ {
+ if (source.IsEmpty)
+ throw new ArgumentNullException ("source");
+
+ MemberRelationshipWeakEntry entry = _relations[new MemberRelationshipWeakEntry (source)] as MemberRelationshipWeakEntry;
+ if (entry != null)
+ return new MemberRelationship (entry.Owner, entry.Member);
+ return MemberRelationship.Empty;
+ }
+
+ protected virtual void SetRelationship (MemberRelationship source, MemberRelationship relationship)
+ {
+ if (source.IsEmpty)
+ throw new ArgumentNullException ("source");
+
+ if (!relationship.IsEmpty && !this.SupportsRelationship (source, relationship))
+ throw new ArgumentException ("Relationship not supported.");
+
+ _relations[new MemberRelationshipWeakEntry (source)] = new MemberRelationshipWeakEntry (relationship);
+ }
+
+ public MemberRelationship this [object owner, MemberDescriptor member] {
+ get { return GetRelationship (new MemberRelationship (owner, member)); }
+ set { SetRelationship (new MemberRelationship (owner, member), value); }
+ }
+
+ public MemberRelationship this [MemberRelationship source] {
+ get { return GetRelationship (source); }
+ set { SetRelationship (source, value); }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs b/mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs
new file mode 100644
index 00000000000..406b18b181f
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design.Serialization/SerializationStore.cs
@@ -0,0 +1,58 @@
+//
+// System.ComponentModel.Design.Serialization.SerializationStore
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.IO;
+
+namespace System.ComponentModel.Design.Serialization
+{
+ public abstract class SerializationStore : IDisposable
+ {
+ public SerializationStore ()
+ {
+ }
+
+ public abstract void Close ();
+ public abstract void Save (Stream stream);
+
+ public void Dispose (bool disposing)
+ {
+ if (disposing)
+ this.Close ();
+ }
+
+ void IDisposable.Dispose ()
+ {
+ this.Dispose (true);
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design/Changelog b/mcs/class/System/System.ComponentModel.Design/Changelog
index 22f534adcf8..28c9f78d24a 100644
--- a/mcs/class/System/System.ComponentModel.Design/Changelog
+++ b/mcs/class/System/System.ComponentModel.Design/Changelog
@@ -1,3 +1,10 @@
+2007-08-29 Ivan N. Zlatev <contact@i-nz.net>
+
+ * DefaultSerializationProviderAttribute.cs: implemented.
+ * ComponentSerializationService.cs: implemented.
+ * MemberRelationship.cs: implemented.
+ * SerializationStore.cs: implemented.
+
2007-06-06 Ivan N. Zlatev <contact@i-nz.net>
* IComponentInitialization.cs: New 2.0 interface
diff --git a/mcs/class/System/System.ComponentModel.Design/DesignerOptionService.cs b/mcs/class/System/System.ComponentModel.Design/DesignerOptionService.cs
new file mode 100644
index 00000000000..601dd5340b6
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/DesignerOptionService.cs
@@ -0,0 +1,331 @@
+//
+// System.ComponentModel.Design.DesignerOptionService
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2006-2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.Globalization;
+using System.ComponentModel;
+
+namespace System.ComponentModel.Design
+{
+
+ public class DesignerOptionService : IDesignerOptionService
+ {
+
+ public sealed class DesignerOptionCollection : IList, ICollection, IEnumerable
+ {
+ // PropertyDescriptor objects are taken directly from the value passed to the CreateOptionCollection method
+ // and are wrapped in an additional property descriptor that hides the value object from the user. This means
+ // that any value may be passed into the component parameter of the various PropertyDescriptor methods. The
+ // value is not recognized and is replaced with the correct value internally.
+ //
+ public sealed class WrappedPropertyDescriptor : PropertyDescriptor
+ {
+ private PropertyDescriptor _property;
+ private object _component;
+
+ public WrappedPropertyDescriptor (PropertyDescriptor property, object component) : base (property.Name, new Attribute[0])
+ {
+ _property = property;
+ _component = component;
+ }
+
+ public override object GetValue (object ignored)
+ {
+ return _property.GetValue (_component);
+ }
+
+ public override void SetValue (object ignored, object value)
+ {
+ _property.SetValue (_component, value);
+ }
+
+ public override bool CanResetValue (object ignored)
+ {
+ return _property.CanResetValue (_component);
+ }
+
+ public override void ResetValue (object ignored)
+ {
+ _property.ResetValue (_component);
+ }
+
+ public override bool ShouldSerializeValue (object ignored)
+ {
+ return _property.ShouldSerializeValue (_component);
+ }
+
+ public override AttributeCollection Attributes {
+ get { return _property.Attributes; }
+ }
+
+ public override bool IsReadOnly {
+ get { return _property.IsReadOnly; }
+ }
+
+ public override Type ComponentType {
+ get { return _property.ComponentType; }
+ }
+
+ public override Type PropertyType {
+ get { return _property.PropertyType; }
+ }
+ } // WrappedPropertyDescriptor
+
+ private string _name;
+ private object _propertiesProvider;
+ private DesignerOptionCollection _parent;
+ private ArrayList _children;
+ private DesignerOptionService _optionService;
+
+ internal DesignerOptionCollection (DesignerOptionCollection parent, string name, object propertiesProvider, DesignerOptionService service)
+ {
+ _name = name;
+ _propertiesProvider = propertiesProvider;
+ _parent = parent;
+
+ if (parent != null) {
+ if (parent._children == null)
+ parent._children = new ArrayList ();
+ parent._children.Add (this);
+ }
+
+ _children = new ArrayList ();
+ _optionService = service;
+ service.PopulateOptionCollection (this);
+ }
+
+ public bool ShowDialog ()
+ {
+ return _optionService.ShowDialog (this, _propertiesProvider);
+ }
+
+ public DesignerOptionCollection this[int index] {
+ get { return (DesignerOptionCollection) _children[index]; }
+ }
+
+ public DesignerOptionCollection this[string index] {
+ get {
+ foreach (DesignerOptionCollection dc in _children) {
+ if (String.Compare (dc.Name, index, true, CultureInfo.InvariantCulture) == 0)
+ return dc;
+ }
+ return null;
+ }
+ }
+
+ public string Name {
+ get { return _name; }
+ }
+
+ public int Count {
+ get {
+ if (_children != null)
+ return _children.Count;
+ return 0;
+ }
+ }
+
+ public DesignerOptionCollection Parent {
+ get { return _parent; }
+ }
+
+ public PropertyDescriptorCollection Properties {
+ get {
+ // TypeDescriptor.GetProperties gets only the public properties.
+ //
+ PropertyDescriptorCollection properties = TypeDescriptor.GetProperties (_propertiesProvider);
+ ArrayList wrappedProperties = new ArrayList (properties.Count);
+
+ foreach (PropertyDescriptor pd in properties)
+ wrappedProperties.Add (new WrappedPropertyDescriptor (pd, _propertiesProvider));
+
+ PropertyDescriptor[] propertyArray = (PropertyDescriptor[]) wrappedProperties.ToArray (typeof (PropertyDescriptor));
+ return new PropertyDescriptorCollection (propertyArray);
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return _children.GetEnumerator ();
+ }
+
+ public int IndexOf (DesignerOptionCollection item)
+ {
+ return _children.IndexOf (item);
+ }
+
+ public void CopyTo (Array array, int index)
+ {
+ _children.CopyTo (array, index);
+ }
+
+ bool IList.IsFixedSize {
+ get { return true; }
+ }
+
+ bool IList.IsReadOnly {
+ get { return true; }
+ }
+
+ object IList.this[int index] {
+ get { return this[index]; }
+ set { throw new NotSupportedException (); }
+ }
+
+ bool ICollection.IsSynchronized {
+ get { return false; }
+ }
+
+ object ICollection.SyncRoot {
+ get { return this; }
+ }
+
+ bool IList.Contains (object item)
+ {
+ return _children.Contains (item);
+ }
+
+ int IList.IndexOf (object item)
+ {
+ return _children.IndexOf (item);
+ }
+
+ int IList.Add (object item)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Remove (object item)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.RemoveAt (int index)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Insert (int index, object item)
+ {
+ throw new NotSupportedException ();
+ }
+
+ void IList.Clear ()
+ {
+ throw new NotSupportedException ();
+ }
+
+ } // DesignerOptionCollection
+
+
+ private DesignerOptionCollection _options;
+
+ protected internal DesignerOptionService ()
+ {
+ }
+
+ protected DesignerOptionCollection CreateOptionCollection (DesignerOptionCollection parent, string name, Object value)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+ if (parent == null)
+ throw new ArgumentNullException ("parent");
+ if (name == String.Empty)
+ throw new ArgumentException ("name.Length == 0");
+
+ return new DesignerOptionCollection (parent, name, value, this);
+ }
+
+ protected virtual bool ShowDialog (DesignerOptionCollection options, object optionObject)
+ {
+ return false;
+ }
+
+ protected virtual void PopulateOptionCollection (DesignerOptionCollection options)
+ {
+ }
+
+ public DesignerOptionCollection Options {
+ get {
+ if (_options == null)
+ _options = new DesignerOptionCollection (null, String.Empty, null, this);
+
+ return _options;
+ }
+ }
+
+
+ object IDesignerOptionService.GetOptionValue (string pageName, string valueName)
+ {
+ if (pageName == null)
+ throw new ArgumentNullException ("pageName");
+ if (valueName == null)
+ throw new ArgumentNullException ("valueName");
+
+ PropertyDescriptor property = GetOptionProperty (pageName, valueName);
+ if (property != null)
+ return property.GetValue (null);
+
+ return null;
+ }
+
+ void IDesignerOptionService.SetOptionValue (string pageName, string valueName, object value)
+ {
+ if (pageName == null)
+ throw new ArgumentNullException ("pageName");
+ if (valueName == null)
+ throw new ArgumentNullException ("valueName");
+
+ PropertyDescriptor property = GetOptionProperty (pageName, valueName);
+ if (property != null)
+ property.SetValue (null, value);
+ }
+
+ // Go to the page and get the property associated with the option name.
+ //
+ private PropertyDescriptor GetOptionProperty (string pageName, string valueName)
+ {
+ string[] pages = pageName.Split (new char[] { '\\' });
+
+ DesignerOptionCollection options = this.Options;
+ foreach (string page in pages) {
+ options = options[page];
+ if (options == null)
+ return null;
+ }
+
+ return options.Properties[valueName];
+ }
+
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel.Design/ITreeDesigner.cs b/mcs/class/System/System.ComponentModel.Design/ITreeDesigner.cs
new file mode 100644
index 00000000000..3762d7d4178
--- /dev/null
+++ b/mcs/class/System/System.ComponentModel.Design/ITreeDesigner.cs
@@ -0,0 +1,49 @@
+//
+// System.ComponentModel.Design.ITreeDesigner
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2006 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+using System.Collections;
+using System.ComponentModel;
+
+namespace System.ComponentModel.Design
+{
+ public interface ITreeDesigner : IDesigner, IDisposable
+ {
+ ICollection Children {
+ get;
+ }
+
+ IDesigner Parent {
+ get;
+ }
+ }
+}
+#endif
diff --git a/mcs/class/System/System.ComponentModel/ChangeLog b/mcs/class/System/System.ComponentModel/ChangeLog
index 57d5405a376..7705c3d106b 100644
--- a/mcs/class/System/System.ComponentModel/ChangeLog
+++ b/mcs/class/System/System.ComponentModel/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-29 Ivan N. Zlatev <contact@i-nz.net>
+
+ * DesignerOptionService.cs: implemented.
+ * ITreeDesigner.cs: implemented.
+
2007-08-25 Ivan N. Zlatev <contact@i-nz.net>
* NestedContainer.cs: implemented.
diff --git a/mcs/class/System/System.dll.sources b/mcs/class/System/System.dll.sources
index aba9e920413..6dd7fd2467e 100644
--- a/mcs/class/System/System.dll.sources
+++ b/mcs/class/System/System.dll.sources
@@ -217,6 +217,7 @@ System.ComponentModel.Design/ComponentEventHandler.cs
System.ComponentModel.Design/ComponentRenameEventArgs.cs
System.ComponentModel.Design/ComponentRenameEventHandler.cs
System.ComponentModel.Design/DesignerCollection.cs
+System.ComponentModel.Design/DesignerOptionService.cs
System.ComponentModel.Design/DesignerEventArgs.cs
System.ComponentModel.Design/DesignerEventHandler.cs
System.ComponentModel.Design/DesignerTransactionCloseEventArgs.cs
@@ -253,12 +254,14 @@ System.ComponentModel.Design/IResourceService.cs
System.ComponentModel.Design/IRootDesigner.cs
System.ComponentModel.Design/ISelectionService.cs
System.ComponentModel.Design/IServiceContainer.cs
+System.ComponentModel.Design/ITreeDesigner.cs
System.ComponentModel.Design/ITypeDescriptorFilterService.cs
System.ComponentModel.Design/ITypeResolutionService.cs
System.ComponentModel.Design/MenuCommand.cs
System.ComponentModel/DesignOnlyAttribute.cs
System.ComponentModel.Design/RuntimeLicenseContext.cs
System.ComponentModel.Design/SelectionTypes.cs
+System.ComponentModel.Design.Serialization/ComponentSerializationService.cs
System.ComponentModel.Design.Serialization/ContextStack.cs
System.ComponentModel.Design.Serialization/DesignerLoader.cs
System.ComponentModel.Design.Serialization/DesignerSerializerAttribute.cs
@@ -269,9 +272,13 @@ System.ComponentModel.Design.Serialization/IDesignerSerializationProvider.cs
System.ComponentModel.Design.Serialization/IDesignerSerializationService.cs
System.ComponentModel.Design.Serialization/INameCreationService.cs
System.ComponentModel.Design.Serialization/InstanceDescriptor.cs
+System.ComponentModel.Design.Serialization/MemberRelationship.cs
+System.ComponentModel.Design.Serialization/MemberRelationshipService.cs
System.ComponentModel.Design.Serialization/ResolveNameEventArgs.cs
System.ComponentModel.Design.Serialization/ResolveNameEventHandler.cs
System.ComponentModel.Design.Serialization/RootDesignerSerializerAttribute.cs
+System.ComponentModel.Design.Serialization/SerializationStore.cs
+System.ComponentModel.Design.Serialization/DefaultSerializationProviderAttribute.cs
System.ComponentModel.Design/ServiceContainer.cs
System.ComponentModel.Design/ServiceCreatorCallback.cs
System.ComponentModel.Design/StandardCommands.cs