2006-03-09 Mike Kestner <mkestner@novell.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / Theme.cs
index 26e79d4edf336c9b20b77cf16ea667430ddbf00f..f24b03d9bbf4ac1c3fbf7410df33439b5f7eb001 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-// Copyright (c) 2004 Novell, Inc.
+// Copyright (c) 2004-2005 Novell, Inc.
 //
 // Authors:
 //     Jordi Mas i Hernandez, jordi@ximian.com
-//
-//
-// $Revision: 1.10 $
-// $Modtime: $
-// $Log: Theme.cs,v $
-// Revision 1.10  2004/09/28 18:44:25  pbartok
-// - Streamlined Theme interfaces:
-//   * Each DrawXXX method for a control now is passed the object for the
-//     control to be drawn in order to allow accessing any state the theme
-//     might require
-//
-//   * ControlPaint methods for the theme now have a CP prefix to avoid
-//     name clashes with the Draw methods for controls
-//
-//   * Every control now retrieves it's DefaultSize from the current theme
-//
-// Revision 1.9  2004/09/17 12:18:42  jordi
-// Very early menu support
-//
-// Revision 1.8  2004/09/07 17:12:26  jordi
-// GroupBox control
-//
-// Revision 1.7  2004/09/07 09:40:15  jordi
-// LinkLabel fixes, methods, multiple links
-//
-// Revision 1.6  2004/09/02 16:32:54  jordi
-// implements resource pool for pens, brushes, and hatchbruses
-//
-// Revision 1.5  2004/08/25 20:04:40  ravindra
-// Added the missing divider code and grip for ToolBar Control.
-//
-// Revision 1.4  2004/08/24 18:37:02  jordi
-// fixes formmating, methods signature, and adds missing events
-//
-// Revision 1.3  2004/08/24 16:16:46  jackson
-// Handle drawing picture boxes in the theme now. Draw picture box borders and obey sizing modes
-//
-// Revision 1.2  2004/08/20 00:12:51  jordi
-// fixes methods signature
-//
-// Revision 1.1  2004/08/19 22:26:30  jordi
-// move themes from an interface to a class
-//
+//     Peter Dennis Bartok, pbartok@novell.com
 //
 
+
+using System.Collections;
 using System.Drawing;
 using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;\r
