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