2 // System.Web.UI.WebControls.Panel.cs
5 // Ben Maurer (bmaurer@novell.com)
7 // (C) 2005 Novell, Inc (http://www.novell.com)
9 // TODO: Are we missing something in LoadViewState?
10 // What to do in AddParsedSubObject
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.ComponentModel;
33 using System.Security.Permissions;
35 namespace System.Web.UI.WebControls {
38 [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
39 [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
41 [Designer ("System.Web.UI.Design.WebControls.PanelDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
42 [ParseChildren (false)]
43 [PersistChildren (true)]
44 [ToolboxData ("<{0}:Panel runat=server>Panel</{0}:Panel>")]
45 public class Panel : WebControl {
47 public Panel () : base (HtmlTextWriterTag.Div)
51 protected override void AddAttributesToRender (HtmlTextWriter w)
53 base.AddAttributesToRender (w);
55 string image = BackImageUrl;
57 image = String.Format ("url({0})", image);
58 w.AddStyleAttribute (HtmlTextWriterStyle.BackgroundImage, image);
63 w.AddStyleAttribute (HtmlTextWriterStyle.WhiteSpace, "nowrap");
65 w.AddAttribute (HtmlTextWriterAttribute.Nowrap, "nowrap");
71 switch (HorizontalAlign) {
72 case HorizontalAlign.Center: align = "center"; break;
73 case HorizontalAlign.Justify: align = "justify"; break;
74 case HorizontalAlign.Left: align = "left"; break;
75 case HorizontalAlign.Right: align = "right"; break;
79 w.AddAttribute (HtmlTextWriterAttribute.Align, align);
84 [Editor("System.Web.UI.Design.ImageUrlEditor, " + Consts.AssemblySystem_Design, typeof(System.Drawing.Design.UITypeEditor))]
85 [WebSysDescription ("")]
86 [WebCategory ("Appearance")]
87 public virtual string BackImageUrl {
89 return ViewState.GetString ("BackImageUrl", "");
93 ViewState ["BackImageUrl"] = value;
98 [DefaultValue(HorizontalAlign.NotSet)]
99 [WebSysDescription ("")]
100 [WebCategory ("Layout")]
101 public virtual HorizontalAlign HorizontalAlign {
103 return (HorizontalAlign) ViewState.GetInt ("HorizontalAlign", (int) HorizontalAlign.NotSet);
106 ViewState ["HorizontalAlign"] = (int) value;
112 [WebSysDescription ("")]
113 [WebCategory ("Layout")]
114 public virtual bool Wrap {
116 return ViewState.GetBool ("Wrap", true);
119 ViewState ["Wrap"] = value;