-using System.Collections;
+using System.Drawing.Imaging;
+using System.Reflection;
 
 namespace System.Windows.Forms
 {
-       
+       internal enum UIIcon {
+               PlacesRecentDocuments,
+               PlacesDesktop,
+               PlacesPersonal,
+               PlacesMyComputer,
+               PlacesMyNetwork,
+               MessageBoxError,
+               MessageBoxQuestion,
+               MessageBoxWarning,
+               MessageBoxInfo,
+               
+               NormalFolder
+       }
        
        // Implements a pool of system resources        
        internal class SystemResPool
@@ -81,15 +53,17 @@ namespace System.Windows.Forms
                private Hashtable pens = new Hashtable ();
                private Hashtable solidbrushes = new Hashtable ();
                private Hashtable hatchbrushes = new Hashtable ();
+               private Hashtable uiImages = new Hashtable();
                
                public SystemResPool () {}
                
                public Pen GetPen (Color color)
                {
-                       string hash = color.ToString();                 
-                       
-                       if (pens.Contains (hash))
-                               return (Pen) pens[hash];                                
+                       int hash = color.ToArgb ();                     
+
+                       Pen res = pens [hash] as Pen;
+                       if (res != null)
+                               return res;
                        
                        Pen pen = new Pen (color);
                        pens.Add (hash, pen);
@@ -98,10 +72,11 @@ namespace System.Windows.Forms
                
                public SolidBrush GetSolidBrush (Color color)
                {
-                       string hash = color.ToString ();
-                                               
-                       if (solidbrushes.Contains (hash))
-                               return (SolidBrush) solidbrushes[hash];                                                 
+                       int hash = color.ToArgb ();
+
+                       SolidBrush res = solidbrushes [hash] as SolidBrush;
+                       if (res != null)
+                               return res;
                        
                        SolidBrush brush = new SolidBrush (color);
                        solidbrushes.Add (hash, brush);
@@ -114,12 +89,29 @@ namespace System.Windows.Forms
                                                
                        if (hatchbrushes.Contains (hash))
                                return (HatchBrush) hatchbrushes[hash];                                                 
-                       
+
                        HatchBrush brush = new HatchBrush (hatchStyle, foreColor, backColor);
                        hatchbrushes.Add (hash, brush);
                        return brush;
                }
                
+               public void AddUIImage (Image image, string name, int size)
+               {
+                       string hash = name + size.ToString();
+                       
+                       if (uiImages.Contains (hash))
+                               return;
+                       uiImages.Add (hash, image);
+               }
+               
+               public Image GetUIImage(string name, int size)
+               {
+                       string hash = name + size.ToString();
+                       
+                       Image image = uiImages [hash] as Image;
+                       
+                       return image;
+               }
        }
 
        internal abstract class Theme
@@ -128,115 +120,167 @@ namespace System.Windows.Forms
                protected Font default_font;
                protected Color defaultWindowBackColor;
                protected Color defaultWindowForeColor;         
+               protected bool always_draw_hotkeys = true;
                internal SystemResPool ResPool = new SystemResPool ();
-       
+               private Type system_colors = Type.GetType("System.Drawing.SystemColors, System.Drawing");
+
+               private void SetSystemColors(string name, Color value) {
+                       if (system_colors != null) {
+                               MethodInfo update;
+
+                               system_colors.GetField(name, System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value);
+                               update = system_colors.GetMethod("UpdateColors", BindingFlags.Static | BindingFlags.NonPublic);
+                               if (update != null) {
+                                       update.Invoke(null, null);
+                               }
+                       }
+               }
+
+
+               /* OS Feature support */
+               public abstract Version Version {
+                       get;
+               }
+
                /* Default properties */                
-               public virtual Color ColorScrollbar {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_SCROLLBAR);}
+               public virtual Color ColorScrollBar {
+                       get { return SystemColors.ScrollBar;}
+                       set { SetSystemColors("scroll_bar", value); }
                }
 
-               public virtual Color ColorBackground {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BACKGROUND);}
+               public virtual Color ColorDesktop {
+                       get { return SystemColors.Desktop;}
+                       set { SetSystemColors("desktop", value); }
                }
 
-               public virtual Color ColorActiveTitle {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_ACTIVECAPTION);}
+               public virtual Color ColorActiveCaption {
+                       get { return SystemColors.ActiveCaption;}
+                       set { SetSystemColors("active_caption", value); }
                }
 
-               public virtual Color ColorInactiveTitle {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTION);}
+               public virtual Color ColorInactiveCaption {
+                       get { return SystemColors.InactiveCaption;}
+                       set { SetSystemColors("inactive_caption", value); }
                }
 
                public virtual Color ColorMenu {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_MENU);}
+                       get { return SystemColors.Menu;}
+                       set { SetSystemColors("menu", value); }
                }
 
                public virtual Color ColorWindow {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_WINDOW);}
+                       get { return SystemColors.Window;}
+                       set { SetSystemColors("window", value); }
                }
 
                public virtual Color ColorWindowFrame {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_WINDOWFRAME);}
+                       get { return SystemColors.WindowFrame;}
+                       set { SetSystemColors("window_frame", value); }
                }
 
                public virtual Color ColorMenuText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_MENUTEXT);}
+                       get { return SystemColors.MenuText;}
+                       set { SetSystemColors("menu_text", value); }
                }
 
                public virtual Color ColorWindowText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_WINDOWTEXT);}
+                       get { return SystemColors.WindowText;}
+                       set { SetSystemColors("window_text", value); }
                }
 
-               public virtual Color ColorTitleText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_CAPTIONTEXT);}
+               public virtual Color ColorActiveCaptionText {
+                       get { return SystemColors.ActiveCaptionText;}
+                       set { SetSystemColors("active_caption_text", value); }
                }
 
                public virtual Color ColorActiveBorder {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_ACTIVEBORDER);}
