[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePa
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs, 1.25, 1.26 Glyphs.cs, 1.3, 1.4 |
Date: |
Fri, 21 Nov 2003 10:37:25 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes
In directory subversions:/tmp/cvs-serv32450/System.Windows.Forms/Themes
Modified Files:
DefaultThemePainter.cs Glyphs.cs
Log Message:
Use a glyph-based drawing approach for radio buttons.
Index: DefaultThemePainter.cs
===================================================================
RCS file:
/cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes/DefaultThemePainter.cs,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** DefaultThemePainter.cs 21 Nov 2003 07:45:43 -0000 1.25
--- DefaultThemePainter.cs 21 Nov 2003 10:37:22 -0000 1.26
***************
*** 1561,1578 ****
Brush backgroundBrush)
{
! // fill in the background
graphics.FillRectangle(backgroundBrush, x, y,
width, height);
Color lightlight =
ControlPaint.LightLight(backColor);
Color darkdark =
ControlPaint.DarkDark(backColor);
Color light = ControlPaint.Light(backColor);
Color dark = ControlPaint.Dark(backColor);
!
! Color fillColor = lightlight;
! if ((state & ButtonState.Inactive) != 0)
{
fillColor = light;
}
// fill in center area
using (Brush b = new SolidBrush(fillColor))
--- 1561,1630 ----
Brush backgroundBrush)
{
! // Fill in the background.
graphics.FillRectangle(backgroundBrush, x, y,
width, height);
+ // Collect up the colors that we need to draw
the button.
Color lightlight =
ControlPaint.LightLight(backColor);
Color darkdark =
ControlPaint.DarkDark(backColor);
Color light = ControlPaint.Light(backColor);
Color dark = ControlPaint.Dark(backColor);
! Color fillColor;
! Color bulletColor;
! if((state & ButtonState.Inactive) != 0)
! {
! fillColor = light;
! bulletColor = dark;
! }
! else if((state & ButtonState.Pushed) != 0)
{
fillColor = light;
+ bulletColor = foreColor;
+ }
+ else
+ {
+ fillColor = lightlight;
+ bulletColor = foreColor;
}
+ // Draw the glyphs that make up the components.
+ int radio_width = Glyphs.radio_width;
+ int radio_height = Glyphs.radio_height;
+ if((state & ButtonState.Flat) == 0)
+ {
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.radio1_bits,
+ radio_width,
radio_height, dark);
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.radio2_bits,
+ radio_width,
radio_height, darkdark);
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.radio3_bits,
+ radio_width,
radio_height, lightlight);
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.radio4_bits,
+ radio_width,
radio_height, light);
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.radio5_bits,
+ radio_width,
radio_height, fillColor);
+ }
+ else
+ {
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.rflat1_bits,
+ radio_width,
radio_height, bulletColor);
+ DrawGlyph(graphics, x, y, width, height,
+ Glyphs.rflat2_bits,
+ radio_width,
radio_height, fillColor);
+ }
+
+ // Draw the glyph for the checked state.
+ if((state & ButtonState.Checked) != 0)
+ {
+ DrawGlyph(graphics, x, y, width, height,
+
Glyphs.radio_bullet_bits,
+ radio_width,
radio_height, bulletColor);
+ }
+
+ #if false // May need later for non-standard glyph sizes.
// fill in center area
using (Brush b = new SolidBrush(fillColor))
***************
*** 1633,1636 ****
--- 1685,1689 ----
}
}
+ #endif
}
Index: Glyphs.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes/Glyphs.cs,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Glyphs.cs 21 Nov 2003 07:45:43 -0000 1.3
--- Glyphs.cs 21 Nov 2003 10:37:22 -0000 1.4
***************
*** 118,121 ****
--- 118,161 ----
0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00};
+ // The various components of a normal radio button's border.
+ public const int radio_width = 12;
+ public const int radio_height = 12;
+ public static readonly byte[] radio1_bits = // Dark
+ {0xf0, 0x00, 0x0c, 0x03, 0x02, 0x00, 0x02, 0x00, 0x01,
+ 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00};
+ public static readonly byte[] radio2_bits = // DarkDark
+ {0x00, 0x00, 0xf0, 0x00, 0x0c, 0x03, 0x04, 0x00, 0x02,
+ 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ public static readonly byte[] radio3_bits = // LightLight
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00,
+ 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x00, 0x04,
+ 0x00, 0x04, 0x0c, 0x03, 0xf0, 0x00};
+ public static readonly byte[] radio4_bits = // Light
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02,
+ 0x0c, 0x03, 0xf0, 0x00, 0x00, 0x00};
+ public static readonly byte[] radio5_bits = // Inside
background
+ {0x00, 0xf0, 0x00, 0xf0, 0xf0, 0xf0, 0xf8, 0xf1, 0xfc,
+ 0xf3, 0xfc, 0xf3, 0xfc, 0xf3, 0xfc, 0xf3, 0xf8, 0xf1,
+ 0xf0, 0xf0, 0x00, 0xf0, 0x00, 0xf0};
+
+ // The various components of a flat radio button's border.
+ public static readonly byte[] rflat1_bits = // Border
+ {0xf0, 0x00, 0x0c, 0x03, 0x02, 0x04, 0x02, 0x04, 0x01,
+ 0x08, 0x01, 0x08, 0x01, 0x08, 0x01, 0x08, 0x02, 0x04,
+ 0x02, 0x04, 0x0c, 0x03, 0xf0, 0x00};
+ public static readonly byte[] rflat2_bits = // Inside
background
+ {0x00, 0xf0, 0xf0, 0xf0, 0xfc, 0xf3, 0xfc, 0xf3, 0xfe,
+ 0xf7, 0xfe, 0xf7, 0xfe, 0xf7, 0xfe, 0xf7, 0xfc, 0xf3,
+ 0xfc, 0xf3, 0xf0, 0xf0, 0x00, 0xf0};
+
+ // The bullet to draw on the inside of a radio button when selected.
+ public static readonly byte[] radio_bullet_bits =
+ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60,
+ 0x00, 0xf0, 0x00, 0xf0, 0x00, 0x60, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
}; // class Glyphs
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs, 1.25, 1.26 Glyphs.cs, 1.3, 1.4,
Rhys Weatherley <address@hidden> <=