Browse Source

* DataGrid.cs, DataList.cs, RepeatInfo.cs: added accessablity features

svn path=/trunk/mcs/; revision=58348
Vladimir Krasnov 20 years ago
parent
commit
cb13a63be9

+ 4 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,7 @@
+2006-03-23  Vladimir Krasnov  <[email protected]>
+
+	* DataGrid.cs, DataList.cs, RepeatInfo.cs: added accessablity features
+
 2006-03-23  Vladimir Krasnov  <[email protected]>
 
 	* DataGrid.cs: fixed CreateControlHierarchy, added CurrentPageIndex

+ 4 - 0
mcs/class/System.Web/System.Web.UI.WebControls/DataGrid.cs

@@ -1053,6 +1053,10 @@ namespace System.Web.UI.WebControls {
 			rt.CopyBaseAttributes (this);
 			rt.ApplyStyle (ControlStyle);
 
+			rt.Caption = Caption;
+			rt.CaptionAlign = CaptionAlign;
+			rt.Enabled = Enabled;
+
 			bool top_pager = true;
 			Style alt = null;
 			foreach (DataGridItem item in rt.Rows) {

+ 3 - 0
mcs/class/System.Web/System.Web.UI.WebControls/DataList.cs

@@ -853,6 +853,9 @@ namespace System.Web.UI.WebControls {
 			ri.RepeatColumns = RepeatColumns;
 			ri.RepeatDirection = RepeatDirection;
 			ri.RepeatLayout = RepeatLayout;
+			ri.CaptionAlign = CaptionAlign;
+			ri.Caption = Caption;
+			ri.UseAccessibleHeader = UseAccessibleHeader;
 /*
 // debugging stuff that I prefer to keep for a while
 Console.WriteLine ("RepeatColumns {0}", ri.RepeatColumns);

+ 49 - 0
mcs/class/System.Web/System.Web.UI.WebControls/RepeatInfo.cs

@@ -29,6 +29,7 @@
 //#define DEBUG_REPEAT_INFO
 
 using System.Diagnostics;
+using System.ComponentModel;
 using System.Security.Permissions;
 
 namespace System.Web.UI.WebControls {
@@ -83,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)
@@ -241,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) {
@@ -442,5 +463,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; }		
+		}
+
 	}
 }