+                       get { return SystemColors.ActiveBorder;}
+                       set { SetSystemColors("active_border", value); }
                }
 
                public virtual Color ColorInactiveBorder{
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INACTIVEBORDER);}
+                       get { return SystemColors.InactiveBorder;}
+                       set { SetSystemColors("inactive_border", value); }
                }
 
-               public virtual Color ColorAppWorkSpace {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_APPWORKSPACE);}
+               public virtual Color ColorAppWorkspace {
+                       get { return SystemColors.AppWorkspace;}
+                       set { SetSystemColors("app_workspace", value); }
                }
 
-               public virtual Color ColorHilight {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHT);}
+               public virtual Color ColorHighlight {
+                       get { return SystemColors.Highlight;}
+                       set { SetSystemColors("highlight", value); }
                }
 
-               public virtual Color ColorHilightText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_HIGHLIGHTTEXT);}
+               public virtual Color ColorHighlightText {
+                       get { return SystemColors.HighlightText;}
+                       set { SetSystemColors("highlight_text", value); }
                }
 
-               public virtual Color ColorButtonFace {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNFACE);}
+               public virtual Color ColorControl {
+                       get { return SystemColors.Control;}
+                       set { SetSystemColors("control", value); }
                }
 
-               public virtual Color ColorButtonShadow {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNSHADOW);}
+               public virtual Color ColorControlDark {
+                       get { return SystemColors.ControlDark;}
+                       set { SetSystemColors("control_dark", value); }
                }
 
                public virtual Color ColorGrayText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_GRAYTEXT);}
+                       get { return SystemColors.GrayText;}
+                       set { SetSystemColors("gray_text", value); }
                }
 
-               public virtual Color ColorButtonText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNTEXT);}
+               public virtual Color ColorControlText {
+                       get { return SystemColors.ControlText;}
+                       set { SetSystemColors("control_text", value); }
                }
 
-               public virtual Color ColorInactiveTitleText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INACTIVECAPTIONTEXT);}
+               public virtual Color ColorInactiveCaptionText {
+                       get { return SystemColors.InactiveCaptionText;}
+                       set { SetSystemColors("inactive_caption_text", value); }
                }
 
-               public virtual Color ColorButtonHilight {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_BTNHIGHLIGHT);}
+               public virtual Color ColorControlLight {
+                       get { return SystemColors.ControlLight;}
+                       set { SetSystemColors("control_light", value); }
                }
 
-               public virtual Color ColorButtonDkShadow {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_3DDKSHADOW);}
+               public virtual Color ColorControlDarkDark {
+                       get { return SystemColors.ControlDarkDark;}
+                       set { SetSystemColors("control_dark_dark", value); }
                }
 
-               public virtual Color ColorButtonLight {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_3DLIGHT);}
+               public virtual Color ColorControlLightLight {
+                       get { return SystemColors.ControlLightLight;}
+                       set { SetSystemColors("control_light_light", value); }
                }
 
                public virtual Color ColorInfoText {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INFOTEXT);}
+                       get { return SystemColors.InfoText;}
+                       set { SetSystemColors("info_text", value); }
+               }
+
+               public virtual Color ColorInfo {
+                       get { return SystemColors.Info;}
+                       set { SetSystemColors("info", value); }
                }
 
