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:
authorAndreas N <andreas@mono-cvs.ximian.com>2003-07-02 22:26:12 +0400
committerAndreas N <andreas@mono-cvs.ximian.com>2003-07-02 22:26:12 +0400
commit94ef21574a030f889477d81e41b2f95f7f656c11 (patch)
tree6faa16554b2cde21f1d7299cec383cf5f1faf756 /mcs/class/System/System.ComponentModel
parent08dbd6dc1cfdfe7ba7ac2e8fd6640b6e6e720082 (diff)
2003-07-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* AttributeCollection.cs: Fixed public members * BaseNumberConverter.cs: Changed InnerType to internal to match public assembly signature * BrowsableAttribute.cs: Removed wrong constructor, Restyle according to guidelines * CategoryAttribute.cs: Changed public fields to properties * EnumConverter.cs: Added and implemented missing properties, improved implementation * EventDescriptorCollection.cs: Fixed wrong signatures, added implementation, fixed potential bug * PropertyDescriptorCollection.cs: Fixed public members * ReferenceConverter.cs: Implementation added * SyntaxCheck.cs: Improved string checks, added MonoTODO descriptions * TypeDescriptor.cs: Implementations added svn path=/trunk/mcs/; revision=15875
Diffstat (limited to 'mcs/class/System/System.ComponentModel')
-rw-r--r--mcs/class/System/System.ComponentModel/AttributeCollection.cs4
-rw-r--r--mcs/class/System/System.ComponentModel/BaseNumberConverter.cs4
-rwxr-xr-xmcs/class/System/System.ComponentModel/BrowsableAttribute.cs9
-rwxr-xr-xmcs/class/System/System.ComponentModel/CategoryAttribute.cs404
-rw-r--r--mcs/class/System/System.ComponentModel/ChangeLog13
-rw-r--r--mcs/class/System/System.ComponentModel/EnumConverter.cs35
-rw-r--r--mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs15
-rw-r--r--mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs18
-rw-r--r--mcs/class/System/System.ComponentModel/ReferenceConverter.cs27
-rw-r--r--mcs/class/System/System.ComponentModel/SyntaxCheck.cs16
-rw-r--r--mcs/class/System/System.ComponentModel/TypeDescriptor.cs55
11 files changed, 310 insertions, 290 deletions
diff --git a/mcs/class/System/System.ComponentModel/AttributeCollection.cs b/mcs/class/System/System.ComponentModel/AttributeCollection.cs
index feaaea0c74c..9412d1966e5 100644
--- a/mcs/class/System/System.ComponentModel/AttributeCollection.cs
+++ b/mcs/class/System/System.ComponentModel/AttributeCollection.cs
@@ -88,13 +88,13 @@ namespace System.ComponentModel
return attr;
}
- public bool IsSynchronized {
+ bool ICollection.IsSynchronized {
get {
return attrList.IsSynchronized;
}
}
- public object SyncRoot {
+ object ICollection.SyncRoot {
get {
return attrList.SyncRoot;
}
diff --git a/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs b/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs
index 2267e39156b..f73e576d9fe 100644
--- a/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs
+++ b/mcs/class/System/System.ComponentModel/BaseNumberConverter.cs
@@ -2,7 +2,7 @@
// System.ComponentModel.BaseNumberConverter.cs
//
// Authors:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002/2003 Ximian, Inc (http://www.ximian.com)
// (C) 2003 Andreas Nahr
@@ -16,7 +16,7 @@ namespace System.ComponentModel
public abstract class BaseNumberConverter : TypeConverter
{
- protected Type InnerType;
+ internal Type InnerType;
protected BaseNumberConverter()
{
diff --git a/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
index e6cb5a933a2..80c6685ebfe 100755
--- a/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
+++ b/mcs/class/System/System.ComponentModel/BrowsableAttribute.cs
@@ -2,8 +2,8 @@
// System.ComponentModel.BrowsableAttribute.cs
//
// Author:
-// Miguel de Icaza (miguel@ximian.com)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Miguel de Icaza (miguel@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
// (C) 2003 Andreas Nahr
@@ -21,10 +21,6 @@ namespace System.ComponentModel {
public static readonly BrowsableAttribute No = new BrowsableAttribute (false);
public static readonly BrowsableAttribute Yes = new BrowsableAttribute (true);
- public BrowsableAttribute ()
- {
- }
-
public BrowsableAttribute (bool browsable)
{
this.browsable = browsable;
@@ -52,7 +48,6 @@ namespace System.ComponentModel {
{
return browsable == BrowsableAttribute.Default.Browsable;
}
-
}
}
diff --git a/mcs/class/System/System.ComponentModel/CategoryAttribute.cs b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
index befc19b4658..ea307d06037 100755
--- a/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
+++ b/mcs/class/System/System.ComponentModel/CategoryAttribute.cs
@@ -2,8 +2,8 @@
// System.ComponentModel.CategoryAttribute.cs
//
// Author:
-// Miguel de Icaza (miguel@ximian.com)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Miguel de Icaza (miguel@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Ximian, Inc. http://www.ximian.com
// (C) 2003 Andreas Nahr
@@ -18,19 +18,9 @@ namespace System.ComponentModel {
private string category;
private bool IsLocalized = false;
- public static readonly CategoryAttribute Default = new CategoryAttribute ();
- public static readonly CategoryAttribute Action = new CategoryAttribute ("Action");
- public static readonly CategoryAttribute Appearance = new CategoryAttribute ("Appearance");
- public static readonly CategoryAttribute Behavior = new CategoryAttribute ("Behavior");
- public static readonly CategoryAttribute Data = new CategoryAttribute ("Data");
- public static readonly CategoryAttribute Design = new CategoryAttribute ("Design");
- public static readonly CategoryAttribute DragDrop = new CategoryAttribute ("Drag Drop");
- public static readonly CategoryAttribute Focus = new CategoryAttribute ("Focus");
- public static readonly CategoryAttribute Format = new CategoryAttribute ("Format");
- public static readonly CategoryAttribute Key = new CategoryAttribute ("Key");
- public static readonly CategoryAttribute Layout = new CategoryAttribute ("Layout");
- public static readonly CategoryAttribute Mouse = new CategoryAttribute ("Mouse");
- public static readonly CategoryAttribute WindowStyle = new CategoryAttribute ("Window Style");
+ static CategoryAttribute action, appearance, behaviour, data, def;
+ static CategoryAttribute design, drag_drop, focus, format, key;
+ static CategoryAttribute layout, mouse, window_style;
public CategoryAttribute ()
@@ -38,12 +28,182 @@ namespace System.ComponentModel {
this.category = "Misc";
}
-
public CategoryAttribute (string category)
{
this.category = 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 Behavior {
+ get {
+ if (behaviour != null)
+ return behaviour;
+
+ lock (typeof (CategoryAttribute)) {
+ if (behaviour == null)
+ behaviour = new CategoryAttribute ("Behavior");
+ }
+ 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 ();
+ }
+ 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;
+ }
+ }
+
+ [MonoTODO ("Add localization support")]
protected virtual string GetLocalizedString (string value)
{
// FIXME: Check if other implementation exists
@@ -81,218 +241,6 @@ namespace System.ComponentModel {
{
return category == CategoryAttribute.Default.Category;
}
-
- // OLD IMPLEMENTATION - redid the implementation without storing any of the static
- // members which require to do locks to keep in sync
- // 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
index cdb747b6d28..0e89562a7e8 100644
--- a/mcs/class/System/System.ComponentModel/ChangeLog
+++ b/mcs/class/System/System.ComponentModel/ChangeLog
@@ -1,5 +1,18 @@
2003-07-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+ * AttributeCollection.cs: Fixed public members
+ * BaseNumberConverter.cs: Changed InnerType to internal to match public assembly signature
+ * BrowsableAttribute.cs: Removed wrong constructor, Restyle according to guidelines
+ * CategoryAttribute.cs: Changed public fields to properties
+ * EnumConverter.cs: Added and implemented missing properties, improved implementation
+ * EventDescriptorCollection.cs: Fixed wrong signatures, added implementation, fixed potential bug
+ * PropertyDescriptorCollection.cs: Fixed public members
+ * ReferenceConverter.cs: Implementation added
+ * SyntaxCheck.cs: Improved string checks, added MonoTODO descriptions
+ * TypeDescriptor.cs: Implementations added
+
+2003-07-02 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
+
* ISite.cs: Fixed attributes, fixed header
* ITypeDescriptorContext.cs: Fixed attributes, formatting corrections
* WarningException.cs: Fixed attributes, formatting corrections
diff --git a/mcs/class/System/System.ComponentModel/EnumConverter.cs b/mcs/class/System/System.ComponentModel/EnumConverter.cs
index 46f43f41757..ecd751a8e11 100644
--- a/mcs/class/System/System.ComponentModel/EnumConverter.cs
+++ b/mcs/class/System/System.ComponentModel/EnumConverter.cs
@@ -1,12 +1,15 @@
//
-// System.ComponentModel.EnumConverter
+// System.ComponentModel.EnumConverter.cs
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
+// (C) 2003 Andreas Nahr
//
using System;
+using System.Collections;
using System.Globalization;
namespace System.ComponentModel
@@ -34,7 +37,8 @@ namespace System.ComponentModel
Type destinationType)
{
if (destinationType == typeof (string))
- return value.ToString ();
+ if (value != null)
+ return Enum.Format (type, value, "G");
return base.ConvertTo (context, culture, value, destinationType);
}
@@ -86,6 +90,31 @@ namespace System.ComponentModel
}
return stdValues;
}
+
+ protected IComparer Comparer {
+ get { return new EnumConverter.EnumComparer (); }
+ }
+
+ protected Type EnumType {
+ get { return type; }
+ }
+
+ protected TypeConverter.StandardValuesCollection Values {
+ get { return stdValues; }
+ set { stdValues = value; }
+ }
+
+ private class EnumComparer : IComparer
+ {
+ int IComparer.Compare (object compareObject1, object compareObject2)
+ {
+ string CompareString1 = (compareObject1 as string);
+ string CompareString2 = (compareObject2 as string);
+ if ((CompareString1 == null) || (CompareString2 == null))
+ return Collections.Comparer.Default.Compare (compareObject1, compareObject2);
+ return CultureInfo.InvariantCulture.CompareInfo.Compare (CompareString1, CompareString2);
+ }
+ }
}
}
diff --git a/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs b/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs
index e15c511536c..b37224005cd 100644
--- a/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs
+++ b/mcs/class/System/System.ComponentModel/EventDescriptorCollection.cs
@@ -17,7 +17,7 @@ namespace System.ComponentModel
[ComVisible (true)]
public class EventDescriptorCollection : IList, ICollection, IEnumerable
{
- private ArrayList eventList;
+ private ArrayList eventList = new ArrayList ();
public static readonly EventDescriptorCollection Empty;
@@ -88,13 +88,12 @@ namespace System.ComponentModel
throw new NotImplementedException ();
}
- [MonoTODO]
- protected virtual EventDescriptorCollection InternalSort (IComparer comparer) {
- throw new NotImplementedException ();
+ protected virtual void InternalSort (IComparer comparer) {
+ eventList.Sort (comparer);
}
[MonoTODO]
- protected virtual EventDescriptorCollection InternalSort (string[] order) {
+ protected virtual void InternalSort (string[] order) {
throw new NotImplementedException ();
}
@@ -148,17 +147,15 @@ namespace System.ComponentModel
get {
return eventList[index];
}
- [MonoTODO]
set {
- throw new NotImplementedException ();
+ eventList[index] = value;
}
}
// ICollection methods
- [MonoTODO]
void ICollection.CopyTo (Array array, int index) {
- throw new NotImplementedException ();
+ eventList.CopyTo (array, index);
}
bool ICollection.IsSynchronized {
diff --git a/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs b/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
index 21f15d81d9b..177f1f2f59c 100644
--- a/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
+++ b/mcs/class/System/System.ComponentModel/PropertyDescriptorCollection.cs
@@ -2,9 +2,9 @@
// System.ComponentModel.PropertyDescriptorCollection.cs
//
// Authors:
-// Rodrigo Moya (rodrigo@ximian.com)
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Rodrigo Moya (rodrigo@ximian.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) Rodrigo Moya, 2002
// (c) 2002 Ximian, Inc. (http://www.ximian.com)
@@ -198,14 +198,22 @@ namespace System.ComponentModel
}
}
- public bool IsReadOnly
+ bool IList.IsReadOnly
{
get {
return readOnly;
}
}
- public bool IsSynchronized
+ bool IDictionary.IsReadOnly
+ {
+ get
+ {
+ return readOnly;
+ }
+ }
+
+ bool ICollection.IsSynchronized
{
get {
return false;
diff --git a/mcs/class/System/System.ComponentModel/ReferenceConverter.cs b/mcs/class/System/System.ComponentModel/ReferenceConverter.cs
index 662a5234ad4..9670bba55de 100644
--- a/mcs/class/System/System.ComponentModel/ReferenceConverter.cs
+++ b/mcs/class/System/System.ComponentModel/ReferenceConverter.cs
@@ -1,10 +1,12 @@
//
-// System.ComponentModel.ReferenceConverter
+// System.ComponentModel.ReferenceConverter.cs
//
// Authors:
-// Martin Willemoes Hansen (mwh@sysrq.dk)
+// Martin Willemoes Hansen (mwh@sysrq.dk)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Martin Willemoes Hansen
+// (C) 2003 Andreas Nahr
//
using System.Globalization;
@@ -13,16 +15,17 @@ namespace System.ComponentModel
{
public class ReferenceConverter : TypeConverter
{
- [MonoTODO]
+
public ReferenceConverter (Type type)
{
}
- [MonoTODO]
public override bool CanConvertFrom (ITypeDescriptorContext context,
Type sourceType)
{
- throw new NotImplementedException();
+ if (sourceType == typeof (string))
+ return true;
+ return base.CanConvertFrom (context, sourceType);
}
[MonoTODO]
@@ -48,27 +51,19 @@ namespace System.ComponentModel
throw new NotImplementedException();
}
- [MonoTODO]
public override bool GetStandardValuesExclusive (ITypeDescriptorContext context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
public override bool GetStandardValuesSupported (ITypeDescriptorContext context)
{
- throw new NotImplementedException();
+ return true;
}
- [MonoTODO]
protected virtual bool IsValueAllowed (ITypeDescriptorContext context, object value)
{
- throw new NotImplementedException();
- }
-
- [MonoTODO]
- ~ReferenceConverter()
- {
+ return true;
}
}
}
diff --git a/mcs/class/System/System.ComponentModel/SyntaxCheck.cs b/mcs/class/System/System.ComponentModel/SyntaxCheck.cs
index 6bd896699b9..287b084a63a 100644
--- a/mcs/class/System/System.ComponentModel/SyntaxCheck.cs
+++ b/mcs/class/System/System.ComponentModel/SyntaxCheck.cs
@@ -1,8 +1,8 @@
//
-// System.ComponentModel.SyntaxCheck
+// System.ComponentModel.SyntaxCheck.cs
//
// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2003 Andreas Nahr
//
@@ -11,25 +11,26 @@ using System.IO;
namespace System.ComponentModel
{
+ // LAMESPEC should be sealed or event internal?
public class SyntaxCheck
{
private SyntaxCheck ()
{
}
- [MonoTODO]
+ [MonoTODO ("Don't know what MS wants to do with this")]
public static bool CheckMachineName (string value)
{
- if (value == null || value.Trim () == "")
+ if (value == null || value.Trim ().Length == 0)
return false;
return Environment.MachineName.Equals (value);
}
- [MonoTODO]
+ [MonoTODO ("Don't know what MS wants to do with this")]
public static bool CheckPath (string value)
{
- if (value == null || value.Trim () == "")
+ if (value == null || value.Trim ().Length == 0)
return false;
try {
@@ -40,10 +41,9 @@ namespace System.ComponentModel
return true;
}
- [MonoTODO]
public static bool CheckRootedPath (string value)
{
- if (value == null || value.Trim () == "")
+ if (value == null || value.Trim ().Length == 0)
return false;
return Path.IsPathRooted (value);
diff --git a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
index cd86efac8be..ae9ec11a2a0 100644
--- a/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
+++ b/mcs/class/System/System.ComponentModel/TypeDescriptor.cs
@@ -1,9 +1,9 @@
//
-// System.ComponentModel.TypeDescriptor
+// System.ComponentModel.TypeDescriptor.cs
//
// Authors:
-// Gonzalo Paniagua Javier (gonzalo@ximian.com)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
+// Gonzalo Paniagua Javier (gonzalo@ximian.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Ximian, Inc (http://www.ximian.com)
// (C) 2003 Andreas Nahr
@@ -12,6 +12,7 @@
using System;
using System.Collections;
using System.Reflection;
+using System.Globalization;
using System.ComponentModel.Design;
namespace System.ComponentModel
@@ -21,6 +22,7 @@ public sealed class TypeDescriptor
{
private static readonly string creatingDefaultConverters = "creatingDefaultConverters";
private static Hashtable defaultConverters;
+ private static IComNativeDescriptorHandler descriptorHandler;
private TypeDescriptor ()
{
@@ -150,7 +152,17 @@ public sealed class TypeDescriptor
[MonoTODO]
public static TypeConverter GetConverter (object component, bool noCustomTypeDesc)
{
- throw new NotImplementedException ();
+ if (component == null)
+ throw new ArgumentNullException ("component", "component cannot be null");
+
+ // FIXME: implementation correct?
+ if (noCustomTypeDesc == false && component is ICustomTypeDescriptor) {
+ return ((ICustomTypeDescriptor) component).GetConverter ();
+ }
+ else {
+ // return the normal converter of this component
+ return null;
+ }
}
private static Hashtable DefaultConverters
@@ -163,10 +175,32 @@ public sealed class TypeDescriptor
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 (bool), typeof (BooleanConverter));
+ defaultConverters.Add (typeof (byte), typeof (ByteConverter));
+ defaultConverters.Add (typeof (sbyte), typeof (SByteConverter));
defaultConverters.Add (typeof (string), typeof (StringConverter));
+ defaultConverters.Add (typeof (char), typeof (CharConverter));
+ defaultConverters.Add (typeof (short), typeof (Int16Converter));
+ defaultConverters.Add (typeof (int), typeof (Int32Converter));
+ defaultConverters.Add (typeof (long), typeof (Int64Converter));
+ defaultConverters.Add (typeof (ushort), typeof (UInt16Converter));
+ defaultConverters.Add (typeof (uint), typeof (UInt32Converter));
+ defaultConverters.Add (typeof (ulong), typeof (UInt64Converter));
+ defaultConverters.Add (typeof (float), typeof (SingleConverter));
+ defaultConverters.Add (typeof (double), typeof (DoubleConverter));
+ defaultConverters.Add (typeof (decimal), typeof (DecimalConverter));
+ defaultConverters.Add (typeof (object), typeof (TypeConverter));
+ defaultConverters.Add (typeof (void), typeof (TypeConverter));
+ defaultConverters.Add (typeof (Array), typeof (ArrayConverter));
+ defaultConverters.Add (typeof (CultureInfo), typeof (CultureInfoConverter));
+ defaultConverters.Add (typeof (DateTime), typeof (DateTimeConverter));
+ defaultConverters.Add (typeof (Enum), typeof (EnumConverter));
+ defaultConverters.Add (typeof (Guid), typeof (GuidConverter));
+ defaultConverters.Add (typeof (TimeSpan), typeof (TimeSpanConverter));
+ defaultConverters.Add (typeof (ICollection), typeof (CollectionConverter));
+ //FIXME We need to add the type for the ReferenceConverter
+ //defaultConverters.Add (typeof (????), typeof (ReferenceConverter));
}
return defaultConverters;
}
@@ -363,10 +397,9 @@ public sealed class TypeDescriptor
throw new NotImplementedException ();
}
- [MonoTODO]
public static IComNativeDescriptorHandler ComNativeDescriptorHandler {
- get{ throw new NotImplementedException (); }
- set{ throw new NotImplementedException (); }
+ get { return descriptorHandler; }
+ set { descriptorHandler = value; }
}
[MonoTODO]
@@ -390,10 +423,12 @@ public sealed class TypeDescriptor
[MonoTODO]
public static void Refresh (Type type)
{
+ //FIXME this is just to get rid of the warning about Refreshed never being used
+ if (Refreshed != null)
+ Refreshed (new RefreshEventArgs (type));
throw new NotImplementedException ();
}
- [MonoTODO]
public static event RefreshEventHandler Refreshed;
}
}