* Theme.cs: add a Clamp method, just for kicks.
[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                 public int Clamp (int value, int lower, int upper)
532                 {
533                         if (value < lower) return lower;
534                         else if (value > upper) return upper;
535                         else return value;
536                 }
537
538                 [MonoTODO("Figure out where to point for My Network Places")]
539                 public virtual string Places(UIIcon index) {
540                         switch (index) {
541                                 case UIIcon.PlacesRecentDocuments: {
542                                         // Default = "Recent Documents"
543                                         return Environment.GetFolderPath(Environment.SpecialFolder.Recent);
544                                 }
545
546                                 case UIIcon.PlacesDesktop: {
547                                         // Default = "Desktop"
548                                         return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
549                                 }
550
551                                 case UIIcon.PlacesPersonal: {
552                                         // Default = "My Documents"
553                                         return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
554                                 }
555
556                                 case UIIcon.PlacesMyComputer: {
557                                         // Default = "My Computer"
558                                         return Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
559                                 }
560
561                                 case UIIcon.PlacesMyNetwork: {
562                                         // Default = "My Network Places"
563                                         return "/tmp";
564                                 }
565
566                                 default: {
567                                         throw new ArgumentOutOfRangeException("index", index, "Unsupported place");
568                                 }
569                         }
570                 }
571
572                 //
573                 // This routine fetches images embedded as assembly resources (not
574                 // resgen resources).  It optionally scales the image to fit the
575                 // specified size x dimension (it adjusts y automatically to fit that).
576                 //
577                 private Image GetSizedResourceImage(string name, int width)
578                 {
579                         Image image = ResPool.GetUIImage (name, width);
580                         if (image != null)
581                                 return image;
582                         
583                         string  fullname;
584
585                         if (width > 0) {
586                                 // Try name_width
587                                 fullname = String.Format("{1}_{0}", name, width);
588                                 image = ResourceImageLoader.Get (fullname);
589                                 if (image != null){
590                                         ResPool.AddUIImage (image, name, width);
591                                         return image;
592                                 }
593                         }
594
595                         // Just try name
596                         image = ResourceImageLoader.Get (name);
597                         if (image == null)
598                                 return null;
599                         
600                         ResPool.AddUIImage (image, name, 0);
601                         if (image.Width != width && width != 0){
602                                 Console.Error.WriteLine ("warning: requesting icon that not been tuned {0}_{1} {2}", width, name, image.Width);
603                                 int height = (image.Height * width)/image.Width;
604                                 Bitmap b = new Bitmap (width, height);
605                                 Graphics g = Graphics.FromImage (b);
606                                 g.DrawImage (image, 0, 0, width, height);
607                                 ResPool.AddUIImage (b, name, width);
608
609                                 return b;
610                         }
611                         return image;
612                 }
613                 
614                 public virtual Image Images(UIIcon index) {
615                         return Images(index, 0);
616                 }
617                         
618                 public virtual Image Images(UIIcon index, int size) {
619                         switch (index) {
620                                 case UIIcon.PlacesRecentDocuments:
621                                         return GetSizedResourceImage ("document-open.png", size);
622                                 case UIIcon.PlacesDesktop:
623                                         return GetSizedResourceImage ("user-desktop.png", size);
624                                 case UIIcon.PlacesPersonal:
625                                         return GetSizedResourceImage ("user-home.png", size);
626                                 case UIIcon.PlacesMyComputer:
627                                         return GetSizedResourceImage ("computer.png", size);
628                                 case UIIcon.PlacesMyNetwork:
629                                         return GetSizedResourceImage ("folder-remote.png", size);
630
631                                 // Icons for message boxes
632                                 case UIIcon.MessageBoxError:
633                                         return GetSizedResourceImage ("dialog-error.png", size);
634                                 case UIIcon.MessageBoxInfo:
635                                         return GetSizedResourceImage ("dialog-information.png", size);
636                                 case UIIcon.MessageBoxQuestion:
637                                         return GetSizedResourceImage ("dialog-question.png", size);
638                                 case UIIcon.MessageBoxWarning:
639                                         return GetSizedResourceImage ("dialog-warning.png", size);
640                                 
641                                 // misc Icons
642                                 case UIIcon.NormalFolder:
643                                         return GetSizedResourceImage ("folder.png", size);
644
645                                 default: {
646                                         throw new ArgumentException("Invalid Icon type requested", "index");
647                                 }
648                         }
649                 }
650
651                 public virtual Image Images(string mimetype, string extension, int size) {
652                         return null;
653                 }
654
655                 #region Principal Theme Methods
656                 // 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)
657                 public abstract void ResetDefaults();
658
659                 // If the theme writes directly to a window instead of a device context
660                 public abstract bool DoubleBufferingSupported {get;}
661                 #endregion      // Principal Theme Methods
662
663                 #region OwnerDraw Support
664                 public abstract void DrawOwnerDrawBackground (DrawItemEventArgs e);
665                 public abstract void DrawOwnerDrawFocusRectangle (DrawItemEventArgs e);
666                 #endregion      // OwnerDraw Support
667
668                 #region Button
669                 #endregion      // Button
670
671                 #region ButtonBase
672                 // Drawing
673                 public abstract void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button);
674
675                 // Sizing
676                 public abstract Size ButtonBaseDefaultSize{get;}
677                 #endregion      // ButtonBase
678
679                 #region CheckBox
680                 public abstract void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox);
681                 #endregion      // CheckBox
682                 
683                 #region CheckedListBox
684                 // Drawing              
685                 public abstract void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e);
686                 #endregion // CheckedListBox
687                 
688                 #region ComboBox
689                 // Drawing
690                 public abstract void DrawComboBoxItem (ComboBox ctrl, DrawItemEventArgs e);
691                 #endregion      // ComboBox
692
693                 #region Control
694                 #endregion      // Control
695                 
696                 #region Datagrid
697                 public abstract int DataGridPreferredColumnWidth { get; }
698                 public abstract int DataGridMinimumColumnCheckBoxHeight { get; }
699                 public abstract int DataGridMinimumColumnCheckBoxWidth { get; }
700                 
701                 // Default colours
702                 public abstract Color DataGridAlternatingBackColor { get; }             
703                 public abstract Color DataGridBackColor { get; }                
704                 public abstract Color DataGridBackgroundColor { get; }
705                 public abstract Color DataGridCaptionBackColor { get; }
706                 public abstract Color DataGridCaptionForeColor { get; }         
707                 public abstract Color DataGridGridLineColor { get; }
708                 public abstract Color DataGridHeaderBackColor { get; }
709                 public abstract Color DataGridHeaderForeColor { get; }
710                 public abstract Color DataGridLinkColor { get; }
711                 public abstract Color DataGridLinkHoverColor { get; }
712                 public abstract Color DataGridParentRowsBackColor { get; }
713                 public abstract Color DataGridParentRowsForeColor { get; }
714                 public abstract Color DataGridSelectionBackColor { get; }
715                 public abstract Color DataGridSelectionForeColor { get; }
716                 // Paint                
717                 public abstract void DataGridPaint (PaintEventArgs pe, DataGrid grid);
718                 public abstract void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid);
719                 public abstract void DataGridPaintColumnHeaders (Graphics g, Rectangle clip, DataGrid grid);
720                 public abstract void DataGridPaintRowContents (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
721                 public abstract void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid);
722                 public abstract void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid);
723                 public abstract void DataGridPaintParentRows (Graphics g, Rectangle bounds, DataGrid grid);
724                 public abstract void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid);
725                 public abstract void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid);
726                 public abstract void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
727                 public abstract void DataGridPaintRelationRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, Rectangle clip, DataGrid grid);
728                 
729                 #endregion // Datagrid
730
731                 #region DateTimePicker
732
733                 public abstract void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp);
734
735                 #endregion      // DateTimePicker
736
737                 #region GroupBox
738                 // Drawing
739                 public abstract void DrawGroupBox (Graphics dc,  Rectangle clip_area, GroupBox box);
740
741                 // Sizing
742                 public abstract Size GroupBoxDefaultSize{get;}
743                 #endregion      // GroupBox
744
745                 #region HScrollBar
746                 public abstract Size HScrollBarDefaultSize{get;}        // Default size of the scrollbar
747                 #endregion      // HScrollBar
748
749                 #region Label
750                 // Drawing
751                 public abstract void DrawLabel (Graphics dc, Rectangle clip_rectangle, Label label);
752
753                 // Sizing
754                 public abstract Size LabelDefaultSize{get;}
755                 #endregion      // Label
756
757                 #region LinkLabel
758                 public abstract void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label);
759                 #endregion      // LinkLabel
760                 
761                 #region ListBox
762                 // Drawing
763                 public abstract void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e);               
764                 #endregion      // ListBox              
765                 
766                 #region ListView
767                 // Drawing
768                 public abstract void DrawListViewItems (Graphics dc, Rectangle clip_rectangle, ListView control);
769                 public abstract void DrawListViewHeader (Graphics dc, Rectangle clip_rectangle, ListView control);
770                 public abstract void DrawListViewHeaderDragDetails (Graphics dc, ListView control, ColumnHeader drag_column, int target_x);
771
772                 // Sizing
773                 public abstract Size ListViewCheckBoxSize { get; }
774                 public abstract int ListViewColumnHeaderHeight { get; }
775                 public abstract int ListViewDefaultColumnWidth { get; }
776                 public abstract int ListViewVerticalSpacing { get; }
777                 public abstract int ListViewEmptyColumnWidth { get; }
778                 public abstract int ListViewHorizontalSpacing { get; }
779                 public abstract Size ListViewDefaultSize { get; }
780                 #endregion      // ListView
781                 
782                 #region Menus
783                 public abstract void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar);
784                 public abstract void CalcPopupMenuSize (Graphics dc, Menu menu);
785                 public abstract int CalcMenuBarSize (Graphics dc, Menu menu, int width);
786                 public abstract void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect);
787                 public abstract void DrawMenuItem (MenuItem item, DrawItemEventArgs e);
788                 public abstract void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect);                
789                 #endregion      // Menus
790
791                 #region MonthCalendar
792                 public abstract void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar month_calendar);
793                 #endregion      // MonthCalendar
794
795                 #region Panel
796                 // Sizing
797                 public abstract Size PanelDefaultSize{get;}
798                 #endregion      // Panel
799
800                 #region PictureBox
801                 // Drawing
802                 public abstract void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb);
803
804                 // Sizing
805                 public abstract Size PictureBoxDefaultSize{get;}
806                 #endregion      // PictureBox
807
808                 #region PrintPreviewControl
809                 public abstract int PrintPreviewControlPadding{get;}
810                 public abstract Size PrintPreviewControlGetPageSize (PrintPreviewControl preview);
811                 public abstract void PrintPreviewControlPaint (PaintEventArgs pe, PrintPreviewControl preview, Size page_image_size);
812                 #endregion      // PrintPreviewControl
813
814                 #region ProgressBar
815                 // Drawing
816                 public abstract void DrawProgressBar (Graphics dc, Rectangle clip_rectangle, ProgressBar progress_bar);
817
818                 // Sizing
819                 public abstract Size ProgressBarDefaultSize{get;}
820                 #endregion      // ProgressBar
821
822                 #region RadioButton
823                 // Drawing
824                 public abstract void DrawRadioButton (Graphics dc, Rectangle clip_rectangle, RadioButton radio_button);
825
826                 // Sizing
827                 public abstract Size RadioButtonDefaultSize{get;}
828                 #endregion      // RadioButton
829
830                 #region ScrollBar
831                 // Drawing
832                 //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);
833                 public abstract void DrawScrollBar (Graphics dc, Rectangle clip_rectangle, ScrollBar bar);
834
835                 // Sizing
836                 public abstract int ScrollBarButtonSize {get;}          // Size of the scroll button
837                 #endregion      // ScrollBar
838
839                 #region StatusBar
840                 // Drawing
841                 public abstract void DrawStatusBar (Graphics dc, Rectangle clip_rectangle, StatusBar sb);
842
843                 // Sizing
844                 public abstract int StatusBarSizeGripWidth {get;}               // Size of Resize area
845                 public abstract int StatusBarHorzGapWidth {get;}        // Gap between panels
846                 public abstract Size StatusBarDefaultSize{get;}
847                 #endregion      // StatusBar
848
849                 #region TabControl
850                 public abstract Size TabControlDefaultItemSize { get; }
851                 public abstract Point TabControlDefaultPadding { get; }
852                 public abstract int TabControlMinimumTabWidth { get; }
853
854                 public abstract Rectangle GetTabControlLeftScrollRect (TabControl tab);
855                 public abstract Rectangle GetTabControlRightScrollRect (TabControl tab);
856                 public abstract Rectangle GetTabControlDisplayRectangle (TabControl tab);
857                 public abstract Size TabControlGetSpacing (TabControl tab);
858                 public abstract void DrawTabControl (Graphics dc, Rectangle area, TabControl tab);
859                 #endregion
860
861                 #region ToolBar
862                 // Drawing
863                 public abstract void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control);
864
865                 // Sizing
866                 public abstract int ToolBarGripWidth {get;}              // Grip width for the ToolBar
867                 public abstract int ToolBarImageGripWidth {get;}         // Grip width for the Image on the ToolBarButton
868                 public abstract int ToolBarSeparatorWidth {get;}         // width of the separator
869                 public abstract int ToolBarDropDownWidth { get; }        // width of the dropdown arrow rect
870                 public abstract int ToolBarDropDownArrowWidth { get; }   // width for the dropdown arrow on the ToolBarButton
871                 public abstract int ToolBarDropDownArrowHeight { get; }  // height for the dropdown arrow on the ToolBarButton
872                 public abstract Size ToolBarDefaultSize{get;}
873                 public abstract bool ToolBarInvalidateEntireButton { get; }
874                 #endregion      // ToolBar
875
876                 #region ToolTip
877                 public abstract void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control);
878                 public abstract Size ToolTipSize(ToolTip.ToolTipWindow tt, string text);
879                 #endregion      // ToolTip              
880                 
881
882                 #region TrackBar
883                 // Drawing
884                 public abstract void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb);
885
886                 // Sizing
887                 public abstract Size TrackBarDefaultSize{get; }         // Default size for the TrackBar control
888                 #endregion      // TrackBar
889
890                 #region VScrollBar
891                 public abstract Size VScrollBarDefaultSize{get;}        // Default size of the scrollbar
892                 #endregion      // VScrollBar
893
894                 #region TreeView
895                 public abstract Size TreeViewDefaultSize { get; }
896                 #endregion
897
898                 public virtual void DrawManagedWindowDecorations (Graphics dc, Rectangle clip, InternalWindowManager wm)
899                 {
900                         // Just making virtual for now so all the themes still build.
901                 }
902
903                 public virtual int ManagedWindowTitleBarHeight (InternalWindowManager wm)
904                 {
905                         // Just making virtual for now so all the themes still build.
906                         return 15;
907                 }
908
909                 public virtual int ManagedWindowBorderWidth (InternalWindowManager wm)
910                 {
911                         // Just making virtual for now so all the themes still build.
912                         return 3;
913                 }
914
915                 public virtual int ManagedWindowIconWidth (InternalWindowManager wm)
916                 {
917                         // Just making virtual for now so all the themes still build.
918                         return ManagedWindowTitleBarHeight (wm) - 5;
919                 }
920
921                 public virtual Size ManagedWindowButtonSize (InternalWindowManager wm)
922                 {
923                         // Just making virtual for now so all the themes still build.
924                         return new Size (10, 10);
925                 }
926
927                 public virtual void ManagedWindowSetButtonLocations (InternalWindowManager wm)
928                 {
929                         // Just making virtual for now so all the themes still build.
930                 }
931
932                 #region ControlPaint Methods
933                 public abstract void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
934                         ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle,
935                         Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor,
936                         int bottomWidth, ButtonBorderStyle bottomStyle);
937
938                 public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
939                 public abstract void CPDrawButton (Graphics graphics, Rectangle rectangle, ButtonState state);
940                 public abstract void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state);
941                 public abstract void CPDrawCheckBox (Graphics graphics, Rectangle rectangle, ButtonState state);
942                 public abstract void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state);
943                 public abstract void CPDrawContainerGrabHandle (Graphics graphics, Rectangle bounds);
944                 public abstract void CPDrawFocusRectangle (Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor);
945                 public abstract void CPDrawGrabHandle (Graphics graphics, Rectangle rectangle, bool primary, bool enabled);
946                 public abstract void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor);
947                 public abstract void CPDrawImageDisabled (Graphics graphics, Image image, int x, int y, Color background);
948                 public abstract void CPDrawLockedFrame (Graphics graphics, Rectangle rectangle, bool primary);
949                 public abstract void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color);
950                 public abstract void CPDrawRadioButton (Graphics graphics, Rectangle rectangle, ButtonState state);
951                 public abstract void CPDrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style);
952                 public abstract void CPDrawReversibleLine (Point start, Point end, Color backColor);
953                 public abstract void CPDrawScrollButton (Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state);
954                 public abstract void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect,
955                         Color backColor);
956                 public abstract void CPDrawSizeGrip (Graphics graphics, Color backColor, Rectangle bounds);
957                 public abstract void CPDrawStringDisabled (Graphics graphics, string s, Font font, Color color, RectangleF layoutRectangle,
958                         StringFormat format);
959                 public abstract void CPDrawBorderStyle (Graphics dc, Rectangle area, BorderStyle border_style);
960                 #endregion      // ControlPaint Methods
961         }
962 }