Merge pull request #4453 from lambdageek/bug-49721
[mono.git] / mcs / class / System.Web / System.Web.UI.WebControls / Style.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 // 
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 // 
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2005 Novell, Inc. (http://www.novell.com)
21 //
22 // Authors:
23 //      Peter Dennis Bartok     (pbartok@novell.com)
24 //
25 //
26
27 using System.ComponentModel;
28 using System.Drawing;
29 using System.Security.Permissions;
30
31 namespace System.Web.UI.WebControls {
32
33         // CAS
34         [AspNetHostingPermissionAttribute (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
35         [AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
36         // attributes
37 // Not until we actually have StyleConverter
38 //      [TypeConverter(typeof(System.Web.UI.WebControls.StyleConverter))]
39         [ToolboxItem("")]
40         public class Style : System.ComponentModel.Component, System.Web.UI.IStateManager 
41         {
42                 internal const string BitStateKey = "_!SB";
43
44                 [Flags]
45                 internal enum Styles 
46                 {
47                         BackColor       = 0x00000008,
48                         BorderColor     = 0x00000010,
49                         BorderStyle     = 0x00000040,
50                         BorderWidth     = 0x00000020,
51                         CssClass        = 0x00000002,
52                         Font            = 0x00000001,
53                         ForeColor       = 0x00000004,
54                         Height          = 0x00000080,
55                         Width           = 0x00000100,
56
57                         FontAll = 0xFE00,
58                         FontBold = 0x800,
59                         FontItalic = 0x1000,
60                         FontNames = 0x200,
61                         FontOverline = 0x4000,
62                         FontSize = 0x400,
63                         FontStrikeout = 0x8000,
64                         FontUnderline = 0x2000
65                 }
66
67                 #region Fields
68                 int styles;
69                 int stylesTraked;
70                 internal StateBag       viewstate;
71                 FontInfo        fontinfo;
72                 bool            tracking;
73                 bool _isSharedViewState;
74                 string          registered_class;
75                 #endregion      // Fields
76
77                 #region Public Constructors
78                 public Style()
79                 {
80                         viewstate = new StateBag ();
81                         GC.SuppressFinalize (this);
82                 }
83
84                 public Style(System.Web.UI.StateBag bag) 
85                 {
86                         viewstate = bag;
87                         if (viewstate == null)
88                                 viewstate = new StateBag ();
89                         _isSharedViewState = true;
90                         GC.SuppressFinalize (this);
91                 }
92                 #endregion      // Public Constructors
93
94                 #region Public Instance Properties
95                 [DefaultValue(typeof (Color), "")]
96                 [NotifyParentProperty(true)]
97                 [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
98                 [WebSysDescription ("")]
99                 [WebCategory ("Appearance")]
100                 public Color BackColor 
101                 {
102                         get 
103                         {
104                                 if (!CheckBit ((int) Styles.BackColor)) 
105                                 {
106                                         return Color.Empty;
107                                 }
108
109                                 return (Color)viewstate["BackColor"];
110                         }
111
112                         set 
113                         {
114                                 viewstate["BackColor"] = value;
115                                 SetBit ((int) Styles.BackColor);
116                         }
117                 }
118
119                 [DefaultValue(typeof (Color), "")]
120                 [NotifyParentProperty(true)]
121                 [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
122                 [WebSysDescription ("")]
123                 [WebCategory ("Appearance")]
124                 public Color BorderColor 
125                 {
126                         get 
127                         {
128                                 if (!CheckBit ((int) Styles.BorderColor)) 
129                                 {
130                                         return Color.Empty;
131                                 }
132
133                                 return (Color)viewstate["BorderColor"];
134                         }
135
136                         set 
137                         {
138                                 viewstate["BorderColor"] = value;
139                                 SetBit ((int) Styles.BorderColor);
140                         }
141                 }
142
143                 [DefaultValue(BorderStyle.NotSet)]
144                 [NotifyParentProperty(true)]
145                 [WebSysDescription ("")]
146                 [WebCategory ("Appearance")]
147                 public BorderStyle BorderStyle 
148                 {
149                         get 
150                         {
151                                 if (!CheckBit ((int) Styles.BorderStyle)) 
152                                 {
153                                         return BorderStyle.NotSet;
154                                 }
155
156                                 return (BorderStyle)viewstate["BorderStyle"];
157                         }
158
159                         set 
160                         {
161                                 if (value < BorderStyle.NotSet || value > BorderStyle.Outset)
162                                         throw new ArgumentOutOfRangeException ("value", "The selected value is not one of the BorderStyle enumeration values.");
163                                 
164                                 viewstate["BorderStyle"] = value;
165                                 SetBit ((int) Styles.BorderStyle);
166                         }
167                 }
168
169                 [DefaultValue(typeof (Unit), "")]
170                 [NotifyParentProperty(true)]
171                 [WebSysDescription ("")]
172                 [WebCategory ("Appearance")]
173                 public Unit BorderWidth 
174                 {
175                         get 
176                         {
177                                 if (!CheckBit ((int) Styles.BorderWidth)) 
178                                 {
179                                         return Unit.Empty;
180                                 }
181
182                                 return (Unit)viewstate["BorderWidth"];
183                         }
184
185                         set 
186                         {
187                                 if (value.Value < 0) 
188                                 {
189                                         throw new ArgumentOutOfRangeException("Value", value.Value, "BorderWidth must not be negative");
190                                 }
191
192                                 viewstate["BorderWidth"] = value;
193                                 SetBit ((int) Styles.BorderWidth);
194                         }
195                 }
196
197                 //[TypeConverter ("System.Web.UI.WebControls.EmptyStringExpandableObjectConverter")]
198                 [CssClassProperty]
199                 [DefaultValue("")]
200                 [NotifyParentProperty(true)]
201                 [WebSysDescription ("")]
202                 [WebCategory ("Appearance")]
203                 public string CssClass {
204                         get {
205                                 if (!CheckBit ((int) Styles.CssClass))
206                                 {
207                                         return String.Empty;
208                                 }
209
210                                 string ret = viewstate["CssClass"] as string;
211                                 if (ret == null)
212                                         return String.Empty;
213
214                                 return ret;
215                         }
216
217                         set {
218                                 viewstate["CssClass"] = value;
219                                 SetBit ((int) Styles.CssClass);
220                         }
221                 }
222
223                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
224                 [NotifyParentProperty(true)]
225                 [WebSysDescription ("")]
226                 [WebCategory ("Appearance")]
227                 public FontInfo Font 
228                 {
229                         get 
230                         {
231                                 if (fontinfo == null) 
232                                 {
233                                         fontinfo = new FontInfo(this);
234                                 }
235                                 return fontinfo;
236                         }
237                 }
238
239                 [DefaultValue(typeof (Color), "")]
240                 [NotifyParentProperty(true)]
241                 [TypeConverter(typeof(System.Web.UI.WebControls.WebColorConverter))]
242                 [WebSysDescription ("")]
243                 [WebCategory ("Appearance")]
244                 public Color ForeColor 
245                 {
246                         get 
247                         {
248                                 if (!CheckBit ((int) Styles.ForeColor)) 
249                                 {
250                                         return Color.Empty;
251                                 }
252
253                                 return (Color)viewstate["ForeColor"];
254                         }
255
256                         set 
257                         {
258                                 viewstate["ForeColor"] = value;
259                                 SetBit ((int) Styles.ForeColor);
260                         }
261                 }
262
263                 [DefaultValue(typeof (Unit), "")]
264                 [NotifyParentProperty(true)]
265                 [WebSysDescription ("")]
266                 [WebCategory ("Appearance")]
267                 public Unit Height 
268                 {
269                         get 
270                         {
271                                 if (!CheckBit ((int) Styles.Height)) 
272                                 {
273                                         return Unit.Empty;
274                                 }
275
276                                 return (Unit)viewstate["Height"];
277                         }
278
279                         set 
280                         {
281                                 if (value.Value < 0) 
282                                 {
283                                         throw new ArgumentOutOfRangeException("Value", value.Value, "Height must not be negative");
284                                 }
285
286                                 viewstate["Height"] = value;
287                                 SetBit ((int) Styles.Height);
288                         }
289                 }
290
291                 [DefaultValue(typeof (Unit), "")]
292                 [NotifyParentProperty(true)]
293                 [WebSysDescription ("")]
294                 [WebCategory ("Appearance")]
295                 public Unit Width 
296                 {
297                         get 
298                         {
299                                 if (!CheckBit ((int) Styles.Width)) 
300                                 {
301                                         return Unit.Empty;
302                                 }
303
304                                 return (Unit)viewstate["Width"];
305                         }
306
307                         set 
308                         {
309                                 if (value.Value < 0) 
310                                 {
311                                         throw new ArgumentOutOfRangeException("Value", value.Value, "Width must not be negative");
312                                 }
313
314                                 viewstate["Width"] = value;
315                                 SetBit ((int) Styles.Width);
316                         }
317                 }
318                 #endregion      // Public Instance Properties
319
320                 #region Protected Instance Properties
321                 [Browsable (false)]
322                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
323                 public virtual bool IsEmpty 
324                 {
325                         get 
326                         {
327                                 return (styles == 0 && RegisteredCssClass.Length == 0);
328                         }
329                 }
330
331                 protected bool IsTrackingViewState 
332                 {
333                         get 
334                         {
335                                 return tracking;
336                         }
337                 }
338
339                 [Browsable(false)]
340                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
341                 protected internal StateBag ViewState 
342                 {
343                         get 
344                         {
345                                 return viewstate;
346                         }
347                 }
348                 #endregion      // Protected Instance Properties
349
350                 #region Internal Instance Properties
351                 internal bool AlwaysRenderTextDecoration
352                 {
353                         get
354                         {
355                                 if (viewstate["AlwaysRenderTextDecoration"] == null)
356                                         return false;
357                                 return (bool)viewstate["AlwaysRenderTextDecoration"];
358                         }
359                     
360                         set
361                         {
362                                 viewstate["AlwaysRenderTextDecoration"] = value;
363                         }
364                 }
365                 #endregion      // Internal Instance Properties
366                 
367                 #region Public Instance Methods
368                 public void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer) 
369                 {
370                         AddAttributesToRender(writer, null);
371                 }
372
373                 public virtual void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, WebControl owner)
374                 {
375                         if (RegisteredCssClass.Length > 0) {
376                                 string cssclass = CssClass;
377                                 if (!String.IsNullOrEmpty (cssclass))
378                                         writer.AddAttribute (HtmlTextWriterAttribute.Class, cssclass + " " + RegisteredCssClass);
379                                 else
380                                         writer.AddAttribute (HtmlTextWriterAttribute.Class, RegisteredCssClass);
381                         }
382                         else 
383                         {
384                                 string cssclass = CssClass;
385                                 if (cssclass != null && cssclass.Length > 0)
386                                         writer.AddAttribute (HtmlTextWriterAttribute.Class, cssclass);
387                                 CssStyleCollection col = new CssStyleCollection ();
388                                 FillStyleAttributes (col, owner);
389                                 foreach (string key in col.Keys) {
390                                         writer.AddStyleAttribute (key, col [key]);
391                                 }
392                         }
393                 }
394                 protected virtual void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver)
395                 {
396                         Color           color;
397                         BorderStyle     bs;
398                         Unit            u;
399
400                         if (CheckBit ((int) Styles.BackColor))
401                         {
402                                 color = (Color)viewstate["BackColor"];
403                                 if (!color.IsEmpty)
404                                         attributes.Add (HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(color));
405                         }
406
407                         if (CheckBit ((int) Styles.BorderColor)) 
408                         {
409                                 color = (Color)viewstate["BorderColor"];
410                                 if (!color.IsEmpty)
411                                         attributes.Add (HtmlTextWriterStyle.BorderColor, ColorTranslator.ToHtml(color));
412                         }
413
414                         bool have_width = false;
415                         if (CheckBit ((int) Styles.BorderWidth)) {
416                                 u = (Unit) viewstate ["BorderWidth"];
417                                 if (!u.IsEmpty) {
418                                         if (u.Value > 0)
419                                                 have_width = true;
420                                         attributes.Add (HtmlTextWriterStyle.BorderWidth, u.ToString ());
421                                 }
422                         }
423
424                         if (CheckBit ((int) Styles.BorderStyle)) {
425                                 bs = (BorderStyle) viewstate ["BorderStyle"];
426                                 if (bs != BorderStyle.NotSet)
427                                         attributes.Add (HtmlTextWriterStyle.BorderStyle, bs.ToString ());
428                                 else if (have_width)
429                                                 attributes.Add (HtmlTextWriterStyle.BorderStyle, "solid");
430                         }
431                         else if (have_width) {
432                                 attributes.Add (HtmlTextWriterStyle.BorderStyle, "solid");
433                         }
434
435                         if (CheckBit ((int) Styles.ForeColor)) 
436                         {
437                                 color = (Color)viewstate["ForeColor"];
438                                 if (!color.IsEmpty)
439                                         attributes.Add (HtmlTextWriterStyle.Color, ColorTranslator.ToHtml(color));
440                         }
441
442                         if (CheckBit ((int) Styles.Height)) 
443                         {
444                                 u = (Unit)viewstate["Height"];
445                                 if (!u.IsEmpty)
446                                         attributes.Add (HtmlTextWriterStyle.Height, u.ToString());
447                         }
448
449                         if (CheckBit ((int) Styles.Width)) 
450                         {
451                                 u = (Unit)viewstate["Width"];
452                                 if (!u.IsEmpty)
453                                         attributes.Add (HtmlTextWriterStyle.Width, u.ToString());
454                         }
455
456                         Font.FillStyleAttributes (attributes, AlwaysRenderTextDecoration);
457                 }
458
459                 public virtual void CopyFrom(Style s) 
460                 {
461                         if ((s == null) || s.IsEmpty) 
462                         {
463                                 return;
464                         }
465
466                         if (s.fontinfo != null) 
467                         {
468                                 Font.CopyFrom(s.fontinfo);
469                         }
470
471                         if ((s.CheckBit ((int) Styles.BackColor)) && (s.BackColor != Color.Empty))
472                         {
473                                 this.BackColor = s.BackColor;
474                         }
475                         if ((s.CheckBit ((int) Styles.BorderColor)) && (s.BorderColor != Color.Empty))
476                         {
477                                 this.BorderColor = s.BorderColor;
478                         }
479                         if ((s.CheckBit ((int) Styles.BorderStyle)) && (s.BorderStyle != BorderStyle.NotSet))
480                         {
481                                 this.BorderStyle = s.BorderStyle;
482                         }
483                         if ((s.CheckBit ((int) Styles.BorderWidth)) && (!s.BorderWidth.IsEmpty))
484                         {
485                                 this.BorderWidth = s.BorderWidth;
486                         }
487                         if ((s.CheckBit ((int) Styles.CssClass)) && (s.CssClass != string.Empty))
488                         {
489                                 this.CssClass = s.CssClass;
490                         }
491                         if ((s.CheckBit ((int) Styles.ForeColor)) && (s.ForeColor != Color.Empty))
492                         {
493                                 this.ForeColor = s.ForeColor;
494                         }
495                         if ((s.CheckBit ((int) Styles.Height)) && (!s.Height.IsEmpty))
496                         {
497                                 this.Height = s.Height;
498                         }
499                         if ((s.CheckBit ((int) Styles.Width)) && (!s.Width.IsEmpty))
500                         {
501                                 this.Width = s.Width;
502                         }
503                 }
504
505                 public virtual void MergeWith(Style s) 
506                 {
507                         if ((s == null) || (s.IsEmpty))
508                         {
509                                 return;
510                         }
511
512                         if (s.fontinfo != null) 
513                         {
514                                 Font.MergeWith(s.fontinfo);
515                         }
516
517                         if ((!CheckBit ((int) Styles.BackColor)) && (s.CheckBit ((int) Styles.BackColor)) && (s.BackColor != Color.Empty))
518                         {
519                                 this.BackColor = s.BackColor;
520                         }
521                         if ((!CheckBit ((int) Styles.BorderColor)) && (s.CheckBit ((int) Styles.BorderColor)) && (s.BorderColor != Color.Empty)) 
522                         {
523                                 this.BorderColor = s.BorderColor;
524                         }
525                         if ((!CheckBit ((int) Styles.BorderStyle)) && (s.CheckBit ((int) Styles.BorderStyle)) && (s.BorderStyle != BorderStyle.NotSet))
526                         {
527                                 this.BorderStyle = s.BorderStyle;
528                         }
529                         if ((!CheckBit ((int) Styles.BorderWidth)) && (s.CheckBit ((int) Styles.BorderWidth)) && (!s.BorderWidth.IsEmpty))
530                         {
531                                 this.BorderWidth = s.BorderWidth;
532                         }
533                         if ((!CheckBit ((int) Styles.CssClass)) && (s.CheckBit ((int) Styles.CssClass)) && (s.CssClass != string.Empty))
534                         {
535                                 this.CssClass = s.CssClass;
536                         }
537                         if ((!CheckBit ((int) Styles.ForeColor)) && (s.CheckBit ((int) Styles.ForeColor)) && (s.ForeColor != Color.Empty))
538                         {
539                                 this.ForeColor = s.ForeColor;
540                         }
541                         if ((!CheckBit ((int) Styles.Height)) && (s.CheckBit ((int) Styles.Height)) && (!s.Height.IsEmpty))
542                         {
543                                 this.Height = s.Height;
544                         }
545                         if ((!CheckBit ((int) Styles.Width)) && (s.CheckBit ((int) Styles.Width)) && (!s.Width.IsEmpty))
546                         {
547                                 this.Width = s.Width;
548                         }
549                 }
550
551                 /*
552                 internal void Print ()
553                 {
554                         Console.WriteLine ("BackColor: {0}", BackColor);
555                         Console.WriteLine ("BorderColor: {0}", BorderColor);
556                         Console.WriteLine ("BorderStyle: {0}", BorderStyle);
557                         Console.WriteLine ("BorderWidth: {0}", BorderWidth);
558                         Console.WriteLine ("CssClass: {0}", CssClass);
559                         Console.WriteLine ("ForeColor: {0}", ForeColor);
560                         Console.WriteLine ("Height: {0}", Height);
561                         Console.WriteLine ("Width: {0}", Width);
562                 }
563                 */
564
565                 public virtual void Reset() 
566                 {
567                         viewstate.Remove("BackColor");
568                         viewstate.Remove("BorderColor");
569                         viewstate.Remove("BorderStyle");
570                         viewstate.Remove("BorderWidth");
571                         viewstate.Remove("CssClass");
572                         viewstate.Remove("ForeColor");
573                         viewstate.Remove("Height");
574                         viewstate.Remove("Width");
575                         if (fontinfo != null) 
576                         {
577                                 fontinfo.Reset();
578                         }
579                         styles = 0;
580                         viewstate.Remove (BitStateKey);
581                         stylesTraked = 0;
582                 }
583                 #endregion      // Public Instance Methods
584
585                 #region Protected Instance Methods
586                 protected internal void LoadViewState(object state) 
587                 {
588                         viewstate.LoadViewState(state);
589
590                         LoadBitState ();
591                 }
592
593                 protected internal virtual object SaveViewState () 
594                 {
595                         SaveBitState ();
596                         
597                         if (_isSharedViewState)
598                                 return null;
599
600                         return viewstate.SaveViewState ();
601                         
602                 }
603
604                 internal void SaveBitState ()
605                 {
606                         if (stylesTraked != 0)
607                                 viewstate [BitStateKey] = stylesTraked;
608                 }
609
610                 internal void LoadBitState () {
611                         if (viewstate [BitStateKey] == null)
612                                 return;
613
614                         int bit = (int) viewstate [BitStateKey];
615                         styles |= bit;
616                         stylesTraked |= bit;
617                 }
618
619                 protected internal virtual void SetBit( int bit ) 
620                 {
621                         styles |= bit;
622                         if (tracking)
623                                 stylesTraked |= bit;
624                 }
625
626                 internal void RemoveBit (int bit) {
627                         styles &= ~bit;
628                         if (tracking) {
629                                 stylesTraked &= ~bit;
630                                 if (stylesTraked == 0)
631                                         viewstate.Remove (BitStateKey);
632                         }
633                 }
634
635                 internal bool CheckBit (int bit) {
636                         return (styles & bit) != 0;
637                 }
638
639                 protected internal virtual void TrackViewState () 
640                 {
641                         tracking = true;
642                         viewstate.TrackViewState();
643                 }
644                 #endregion      // Protected Instance Methods
645
646                 #region IStateManager Properties & Methods
647                 void IStateManager.LoadViewState(object state) 
648                 {
649                         LoadViewState(state);
650                 }
651
652                 object IStateManager.SaveViewState() 
653                 {
654                         return SaveViewState();
655                 }
656
657                 void IStateManager.TrackViewState() 
658                 {
659                         TrackViewState();
660                 }
661
662                 bool IStateManager.IsTrackingViewState 
663                 {
664                         get 
665                         {
666                                 return this.IsTrackingViewState;
667                         }
668                 }
669                 #endregion      // IStateManager Properties & Methods
670
671                 internal void SetRegisteredCssClass (string name)
672                 {
673                         registered_class = name;
674                 }
675
676                 public CssStyleCollection GetStyleAttributes (IUrlResolutionService urlResolver)
677                 {
678                         CssStyleCollection col = new CssStyleCollection ();
679                         FillStyleAttributes (col, urlResolver);
680                         return col;
681                 }
682
683                 [EditorBrowsable(EditorBrowsableState.Advanced)]
684                 [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
685                 [Browsable(false)]
686                 public string RegisteredCssClass {
687                         get {
688                                 if (registered_class == null)
689                                         registered_class = String.Empty;
690                                 return registered_class;
691                         }
692                 }
693
694                 internal void CopyTextStylesFrom (Style source) {
695                         // Used primary for TreeView and Menu
696                         if (source.CheckBit ((int) Styles.ForeColor)) {
697                                 ForeColor = source.ForeColor;
698                         }
699                         if (source.CheckBit((int) Styles.FontAll)) {
700                                 Font.CopyFrom (source.Font);
701                         }
702                 }
703
704                 internal void RemoveTextStyles () {
705                         ForeColor = Color.Empty;
706                         fontinfo = null;
707                 }
708
709                 internal void AddCssClass (string cssClass)
710                 {
711                         if (String.IsNullOrEmpty (cssClass))
712                                 return;
713
714                         string newClass = CssClass;
715                         if (newClass.Length > 0)
716                                 newClass += " ";
717                         newClass += cssClass;
718                         CssClass = newClass;
719                 }
720                 internal void PrependCssClass (string cssClass)
721                 {
722                         if (String.IsNullOrEmpty (cssClass))
723                                 return;
724
725                         string oldClass = CssClass;
726                         if (oldClass.Length > 0)
727                                 cssClass += " ";
728                         CssClass = cssClass + oldClass;
729                 }
730                 public void SetDirty ()
731                 {
732                         if (viewstate != null)
733                                 viewstate.SetDirty (true);
734                         stylesTraked = styles;
735                 }
736         }
737 }