-               public virtual Color ColorInfoWindow {
-                       get {return GetColor (XplatUIWin32.GetSysColorIndex.COLOR_INFOBK);}
+               public virtual Color ColorHotTrack {
+                       get { return SystemColors.HotTrack;}
+                       set { SetSystemColors("hot_track", value);}
                }
 
                public virtual Color DefaultControlBackColor {
-                       get { return ColorButtonFace; }
+                       get { return ColorControl; }
+                       set { ColorControl = value; }
                }
 
                public virtual Color DefaultControlForeColor {
-                       get { return ColorButtonText; }
+                       get { return ColorControlText; }
+                       set { ColorControlText = value; }
                }
 
                public virtual Font DefaultFont {
@@ -261,7 +305,276 @@ namespace System.Windows.Forms
                        syscolors.SetValue (color, (int) idx);
                }
 
+               // Theme/UI specific defaults
+               public virtual ArrangeDirection ArrangeDirection  {
+                       get {
+                               return ArrangeDirection.Down;
+                       }
+               }
+
+               public virtual ArrangeStartingPosition ArrangeStartingPosition {
+                       get {
+                               return ArrangeStartingPosition.BottomLeft;
+                       }
+               }
+
+               public virtual Size Border3DSize {
+                       get {
+                               return new Size(2, 2);
+                       }
+               }
+
+               public virtual Size BorderSize {
+                       get {
+                               return new Size(1, 1);
+                       }
+               }
+
+               public virtual Size CaptionButtonSize {
+                       get {
+                               return new Size(18, 18);
+                       }
+               }
+
+               public virtual int CaptionHeight {
+                       get {
+                               return XplatUI.CaptionHeight;
+                       }
+               }
+
+               public virtual Size DoubleClickSize {
+                       get {
+                               return new Size(4, 4);
+                       }
+               }
+
+               public virtual int DoubleClickTime {
+                       get {
+                               return 500;
+                       }
+               }
+
+               public virtual Size FixedFrameBorderSize {
+                       get {
+                               return new Size(3, 3);
+                       }
+               }
+
+               public virtual Size FrameBorderSize {
+                       get {
+                               return XplatUI.FrameBorderSize;
+                       }
+               }
+
+               public virtual int HorizontalScrollBarArrowWidth {
+                       get {
+                               return 16;
+                       }
+               }
+
+               public virtual int HorizontalScrollBarHeight {
+                       get {
+                               return 16;
+                       }
+               }
+
+               public virtual int HorizontalScrollBarThumbWidth {
+                       get {
+                               return 16;
+                       }
+               }
+
+               public virtual Size IconSpacingSize {
+                       get {
+                               return new Size(75, 75);
+                       }
+               }
+
+               public virtual Size MenuButtonSize {
+                       get {
+                               return new Size(18, 18);
+                       }
+               }
+
+               public virtual Size MenuCheckSize {
+                       get {
+                               return new Size(13, 13);
+                       }
+               }
+
+               public virtual Font MenuFont {
+                       get {
+                               return default_font;
+                       }
+               }
+
+               public virtual int MenuHeight {
+                       get {
+                               return 19;
+                       }
+               }
+
+               public virtual int MouseWheelScrollLines {
+                       get {
+                               return 3;
+                       }
+               }
+
+               public virtual bool RightAlignedMenus {
+                       get {
+                               return false;
+                       }
+               }
+
+               public virtual Size ToolWindowCaptionButtonSize {
+                       get {
+                               return new Size(15, 15);
+                       }
+               }
+
+               public virtual int ToolWindowCaptionHeight {
+                       get {
+                               return 16;
+                       }
+               }
+
+               public virtual int VerticalScrollBarArrowHeight {
+                       get {
+                               return 16;
+                       }
+               }
+
+               public virtual int VerticalScrollBarThumbHeight {
+                       get {
+                               return 16;
+                       }
+               }
+
+               public virtual int VerticalScrollBarWidth {
+                       get {
+                               return 16;
+                       }
+               }
+               
+               [MonoTODO("Figure out where to point for My Network Places")]
+               public virtual string Places(UIIcon index) {
+                       switch (index) {
+                               case UIIcon.PlacesRecentDocuments: {
+                                       // Default = "Recent Documents"
+                                       return Environment.GetFolderPath(Environment.SpecialFolder.Recent);
+                               }
+
+                               case UIIcon.PlacesDesktop: {
+                                       // Default = "Desktop"
+                                       return Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+                               }
+
+                               case UIIcon.PlacesPersonal: {
+                                       // Default = "My Documents"
+                                       return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
+                               }
+
+                               case UIIcon.PlacesMyComputer: {
+                                       // Default = "My Computer"
+                                       return Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
+                               }
+
+                               case UIIcon.PlacesMyNetwork: {
+                                       // Default = "My Network Places"
+                                       return "/tmp";
+                               }
+
+                               default: {
+                                       throw new ArgumentOutOfRangeException("index", index, "Unsupported place");
+                               }
+                       }
+               }
+
+               private Image GetSizedResourceImage(string name, int size) {
+                       
+                       Image image = ResPool.GetUIImage (name, size);
+                       if (image != null)
+                               return image;
+                       
+                       string  fullname;
+
+                       if (size > 0) {
+                               // Try name name_sizexsize
+                               fullname = String.Format("{0}_{1}x{1}", name, size);
+                               image = ResPool.GetUIImage (fullname, size);
+                               if (image != null)
+                                       return image;
+                               else {
+                                       image = (Image)Locale.GetResource(fullname);
+                                       if (image != null) {
+                                               ResPool.AddUIImage (image, fullname, size);
+                                               return image;
+                                       }
+                               }
+
+                               // Try name_size
+                               fullname = String.Format("{0}_{1}", name, size);
+                               image = ResPool.GetUIImage (fullname, size);
+                               if (image != null)
+                                       return image;
+                               else {
+                                       image = (Image)Locale.GetResource(fullname);
+                                       if (image != null) {
+                                               ResPool.AddUIImage (image, fullname, size);
+                                               return image;
+                                       }
+                               }
+                               
+                               image = (Image)Locale.GetResource(name);
+                               if (image != null) {
+                                       image = new Bitmap (image, new Size (size, size));
+                                       ResPool.AddUIImage (image, name, size);
+                                       return image;
+                               }
+                       }
+
+                       // Just try name
+                       image = (Image)Locale.GetResource(name);
+                       ResPool.AddUIImage (image, name, size);
+                       return image;
+               }
+               
+               public virtual Image Images(UIIcon index) {
+                       return Images(index, 0);
+               }
+                       
+               public virtual Image Images(UIIcon index, int size) {
+                       switch (index) {
+                               case UIIcon.PlacesRecentDocuments:      return GetSizedResourceImage ("last_open", size);
+                               case UIIcon.PlacesDesktop:              return GetSizedResourceImage ("desktop", size);
+                               case UIIcon.PlacesPersonal:             return GetSizedResourceImage ("folder_with_paper", size);
+                               case UIIcon.PlacesMyComputer:           return GetSizedResourceImage ("monitor-computer", size);
+                               case UIIcon.PlacesMyNetwork:            return GetSizedResourceImage ("monitor-planet", size);
+
+                               // Icons for message boxes
+                               case UIIcon.MessageBoxError:            return GetSizedResourceImage ("mbox_error.png", size);
+                               case UIIcon.MessageBoxInfo:             return GetSizedResourceImage ("mbox_info.png", size);
+                               case UIIcon.MessageBoxQuestion:         return GetSizedResourceImage ("mbox_question.png", size);
+                               case UIIcon.MessageBoxWarning:          return GetSizedResourceImage ("mbox_warn.png", size);
+                               
+                               // misc Icons
+                               case UIIcon.NormalFolder:               return GetSizedResourceImage ("folder", size);
+
+                               default: {
+                                       throw new ArgumentException("Invalid Icon type requested", "index");
+                               }
+                       }
+                       return null;
+               }
+
+               public virtual Image Images(string mimetype, string extension, int size) {
+                       return null;
+               }
+
                #region Principal Theme Methods
+               // 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)
+               public abstract void ResetDefaults();
+
                // If the theme writes directly to a window instead of a device context
                public abstract bool DoubleBufferingSupported {get;}
                #endregion      // Principal Theme Methods
@@ -285,9 +598,71 @@ namespace System.Windows.Forms
                #region CheckBox
                public abstract void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox);
                #endregion      // CheckBox
