2002-01-31 Gaurav Vaish <gvaish@.iitk.ac.in>
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / WebColorConverter.cs
1 /**\r
2  * Namespace: System.Web.UI.WebControls\r
3  * Class:     WebColorConverter\r
4  * \r
5  * Author:  Gaurav Vaish\r
6  * Maintainer: gvaish@iitk.ac.in\r
7  * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
8  * Implementation: yes\r
9  * Status:  ??%\r
10  * \r
11  * (C) Gaurav Vaish (2002)\r
12  */\r
13 \r
14 using System;\r
15 using System.Drawing;\r
16 using System.Web;\r
17 using System.Web.UI;\r
18 \r
19 namespace System.Web.UI.WebControls\r
20 {\r
21         public class WebColorConverter : ColorConverter\r
22         {\r
23                 public WebColorConverter(): base()\r
24                 {\r
25                 }\r
26                 \r
27                 [MonoTODO("Implement_If_Color_Is_#xxxxxx_OR_A_KnownColor")]\r
28                 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\r
29                 {\r
30                         if(value is string)\r
31                         {\r
32                                 string val = ((string)value).Trim();\r
33                                 if(val == String.Empty || val.Lenth == 0)\r
34                                 {\r
35                                         return Color.Empty;\r
36                                 }\r
37                                 if(val[0] == '#')\r
38                                 {\r
39                                         throw new NotImplementedException();\r
40                                 }\r
41                         }\r
42                         return ConvertFrom(context, culture, value);\r
43                 }\r
44                 \r
45                 [MonoTODO("Convert_To_For_KnownColor_And_For_#xxxxxx")]\r
46                 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)\r
47                 {\r
48                         if(destinationType == null)\r
49                         {\r
50                                 throw new ArgumentNullException("destinationType");\r
51                         }\r
52                         throw new NotImplementedException();\r
53                 }\r
54         }\r
55 }\r