2 // System.Web.UI.WebControls.SubMenuStyle.cs
5 // Lluis Sanchez Gual (lluis@novell.com)
7 // (C) 2004 Novell, Inc (http://www.novell.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
34 using System.ComponentModel;
36 namespace System.Web.UI.WebControls
38 public class SubMenuStyle: Style, ICustomTypeDescriptor
40 const string HORZ_PADD = "HorizontalPadding";
41 const string VERT_PADD = "VerticalPadding";
43 public SubMenuStyle ()
47 public SubMenuStyle (StateBag bag): base (bag)
53 return ViewState [v] != null;
56 [DefaultValue (typeof(Unit), "")]
57 [NotifyParentProperty (true)]
58 public Unit HorizontalPadding {
61 return (Unit)(ViewState[HORZ_PADD]);
65 ViewState[HORZ_PADD] = value;
69 [DefaultValue (typeof(Unit), "")]
70 [NotifyParentProperty (true)]
71 public Unit VerticalPadding {
74 return (Unit)(ViewState[VERT_PADD]);
78 ViewState[VERT_PADD] = value;
82 public override void CopyFrom (Style s)
84 if (s == null || s.IsEmpty)
88 SubMenuStyle from = s as SubMenuStyle;
92 if (from.IsSet (HORZ_PADD))
93 HorizontalPadding = from.HorizontalPadding;
95 if (from.IsSet (VERT_PADD))
96 VerticalPadding = from.VerticalPadding;
99 public override void MergeWith(Style s)
101 if(s != null && !s.IsEmpty)
109 SubMenuStyle with = s as SubMenuStyle;
110 if (with == null) return;
112 if (with.IsSet(HORZ_PADD) && !IsSet(HORZ_PADD)) {
113 HorizontalPadding = with.HorizontalPadding;
115 if (with.IsSet(VERT_PADD) && !IsSet(VERT_PADD)) {
116 VerticalPadding = with.VerticalPadding;
121 public override void Reset()
124 ViewState.Remove("HorizontalPadding");
126 ViewState.Remove("VerticalPadding");
130 protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
132 base.FillStyleAttributes (attributes, urlResolver);
133 if (IsSet (HORZ_PADD)) {
134 attributes.Add (HtmlTextWriterStyle.PaddingLeft, HorizontalPadding.ToString ());
135 attributes.Add (HtmlTextWriterStyle.PaddingRight, HorizontalPadding.ToString ());
137 if (IsSet (VERT_PADD)) {
138 attributes.Add (HtmlTextWriterStyle.PaddingTop, VerticalPadding.ToString ());
139 attributes.Add (HtmlTextWriterStyle.PaddingBottom, VerticalPadding.ToString ());
143 [MonoTODO ("Not implemented")]
144 System.ComponentModel.AttributeCollection ICustomTypeDescriptor.GetAttributes ()
146 throw new NotImplementedException ();
149 [MonoTODO("Not implemented")]
150 string ICustomTypeDescriptor.GetClassName ()
152 throw new NotImplementedException ();
155 [MonoTODO("Not implemented")]
156 string ICustomTypeDescriptor.GetComponentName ()
158 throw new NotImplementedException ();
161 [MonoTODO("Not implemented")]
162 TypeConverter ICustomTypeDescriptor.GetConverter ()
164 throw new NotImplementedException ();
167 [MonoTODO("Not implemented")]
168 EventDescriptor ICustomTypeDescriptor.GetDefaultEvent ()
170 throw new NotImplementedException ();
173 [MonoTODO("Not implemented")]
174 PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty ()
176 throw new NotImplementedException ();
179 [MonoTODO("Not implemented")]
180 object ICustomTypeDescriptor.GetEditor (Type editorBaseType)
182 throw new NotImplementedException ();
185 [MonoTODO("Not implemented")]
186 EventDescriptorCollection ICustomTypeDescriptor.GetEvents ()
188 throw new NotImplementedException ();
191 [MonoTODO("Not implemented")]
192 EventDescriptorCollection ICustomTypeDescriptor.GetEvents (Attribute [] arr)
194 throw new NotImplementedException ();
197 [MonoTODO("Not implemented")]
198 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ()
200 throw new NotImplementedException ();
203 [MonoTODO("Not implemented")]
204 PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute [] arr)
206 throw new NotImplementedException ();
209 [MonoTODO("Not implemented")]
210 object ICustomTypeDescriptor.GetPropertyOwner (PropertyDescriptor pd)
212 throw new NotImplementedException ();