In System.Windows.Forms:
[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                 public abstract Font GetLinkFont (Control control);
726                 #endregion      // Control
727                 
728                 #region Datagrid
729                 public abstract int DataGridPreferredColumnWidth { get; }
730                 public abstract int DataGridMinimumColumnCheckBoxHeight { get; }
731                 public abstract int DataGridMinimumColumnCheckBoxWidth { get; }
732                 
733                 // Default colours
734                 public abstract Color DataGridAlternatingBackColor { get; }
735                 public abstract Color DataGridBackColor { get; }
736                 public abstract Color DataGridBackgroundColor { get; }
737                 public abstract Color DataGridCaptionBackColor { get; }
738                 public abstract Color DataGridCaptionForeColor { get; }
739                 public abstract Color DataGridGridLineColor { get; }
740                 public abstract Color DataGridHeaderBackColor { get; }
741                 public abstract Color DataGridHeaderForeColor { get; }
742                 public abstract Color DataGridLinkColor { get; }
743                 public abstract Color DataGridLinkHoverColor { get; }
744                 public abstract Color DataGridParentRowsBackColor { get; }
745                 public abstract Color DataGridParentRowsForeColor { get; }
746                 public abstract Color DataGridSelectionBackColor { get; }
747                 public abstract Color DataGridSelectionForeColor { get; }
748                 // Paint                
749                 public abstract void DataGridPaint (PaintEventArgs pe, DataGrid grid);
750                 public abstract void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid);
751                 public abstract void DataGridPaintColumnHeaders (Graphics g, Rectangle clip, DataGrid grid);
752                 public abstract void DataGridPaintRowContents (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
753                 public abstract void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid);
754                 public abstract void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid);
755                 public abstract void DataGridPaintParentRows (Graphics g, Rectangle bounds, DataGrid grid);
756                 public abstract void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid);
757                 public abstract void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid);
758                 public abstract void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
759                 public abstract void DataGridPaintRelationRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
760                 
761                 #endregion // Datagrid
762
763                 #region DateTimePicker
764
765                 public abstract void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp);
766
767                 #endregion      // DateTimePicker
768
769                 #region GroupBox
770                 // Drawing
771                 public abstract void DrawGroupBox (Graphics dc,  Rectangle clip_area, GroupBox box);
772
773                 // Sizing
774                 public abstract Size GroupBoxDefaultSize{get;}
775                 #endregion      // GroupBox
776
777                 #region HScrollBar
778                 public abstract Size HScrollBarDefaultSize{get;}        // Default size of the scrollbar
779                 #endregion      // HScrollBar
780
781                 #region Label
782                 // Drawing
783                 public abstract void DrawLabel (Graphics dc, Rectangle clip_rectangle, Label label);
784
785                 // Sizing
786                 public abstract Size LabelDefaultSize{get;}
787                 #endregion      // Label
788
789                 #region LinkLabel
790                 public abstract void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label);
791                 #endregion      // LinkLabel
792                 
793                 #region ListBox
794                 // Drawing
795                 public abstract void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e);
796                 #endregion      // ListBox
797                 
798                 #region ListView
799                 // Drawing
800                 public abstract void DrawListViewItems (Graphics dc, Rectangle clip_rectangle, ListView control);
801                 public abstract void DrawListViewHeader (Graphics dc, Rectangle clip_rectangle, ListView control);
802                 public abstract void DrawListViewHeaderDragDetails (Graphics dc, ListView control, ColumnHeader drag_column, int target_x);
803
804                 // Sizing
805                 public abstract Size ListViewCheckBoxSize { get; }
806                 public abstract int ListViewColumnHeaderHeight { get; }
807                 public abstract int ListViewDefaultColumnWidth { get; }
808                 public abstract int ListViewVerticalSpacing { get; }
809                 public abstract int ListViewEmptyColumnWidth { get; }
810                 public abstract int ListViewHorizontalSpacing { get; }
811                 public abstract Size ListViewDefaultSize { get; }
812                 public abstract int ListViewGroupHeight { get; }
813                 public abstract int ListViewTileWidthFactor { get; }
814                 public abstract int ListViewTileHeightFactor { get; }
815                 #endregion      // ListView
816                 
817                 #region Menus
818                 public abstract void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar);
819                 public abstract void CalcPopupMenuSize (Graphics dc, Menu menu);
820                 public abstract int CalcMenuBarSize (Graphics dc, Menu menu, int width);
821                 public abstract void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect);
822                 public abstract void DrawMenuItem (MenuItem item, DrawItemEventArgs e);
823                 public abstract void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect);
824                 #endregion      // Menus
825
826                 #region MonthCalendar
827                 public abstract void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar month_calendar);
828                 #endregion      // MonthCalendar
829
830                 #region Panel
831                 // Sizing
832                 public abstract Size PanelDefaultSize{get;}
833                 #endregion      // Panel
834
835                 #region PictureBox
836                 // Drawing
837                 public abstract void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb);
838
839                 // Sizing
840                 public abstract Size PictureBoxDefaultSize{get;}
841                 #endregion      // PictureBox
842
843                 #region PrintPreviewControl
844                 public abstract int PrintPreviewControlPadding{get;}
845                 public abstract Size PrintPreviewControlGetPageSize (PrintPreviewControl preview);
846                 public abstract void PrintPreviewControlPaint (PaintEventArgs pe, PrintPreviewControl preview, Size page_image_size);
847                 #endregion      // PrintPreviewControl
848
849                 #region ProgressBar
850                 // Drawing
851                 public abstract void DrawProgressBar (Graphics dc, Rectangle clip_rectangle, ProgressBar progress_bar);
852
853                 // Sizing
854                 public abstract Size ProgressBarDefaultSize{get;}
855                 #endregion      // ProgressBar
856
857                 #region RadioButton
858                 // Drawing
859                 public abstract void DrawRadioButton (Graphics dc, Rectangle clip_rectangle, RadioButton radio_button);
860
861                 // Sizing
862                 public abstract Size RadioButtonDefaultSize{get;}
863                 #endregion      // RadioButton
864
865                 #region ScrollBar
866                 // Drawing
867                 //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);
868                 public abstract void DrawScrollBar (Graphics dc, Rectangle clip_rectangle, ScrollBar bar);
869
870                 // Sizing
871                 public abstract int ScrollBarButtonSize {get;}          // Size of the scroll button
872                 #endregion      // ScrollBar
873
874                 #region StatusBar
875                 // Drawing
876                 public abstract void DrawStatusBar (Graphics dc, Rectangle clip_rectangle, StatusBar sb);
877
878                 // Sizing
879                 public abstract int StatusBarSizeGripWidth {get;}               // Size of Resize area
880                 public abstract int StatusBarHorzGapWidth {get;}        // Gap between panels
881                 public abstract Size StatusBarDefaultSize{get;}
882                 #endregion      // StatusBar
883
884                 #region TabControl
885                 public abstract Size TabControlDefaultItemSize { get; }
886                 public abstract Point TabControlDefaultPadding { get; }
887                 public abstract int TabControlMinimumTabWidth { get; }
888
889                 public abstract Rectangle GetTabControlLeftScrollRect (TabControl tab);
890                 public abstract Rectangle GetTabControlRightScrollRect (TabControl tab);
891                 public abstract Rectangle GetTabControlDisplayRectangle (TabControl tab);
892                 public abstract Size TabControlGetSpacing (TabControl tab);
893                 public abstract void DrawTabControl (Graphics dc, Rectangle area, TabControl tab);
894                 #endregion
895
896                 #region ToolBar
897                 // Drawing
898                 public abstract void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control);
899
900                 // Sizing
901                 public abstract int ToolBarGripWidth {get;}              // Grip width for the ToolBar
902                 public abstract int ToolBarImageGripWidth {get;}         // Grip width for the Image on the ToolBarButton
903                 public abstract int ToolBarSeparatorWidth {get;}         // width of the separator
904                 public abstract int ToolBarDropDownWidth { get; }        // width of the dropdown arrow rect
905                 public abstract int ToolBarDropDownArrowWidth { get; }   // width for the dropdown arrow on the ToolBarButton
906                 public abstract int ToolBarDropDownArrowHeight { get; }  // height for the dropdown arrow on the ToolBarButton
907                 public abstract Size ToolBarDefaultSize{get;}
908                 #endregion      // ToolBar
909
910                 #region ToolTip
911                 public abstract void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control);
912                 public abstract Size ToolTipSize(ToolTip.ToolTipWindow tt, string text);
913                 #endregion      // ToolTip
914                 
915                 #region BalloonWindow
916 #if NET_2_0
917                 public abstract void DrawBalloonWindow (Graphics dc, Rectangle clip, NotifyIcon.BalloonWindow control);
918                 public abstract Rectangle BalloonWindowRect (NotifyIcon.BalloonWindow control);
919 #endif
920                 #endregion      // BalloonWindow
921
922                 #region TrackBar
923                 // Drawing
924                 public abstract void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb);
925
926                 // Sizing
927                 public abstract Size TrackBarDefaultSize{get; }         // Default size for the TrackBar control
928                 
929                 public abstract int TrackBarValueFromMousePosition (int x, int y, TrackBar tb);
930                 #endregion      // TrackBar
931
932                 #region VScrollBar
933                 public abstract Size VScrollBarDefaultSize{get;}        // Default size of the scrollbar
934                 #endregion      // VScrollBar
935
936                 #region TreeView
937                 public abstract Size TreeViewDefaultSize { get; }
938                 #endregion
939
940                 public virtual void DrawManagedWindowDecorations (Graphics dc, Rectangle clip, InternalWindowManager wm)
941                 {
942                         // Just making virtual for now so all the themes still build.
943                 }
944
945                 public virtual int ManagedWindowTitleBarHeight (InternalWindowManager wm)
946                 {
947                         // Just making virtual for now so all the themes still build.
948                         return 15;
949                 }
950
951                 public virtual int ManagedWindowBorderWidth (InternalWindowManager wm)
952                 {
953                         // Just making virtual for now so all the themes still build.
954                         return 3;
955                 }
956
957                 public virtual int ManagedWindowIconWidth (InternalWindowManager wm)
958                 {
959                         // Just making virtual for now so all the themes still build.
960                         return ManagedWindowTitleBarHeight (wm) - 5;
961                 }
962
963                 public virtual Size ManagedWindowButtonSize (InternalWindowManager wm)
964                 {
965                         // Just making virtual for now so all the themes still build.
966                         return new Size (10, 10);
967                 }
968
969                 public virtual void ManagedWindowSetButtonLocations (InternalWindowManager wm)
970                 {
971                         // Just making virtual for now so all the themes still build.
972                 }
973
974                 #region ControlPaint Methods
975                 public abstract void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
976                         ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
977                         Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
978                         int bottomWidth, ButtonBorderStyle bottomStyle);
979
980                 public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
981                 public abstract void CPDrawButton (Graphics graphics, Rectangle rectangle, ButtonState state);
982                 public abstract void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state);
983                 public abstract void CPDrawCheckBox (Graphics graphics, Rectangle rectangle, ButtonState state);
984                 public abstract void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state);
985                 public abstract void CPDrawContainerGrabHandle (Graphics graphics, Rectangle bounds);
986                 public abstract void CPDrawFocusRectangle (Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor);
987                 public abstract void CPDrawGrabHandle (Graphics graphics, Rectangle rectangle, bool primary, bool enabled);
988                 public abstract void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor);
989                 public abstract void CPDrawImageDisabled (Graphics graphics, Image image, int x, int y, Color background);
990                 public abstract void CPDrawLockedFrame (Graphics graphics, Rectangle rectangle, bool primary);
991                 public abstract void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color);
992                 public abstract void CPDrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state);
993                 public abstract void CPDrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style);
994                 public abstract void CPDrawReversibleLine (Point start, Point end, Color backColor);
995                 public abstract void CPDrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state);
996                 public abstract void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect,
997                         Color backColor);
998                 public abstract void CPDrawSizeGrip (Graphics graphics, Color backColor, Rectangle bounds);
999                 public abstract void CPDrawStringDisabled (Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
1000                         StringFormat format);
1001                 public abstract void CPDrawBorderStyle (Graphics dc, Rectangle area, BorderStyle border_style);
1002                 #endregion      // ControlPaint Methods
1003         }
1004 }