+               
+               #region CheckedListBox
+               // Drawing              
+               public abstract void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e);
+               public abstract Rectangle CheckedListBoxCheckRectangle ();
+               #endregion // CheckedListBox
+               
+               #region ComboBox
+               // Drawing
+               public abstract void DrawComboBoxEditDecorations (Graphics dc, ComboBox ctrl, Rectangle rect);
+               public abstract void DrawComboListBoxDecorations (Graphics dc, ComboBox ctrl, Rectangle rect);
+               public abstract void DrawComboBoxItem (ComboBox ctrl, DrawItemEventArgs e);
+               
+               // Sizing
+               public abstract int DrawComboBoxEditDecorationTop ();
+               public abstract int DrawComboBoxEditDecorationBottom ();
+               public abstract int DrawComboBoxEditDecorationRight ();
+               public abstract int DrawComboBoxEditDecorationLeft ();
+               public abstract int DrawComboListBoxDecorationTop (ComboBoxStyle style);
+               public abstract int DrawComboListBoxDecorationBottom (ComboBoxStyle style);
+               public abstract int DrawComboListBoxDecorationRight (ComboBoxStyle style);
+               public abstract int DrawComboListBoxDecorationLeft (ComboBoxStyle style);
+               #endregion      // ComboBox
 
                #region Control
                #endregion      // Control
