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