2 // System.Web.UI.WebControls.MenuItemStyle.cs
5 // Igor Zelmanovich (igorz@mainsoft.com)
7 // (C) 2007 Mainsoft, Inc (http://www.mainsoft.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 PanelStyle : Style
43 BackImageUrl = 0x00010000,
44 Direction = 0x00020000,
45 HorizontalAlign = 0x00040000,
46 ScrollBars = 0x00080000,
50 public PanelStyle (StateBag bag)
57 public virtual string BackImageUrl {
59 if (!CheckBit ((int) PanelStyles.BackImageUrl))
62 return ViewState.GetString ("BackImageUrl", String.Empty);
66 ViewState ["BackImageUrl"] = value;
67 SetBit ((int) PanelStyles.BackImageUrl);
71 [DefaultValue (ContentDirection.NotSet)]
72 public virtual ContentDirection Direction {
74 if (!CheckBit ((int) PanelStyles.Direction))
75 return ContentDirection.NotSet;
77 return (ContentDirection) ViewState ["Direction"];
80 ViewState ["Direction"] = value;
81 SetBit ((int) PanelStyles.Direction);
85 [DefaultValue (HorizontalAlign.NotSet)]
86 public virtual HorizontalAlign HorizontalAlign {
88 if (!CheckBit ((int) PanelStyles.HorizontalAlign))
89 return HorizontalAlign.NotSet;
91 return (HorizontalAlign) ViewState ["HorizontalAlign"];
94 ViewState ["HorizontalAlign"] = value;
95 SetBit ((int) PanelStyles.HorizontalAlign);
99 [DefaultValue (ScrollBars.None)]
100 public virtual ScrollBars ScrollBars {
102 if (!CheckBit ((int) PanelStyles.ScrollBars))
103 return ScrollBars.None;
105 return (ScrollBars) ViewState ["ScrollBars"];
108 ViewState ["ScrollBars"] = value;
109 SetBit ((int) PanelStyles.ScrollBars);
113 [DefaultValue (true)]
114 public virtual bool Wrap {
116 if (!CheckBit ((int) PanelStyles.Wrap))
119 return (bool) ViewState ["Wrap"];
122 ViewState ["Wrap"] = value;
123 SetBit ((int) PanelStyles.Wrap);
127 public override void CopyFrom (Style s)
129 if ((s == null) || s.IsEmpty)
134 PanelStyle ps = s as PanelStyle;
138 if (s.CheckBit ((int) PanelStyles.BackImageUrl)) {
139 this.BackImageUrl = ps.BackImageUrl;
141 if (s.CheckBit ((int) PanelStyles.Direction)) {
142 this.Direction = ps.Direction;
144 if (s.CheckBit ((int) PanelStyles.HorizontalAlign)) {
145 this.HorizontalAlign = ps.HorizontalAlign;
147 if (s.CheckBit ((int) PanelStyles.ScrollBars)) {
148 this.ScrollBars = ps.ScrollBars;
150 if (s.CheckBit ((int) PanelStyles.Wrap)) {
155 public override void MergeWith (Style s)
157 if ((s == null) || (s.IsEmpty))
162 PanelStyle ps = s as PanelStyle;
166 if (!CheckBit ((int) PanelStyles.BackImageUrl) && s.CheckBit ((int) PanelStyles.BackImageUrl)) {
167 this.BackImageUrl = ps.BackImageUrl;
169 if (!CheckBit ((int) PanelStyles.Direction) && s.CheckBit ((int) PanelStyles.Direction)) {
170 this.Direction = ps.Direction;
172 if (!CheckBit ((int) PanelStyles.HorizontalAlign) && s.CheckBit ((int) PanelStyles.HorizontalAlign)) {
173 this.HorizontalAlign = ps.HorizontalAlign;
175 if (!CheckBit ((int) PanelStyles.ScrollBars) && s.CheckBit ((int) PanelStyles.ScrollBars)) {
176 this.ScrollBars = ps.ScrollBars;
178 if (!CheckBit ((int) PanelStyles.Wrap) && s.CheckBit ((int) PanelStyles.Wrap)) {
183 public override void Reset ()
187 ViewState.Remove ("BackImageUrl");
188 ViewState.Remove ("Direction");
189 ViewState.Remove ("HorizontalAlign");
190 ViewState.Remove ("ScrollBars");
191 ViewState.Remove ("Wrap");