+               
+               #region Datagrid
+               public abstract int DataGridPreferredColumnWidth { get; }
+               public abstract int DataGridMinimumColumnCheckBoxHeight { get; }
+               public abstract int DataGridMinimumColumnCheckBoxWidth { get; }
+               
+               // Default colours
+               public abstract Color DataGridAlternatingBackColor { get; }             
+               public abstract Color DataGridBackColor { get; }                
+               public abstract Color DataGridBackgroundColor { get; }
+               public abstract Color DataGridCaptionBackColor { get; }
+               public abstract Color DataGridCaptionForeColor { get; }         
+               public abstract Color DataGridGridLineColor { get; }
+               public abstract Color DataGridHeaderBackColor { get; }
+               public abstract Color DataGridHeaderForeColor { get; }
+               public abstract Color DataGridLinkColor { get; }
+               public abstract Color DataGridLinkHoverColor { get; }
+               public abstract Color DataGridParentRowsBackColor { get; }
+               public abstract Color DataGridParentRowsForeColor { get; }
+               public abstract Color DataGridSelectionBackColor { get; }
+               public abstract Color DataGridSelectionForeColor { get; }
+               // Paint                
+               public abstract void DataGridPaint (PaintEventArgs pe, DataGrid grid);
+               public abstract void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid);
+               public abstract void DataGridPaintColumnsHdrs (Graphics g, Rectangle clip, DataGrid grid);
+               public abstract void DataGridPaintRowsHeaders (Graphics g, Rectangle clip, DataGrid grid);
+               public abstract void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid);
+               public abstract void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid);
+               public abstract void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid);
+               public abstract void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, DataGrid grid);
+               
+               
+               #endregion // Datagrid
+
+               #region DateTimePicker
+
+               public abstract void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp);
+
+               #endregion      // DateTimePicker
 
                #region GroupBox
                // Drawing
@@ -310,7 +685,42 @@ namespace System.Windows.Forms
                #endregion      // Label
 
                #region LinkLabel
+               public abstract void DrawLinkLabel (Graphics dc, Rectangle clip_rectangle, LinkLabel label);
                #endregion      // LinkLabel
+               
+               #region ListBox
+               // Drawing
+               public abstract void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e);               
+               #endregion      // ListBox              
+               
+               #region ListView
+               // Drawing
+               public abstract void DrawListViewItems (Graphics dc, Rectangle clip_rectangle, ListView control);
+               public abstract void DrawListViewHeader (Graphics dc, Rectangle clip_rectangle, ListView control);
+               public abstract void DrawListViewHeaderDragDetails (Graphics dc, ListView control, ColumnHeader drag_column, int target_x);
+
+               // Sizing
+               public abstract Size ListViewCheckBoxSize { get; }
+               public abstract int ListViewColumnHeaderHeight { get; }
+               public abstract int ListViewDefaultColumnWidth { get; }
+               public abstract int ListViewVerticalSpacing { get; }
+               public abstract int ListViewEmptyColumnWidth { get; }
+               public abstract int ListViewHorizontalSpacing { get; }
+               public abstract Size ListViewDefaultSize { get; }
+               #endregion      // ListView
+               
+               #region Menus
+               public abstract void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar);
+               public abstract void CalcPopupMenuSize (Graphics dc, Menu menu);
+               public abstract int CalcMenuBarSize (Graphics dc, Menu menu, int width);
+               public abstract void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect);
+               public abstract void DrawMenuItem (MenuItem item, DrawItemEventArgs e);
+               public abstract void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect);                
+               #endregion      // Menus
+
+               #region MonthCalendar
+               public abstract void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar month_calendar);
+               #endregion      // MonthCalendar
 
                #region Panel
                // Sizing
