2006-10-18 Igor Zelmanovich <igorz@mainsoft.com>
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / RepeatInfo.cs
index 92d885d7065e9ef418ba5beb07e7be58f678512a..788dfc6a5107aa252f7e3354f00545e1e586994f 100644 (file)
 //#define DEBUG_REPEAT_INFO
 
 using System.Diagnostics;
+using System.ComponentModel;
+using System.Security.Permissions;
 
 namespace System.Web.UI.WebControls {
 
+       // CAS - no inheritance demand required because the class is sealed
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class RepeatInfo {
 
                // What is baseControl for ?
@@ -80,6 +84,16 @@ namespace System.Web.UI.WebControls {
                        if (! oti)
                                RenderBeginTag (w, controlStyle, baseControl);
 
+                       if (UseAccessibleHeader) {
+                               if (CaptionAlign != TableCaptionAlign.NotSet)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Align, CaptionAlign.ToString());
+
+                               w.RenderBeginTag (HtmlTextWriterTag.Caption);
+                               w.Write (Caption);
+                               w.RenderEndTag ();
+
+                       }
+
                        // Render the header
                        if (user.HasHeader) {
                                if (oti)
@@ -238,6 +252,16 @@ namespace System.Web.UI.WebControls {
 
                        RenderBeginTag (w, controlStyle, baseControl);
                        
+                       if (UseAccessibleHeader) {
+                               if (CaptionAlign != TableCaptionAlign.NotSet)
+                                       w.AddAttribute (HtmlTextWriterAttribute.Align, CaptionAlign.ToString());
+
+                               w.RenderBeginTag (HtmlTextWriterTag.Caption);
+                               w.Write (Caption);
+                               w.RenderEndTag ();
+
+                       }
+                       
                        // Render the header
                        if (user.HasHeader) {
                                if (table) {
@@ -376,6 +400,7 @@ namespace System.Web.UI.WebControls {
                        c.ID = wc.ClientID;
                        c.CopyBaseAttributes (wc);
                        c.ApplyStyle (s);
+                       c.Enabled = wc.Enabled;
                        c.RenderBeginTag (w);
                }
                
@@ -439,5 +464,33 @@ namespace System.Web.UI.WebControls {
                        if (HttpContext.Current != null)
                                HttpContext.Current.Trace.Write (s);
                }
+
+               private string caption = "";
+               private TableCaptionAlign captionAlign = TableCaptionAlign.NotSet; 
+               private  bool useAccessibleHeader = false; 
+
+               [WebSysDescription ("")]
+               [WebCategory ("Accessibility")]
+               public string Caption {
+                       get {return caption;}
+                       set { caption = value; }
+               }
+
+               [WebSysDescription ("")]
+               [DefaultValue (TableCaptionAlign.NotSet)]
+               [WebCategory ("Accessibility")]
+               public TableCaptionAlign CaptionAlign {
+                       get {return captionAlign;}
+                       set { captionAlign = value; }
+               }
+
+               [WebSysDescription ("")]
+               [DefaultValue (false)]
+               [WebCategory ("Accessibility")]
+               public bool UseAccessibleHeader {
+                       get {return useAccessibleHeader;}
+                       set { useAccessibleHeader = value; }            
+               }
+
        }
 }