PageRenderTime 146ms CodeModel.GetById 60ms app.highlight 56ms RepoModel.GetById 25ms app.codeStats 0ms

/IZWebFileManager/BorderedPanelStyle.cs

http://izwebfilemanager.googlecode.com/
C# | 759 lines | 623 code | 121 blank | 15 comment | 155 complexity | f6279eb1f761bcc93fe4bbf000539d9c MD5 | raw file
  1// Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
  2//
  3// This program is free software; you can redistribute it and/or modify
  4// it under the terms of the GNU General Public License as published by
  5// the Free Software Foundation; either version 2 of the License, or
  6// (at your option) any later version.
  7//
  8// This program is distributed in the hope that it will be useful,
  9// but WITHOUT ANY WARRANTY; without even the implied warranty of
 10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 11// GNU General Public License for more details.
 12//
 13// You should have received a copy of the GNU General Public License
 14// along with this program; if not, write to the Free Software
 15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 16
 17using System;
 18using System.Collections.Generic;
 19using System.Text;
 20using System.Web.UI.WebControls;
 21using System.Web.UI;
 22using System.ComponentModel;
 23using System.Web;
 24using System.Drawing.Design;
 25using System.Diagnostics.CodeAnalysis;
 26using System.Globalization;
 27using System.Drawing;
 28
 29namespace IZ.WebFileManager
 30{
 31	[TypeConverter (typeof (ExpandableObjectConverter))]
 32	public class BorderedPanelStyle : PanelStyle
 33	{
 34		[Flags]
 35		enum StyleKey
 36		{
 37			OuterBorderBottomImageUrl = 0x0001,
 38			OuterBorderTopImageUrl = 0x0002,
 39			OuterBorderLeftImageUrl = 0x0004,
 40			OuterBorderRightImageUrl = 0x0008,
 41
 42			OuterBorderLeftTopCornerImageUrl = 0x0010,
 43			OuterBorderLeftBottomCornerImageUrl = 0x0020,
 44			OuterBorderRightTopCornerImageUrl = 0x0040,
 45			OuterBorderRightBottomCornerImageUrl = 0x0080,
 46
 47			OuterBorderLeftWidth = 0x0100,
 48			OuterBorderBottomWidth = 0x0200,
 49			OuterBorderRightWidth = 0x0400,
 50			OuterBorderTopWidth = 0x0800,
 51
 52			OuterBorderStyle = 0x1000,
 53			OuterBorderBackColor = 0x2000,
 54
 55			PaddingTop = 0x010000,
 56			PaddingBottom = 0x020000,
 57			PaddingLeft = 0x040000,
 58			PaddingRight = 0x080000,
 59
 60			MarginTop = 0x100000,
 61			MarginBottom = 0x200000,
 62			MarginLeft = 0x400000,
 63			MarginRight = 0x800000,
 64		}
 65
 66		#region Constructors
 67
 68		public BorderedPanelStyle ()
 69			: base (new StateBag ()) {
 70		}
 71
 72		public BorderedPanelStyle (StateBag bag)
 73			: base (bag) {
 74		}
 75
 76		#endregion
 77
 78		#region Fields
 79
 80		int styles;
 81
 82		#endregion
 83
 84		#region Properties
 85
 86		[DefaultValue (ContentDirection.NotSet)]
 87		public override ContentDirection Direction {
 88			get {
 89				return base.Direction;
 90			}
 91			set {
 92				base.Direction = value;
 93			}
 94		}
 95
 96		[DefaultValue (HorizontalAlign.NotSet)]
 97		public override HorizontalAlign HorizontalAlign {
 98			get {
 99				return base.HorizontalAlign;
100			}
101			set {
102				base.HorizontalAlign = value;
103			}
104		}
105
106		[DefaultValue (ScrollBars.None)]
107		public override ScrollBars ScrollBars {
108			get {
109				return base.ScrollBars;
110			}
111			set {
112				base.ScrollBars = value;
113			}
114		}
115
116		[DefaultValue (true)]
117		public override bool Wrap {
118			get {
119				return base.Wrap;
120			}
121			set {
122				base.Wrap = value;
123			}
124		}
125
126		[Category ("Appearance")]
127		[DefaultValue (typeof (Color), "")]
128		[TypeConverter (typeof (WebColorConverter))]
129		[NotifyParentProperty (true)]
130		public Color OuterBorderBackColor {
131			get {
132				if (CheckStyle (StyleKey.OuterBorderBackColor))
133					return (Color) this.ViewState ["OuterBorderBackColor"];
134				return Color.Empty;
135			}
136			set {
137				this.ViewState ["OuterBorderBackColor"] = value;
138				SetStyle (StyleKey.OuterBorderBackColor);
139			}
140		}
141
142		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
143		[UrlProperty]
144		[DefaultValue ("")]
145		[Category ("Appearance")]
146		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
147		public string OuterBorderBottomImageUrl {
148			get {
149				if (CheckStyle (StyleKey.OuterBorderBottomImageUrl))
150					return (string) ViewState ["OuterBorderBottomImageUrl"];
151				return String.Empty;
152			}
153			set {
154				if (value == null)
155					throw new ArgumentNullException ("value");
156				ViewState ["OuterBorderBottomImageUrl"] = value;
157				SetStyle (StyleKey.OuterBorderBottomImageUrl);
158			}
159		}
160
161		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
162		[UrlProperty]
163		[DefaultValue ("")]
164		[Category ("Appearance")]
165		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
166		public string OuterBorderTopImageUrl {
167			get {
168				if (CheckStyle (StyleKey.OuterBorderTopImageUrl))
169					return (string) ViewState ["OuterBorderTopImageUrl"];
170				return String.Empty;
171			}
172			set {
173				if (value == null)
174					throw new ArgumentNullException ("value");
175				ViewState ["OuterBorderTopImageUrl"] = value;
176				SetStyle (StyleKey.OuterBorderTopImageUrl);
177			}
178		}
179
180		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
181		[UrlProperty]
182		[DefaultValue ("")]
183		[Category ("Appearance")]
184		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
185		public string OuterBorderLeftImageUrl {
186			get {
187				if (CheckStyle (StyleKey.OuterBorderLeftImageUrl))
188					return (string) ViewState ["OuterBorderLeftImageUrl"];
189				return String.Empty;
190			}
191			set {
192				if (value == null)
193					throw new ArgumentNullException ("value");
194				ViewState ["OuterBorderLeftImageUrl"] = value;
195				SetStyle (StyleKey.OuterBorderLeftImageUrl);
196			}
197		}
198
199		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
200		[UrlProperty]
201		[DefaultValue ("")]
202		[Category ("Appearance")]
203		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
204		public string OuterBorderRightImageUrl {
205			get {
206				if (CheckStyle (StyleKey.OuterBorderRightImageUrl))
207					return (string) ViewState ["OuterBorderRightImageUrl"];
208				return String.Empty;
209			}
210			set {
211				if (value == null)
212					throw new ArgumentNullException ("value");
213				ViewState ["OuterBorderRightImageUrl"] = value;
214				SetStyle (StyleKey.OuterBorderRightImageUrl);
215			}
216		}
217
218		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
219		[UrlProperty]
220		[DefaultValue ("")]
221		[Category ("Appearance")]
222		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
223		public string OuterBorderRightBottomCornerImageUrl {
224			get {
225				if (CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
226					return (string) ViewState ["OuterBorderRightBottomCornerImageUrl"];
227				return String.Empty;
228			}
229			set {
230				if (value == null)
231					throw new ArgumentNullException ("value");
232				ViewState ["OuterBorderRightBottomCornerImageUrl"] = value;
233				SetStyle (StyleKey.OuterBorderRightBottomCornerImageUrl);
234			}
235		}
236
237		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
238		[UrlProperty]
239		[DefaultValue ("")]
240		[Category ("Appearance")]
241		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
242		public string OuterBorderRightTopCornerImageUrl {
243			get {
244				if (CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
245					return (string) ViewState ["OuterBorderRightTopCornerImageUrl"];
246				return String.Empty;
247			}
248			set {
249				if (value == null)
250					throw new ArgumentNullException ("value");
251				ViewState ["OuterBorderRightTopCornerImageUrl"] = value;
252				SetStyle (StyleKey.OuterBorderRightTopCornerImageUrl);
253			}
254		}
255
256		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
257		[UrlProperty]
258		[DefaultValue ("")]
259		[Category ("Appearance")]
260		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
261		public string OuterBorderLeftBottomCornerImageUrl {
262			get {
263				if (CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
264					return (string) ViewState ["OuterBorderLeftBottomCornerImageUrl"];
265				return String.Empty;
266			}
267			set {
268				if (value == null)
269					throw new ArgumentNullException ("value");
270				ViewState ["OuterBorderLeftBottomCornerImageUrl"] = value;
271				SetStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl);
272			}
273		}
274
275		[SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
276		[UrlProperty]
277		[DefaultValue ("")]
278		[Category ("Appearance")]
279		[Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
280		public string OuterBorderLeftTopCornerImageUrl {
281			get {
282				if (CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
283					return (string) ViewState ["OuterBorderLeftTopCornerImageUrl"];
284				return String.Empty;
285			}
286			set {
287				if (value == null)
288					throw new ArgumentNullException ("value");
289				ViewState ["OuterBorderLeftTopCornerImageUrl"] = value;
290				SetStyle (StyleKey.OuterBorderLeftTopCornerImageUrl);
291			}
292		}
293
294		[DefaultValue (OuterBorderStyle.None)]
295		[Category ("Layout")]
296		public OuterBorderStyle OuterBorderStyle {
297			get {
298				if (CheckStyle (StyleKey.OuterBorderStyle))
299					return (OuterBorderStyle) ViewState ["OuterBorderStyle"];
300				return OuterBorderStyle.None;
301			}
302			set {
303				if (value < OuterBorderStyle.None || value > OuterBorderStyle.AllSides)
304					throw new ArgumentOutOfRangeException ("value");
305				ViewState ["OuterBorderStyle"] = value;
306				SetStyle (StyleKey.OuterBorderStyle);
307			}
308		}
309
310		[DefaultValue (typeof (Unit), "")]
311		[Category ("Layout")]
312		public Unit OuterBorderTopWidth {
313			get {
314				if (CheckStyle (StyleKey.OuterBorderTopWidth))
315					return (Unit) ViewState ["OuterBorderTopWidth"];
316				return Unit.Empty;
317			}
318			set {
319				if (value.Value < 0)
320					throw new ArgumentOutOfRangeException ("value");
321				ViewState ["OuterBorderTopWidth"] = value;
322				SetStyle (StyleKey.OuterBorderTopWidth);
323			}
324		}
325
326		[DefaultValue (typeof (Unit), "")]
327		[Category ("Layout")]
328		public Unit OuterBorderRightWidth {
329			get {
330				if (CheckStyle (StyleKey.OuterBorderRightWidth))
331					return (Unit) ViewState ["OuterBorderRightWidth"];
332				return Unit.Empty;
333			}
334			set {
335				if (value.Value < 0)
336					throw new ArgumentOutOfRangeException ("value");
337				ViewState ["OuterBorderRightWidth"] = value;
338				SetStyle (StyleKey.OuterBorderRightWidth);
339			}
340		}
341
342		[DefaultValue (typeof (Unit), "")]
343		[Category ("Layout")]
344		public Unit OuterBorderBottomWidth {
345			get {
346				if (CheckStyle (StyleKey.OuterBorderBottomWidth))
347					return (Unit) ViewState ["OuterBorderBottomWidth"];
348				return Unit.Empty;
349			}
350			set {
351				if (value.Value < 0)
352					throw new ArgumentOutOfRangeException ("value");
353				ViewState ["OuterBorderBottomWidth"] = value;
354				SetStyle (StyleKey.OuterBorderBottomWidth);
355			}
356		}
357
358		[DefaultValue (typeof (Unit), "")]
359		[Category ("Layout")]
360		public Unit OuterBorderLeftWidth {
361			get {
362				if (CheckStyle (StyleKey.OuterBorderLeftWidth))
363					return (Unit) ViewState ["OuterBorderLeftWidth"];
364				return Unit.Empty;
365			}
366			set {
367				if (value.Value < 0)
368					throw new ArgumentOutOfRangeException ("value");
369				ViewState ["OuterBorderLeftWidth"] = value;
370				SetStyle (StyleKey.OuterBorderLeftWidth);
371			}
372		}
373
374		[DefaultValue (typeof (Unit), "")]
375		[NotifyParentProperty (true)]
376		[RefreshProperties (RefreshProperties.Repaint)]
377		[Category ("Layout")]
378		public Unit PaddingTop {
379			get {
380				if (CheckStyle (StyleKey.PaddingTop))
381					return (Unit) ViewState ["PaddingTop"];
382				return Unit.Empty;
383			}
384			set {
385				ViewState ["PaddingTop"] = value;
386				SetStyle (StyleKey.PaddingTop);
387			}
388		}
389
390		[DefaultValue (typeof (Unit), "")]
391		[NotifyParentProperty (true)]
392		[RefreshProperties (RefreshProperties.Repaint)]
393		[Category ("Layout")]
394		public Unit PaddingBottom {
395			get {
396				if (CheckStyle (StyleKey.PaddingBottom))
397					return (Unit) ViewState ["PaddingBottom"];
398				return Unit.Empty;
399			}
400			set {
401				ViewState ["PaddingBottom"] = value;
402				SetStyle (StyleKey.PaddingBottom);
403			}
404		}
405
406		[DefaultValue (typeof (Unit), "")]
407		[NotifyParentProperty (true)]
408		[RefreshProperties (RefreshProperties.Repaint)]
409		[Category ("Layout")]
410		public Unit PaddingLeft {
411			get {
412				if (CheckStyle (StyleKey.PaddingLeft))
413					return (Unit) ViewState ["PaddingLeft"];
414				return Unit.Empty;
415			}
416			set {
417				ViewState ["PaddingLeft"] = value;
418				SetStyle (StyleKey.PaddingLeft);
419			}
420		}
421
422		[DefaultValue (typeof (Unit), "")]
423		[NotifyParentProperty (true)]
424		[RefreshProperties (RefreshProperties.Repaint)]
425		[Category ("Layout")]
426		public Unit PaddingRight {
427			get {
428				if (CheckStyle (StyleKey.PaddingRight))
429					return (Unit) ViewState ["PaddingRight"];
430				return Unit.Empty;
431			}
432			set {
433				ViewState ["PaddingRight"] = value;
434				SetStyle (StyleKey.PaddingRight);
435			}
436		}
437
438		[DefaultValue (typeof (Unit), "")]
439		[NotifyParentProperty (true)]
440		[RefreshProperties (RefreshProperties.Repaint)]
441		[Category ("Layout")]
442		public Unit MarginTop {
443			get {
444				if (CheckStyle (StyleKey.MarginTop))
445					return (Unit) ViewState ["MarginTop"];
446				return Unit.Empty;
447			}
448			set {
449				ViewState ["MarginTop"] = value;
450				SetStyle (StyleKey.MarginTop);
451			}
452		}
453
454		[DefaultValue (typeof (Unit), "")]
455		[NotifyParentProperty (true)]
456		[RefreshProperties (RefreshProperties.Repaint)]
457		[Category ("Layout")]
458		public Unit MarginBottom {
459			get {
460				if (CheckStyle (StyleKey.MarginBottom))
461					return (Unit) ViewState ["MarginBottom"];
462				return Unit.Empty;
463			}
464			set {
465				ViewState ["MarginBottom"] = value;
466				SetStyle (StyleKey.MarginBottom);
467			}
468		}
469
470		[DefaultValue (typeof (Unit), "")]
471		[NotifyParentProperty (true)]
472		[RefreshProperties (RefreshProperties.Repaint)]
473		[Category ("Layout")]
474		public Unit MarginLeft {
475			get {
476				if (CheckStyle (StyleKey.MarginLeft))
477					return (Unit) ViewState ["MarginLeft"];
478				return Unit.Empty;
479			}
480			set {
481				ViewState ["MarginLeft"] = value;
482				SetStyle (StyleKey.MarginLeft);
483			}
484		}
485
486		[DefaultValue (typeof (Unit), "")]
487		[NotifyParentProperty (true)]
488		[RefreshProperties (RefreshProperties.Repaint)]
489		[Category ("Layout")]
490		public Unit MarginRight {
491			get {
492				if (CheckStyle (StyleKey.MarginRight))
493					return (Unit) ViewState ["MarginRight"];
494				return Unit.Empty;
495			}
496			set {
497				ViewState ["MarginRight"] = value;
498				SetStyle (StyleKey.MarginRight);
499			}
500		}
501
502		public override bool IsEmpty {
503			get { return base.IsEmpty && styles == 0; }
504		}
505
506		#endregion
507
508		void SetStyle (StyleKey styleKey) {
509			styles |= (int) styleKey;
510		}
511
512		bool CheckStyle (StyleKey styleKey) {
513			return ((styles & (int) styleKey) != 0);
514		}
515
516		protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver) {
517			base.FillStyleAttributes (attributes, urlResolver);
518
519			if (PaddingTop != Unit.Empty)
520				attributes.Add (HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString ());
521			if (PaddingLeft != Unit.Empty)
522				attributes.Add (HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString ());
523			if (PaddingRight != Unit.Empty)
524				attributes.Add (HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString ());
525			if (PaddingBottom != Unit.Empty)
526				attributes.Add (HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString ());
527
528			if (MarginTop != Unit.Empty)
529				attributes.Add (HtmlTextWriterStyle.MarginTop, MarginTop.ToString ());
530			if (MarginLeft != Unit.Empty)
531				attributes.Add (HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString ());
532			if (MarginRight != Unit.Empty)
533				attributes.Add (HtmlTextWriterStyle.MarginRight, MarginRight.ToString ());
534			if (MarginBottom != Unit.Empty)
535				attributes.Add (HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString ());
536		}
537
538		public override void CopyFrom (Style s) {
539			base.CopyFrom (s);
540
541			BorderedPanelStyle ps = s as BorderedPanelStyle;
542			if (ps == null)
543				return;
544
545			if (ps.CheckStyle (StyleKey.OuterBorderBackColor))
546				OuterBorderBackColor = ps.OuterBorderBackColor;
547
548			if (ps.CheckStyle (StyleKey.PaddingBottom))
549				PaddingBottom = ps.PaddingBottom;
550
551			if (ps.CheckStyle (StyleKey.PaddingLeft))
552				PaddingLeft = ps.PaddingLeft;
553
554			if (ps.CheckStyle (StyleKey.PaddingRight))
555				PaddingRight = ps.PaddingRight;
556
557			if (ps.CheckStyle (StyleKey.PaddingTop))
558				PaddingTop = ps.PaddingTop;
559
560			if (ps.CheckStyle (StyleKey.MarginBottom))
561				MarginBottom = ps.MarginBottom;
562
563			if (ps.CheckStyle (StyleKey.MarginLeft))
564				MarginLeft = ps.MarginLeft;
565
566			if (ps.CheckStyle (StyleKey.MarginRight))
567				MarginRight = ps.MarginRight;
568
569			if (ps.CheckStyle (StyleKey.MarginTop))
570				MarginTop = ps.MarginTop;
571
572			if (ps.CheckStyle (StyleKey.OuterBorderBottomImageUrl))
573				OuterBorderBottomImageUrl = ps.OuterBorderBottomImageUrl;
574
575			if (ps.CheckStyle (StyleKey.OuterBorderBottomWidth))
576				OuterBorderBottomWidth = ps.OuterBorderBottomWidth;
577
578			if (ps.CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
579				OuterBorderLeftBottomCornerImageUrl = ps.OuterBorderLeftBottomCornerImageUrl;
580
581			if (ps.CheckStyle (StyleKey.OuterBorderLeftImageUrl))
582				OuterBorderLeftImageUrl = ps.OuterBorderLeftImageUrl;
583
584			if (ps.CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
585				OuterBorderLeftTopCornerImageUrl = ps.OuterBorderLeftTopCornerImageUrl;
586
587			if (ps.CheckStyle (StyleKey.OuterBorderLeftWidth))
588				OuterBorderLeftWidth = ps.OuterBorderLeftWidth;
589
590			if (ps.CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
591				OuterBorderRightBottomCornerImageUrl = ps.OuterBorderRightBottomCornerImageUrl;
592
593			if (ps.CheckStyle (StyleKey.OuterBorderRightImageUrl))
594				OuterBorderRightImageUrl = ps.OuterBorderRightImageUrl;
595
596			if (ps.CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
597				OuterBorderRightTopCornerImageUrl = ps.OuterBorderRightTopCornerImageUrl;
598
599			if (ps.CheckStyle (StyleKey.OuterBorderRightWidth))
600				OuterBorderRightWidth = ps.OuterBorderRightWidth;
601
602			if (ps.CheckStyle (StyleKey.OuterBorderStyle))
603				OuterBorderStyle = ps.OuterBorderStyle;
604
605			if (ps.CheckStyle (StyleKey.OuterBorderTopImageUrl))
606				OuterBorderTopImageUrl = ps.OuterBorderTopImageUrl;
607
608			if (ps.CheckStyle (StyleKey.OuterBorderTopWidth))
609				OuterBorderTopWidth = ps.OuterBorderTopWidth;
610		}
611
612		public override void MergeWith (Style s) {
613			base.MergeWith (s);
614
615			BorderedPanelStyle ps = s as BorderedPanelStyle;
616			if (ps == null)
617				return;
618
619			if (!CheckStyle (StyleKey.OuterBorderBackColor) && ps.CheckStyle (StyleKey.OuterBorderBackColor))
620				OuterBorderBackColor = ps.OuterBorderBackColor;
621
622			if (!CheckStyle (StyleKey.PaddingBottom) && ps.CheckStyle (StyleKey.PaddingBottom))
623				PaddingBottom = ps.PaddingBottom;
624
625			if (!CheckStyle (StyleKey.PaddingLeft) && ps.CheckStyle (StyleKey.PaddingLeft))
626				PaddingLeft = ps.PaddingLeft;
627
628			if (!CheckStyle (StyleKey.PaddingRight) && ps.CheckStyle (StyleKey.PaddingRight))
629				PaddingRight = ps.PaddingRight;
630
631			if (!CheckStyle (StyleKey.PaddingTop) && ps.CheckStyle (StyleKey.PaddingTop))
632				PaddingTop = ps.PaddingTop;
633
634			if (!CheckStyle (StyleKey.MarginBottom) && ps.CheckStyle (StyleKey.MarginBottom))
635				MarginBottom = ps.MarginBottom;
636
637			if (!CheckStyle (StyleKey.MarginLeft) && ps.CheckStyle (StyleKey.MarginLeft))
638				MarginLeft = ps.MarginLeft;
639
640			if (!CheckStyle (StyleKey.MarginRight) && ps.CheckStyle (StyleKey.MarginRight))
641				MarginRight = ps.MarginRight;
642
643			if (!CheckStyle (StyleKey.MarginTop) && ps.CheckStyle (StyleKey.MarginTop))
644				MarginTop = ps.MarginTop;
645
646			if (!CheckStyle (StyleKey.OuterBorderBottomImageUrl) && ps.CheckStyle (StyleKey.OuterBorderBottomImageUrl))
647				OuterBorderBottomImageUrl = ps.OuterBorderBottomImageUrl;
648
649			if (!CheckStyle (StyleKey.OuterBorderBottomWidth) && ps.CheckStyle (StyleKey.OuterBorderBottomWidth))
650				OuterBorderBottomWidth = ps.OuterBorderBottomWidth;
651
652			if (!CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
653				OuterBorderLeftBottomCornerImageUrl = ps.OuterBorderLeftBottomCornerImageUrl;
654
655			if (!CheckStyle (StyleKey.OuterBorderLeftImageUrl) && ps.CheckStyle (StyleKey.OuterBorderLeftImageUrl))
656				OuterBorderLeftImageUrl = ps.OuterBorderLeftImageUrl;
657
658			if (!CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
659				OuterBorderLeftTopCornerImageUrl = ps.OuterBorderLeftTopCornerImageUrl;
660
661			if (!CheckStyle (StyleKey.OuterBorderLeftWidth) && ps.CheckStyle (StyleKey.OuterBorderLeftWidth))
662				OuterBorderLeftWidth = ps.OuterBorderLeftWidth;
663
664			if (!CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
665				OuterBorderRightBottomCornerImageUrl = ps.OuterBorderRightBottomCornerImageUrl;
666
667			if (!CheckStyle (StyleKey.OuterBorderRightImageUrl) && ps.CheckStyle (StyleKey.OuterBorderRightImageUrl))
668				OuterBorderRightImageUrl = ps.OuterBorderRightImageUrl;
669
670			if (!CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
671				OuterBorderRightTopCornerImageUrl = ps.OuterBorderRightTopCornerImageUrl;
672
673			if (!CheckStyle (StyleKey.OuterBorderRightWidth) && ps.CheckStyle (StyleKey.OuterBorderRightWidth))
674				OuterBorderRightWidth = ps.OuterBorderRightWidth;
675
676			if (!CheckStyle (StyleKey.OuterBorderStyle) && ps.CheckStyle (StyleKey.OuterBorderStyle))
677				OuterBorderStyle = ps.OuterBorderStyle;
678
679			if (!CheckStyle (StyleKey.OuterBorderTopImageUrl) && ps.CheckStyle (StyleKey.OuterBorderTopImageUrl))
680				OuterBorderTopImageUrl = ps.OuterBorderTopImageUrl;
681
682			if (!CheckStyle (StyleKey.OuterBorderTopWidth) && ps.CheckStyle (StyleKey.OuterBorderTopWidth))
683				OuterBorderTopWidth = ps.OuterBorderTopWidth;
684		}
685
686		public override void Reset () {
687			base.Reset ();
688
689			if (CheckStyle (StyleKey.OuterBorderBackColor))
690				ViewState.Remove ("OuterBorderBackColor");
691
692			if (CheckStyle (StyleKey.PaddingBottom))
693				ViewState.Remove ("PaddingBottom");
694
695			if (CheckStyle (StyleKey.PaddingLeft))
696				ViewState.Remove ("PaddingLeft");
697
698			if (CheckStyle (StyleKey.PaddingRight))
699				ViewState.Remove ("PaddingRight");
700
701			if (CheckStyle (StyleKey.PaddingTop))
702				ViewState.Remove ("PaddingTop");
703
704			if (CheckStyle (StyleKey.MarginBottom))
705				ViewState.Remove ("MarginBottom");
706
707			if (CheckStyle (StyleKey.MarginLeft))
708				ViewState.Remove ("MarginLeft");
709
710			if (CheckStyle (StyleKey.MarginRight))
711				ViewState.Remove ("MarginRight");
712
713			if (CheckStyle (StyleKey.MarginTop))
714				ViewState.Remove ("MarginTop");
715
716			if (CheckStyle (StyleKey.OuterBorderBottomImageUrl))
717				ViewState.Remove ("OuterBorderBottomImageUrl");
718
719			if (CheckStyle (StyleKey.OuterBorderBottomWidth))
720				ViewState.Remove ("OuterBorderBackColor");
721
722			if (CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
723				ViewState.Remove ("OuterBorderLeftBottomCornerImageUrl");
724
725			if (CheckStyle (StyleKey.OuterBorderLeftImageUrl))
726				ViewState.Remove ("OuterBorderLeftImageUrl");
727
728			if (CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
729				ViewState.Remove ("OuterBorderLeftTopCornerImageUrl");
730
731			if (CheckStyle (StyleKey.OuterBorderLeftWidth))
732				ViewState.Remove ("OuterBorderLeftWidth");
733
734			if (CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
735				ViewState.Remove ("OuterBorderRightBottomCornerImageUrl");
736
737			if (CheckStyle (StyleKey.OuterBorderRightImageUrl))
738				ViewState.Remove ("OuterBorderRightImageUrl");
739
740			if (CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
741				ViewState.Remove ("OuterBorderRightTopCornerImageUrl");
742
743			if (CheckStyle (StyleKey.OuterBorderRightWidth))
744				ViewState.Remove ("OuterBorderRightWidth");
745
746			if (CheckStyle (StyleKey.OuterBorderStyle))
747				ViewState.Remove ("OuterBorderStyle");
748
749			if (CheckStyle (StyleKey.OuterBorderTopImageUrl))
750				ViewState.Remove ("OuterBorderTopImageUrl");
751
752			if (CheckStyle (StyleKey.OuterBorderTopWidth))
753				ViewState.Remove ("OuterBorderTopWidth");
754
755			styles = 0;
756		}
757
758	}
759}