@@ -319,7 +729,7 @@ namespace System.Windows.Forms
 
                #region PictureBox
                // Drawing
-               public abstract void DrawPictureBox (Graphics dc, PictureBox pb);
+               public abstract void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb);
 
                // Sizing
                public abstract Size PictureBoxDefaultSize{get;}
@@ -360,30 +770,41 @@ namespace System.Windows.Forms
                public abstract Size StatusBarDefaultSize{get;}
                #endregion      // StatusBar
 
+               #region TabControl
+               public abstract Size TabControlDefaultItemSize { get; }
+               public abstract Point TabControlDefaultPadding { get; }
+               public abstract int TabControlMinimumTabWidth { get; }
+
+               public abstract Rectangle GetTabControlLeftScrollRect (TabControl tab);
+               public abstract Rectangle GetTabControlRightScrollRect (TabControl tab);
+               public abstract Rectangle GetTabControlDisplayRectangle (TabControl tab);
+               public abstract Size TabControlGetSpacing (TabControl tab);
+               public abstract void DrawTabControl (Graphics dc, Rectangle area, TabControl tab);
+               #endregion
+
                #region ToolBar
                // Drawing
-               public abstract void DrawToolBar (Graphics dc, Rectangle clip_area, ToolBar control);
+               public abstract void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control);
 
                // Sizing
-               public abstract int ToolBarGripWidth {get;}              // Grip width for the ToolBar
-               public abstract int ToolBarImageGripWidth {get;}         // Grip width for the Image on the ToolBarButton
-               public abstract int ToolBarSeparatorWidth {get;}         // width of the separator
-               public abstract int ToolBarDropDownWidth { get; }        // width of the dropdown arrow rect
-               public abstract int ToolBarDropDownArrowWidth { get; }   // width for the dropdown arrow on the ToolBarButton
-               public abstract int ToolBarDropDownArrowHeight { get; }  // height for the dropdown arrow on the ToolBarButton
+               public abstract int ToolBarGripWidth {get;}              // Grip width for the ToolBar
+               public abstract int ToolBarImageGripWidth {get;}         // Grip width for the Image on the ToolBarButton
+               public abstract int ToolBarSeparatorWidth {get;}         // width of the separator
+               public abstract int ToolBarDropDownWidth { get; }        // width of the dropdown arrow rect
+               public abstract int ToolBarDropDownArrowWidth { get; }   // width for the dropdown arrow on the ToolBarButton
+               public abstract int ToolBarDropDownArrowHeight { get; }  // height for the dropdown arrow on the ToolBarButton
                public abstract Size ToolBarDefaultSize{get;}
                #endregion      // ToolBar
 
+               #region ToolTip
+               public abstract void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control);
+               public abstract Size ToolTipSize(ToolTip.ToolTipWindow tt, string text);
+               #endregion      // ToolTip              
+               
+
                #region TrackBar
                // Drawing
                public abstract void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb);
-//public abstract void DrawTrackBar (Graphics dc, Rectangle area, TrackBar tb, 
-//ref Rectangle thumb_pos, 
-//ref Rectangle thumb_area, 
-//bool highli_thumb, 
-//float ticks, 
-//int value_pos, 
-//bool mouse_value);
 
                // Sizing
                public abstract Size TrackBarDefaultSize{get; }         // Default size for the TrackBar control
@@ -393,6 +814,9 @@ namespace System.Windows.Forms
                public abstract Size VScrollBarDefaultSize{get;}        // Default size of the scrollbar
                #endregion      // VScrollBar
 
+               #region TreeView
+               public abstract Size TreeViewDefaultSize { get; }
+               #endregion
 
                #region ControlPaint Methods
                public abstract void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,