[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms ContextMenu.cs, 1.4,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms ContextMenu.cs, 1.4, 1.5 Menu.cs, 1.5, 1.6 |
Date: |
Thu, 20 Nov 2003 23:31:18 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv2135/System.Windows.Forms
Modified Files:
ContextMenu.cs Menu.cs
Log Message:
Improve the look of menus and hide definitions that should not
be in the public API.
Index: ContextMenu.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/ContextMenu.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ContextMenu.cs 16 Nov 2003 14:58:55 -0000 1.4
--- ContextMenu.cs 20 Nov 2003 23:31:14 -0000 1.5
***************
*** 24,27 ****
--- 24,28 ----
using System.Drawing;
+ using System.Windows.Forms.Themes;
public class ContextMenu : Menu
***************
*** 112,122 ****
}
! private void popupControl_Paint(Object sender, PaintEventArgs e)
! {
! Graphics g = e.Graphics;
! g.DrawRectangle(BorderPen, 0, 0,
popupControl.Width - 1, popupControl.Height - 1);
// Draw the menu items
for (int i = 0; i < MenuItems.Count; i++)
! DrawMenuItem(g, i, false);
}
--- 113,127 ----
}
! private void popupControl_Paint(Object sender, PaintEventArgs e)
! {
! Graphics g = e.Graphics;
! Rectangle rect = popupControl.ClientRectangle;
! ThemeManager.MainPainter.DrawButton
! (g, rect.X, rect.Y, rect.Width,
rect.Height,
! ButtonState.Normal,
SystemColors.MenuText,
! SystemColors.Menu, false);
// Draw the menu items
for (int i = 0; i < MenuItems.Count; i++)
! DrawMenuItem(g, i, false);
}
***************
*** 280,284 ****
}
popupControl.Hide();
! }
}; // class ContextMenu
--- 285,289 ----
}
popupControl.Hide();
! }
}; // class ContextMenu
Index: Menu.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Menu.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Menu.cs 8 Nov 2003 00:20:27 -0000 1.5
--- Menu.cs 20 Nov 2003 23:31:14 -0000 1.6
***************
*** 25,28 ****
--- 25,29 ----
using System.Collections;
using System.Drawing;
+ using System.Windows.Forms.Themes;
public abstract class Menu
***************
*** 36,43 ****
private MenuItemCollection items;
private int suppressUpdates;
- // The bounds of each item
protected Rectangle[] itemBounds;
- private static Brush backBrush, foreBrush, highlightBrush,
highlightTextBrush;
- private static Pen seperatorPen, borderPen;
private StringFormat format;
--- 37,41 ----
***************
*** 190,194 ****
// Offset from each item to the menu text.
! protected virtual Point ItemPaddingOrigin
{
get
--- 188,192 ----
// Offset from each item to the menu text.
! internal virtual Point ItemPaddingOrigin
{
get
***************
*** 199,203 ****
// How much bigger each item is than the text.
! protected Size ItemPaddingSize
{
get
--- 197,201 ----
// How much bigger each item is than the text.
! internal Size ItemPaddingSize
{
get
***************
*** 208,212 ****
// Padding offset from top left of menu.
! protected virtual Point MenuPaddingOrigin
{
get
--- 206,210 ----
// Padding offset from top left of menu.
! internal virtual Point MenuPaddingOrigin
{
get
***************
*** 217,221 ****
// How much bigger the menu is than the text.
! protected Size MenuPaddingSize
{
get
--- 215,219 ----
// How much bigger the menu is than the text.
! internal Size MenuPaddingSize
{
get
***************
*** 225,229 ****
}
! protected void DrawMenuItem(Graphics g, int item, bool highlighted)
{
Rectangle bounds = itemBounds[item];
--- 223,227 ----
}
! internal void DrawMenuItem(Graphics g, int item, bool highlighted)
{
Rectangle bounds = itemBounds[item];
***************
*** 238,243 ****
if (menuItem.Text == "-")
{
! g.FillRectangle(BackBrush, bounds);
! g.DrawLine(SeperatorPen, bounds.X + 3,
bounds.Y + 2, bounds.Right - 6, bounds.Y + 2);
}
else
--- 236,241 ----
if (menuItem.Text == "-")
{
! g.FillRectangle(SystemBrushes.Menu,
bounds);
!
ThemeManager.MainPainter.DrawSeparator(g, bounds);
}
else
***************
*** 250,259 ****
else
{
! Brush fore = ForeBrush;
! Brush back = BackBrush;
if (highlighted)
{
! fore =
HighlightTextBrush;
! back = HighlightBrush;
}
g.FillRectangle(back, bounds);
--- 248,261 ----
else
{
! Brush fore, back;
if (highlighted)
{
! fore =
SystemBrushes.HighlightText;
! back =
SystemBrushes.Highlight;
! }
! else
! {
! fore =
SystemBrushes.MenuText;
! back =
SystemBrushes.Menu;
}
g.FillRectangle(back, bounds);
***************
*** 270,274 ****
}
! protected int ItemFromPoint(Point p)
{
if (itemBounds == null)
--- 272,276 ----
}
! internal int ItemFromPoint(Point p)
{
if (itemBounds == null)
***************
*** 283,348 ****
- protected Brush BackBrush
- {
- get
- {
- if (backBrush == null)
- backBrush = new SolidBrush(SystemColors.Menu);
- return backBrush;
- }
- }
-
- protected Brush ForeBrush
- {
- get
- {
- if (foreBrush == null)
- foreBrush = new
SolidBrush(SystemColors.MenuText);
- return foreBrush;
- }
- }
-
- protected Pen SeperatorPen
- {
- get
- {
- if (seperatorPen == null)
- // TODO: Which system color?
- seperatorPen = new
Pen(SystemColors.ControlLightLight);
- return seperatorPen;
- }
- }
-
- protected Pen BorderPen
- {
- get
- {
- if (borderPen == null)
- // TODO: Which system color;
- borderPen = new Pen(SystemColors.MenuText);
- return borderPen;
- }
- }
-
- protected Brush HighlightBrush
- {
- get
- {
- if (highlightBrush == null)
- highlightBrush = new
SolidBrush(SystemColors.Highlight);
- return highlightBrush;
- }
- }
-
- protected Brush HighlightTextBrush
- {
- get
- {
- if (highlightTextBrush == null)
- highlightTextBrush = new
SolidBrush(SystemColors.HighlightText);
- return highlightTextBrush;
- }
- }
-
// Collection of menu items.
public class MenuItemCollection : IList
--- 285,288 ----
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms ContextMenu.cs, 1.4, 1.5 Menu.cs, 1.5, 1.6,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs, 1.19, 1.20 IThemePainter.cs, 1.8, 1.9
- Next by Date:
[Dotgnu-pnet-commits] pnetlib ChangeLog,1.1486,1.1487
- Previous by thread:
[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs, 1.19, 1.20 IThemePainter.cs, 1.8, 1.9
- Next by thread:
[Dotgnu-pnet-commits] pnetlib ChangeLog,1.1486,1.1487
- Index(es):