More files from Toelen
[mono.git] / mcs / class / System.Web / System.Web.UI.HtmlControls / HtmlImage.cs
1 /*      System.Web.UI.HtmlControls
2 *       Authors
3 *               Leen Toelen (toelen@hotmail.com)
4 */
5
6 using System;
7 using System.Web;
8 using System.Web.UI;
9 using System.Globalization;
10
11 namespace System.Web.UI.HtmlControls{
12         
13         public class HtmlImage : HtmlControl{
14                 
15                 public HtmlImage(): base("img"){}
16                 
17                 protected override void RenderAttributes(HtmlTextWriter writer){
18                         PreProcessRelativeReferenceAttribute(writer,"src");
19                         RenderAttributes(writer);
20                         writer.Write(" /");
21                 }
22                 
23                 public string Align{
24                         get{
25                                 string attr = Attributes["align"];
26                                 if (attr != null){
27                                         return attr;
28                                 }
29                                 return "";
30                         }
31                         set{
32                                 Attributes["align"] = MapStringAttributeToString(value);
33                         }
34                 }
35                 
36                 public string Alt{
37                         get{
38                                 string attr = Attributes["alt"];
39                                 if (attr != null){
40                                         return attr;
41                                 }
42                                 return "";
43                         }
44                         set{
45                                 Attributes["alt"] = MapStringAttributeToString(value);
46                         }
47                 }
48                 
49                 public int Border{
50                         get{
51                                 string attr = Attributes["border"];
52                                 if (attr != null){
53                                         return Int32.Parse(attr,CultureInfo.InvariantCulture);
54                                 }
55                                 return -1;
56                         }
57                         set{
58                                 Attributes["border"] = MapIntegerAttributeToString(value);
59                         }
60                 }
61                 
62                 public string Src{
63                         get{
64                                 string attr = Attributes["src"];
65                                 if (attr != null){
66                                         return attr;
67                                 }
68                                 return "";
69                         }
70                         set{
71                                 Attributes["src"] = MapStringAttributeToString(value);
72                         }
73                 }
74                 
75                 public int Width{
76                         get{
77                                 string attr = Attributes["width"];
78                                 if (attr != null){
79                                         return Int32.Parse(attr,CultureInfo.InvariantCulture);
80                                 }
81                                 return -1;
82                         }
83                         set{
84                                 Attributes["width"] = MapIntegerAttributeToString(value);
85                         }
86                 }
87                 
88         } // class HtmlImage
89 } // namespace System.Web.UI.HtmlControls
90
91