2006-12-27 Carlos Alberto Cortez <calberto.cortez@gmail.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / Theme.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) 2004-2005 Novell, Inc.
21 //
22 // Authors:
23 //      Jordi Mas i Hernandez, jordi@ximian.com
24 //      Peter Dennis Bartok, pbartok@novell.com
25 //
26
27
28 using System.Collections;
29 using System.Drawing;
30 using System.Drawing.Drawing2D;
31 using System.Drawing.Imaging;
32 using System.Reflection;
33
34 namespace System.Windows.Forms
35 {
36         internal enum UIIcon {
37                 PlacesRecentDocuments,
38                 PlacesDesktop,
39                 PlacesPersonal,
40                 PlacesMyComputer,
41                 PlacesMyNetwork,
42                 MessageBoxError,
43                 MessageBoxQuestion,
44                 MessageBoxWarning,
45                 MessageBoxInfo,
46                 
47                 NormalFolder
48         }
49         
50         internal struct CPColor {
51                 internal Color Dark;
52                 internal Color DarkDark;
53                 internal Color Light;
54                 internal Color LightLight;
55                 
56                 internal static CPColor Empty;
57         }
58         
59         // Implements a pool of system resources        
60         internal class SystemResPool
61         {
62                 private Hashtable pens = new Hashtable ();
63                 private Hashtable dashpens = new Hashtable ();
64                 private Hashtable sizedpens = new Hashtable ();
65                 private Hashtable solidbrushes = new Hashtable ();
66                 private Hashtable hatchbrushes = new Hashtable ();
67                 private Hashtable uiImages = new Hashtable();
68                 private Hashtable cpcolors = new Hashtable ();
69                 
70                 public SystemResPool () {}
71                 
72                 public Pen GetPen (Color color)
73                 {
74                         int hash = color.ToArgb ();                     
75
76                         lock (pens) {
77                                 Pen res = pens [hash] as Pen;
78                                 if (res != null)
79                                         return res;
80                         
81                                 Pen pen = new Pen (color);
82                                 pens.Add (hash, pen);
83                                 return pen;
84                         }
85                 }
86                 
87                 public Pen GetDashPen (Color color, DashStyle dashStyle)
88                 {
89                         string hash = color.ToString() + dashStyle;
90
91                         lock (dashpens) {
92                                 Pen res = dashpens [hash] as Pen;
93                                 if (res != null)
94                                         return res;
95                         
96                                 Pen pen = new Pen (color);
97                                 pen.DashStyle = dashStyle;
98                                 dashpens [hash] = pen;
99                                 return pen;
100                         }
101                 }
102                 
103                 public Pen GetSizedPen (Color color, int size)
104                 {
105                         string hash = color.ToString () + size;
106                         
107                         lock (sizedpens) {
108                                 Pen res = sizedpens [hash] as Pen;
109                                 if (res != null)
110                                         return res;
111                         
112                                 Pen pen = new Pen (color, size);
113                                 sizedpens [hash] = pen;
114                                 return pen;
115                         }
116                 }
117                 
118                 public SolidBrush GetSolidBrush (Color color)
119                 {
120                         int hash = color.ToArgb ();
121
122                         lock (solidbrushes) {
123                                 SolidBrush res = solidbrushes [hash] as SolidBrush;
124                                 if (res != null)
125                                         return res;
126                         
127                                 SolidBrush brush = new SolidBrush (color);
128                                 solidbrushes.Add (hash, brush);
129                                 return brush;
130                         }
131                 }               
132                 
133                 public HatchBrush GetHatchBrush (HatchStyle hatchStyle, Color foreColor, Color backColor)
134                 {
135                         string hash = hatchStyle.ToString () + foreColor.ToString () + backColor.ToString ();                   
136
137                         lock (hatchbrushes) {
138                                 if (hatchbrushes.Contains (hash))
139                                         return (HatchBrush) hatchbrushes[hash];                                                 
140
141                                 HatchBrush brush = new HatchBrush (hatchStyle, foreColor, backColor);
142                                 hatchbrushes.Add (hash, brush);
143                                 return brush;
144                         }
145                 }
146                 
147                 public void AddUIImage (Image image, string name, int size)
148                 {
149                         string hash = name + size.ToString();
150
151                         lock (uiImages) {
152                                 if (uiImages.Contains (hash))
153                                         return;
154                                 uiImages.Add (hash, image);
155                         }
156                 }
157                 
158                 public Image GetUIImage(string name, int size)
159                 {
160                         string hash = name + size.ToString();
161                         
162                         Image image = uiImages [hash] as Image;
163                         
164                         return image;
165                 }
166                 
167                 public CPColor GetCPColor (Color color)
168                 {
169                         lock (cpcolors) {
170                                 object tmp = cpcolors [color];
171                         
172                                 if (tmp == null) {
173                                         CPColor cpcolor = new CPColor ();
174                                         cpcolor.Dark = ControlPaint.Dark (color);
175                                         cpcolor.DarkDark = ControlPaint.DarkDark (color);
176                                         cpcolor.Light = ControlPaint.Light (color);
177                                         cpcolor.LightLight = ControlPaint.LightLight (color);
178                                 
179                                         cpcolors.Add (color, cpcolor);
180
181                                         return cpcolor;
182                                 }
183                         
184                                 return (CPColor)tmp;
185                         }
186                 }
187         }
188
189         internal abstract class Theme
190         {               
191                 protected Array syscolors;
192                 protected Font default_font;
193         protected Font window_border_font;
194                 protected Color defaultWindowBackColor;
195                 protected Color defaultWindowForeColor;         
196                 protected bool always_draw_hotkeys = true;
197                 internal SystemResPool ResPool = new SystemResPool ();
198                 private Type system_colors = Type.GetType("System.Drawing.SystemColors, System.Drawing");
199
200                 private void SetSystemColors(string name, Color value) {
201                         if (system_colors != null) {
202                                 MethodInfo update;
203
204                                 system_colors.GetField(name, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value);
205                                 update = system_colors.GetMethod("UpdateColors", BindingFlags.Static | BindingFlags.NonPublic);
206                                 if (update != null) {
207                                         update.Invoke(null, null);
208                                 }
209                         }
210                 }
211
212
213                 /* OS Feature support */
214                 public abstract Version Version {
215                         get;
216                 }
217
218                 /* Default properties */                
219                 public virtual Color ColorScrollBar {
220                         get { return SystemColors.ScrollBar;}
221                         set { SetSystemColors("scroll_bar", value); }
222                 }
223
224                 public virtual Color ColorDesktop {
225                         get { return SystemColors.Desktop;}
226                         set { SetSystemColors("desktop", value); }
227                 }
228
229                 public virtual Color ColorActiveCaption {
230                         get { return SystemColors.ActiveCaption;}
231                         set { SetSystemColors("active_caption", value); }
232                 }
233
234                 public virtual Color ColorInactiveCaption {
235                         get { return SystemColors.InactiveCaption;}
236                         set { SetSystemColors("inactive_caption", value); }
237                 }
238
239                 public virtual Color ColorMenu {
240                         get { return SystemColors.Menu;}
241                         set { SetSystemColors("menu", value); }
242                 }
243
244                 public virtual Color ColorWindow {
245                         get { return SystemColors.Window;}
246                         set { SetSystemColors("window", value); }
247                 }
248
249                 public virtual Color ColorWindowFrame {
250                         get { return SystemColors.WindowFrame;}
251                         set { SetSystemColors("window_frame", value); }
252                 }
253
254                 public virtual Color ColorMenuText {
255                         get { return SystemColors.MenuText;}
256                         set { SetSystemColors("menu_text", value); }
257                 }
258
259                 public virtual Color ColorWindowText {
260                         get { return SystemColors.WindowText;}
261                         set { SetSystemColors("window_text", value); }
262                 }
263
264                 public virtual Color ColorActiveCaptionText {
265                         get { return SystemColors.ActiveCaptionText;}
266                         set { SetSystemColors("active_caption_text", value); }
267                 }
268
269                 public virtual Color ColorActiveBorder {
270                         get { return SystemColors.ActiveBorder;}
271                         set { SetSystemColors("active_border", value); }
272                 }
273
274                 public virtual Color ColorInactiveBorder{
275                         get { return SystemColors.InactiveBorder;}
276                         set { SetSystemColors("inactive_border", value); }
277                 }
278
279                 public virtual Color ColorAppWorkspace {
280                         get { return SystemColors.AppWorkspace;}
281                         set { SetSystemColors("app_workspace", value); }
282                 }
283
284                 public virtual Color ColorHighlight {
285                         get { return SystemColors.Highlight;}
286                         set { SetSystemColors("highlight", value); }
287                 }
288
289                 public virtual Color ColorHighlightText {
290                         get { return SystemColors.HighlightText;}
291                         set { SetSystemColors("highlight_text", value); }
292                 }
293
294                 public virtual Color ColorControl {
295                         get { return SystemColors.Control;}
296                         set { SetSystemColors("control", value); }
297                 }
298
299                 public virtual Color ColorControlDark {
300                         get { return SystemColors.ControlDark;}
301                         set { SetSystemColors("control_dark", value); }
302                 }
303
304                 public virtual Color ColorGrayText {
305                         get { return SystemColors.GrayText;}
306                         set { SetSystemColors("gray_text", value); }
307                 }
308
309                 public virtual Color ColorControlText {
310                         get { return SystemColors.ControlText;}
311                         set { SetSystemColors("control_text", value); }
312                 }
313
314                 public virtual Color ColorInactiveCaptionText {
315                         get { return SystemColors.InactiveCaptionText;}
316                         set { SetSystemColors("inactive_caption_text", value); }
317                 }
318
319                 public virtual Color ColorControlLight {
320                         get { return SystemColors.ControlLight;}
321                         set { SetSystemColors("control_light", value); }
322                 }
323
324                 public virtual Color ColorControlDarkDark {
325                         get { return SystemColors.ControlDarkDark;}
326                         set { SetSystemColors("control_dark_dark", value); }
327                 }
328
329                 public virtual Color ColorControlLightLight {
330                         get { return SystemColors.ControlLightLight;}
331                         set { SetSystemColors("control_light_light", value); }
332                 }
333
334                 public virtual Color ColorInfoText {
335                         get { return SystemColors.InfoText;}
336                         set { SetSystemColors("info_text", value); }
337                 }
338
339                 public virtual Color ColorInfo {
340                         get { return SystemColors.Info;}
341                         set { SetSystemColors("info", value); }
342                 }
343
344                 public virtual Color ColorHotTrack {
345                         get { return SystemColors.HotTrack;}
346                         set { SetSystemColors("hot_track", value);}
347                 }
348
349                 public virtual Color DefaultControlBackColor {
350                         get { return ColorControl; }
351                         set { ColorControl = value; }
352                 }
353
354                 public virtual Color DefaultControlForeColor {
355                         get { return ColorControlText; }
356                         set { ColorControlText = value; }
357                 }
358
359                 public virtual Font DefaultFont {
360                         get { return default_font; }
361                 }
362
363                 public virtual Color DefaultWindowBackColor {
364                         get { return defaultWindowBackColor; }                  
365                 }
366
367                 public virtual Color DefaultWindowForeColor {
368                         get { return defaultWindowForeColor; }
369                 }
370
371                 public virtual Color GetColor (XplatUIWin32.GetSysColorIndex idx)
372                 {
373                         return (Color) syscolors.GetValue ((int)idx);
374                 }
375
376                 public virtual void SetColor (XplatUIWin32.GetSysColorIndex idx, Color color)
377                 {
378                         syscolors.SetValue (color, (int) idx);
379                 }
380
381                 // Theme/UI specific defaults
382                 public virtual ArrangeDirection ArrangeDirection  {
383                         get {
384                                 return ArrangeDirection.Down;
385                         }
386                 }
387
388                 public virtual ArrangeStartingPosition ArrangeStartingPosition {
389                         get {
390                                 return ArrangeStartingPosition.BottomLeft;
391                         }
392                 }
393
394                 public virtual Size Border3DSize {
395                         get {
396                                 return new Size(2, 2);
397                         }
398                 }
399
400                 public virtual Size BorderSize {
401                         get {
402                                 return new Size(1, 1);
403                         }
404                 }
405
406                 public virtual Size CaptionButtonSize {
407                         get {
408                                 return new Size(18, 18);
409                         }
410                 }
411
412                 public virtual int CaptionHeight {
413                         get {
414                                 return XplatUI.CaptionHeight;
415                         }
416                 }
417
418                 public virtual Size DoubleClickSize {
419                         get {
420                                 return new Size(4, 4);
421                         }
422                 }
423
424                 public virtual int DoubleClickTime {
425                         get {
426                                 return 500;
427                         }
428                 }
429
430                 public virtual Size FixedFrameBorderSize {
431                         get {
432                                 return new Size(3, 3);
433                         }
434                 }
435
436                 public virtual Size FrameBorderSize {
437                         get {
438                                 return XplatUI.FrameBorderSize;
439                         }
440                 }
441
442                 public virtual int HorizontalScrollBarArrowWidth {
443                         get {
444                                 return 16;
445                         }
446                 }
447
448                 public virtual int HorizontalScrollBarHeight {
449                         get {
450                                 return 16;
451                         }
452                 }
453
454                 public virtual int HorizontalScrollBarThumbWidth {
455                         get {
456                                 return 16;
457                         }
458                 }
459
460                 public virtual Size IconSpacingSize {
461                         get {
462                                 return new Size(75, 75);
463                         }
464                 }
465
466                 public virtual Size MenuButtonSize {
467                         get {
468                                 return new Size(18, 18);
469                         }
470                 }
471
472                 public virtual Size MenuCheckSize {
473                         get {
474                                 return new Size(13, 13);
475                         }
476                 }
477
478                 public virtual Font MenuFont {
479                         get {
480                                 return default_font;
481                         }
482                 }
483
484                 public virtual int MenuHeight {
485                         get {
486                                 return XplatUI.MenuHeight;
487                         }
488                 }
489
490                 public virtual int MouseWheelScrollLines {
491                         get {
492                                 return 3;
493                         }
494                 }
495
496                 public virtual bool RightAlignedMenus {
497                         get {
498                                 return false;
499                         }
500                 }
501
502                 public virtual Size ToolWindowCaptionButtonSize {
503                         get {
504                                 return new Size(15, 15);
505                         }
506                 }
507
508                 public virtual int ToolWindowCaptionHeight {
509                         get {
510                                 return 16;
511                         }
512                 }
513
514                 public virtual int VerticalScrollBarArrowHeight {
515                         get {
516                                 return 16;
517                         }
518                 }
519
520                 public virtual int VerticalScrollBarThumbHeight {
521                         get {
522                                 return 16;
523                         }
524                 }
525
526                 public virtual int VerticalScrollBarWidth {
527                         get {
528                                 return 16;
529                         }
530                 }
531
532         public virtual Font WindowBorderFont {
533             get {
534                 return window_border_font;
535             }
536         }
537
538                 public int Clamp (int value, int lower, int upper)
539                 {
540                         if (value < lower) return lower;
541                         else if (value > upper) return upper;
542                         else return value;
543                 }
544
545                 [MonoTODO("Figure out where to point for My Network Places")]
546                 public virtual string Places(UIIcon index) {
547                         switch (index) {
548                                 case UIIcon.PlacesRecentDocuments: {
549                                         // Default = "Recent Documents"
550                                         return Environment.GetFolderPath(Environment.SpecialFolder.Recent);
551                                 }
552
553                                 case UIIcon.PlacesDesktop: {
554                                         // Default = "Desktop"
555                                         return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
556                                 }
557
558                                 case UIIcon.PlacesPersonal: {
559                                         // Default = "My Documents"
560                                         return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
561                                 }
562
563                                 case UIIcon.PlacesMyComputer: {
564                                         // Default = "My Computer"
565                                         return Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
566                                 }
567
568                                 case UIIcon.PlacesMyNetwork: {
569                                         // Default = "My Network Places"
570                                         return "/tmp";
571                                 }
572
573                                 default: {
574                                         throw new ArgumentOutOfRangeException("index", index, "Unsupported place");
575                                 }
576                         }
577                 }
578
579                 //
580                 // This routine fetches images embedded as assembly resources (not
581                 // resgen resources).  It optionally scales the image to fit the
582                 // specified size x dimension (it adjusts y automatically to fit that).
583                 //
584                 private Image GetSizedResourceImage(string name, int width)
585                 {
586                         Image image = ResPool.GetUIImage (name, width);
587                         if (image != null)
588                                 return image;
589                         
590                         string  fullname;
591
592                         if (width > 0) {
593                                 // Try name_width
594                                 fullname = String.Format("{1}_{0}", name, width);
595                                 image = ResourceImageLoader.Get (fullname);
596                                 if (image != null){
597                                         ResPool.AddUIImage (image, name, width);
598                                         return image;
599                                 }
600                         }
601
602                         // Just try name
603                         image = ResourceImageLoader.Get (name);
604                         if (image == null)
605                                 return null;
606                         
607                         ResPool.AddUIImage (image, name, 0);
608                         if (image.Width != width && width != 0){
609                                 Console.Error.WriteLine ("warning: requesting icon that not been tuned {0}_{1} {2}", width, name, image.Width);
610                                 int height = (image.Height * width)/image.Width;
611                                 Bitmap b = new Bitmap (width, height);
612                                 Graphics g = Graphics.FromImage (b);
613                                 g.DrawImage (image, 0, 0, width, height);
614                                 ResPool.AddUIImage (b, name, width);
615
616                                 return b;
617                         }
618                         return image;
619                 }
620                 
621                 public virtual Image Images(UIIcon index) {
622                         return Images(index, 0);
623                 }
624                         
625                 public virtual Image Images(UIIcon index, int size) {
626                         switch (index) {
627                                 case UIIcon.PlacesRecentDocuments:
628                                         return GetSizedResourceImage ("document-open.png", size);
629                                 case UIIcon.PlacesDesktop:
630                                         return GetSizedResourceImage ("user-desktop.png", size);
631                                 case UIIcon.PlacesPersonal:
632                                         return GetSizedResourceImage ("user-home.png", size);
633                                 case UIIcon.PlacesMyComputer:
634                                         return GetSizedResourceImage ("computer.png", size);
635                                 case UIIcon.PlacesMyNetwork:
636                                         return GetSizedResourceImage ("folder-remote.png", size);
637
638                                 // Icons for message boxes
639                                 case UIIcon.MessageBoxError:
640                                         return GetSizedResourceImage ("dialog-error.png", size);
641                                 case UIIcon.MessageBoxInfo:
642                                         return GetSizedResourceImage ("dialog-information.png", size);
643                                 case UIIcon.MessageBoxQuestion:
644                                         return GetSizedResourceImage ("dialog-question.png", size);
645                                 case UIIcon.MessageBoxWarning:
646                                         return GetSizedResourceImage ("dialog-warning.png", size);
647                                 
648                                 // misc Icons
649                                 case UIIcon.NormalFolder:
650                                         return GetSizedResourceImage ("folder.png", size);
651
652                                 default: {
653                                         throw new ArgumentException("Invalid Icon type requested", "index");
654                                 }
655                         }
656                 }
657
658                 public virtual Image Images(string mimetype, string extension, int size) {
659                         return null;
660                 }
661
662                 #region Principal Theme Methods
663                 // To let the theme now that a change of defaults (colors, etc) was detected and force a re-read (and possible recreation of cached resources)
664                 public abstract void ResetDefaults();
665
666                 // If the theme writes directly to a window instead of a device context
667                 public abstract bool DoubleBufferingSupported {get;}
668                 #endregion      // Principal Theme Methods
669
670                 #region OwnerDraw Support
671                 public abstract void DrawOwnerDrawBackground (DrawItemEventArgs e);
672                 public abstract void DrawOwnerDrawFocusRectangle (DrawItemEventArgs e);
673                 #endregion      // OwnerDraw Support
674
675                 #region Button
676                 #endregion      // Button
677
678                 #region ButtonBase
679                 // Drawing
680                 public abstract void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button);
681
682                 // Sizing
683                 public abstract Size ButtonBaseDefaultSize{get;}
684                 #endregion      // ButtonBase
685
686                 #region CheckBox
687                 public abstract void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox);
688                 #endregion      // CheckBox
689                 
690                 #region CheckedListBox
691                 // Drawing              
692                 public abstract void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e);
693                 #endregion // CheckedListBox
694                 
695                 #region ComboBox
696                 // Drawing
697                 public abstract void DrawComboBoxItem (ComboBox ctrl, DrawItemEventArgs e);
698                 #endregion      // ComboBox
699
700                 #region Control
701                 #endregion      // Control
702                 
703                 #region Datagrid
704                 public abstract int DataGridPreferredColumnWidth { get; }
705                 public abstract int DataGridMinimumColumnCheckBoxHeight { get; }
706                 public abstract int DataGridMinimumColumnCheckBoxWidth { get; }
707                 
708                 // Default colours
709                 public abstract Color DataGridAlternatingBackColor { get; }             
710                 public abstract Color DataGridBackColor { get; }                
711                 public abstract Color DataGridBackgroundColor { get; }
712                 public abstract Color DataGridCaptionBackColor { get; }
713                 public abstract Color DataGridCaptionForeColor { get; }         
714                 public abstract Color DataGridGridLineColor { get; }
715                 public abstract Color DataGridHeaderBackColor { get; }
716                 public abstract Color DataGridHeaderForeColor { get; }
717                 public abstract Color DataGridLinkColor { get; }
718                 public abstract Color DataGridLinkHoverColor { get; }
719                 public abstract Color DataGridParentRowsBackColor { get; }
720                 public abstract Color DataGridParentRowsForeColor { get; }
721                 public abstract Color DataGridSelectionBackColor { get; }
722                 public abstract Color DataGridSelectionForeColor { get; }
723                 // Paint                
724                 public abstract void DataGridPaint (PaintEventArgs pe, DataGrid grid);
725                 public abstract void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid);
726                 public abstract void DataGridPaintColumnHeaders (Graphics g, Rectangle clip, DataGrid grid);
727                 public abstract void DataGridPaintRowContents (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
728                 public abstract void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid);
729                 public abstract void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid);
730                 public abstract void DataGridPaintParentRows (Graphics g, Rectangle bounds, DataGrid grid);
731                 public abstract void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid);
732                 public abstract void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid);
733                 public abstract void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
734                 public abstract void DataGridPaintRelationRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
735                 
736                 #endregion // Datagrid
737
738                 #region DateTimePicker
739
740                 public abstract void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp);
741
742                 #endregion      // DateTimePicker
743
744                 #region GroupBox
745                 // Drawing
746                 public abstract void DrawGroupBox (Graphics dc,  Rectangle clip_area, GroupBox box);
747
748                 // Sizing
749                 public abstract Size GroupBoxDefaultSize{get;}
750                 #endregion      // GroupBox
751
752                 #region HScrollBar
753                 public abstract Size HScrollBarDefaultSize{get;}        // Default size of the scrollbar
754                 #endregion      // HScrollBar
755
756                 #region Label
757                 // Drawing
758                 public abstract void DrawLabel (Graphics dc, Rectangle clip_rectangle, Label label);
759
760                 // Sizing
761                 public abstract Size LabelDefaultSize{get;}
762                 #endregion      // Label
763
764                 #region LinkLabel
765                 public abstract void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label);
766                 #endregion      // LinkLabel
767                 
768                 #region ListBox
769                 // Drawing
770                 public abstract void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e);               
771                 #endregion      // ListBox              
772                 
773                 #region ListView
774                 // Drawing
775                 public abstract void DrawListViewItems (Graphics dc, Rectangle clip_rectangle, ListView control);
776                 public abstract void DrawListViewHeader (Graphics dc, Rectangle clip_rectangle, ListView control);
777                 public abstract void DrawListViewHeaderDragDetails (Graphics dc, ListView control, ColumnHeader drag_column, int target_x);
778
779                 // Sizing
780                 public abstract Size ListViewCheckBoxSize { get; }
781                 public abstract int ListViewColumnHeaderHeight { get; }
782                 public abstract int ListViewDefaultColumnWidth { get; }
783                 public abstract int ListViewVerticalSpacing { get; }
784                 public abstract int ListViewEmptyColumnWidth { get; }
785                 public abstract int ListViewHorizontalSpacing { get; }
786                 public abstract Size ListViewDefaultSize { get; }
787                 public abstract int ListViewGroupHeight { get; }
788                 public abstract int ListViewTileWidthFactor { get; }
789                 public abstract int ListViewTileHeightFactor { get; }
790                 #endregion      // ListView
791                 
792                 #region Menus
793                 public abstract void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar);
794                 public abstract void CalcPopupMenuSize (Graphics dc, Menu menu);
795                 public abstract int CalcMenuBarSize (Graphics dc, Menu menu, int width);
796                 public abstract void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect);
797                 public abstract void DrawMenuItem (MenuItem item, DrawItemEventArgs e);
798                 public abstract void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect);                
799                 #endregion      // Menus
800
801                 #region MonthCalendar
802                 public abstract void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar month_calendar);
803                 #endregion      // MonthCalendar
804
805                 #region Panel
806                 // Sizing
807                 public abstract Size PanelDefaultSize{get;}
808                 #endregion      // Panel
809
810                 #region PictureBox
811                 // Drawing
812                 public abstract void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb);
813
814                 // Sizing
815                 public abstract Size PictureBoxDefaultSize{get;}
816                 #endregion      // PictureBox
817
818                 #region PrintPreviewControl
819                 public abstract int PrintPreviewControlPadding{get;}
820                 public abstract Size PrintPreviewControlGetPageSize (PrintPreviewControl preview);
821                 public abstract void PrintPreviewControlPaint (PaintEventArgs pe, PrintPreviewControl preview, Size page_image_size);
822                 #endregion      // PrintPreviewControl
823
824                 #region ProgressBar
825                 // Drawing
826                 public abstract void DrawProgressBar (Graphics dc, Rectangle clip_rectangle, ProgressBar progress_bar);
827
828                 // Sizing
829                 public abstract Size ProgressBarDefaultSize{get;}
830                 #endregion      // ProgressBar
831
832                 #region RadioButton
833                 // Drawing
834                 public abstract void DrawRadioButton (Graphics dc, Rectangle clip_rectangle, RadioButton radio_button);
835
836                 // Sizing
837                 public abstract Size RadioButtonDefaultSize{get;}
838                 #endregion      // RadioButton
839
840                 #region ScrollBar
841                 // Drawing
842                 //public abstract void DrawScrollBar (Graphics dc, Rectangle area, ScrollBar bar, ref Rectangle thumb_pos, ref Rectangle first_arrow_area, ref Rectangle second_arrow_area, ButtonState first_arrow, ButtonState second_arrow, ref int scrollbutton_width, ref int scrollbutton_height, bool vert);
843                 public abstract void DrawScrollBar (Graphics dc, Rectangle clip_rectangle, ScrollBar bar);
844
845                 // Sizing
846                 public abstract int ScrollBarButtonSize {get;}          // Size of the scroll button
847                 #endregion      // ScrollBar
848
849                 #region StatusBar
850                 // Drawing
851                 public abstract void DrawStatusBar (Graphics dc, Rectangle clip_rectangle, StatusBar sb);
852
853                 // Sizing
854                 public abstract int StatusBarSizeGripWidth {get;}               // Size of Resize area
855                 public abstract int StatusBarHorzGapWidth {get;}        // Gap between panels
856                 public abstract Size StatusBarDefaultSize{get;}
857                 #endregion      // StatusBar
858
859                 #region TabControl
860                 public abstract Size TabControlDefaultItemSize { get; }
861                 public abstract Point TabControlDefaultPadding { get; }
862                 public abstract int TabControlMinimumTabWidth { get; }
863
864                 public abstract Rectangle GetTabControlLeftScrollRect (TabControl tab);
865                 public abstract Rectangle GetTabControlRightScrollRect (TabControl tab);
866                 public abstract Rectangle GetTabControlDisplayRectangle (TabControl tab);
867                 public abstract Size TabControlGetSpacing (TabControl tab);
868                 public abstract void DrawTabControl (Graphics dc, Rectangle area, TabControl tab);
869                 #endregion
870
871                 #region ToolBar
872                 // Drawing
873                 public abstract void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control);
874
875                 // Sizing
876                 public abstract int ToolBarGripWidth {get;}              // Grip width for the ToolBar
877                 public abstract int ToolBarImageGripWidth {get;}         // Grip width for the Image on the ToolBarButton
878                 public abstract int ToolBarSeparatorWidth {get;}         // width of the separator
879                 public abstract int ToolBarDropDownWidth { get; }        // width of the dropdown arrow rect
880                 public abstract int ToolBarDropDownArrowWidth { get; }   // width for the dropdown arrow on the ToolBarButton
881                 public abstract int ToolBarDropDownArrowHeight { get; }  // height for the dropdown arrow on the ToolBarButton
882                 public abstract Size ToolBarDefaultSize{get;}
883                 public abstract bool ToolBarInvalidateEntireButton { get; }
884                 #endregion      // ToolBar
885
886                 #region ToolTip
887                 public abstract void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control);
888                 public abstract Size ToolTipSize(ToolTip.ToolTipWindow tt, string text);
889                 #endregion      // ToolTip              
890                 
891
892                 #region TrackBar
893                 // Drawing
894                 public abstract void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb);
895
896                 // Sizing
897                 public abstract Size TrackBarDefaultSize{get; }         // Default size for the TrackBar control
898                 #endregion      // TrackBar
899
900                 #region VScrollBar
901                 public abstract Size VScrollBarDefaultSize{get;}        // Default size of the scrollbar
902                 #endregion      // VScrollBar
903
904                 #region TreeView
905                 public abstract Size TreeViewDefaultSize { get; }
906                 #endregion
907
908                 public virtual void DrawManagedWindowDecorations (Graphics dc, Rectangle clip, InternalWindowManager wm)
909                 {
910                         // Just making virtual for now so all the themes still build.
911                 }
912
913                 public virtual int ManagedWindowTitleBarHeight (InternalWindowManager wm)
914                 {
915                         // Just making virtual for now so all the themes still build.
916                         return 15;
917                 }
918
919                 public virtual int ManagedWindowBorderWidth (InternalWindowManager wm)
920                 {
921                         // Just making virtual for now so all the themes still build.
922                         return 3;
923                 }
924
925                 public virtual int ManagedWindowIconWidth (InternalWindowManager wm)
926                 {
927                         // Just making virtual for now so all the themes still build.
928                         return ManagedWindowTitleBarHeight (wm) - 5;
929                 }
930
931                 public virtual Size ManagedWindowButtonSize (InternalWindowManager wm)
932                 {
933                         // Just making virtual for now so all the themes still build.
934                         return new Size (10, 10);
935                 }
936
937                 public virtual void ManagedWindowSetButtonLocations (InternalWindowManager wm)
938                 {
939                         // Just making virtual for now so all the themes still build.
940                 }
941
942                 #region ControlPaint Methods
943                 public abstract void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
944                         ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
945                         Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
946                         int bottomWidth, ButtonBorderStyle bottomStyle);
947
948                 public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
949                 public abstract void CPDrawButton (Graphics graphics, Rectangle rectangle, ButtonState state);
950                 public abstract void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state);
951                 public abstract void CPDrawCheckBox (Graphics graphics, Rectangle rectangle, ButtonState state);
952                 public abstract void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state);
953                 public abstract void CPDrawContainerGrabHandle (Graphics graphics, Rectangle bounds);
954                 public abstract void CPDrawFocusRectangle (Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor);
955                 public abstract void CPDrawGrabHandle (Graphics graphics, Rectangle rectangle, bool primary, bool enabled);
956                 public abstract void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor);
957                 public abstract void CPDrawImageDisabled (Graphics graphics, Image image, int x, int y, Color background);
958                 public abstract void CPDrawLockedFrame (Graphics graphics, Rectangle rectangle, bool primary);
959                 public abstract void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color);
960                 public abstract void CPDrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state);
961                 public abstract void CPDrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style);
962                 public abstract void CPDrawReversibleLine (Point start, Point end, Color backColor);
963                 public abstract void CPDrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state);
964                 public abstract void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect,
965                         Color backColor);
966                 public abstract void CPDrawSizeGrip (Graphics graphics, Color backColor, Rectangle bounds);
967                 public abstract void CPDrawStringDisabled (Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
968                         StringFormat format);
969                 public abstract void CPDrawBorderStyle (Graphics dc, Rectangle area, BorderStyle border_style);
970                 #endregion      // ControlPaint Methods
971         }
972 }