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