2006-12-26 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ControlPaint.cs
index 634c3b1d53f748e3d339d93cdb8464957ee365cf..d633c8721db64938fc7edf7a54353bf3712c644e 100644 (file)
@@ -50,14 +50,6 @@ namespace System.Windows.Forms {
                #endregion      // Private Enumerations
 
                #region Helpers
-               private static Color Win32ToColor(int Win32Color) {
-                       return(Color.FromArgb(
-                               (int)(Win32Color) & 0xff0000 >> 16,             // blue
-                               (int)(Win32Color) & 0xff00 >> 8,                // green
-                               (int)(Win32Color) & 0xff                        // red
-                       ));
-               }
-
                internal static void Color2HBS(Color color, out int h, out int l, out int s) {
                        int     r;
                        int     g;
@@ -187,7 +179,7 @@ namespace System.Windows.Forms {
                }
 
                public static Color Light(Color baseColor,float per) {
-                       if (baseColor == ThemeEngine.Current.ColorControl) {
+                       if (baseColor.ToArgb () == ThemeEngine.Current.ColorControl.ToArgb ()) {
                                int r_sub, g_sub, b_sub;
                                Color color;
 
@@ -211,9 +203,9 @@ namespace System.Windows.Forms {
                        
                        int H, I, S;
 
-                       ControlPaint.Color2HBS(baseColor, out H, out I, out S);                 
-                       int PreIntensity = Math.Min (255, I + (int) (I * 0.5f));
-                       int NewIntensity =  Math.Min (255, PreIntensity + (int) (PreIntensity * per));
+                       ControlPaint.Color2HBS(baseColor, out H, out I, out S);
+                       int NewIntensity =  Math.Min (255, I + (int)((255 - I) * 0.5f * per));
+                       
                        return ControlPaint.HBS2Color(H, NewIntensity, S);                      
                }
 
@@ -227,7 +219,7 @@ namespace System.Windows.Forms {
 
                public static Color Dark(Color baseColor,float per) {   
 
-                       if (baseColor == ThemeEngine.Current.ColorControl) {
+                       if (baseColor.ToArgb () == ThemeEngine.Current.ColorControl.ToArgb ()) {
                                
                                int r_sub, g_sub, b_sub;
                                Color color;
@@ -262,7 +254,17 @@ namespace System.Windows.Forms {
                }
 
                public static void DrawBorder(Graphics graphics, Rectangle bounds, Color color, ButtonBorderStyle style) {
-                       DrawBorder(graphics, bounds, color, 1, style, color, 1, style, color, 1, style, color, 1, style);
+                       int line_width_top_left = 1;
+                       int line_width_bottom_right = 1;
+                       
+                       if (style == ButtonBorderStyle.Inset)
+                               line_width_top_left = 2;
+                       if (style == ButtonBorderStyle.Outset) {
+                               line_width_bottom_right = 2;
+                               line_width_top_left = 2;
+                       }
+                       
+                       DrawBorder(graphics, bounds, color, line_width_top_left, style, color, line_width_top_left, style, color, line_width_bottom_right, style, color, line_width_bottom_right, style);
                }
 
                public static void DrawBorder( Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth,
@@ -399,37 +401,18 @@ namespace System.Windows.Forms {
                        ThemeEngine.Current.CPDrawRadioButton (graphics, rectangle, state);
                }
 
-               [MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
-               private static bool DRFNotImpl = false;
                public static void DrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style) {
-                       if (!DRFNotImpl) {
-                               DRFNotImpl = true;
-                               Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
-                       }
-                       //throw new NotImplementedException();
+                       XplatUI.DrawReversibleFrame (rectangle, backColor, style);
                }
 
-               [MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
-               private static bool DRLNotImpl = false;
                public static void DrawReversibleLine(Point start, Point end, Color backColor) {
-                       if (!DRLNotImpl) {
-                               DRLNotImpl = true;
-                               Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
-                       }
-                       //throw new NotImplementedException();
+                       XplatUI.DrawReversibleLine (start, end, backColor);
                }
 
-               [MonoTODO("Figure out a good System.Drawing way for XOR drawing")]
-               private static bool FRRNotImpl = false;
                public static void FillReversibleRectangle(Rectangle rectangle, Color backColor) {
-                       if (!FRRNotImpl) {
-                               FRRNotImpl = true;
-                               Console.WriteLine("NOT IMPLEMENTED: FillReversibleRectangle(Rectangle rectangle, Color backColor)");
-                       }
-                       //throw new NotImplementedException();
+                       XplatUI.FillReversibleRectangle (rectangle, backColor);
                }
 
-
                public static void DrawScrollButton (Graphics graphics, int x, int y, int width, int height, ScrollButton button, ButtonState state) {
                        ThemeEngine.Current.CPDrawScrollButton (graphics, new Rectangle(x, y, width, height), button, state);
                }