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)
35 using System
.ComponentModel
;
37 namespace System
.Web
.UI
.WebControls
39 public class PanelStyle
: Style
44 BackImageUrl
= 0x00010000,
45 Direction
= 0x00020000,
46 HorizontalAlign
= 0x00040000,
47 ScrollBars
= 0x00080000,
51 public PanelStyle (StateBag bag
)
56 public virtual string BackImageUrl
{
58 if (!CheckBit ((int) PanelStyles
.BackImageUrl
))
61 return ViewState
.GetString ("BackImageUrl", String
.Empty
);
65 ViewState
["BackImageUrl"] = value;
66 SetBit ((int) PanelStyles
.BackImageUrl
);
70 public virtual ContentDirection Direction
{
72 if (!CheckBit ((int) PanelStyles
.Direction
))
73 return ContentDirection
.NotSet
;
75 return (ContentDirection
) ViewState
["Direction"];
78 ViewState
["Direction"] = value;
79 SetBit ((int) PanelStyles
.Direction
);
83 public virtual HorizontalAlign HorizontalAlign
{
85 if (!CheckBit ((int) PanelStyles
.HorizontalAlign
))
86 return HorizontalAlign
.NotSet
;
88 return (HorizontalAlign
) ViewState
["HorizontalAlign"];
91 ViewState
["HorizontalAlign"] = value;
92 SetBit ((int) PanelStyles
.HorizontalAlign
);
96 public virtual ScrollBars ScrollBars
{
98 if (!CheckBit ((int) PanelStyles
.ScrollBars
))
99 return ScrollBars
.None
;
101 return (ScrollBars
) ViewState
["ScrollBars"];
104 ViewState
["ScrollBars"] = value;
105 SetBit ((int) PanelStyles
.ScrollBars
);
109 public virtual bool Wrap
{
111 if (!CheckBit ((int) PanelStyles
.Wrap
))
114 return (bool) ViewState
["Wrap"];
117 ViewState
["Wrap"] = value;
118 SetBit ((int) PanelStyles
.Wrap
);
122 public override void CopyFrom (Style s
)
124 if ((s
== null) || s
.IsEmpty
)
129 PanelStyle ps
= s
as PanelStyle
;
133 if (s
.CheckBit ((int) PanelStyles
.BackImageUrl
)) {
134 this.BackImageUrl
= ps
.BackImageUrl
;
136 if (s
.CheckBit ((int) PanelStyles
.Direction
)) {
137 this.Direction
= ps
.Direction
;
139 if (s
.CheckBit ((int) PanelStyles
.HorizontalAlign
)) {
140 this.HorizontalAlign
= ps
.HorizontalAlign
;
142 if (s
.CheckBit ((int) PanelStyles
.ScrollBars
)) {
143 this.ScrollBars
= ps
.ScrollBars
;
145 if (s
.CheckBit ((int) PanelStyles
.Wrap
)) {
150 public override void MergeWith (Style s
)
152 if ((s
== null) || (s
.IsEmpty
))
157 PanelStyle ps
= s
as PanelStyle
;
161 if (!CheckBit ((int) PanelStyles
.BackImageUrl
) && s
.CheckBit ((int) PanelStyles
.BackImageUrl
)) {
162 this.BackImageUrl
= ps
.BackImageUrl
;
164 if (!CheckBit ((int) PanelStyles
.Direction
) && s
.CheckBit ((int) PanelStyles
.Direction
)) {
165 this.Direction
= ps
.Direction
;
167 if (!CheckBit ((int) PanelStyles
.HorizontalAlign
) && s
.CheckBit ((int) PanelStyles
.HorizontalAlign
)) {
168 this.HorizontalAlign
= ps
.HorizontalAlign
;
170 if (!CheckBit ((int) PanelStyles
.ScrollBars
) && s
.CheckBit ((int) PanelStyles
.ScrollBars
)) {
171 this.ScrollBars
= ps
.ScrollBars
;
173 if (!CheckBit ((int) PanelStyles
.Wrap
) && s
.CheckBit ((int) PanelStyles
.Wrap
)) {
178 public override void Reset ()
182 ViewState
.Remove ("BackImageUrl");
183 ViewState
.Remove ("Direction");
184 ViewState
.Remove ("HorizontalAlign");
185 ViewState
.Remove ("ScrollBars");
186 ViewState
.Remove ("Wrap");