2 // System.Web.UI.WebControls.MenuItemStyle.cs
\r
5 // Igor Zelmanovich (igorz@mainsoft.com)
\r
7 // (C) 2007 Mainsoft, Inc (http://www.mainsoft.com)
\r
9 // Permission is hereby granted, free of charge, to any person obtaining
\r
10 // a copy of this software and associated documentation files (the
\r
11 // "Software"), to deal in the Software without restriction, including
\r
12 // without limitation the rights to use, copy, modify, merge, publish,
\r
13 // distribute, sublicense, and/or sell copies of the Software, and to
\r
14 // permit persons to whom the Software is furnished to do so, subject to
\r
15 // the following conditions:
\r
17 // The above copyright notice and this permission notice shall be
\r
18 // included in all copies or substantial portions of the Software.
\r
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
\r
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
\r
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
\r
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
28 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
\r
34 using System.Web.UI;
\r
35 using System.ComponentModel;
\r
37 namespace System.Web.UI.WebControls
\r
39 public class PanelStyle : Style
\r
44 BackImageUrl = 0x00010000,
\r
45 Direction = 0x00020000,
\r
46 HorizontalAlign = 0x00040000,
\r
47 ScrollBars = 0x00080000,
\r
51 public PanelStyle (StateBag bag)
\r
56 public virtual string BackImageUrl {
\r
58 if (!CheckBit ((int) PanelStyles.BackImageUrl))
\r
59 return String.Empty;
\r
61 return ViewState.GetString ("BackImageUrl", String.Empty);
\r
65 ViewState ["BackImageUrl"] = value;
\r
66 SetBit ((int) PanelStyles.BackImageUrl);
\r
70 public virtual ContentDirection Direction {
\r
72 if (!CheckBit ((int) PanelStyles.Direction))
\r
73 return ContentDirection.NotSet;
\r
75 return (ContentDirection) ViewState ["Direction"];
\r
78 ViewState ["Direction"] = value;
\r
79 SetBit ((int) PanelStyles.Direction);
\r
83 public virtual HorizontalAlign HorizontalAlign {
\r
85 if (!CheckBit ((int) PanelStyles.HorizontalAlign))
\r
86 return HorizontalAlign.NotSet;
\r
88 return (HorizontalAlign) ViewState ["HorizontalAlign"];
\r
91 ViewState ["HorizontalAlign"] = value;
\r
92 SetBit ((int) PanelStyles.HorizontalAlign);
\r
96 public virtual ScrollBars ScrollBars {
\r
98 if (!CheckBit ((int) PanelStyles.ScrollBars))
\r
99 return ScrollBars.None;
\r
101 return (ScrollBars) ViewState ["ScrollBars"];
\r
104 ViewState ["ScrollBars"] = value;
\r
105 SetBit ((int) PanelStyles.ScrollBars);
\r
109 public virtual bool Wrap {
\r
111 if (!CheckBit ((int) PanelStyles.Wrap))
\r
114 return (bool) ViewState ["Wrap"];
\r
117 ViewState ["Wrap"] = value;
\r
118 SetBit ((int) PanelStyles.Wrap);
\r
122 public override void CopyFrom (Style s)
\r
124 if ((s == null) || s.IsEmpty)
\r
129 PanelStyle ps = s as PanelStyle;
\r
133 if (s.CheckBit ((int) PanelStyles.BackImageUrl)) {
\r
134 this.BackImageUrl = ps.BackImageUrl;
\r
136 if (s.CheckBit ((int) PanelStyles.Direction)) {
\r
137 this.Direction = ps.Direction;
\r
139 if (s.CheckBit ((int) PanelStyles.HorizontalAlign)) {
\r
140 this.HorizontalAlign = ps.HorizontalAlign;
\r
142 if (s.CheckBit ((int) PanelStyles.ScrollBars)) {
\r
143 this.ScrollBars = ps.ScrollBars;
\r
145 if (s.CheckBit ((int) PanelStyles.Wrap)) {
\r
146 this.Wrap = ps.Wrap;
\r
150 public override void MergeWith (Style s)
\r
152 if ((s == null) || (s.IsEmpty))
\r
155 base.MergeWith (s);
\r
157 PanelStyle ps = s as PanelStyle;
\r
161 if (!CheckBit ((int) PanelStyles.BackImageUrl) && s.CheckBit ((int) PanelStyles.BackImageUrl)) {
\r
162 this.BackImageUrl = ps.BackImageUrl;
\r
164 if (!CheckBit ((int) PanelStyles.Direction) && s.CheckBit ((int) PanelStyles.Direction)) {
\r
165 this.Direction = ps.Direction;
\r
167 if (!CheckBit ((int) PanelStyles.HorizontalAlign) && s.CheckBit ((int) PanelStyles.HorizontalAlign)) {
\r
168 this.HorizontalAlign = ps.HorizontalAlign;
\r
170 if (!CheckBit ((int) PanelStyles.ScrollBars) && s.CheckBit ((int) PanelStyles.ScrollBars)) {
\r
171 this.ScrollBars = ps.ScrollBars;
\r
173 if (!CheckBit ((int) PanelStyles.Wrap) && s.CheckBit ((int) PanelStyles.Wrap)) {
\r
174 this.Wrap = ps.Wrap;
\r
178 public override void Reset ()
\r
182 ViewState.Remove ("BackImageUrl");
\r
183 ViewState.Remove ("Direction");
\r
184 ViewState.Remove ("HorizontalAlign");
\r
185 ViewState.Remove ("ScrollBars");
\r
186 ViewState.Remove ("Wrap");
\r