2006-08-03 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / CheckBoxList.cs
index 5cf2fd31ef43ab6efdfa17aa574ca40e8e1a8608..35fd1827e3ca31d7963398077bf5f9d82672e8bc 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-using System;
 using System.Globalization;
 using System.Collections.Specialized;
 using System.ComponentModel;
-
+using System.Security.Permissions;
 
 namespace System.Web.UI.WebControls {
 
+       // CAS
+       [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
+       [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public class CheckBoxList : ListControl, IRepeatInfoUser,
                                    INamingContainer, IPostBackDataHandler {
 
@@ -49,6 +51,8 @@ namespace System.Web.UI.WebControls {
                [Bindable(true)]
 #endif         
                [DefaultValue(-1)]
+               [WebSysDescription ("")]
+               [WebCategory ("Layout")]
                public virtual int CellPadding {
                        get { return TableStyle.CellPadding; }
                        set { TableStyle.CellPadding = value; }
@@ -58,6 +62,8 @@ namespace System.Web.UI.WebControls {
                [Bindable(true)]
 #endif         
                [DefaultValue(-1)]
+               [WebSysDescription ("")]
+               [WebCategory ("Layout")]
                public virtual int CellSpacing {
                        get { return TableStyle.CellSpacing; }
                        set { TableStyle.CellSpacing = value; }
@@ -67,6 +73,8 @@ namespace System.Web.UI.WebControls {
                [Bindable(true)]
 #endif         
                [DefaultValue(0)]
+               [WebSysDescription ("")]
+               [WebCategory ("Layout")]
                public virtual int RepeatColumns {
                        get { return ViewState.GetInt ("RepeatColumns", 0); }
                        set {
@@ -80,6 +88,8 @@ namespace System.Web.UI.WebControls {
                [Bindable(true)]
 #endif         
                [DefaultValue(RepeatDirection.Vertical)]
+               [WebSysDescription ("")]
+               [WebCategory ("Layout")]
                public virtual RepeatDirection RepeatDirection {
                        get {
                                return (RepeatDirection) ViewState.GetInt ("RepeatDirection",
@@ -97,6 +107,8 @@ namespace System.Web.UI.WebControls {
                [Bindable(true)]
 #endif         
                [DefaultValue(RepeatLayout.Table)]
+               [WebSysDescription ("")]
+               [WebCategory ("Layout")]
                public virtual RepeatLayout RepeatLayout {
                        get {
                                return (RepeatLayout) ViewState.GetInt ("RepeatLayout",
@@ -114,6 +126,8 @@ namespace System.Web.UI.WebControls {
                [Bindable(true)]
 #endif         
                [DefaultValue(TextAlign.Right)]
+               [WebSysDescription ("")]
+               [WebCategory ("Appearance")]
                public virtual TextAlign TextAlign {
                        get {
                                return (TextAlign) ViewState.GetInt ("TextAlign",
@@ -126,40 +140,6 @@ namespace System.Web.UI.WebControls {
                        }
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual bool HasFooter 
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual bool HasHeader
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual bool HasSeparators
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-
-               [MonoTODO]
-               protected virtual int RepeatedItemCount
-               {
-                       get {
-                               throw new NotImplementedException ();
-                       }
-               }
-#endif         
-
                private TableStyle TableStyle {
                        get { return (TableStyle) ControlStyle; }
                }
@@ -175,15 +155,6 @@ namespace System.Web.UI.WebControls {
                        return this;
                }
 
-#if NET_2_0
-               [MonoTODO]
-               protected virtual Style GetItemStyle (ListItemType itemType,
-                                                     int repeatIndex)
-               {
-                       throw new NotImplementedException ();
-               }
-#endif
-               
 #if NET_2_0
                protected internal
 #else          
@@ -233,30 +204,9 @@ namespace System.Web.UI.WebControls {
                }
 
 #if NET_2_0
-               [MonoTODO]
-               protected virtual void RenderItem (ListItemType itemType,
-                                                  int repeatIndex,
-                                                  RepeatInfo repeatInfo,
-                                                  HtmlTextWriter w)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               protected virtual void RaisePostDataChangedEvent ()
-               {
-                       throw new NotImplementedException ();
-               }
-#endif         
-
-               bool IPostBackDataHandler.LoadPostData (string postDataKey,
-                               NameValueCollection postCollection)
+               protected virtual
+#endif
+               bool LoadPostData (string postDataKey, NameValueCollection postCollection)
                {
                        int checkbox = -1;
 
@@ -283,36 +233,104 @@ namespace System.Web.UI.WebControls {
                        return false;
                }
 
-               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+#if NET_2_0
+               protected virtual
+#endif
+               void RaisePostDataChangedEvent ()
                {
                        OnSelectedIndexChanged (EventArgs.Empty);
                }
 
+               bool IPostBackDataHandler.LoadPostData (string postDataKey,
+                                                       NameValueCollection postCollection)
+               {
+                       return LoadPostData (postDataKey, postCollection);
+               }
+
+               void IPostBackDataHandler.RaisePostDataChangedEvent ()
+               {
+                       RaisePostDataChangedEvent ();
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasFooter 
+               {
+                       get {
+                               return false;
+                       }
+               }
+
                bool IRepeatInfoUser.HasFooter {
-                       get { return false; }
+                       get { return HasFooter; }
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasHeader
+               {
+                       get {
+                               return false;
+                       }
                }
 
                bool IRepeatInfoUser.HasHeader {
-                       get { return false; }
+                       get { return HasHeader; }
+               }
+
+
+#if NET_2_0
+               protected virtual
+#endif
+               bool HasSeparators
+               {
+                       get {
+                               return false;
+                       }
                }
 
                bool IRepeatInfoUser.HasSeparators {
-                       get { return false; }
+                       get { return HasSeparators; }
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               int RepeatedItemCount
+               {
+                       get {
+                               return Items.Count;
+                       }
                }
 
                int IRepeatInfoUser.RepeatedItemCount {
-                       get { return Items.Count; }
+                       get { return RepeatedItemCount; }
                }
 
-               Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
-                               int repeatIndex)
+#if NET_2_0
+               protected virtual
+#endif
+               Style GetItemStyle (ListItemType itemType,
+                                   int repeatIndex)
                {
                        return null;
                }
 
-               void IRepeatInfoUser.RenderItem (ListItemType itemType,
-                               int repeatIndex, RepeatInfo repeatInfo,
-                               HtmlTextWriter writer)
+               Style IRepeatInfoUser.GetItemStyle (ListItemType itemType,
+                                                   int repeatIndex)
+               {
+                       return GetItemStyle (itemType, repeatIndex);
+               }
+
+#if NET_2_0
+               protected virtual
+#endif
+               void RenderItem (ListItemType itemType,
+                                int repeatIndex,
+                                RepeatInfo repeatInfo,
+                                HtmlTextWriter writer)
                {
                        ListItem item = Items [repeatIndex];
 
@@ -320,7 +338,16 @@ namespace System.Web.UI.WebControls {
                        check_box.Text = item.Text;
                        check_box.AutoPostBack = AutoPostBack;
                        check_box.Checked = item.Selected;
+                       check_box.TextAlign = TextAlign;
+                       check_box.Enabled = Enabled;
                        check_box.RenderControl (writer);
                }
+
+               void IRepeatInfoUser.RenderItem (ListItemType itemType,
+                                                int repeatIndex, RepeatInfo repeatInfo,
+                                                HtmlTextWriter writer)
+               {
+                       RenderItem (itemType, repeatIndex, repeatInfo, writer);
+               }
        }
 }