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