dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes Glyphs.cs, NO


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms/Themes Glyphs.cs, NONE, 1.1 DefaultThemePainter.cs, 1.18, 1.19
Date: Thu, 20 Nov 2003 10:25:22 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes
In directory subversions:/tmp/cvs-serv11067/System.Windows.Forms/Themes

Modified Files:
        DefaultThemePainter.cs 
Added Files:
        Glyphs.cs 
Log Message:


Implement "DefaultThemePainter.DrawMenuGlyph".


Index: DefaultThemePainter.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Themes/DefaultThemePainter.cs,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** DefaultThemePainter.cs      20 Nov 2003 00:53:52 -0000      1.18
--- DefaultThemePainter.cs      20 Nov 2003 10:25:19 -0000      1.19
***************
*** 26,29 ****
--- 26,30 ----
  using System.Drawing;
  using System.Drawing.Drawing2D;
+ using System.Drawing.Toolkit;
  using System.Windows.Forms;
  
***************
*** 41,44 ****
--- 42,56 ----
        protected Brush gridBrush = null;
  
+       // Draw a simple bitmap-based glyph within a rectangle.
+       private static void DrawGlyph
+                               (Graphics graphics, int x, int y, int width, 
int height,
+                                byte[] bits, int bitsWidth, int bitsHeight, 
Color color)
+                       {
+                               x += (width - bitsWidth) / 2;
+                               y += (height - bitsHeight) / 2;
+                               ToolkitManager.DrawGlyph
+                                       (graphics, x, y, bits, bitsWidth, 
bitsHeight, color);
+                       }
+ 
        // Get the width of the specified border type
        public virtual int GetBorderWidth(BorderStyle border)
***************
*** 1320,1329 ****
  
        // Draw a menu glyph.
-       [TODO]
        public virtual void DrawMenuGlyph
                                (Graphics graphics, int x, int y, int width,
                                 int height, MenuGlyph glyph)
                        {
!                               // TODO
                        }
  
--- 1332,1371 ----
  
        // Draw a menu glyph.
        public virtual void DrawMenuGlyph
                                (Graphics graphics, int x, int y, int width,
                                 int height, MenuGlyph glyph)
                        {
!                               switch(glyph)
!                               {
!                                       case MenuGlyph.Arrow:
!                                       {
!                                               DrawGlyph(graphics, x, y, 
width, height,
!                                                                 
Glyphs.menu_arrow_bits,
!                                                                 
Glyphs.menu_arrow_width,
!                                                                 
Glyphs.menu_arrow_height,
!                                                                 
SystemColors.MenuText);
!                                       }
!                                       break;
! 
!                                       case MenuGlyph.Checkmark:
!                                       {
!                                               DrawGlyph(graphics, x, y, 
width, height,
!                                                                 
Glyphs.menu_checkmark_bits,
!                                                                 
Glyphs.menu_checkmark_width,
!                                                                 
Glyphs.menu_checkmark_height,
!                                                                 
SystemColors.MenuText);
!                                       }
!                                       break;
! 
!                                       case MenuGlyph.Bullet:
!                                       {
!                                               DrawGlyph(graphics, x, y, 
width, height,
!                                                                 
Glyphs.menu_bullet_bits,
!                                                                 
Glyphs.menu_bullet_width,
!                                                                 
Glyphs.menu_bullet_height,
!                                                                 
SystemColors.MenuText);
!                                       }
!                                       break;
!                               }
                        }
  

--- NEW FILE: Glyphs.cs ---
/*
 * Glyphs.cs - Implementation of the
 *                      "System.Windows.Forms.Themes.Glyphs" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Windows.Forms.Themes
{

// This class contains a number of bitmap glyphs for drawing
// things like checkmarks, close boxes, scroll arrows, etc.
// All of these are in the form of an xbm.

internal class Glyphs
{
        // Arrow that indicates a submenu.
        public const int menu_arrow_width = 4;
        public const int menu_arrow_height = 7;
        public static readonly byte[] menu_arrow_bits =
                {0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01};

        // Checkmark within a menu.
        public const int menu_checkmark_width = 7;
        public const int menu_checkmark_height = 7;
        public static readonly byte[] menu_checkmark_bits =
                {0x40, 0x60, 0x71, 0x3b, 0x1f, 0x0e, 0x04};

        // Bullet within a menu.
        public const int menu_bullet_width = 7;
        public const int menu_bullet_height = 7;
        public static readonly byte[] menu_bullet_bits =
                {0x1c, 0x3e, 0x7f, 0x7f, 0x7f, 0x3e, 0x1c};

        // Left scroll bar arrow.
        public const int left_arrow_width = 4;
        public const int left_arrow_height = 7;
        public static readonly byte[] left_arrow_bits =
                {0x08, 0x0c, 0x0e, 0x0f, 0x0e, 0x0c, 0x08};

        // Right scroll bar arrow.
        public const int right_arrow_width = 4;
        public const int right_arrow_height = 7;
        public static readonly byte[] right_arrow_bits =
                {0x01, 0x03, 0x07, 0x0f, 0x07, 0x03, 0x01};

        // Up scroll bar arrow.
        public const int up_arrow_width = 7;
        public const int up_arrow_height = 4;
        public static readonly byte[] up_arrow_bits =
                {0x08, 0x1c, 0x3e, 0x7f};

        // Down scroll bar arrow.
        public const int down_arrow_width = 7;
        public const int down_arrow_height = 4;
        public static readonly byte[] down_arrow_bits =
                {0x7f, 0x3e, 0x1c, 0x08};

        // Combo box drop down arrow.
        public const int drop_down_arrow_width = 7;
        public const int drop_down_arrow_height = 4;
        public static readonly byte[] drop_down_arrow_bits =
                {0x7f, 0x3e, 0x1c, 0x08};

}; // class Glyphs

}; // namespace System.Windows.Forms.Themes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]