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

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

[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms/Themes DefaultTh


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms/Themes DefaultThemePainter.cs,NONE,1.1 IThemePainter.cs,NONE,1.1 Makefile,NONE,1.1 ThemeManager.cs,NONE,1.1
Date: Mon, 07 Jul 2003 00:58:52 -0400

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

Added Files:
        DefaultThemePainter.cs IThemePainter.cs Makefile 
        ThemeManager.cs 
Log Message:


Shift the theme handling into the "System.Windows.Forms.Themes" namespace.


--- NEW FILE ---
/*
 * DefaultThemePainter.cs - Implementation of the
 *                      "System.Windows.Forms.Themes.DefaultThemePainter" 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
[...1146 lines suppressed...]
                                SolidBrush brush = new 
SolidBrush(ControlPaint.Light(color));
                                layoutRectangle.Offset(1.0f, 1.0f);
                                graphics.DrawString(s, font, brush, 
layoutRectangle, format);
                                brush.Color = ControlPaint.Dark(color);
                                layoutRectangle.Offset(-1.0f, -1.0f);
                                graphics.DrawString(s, font, brush, 
layoutRectangle, format);
                                brush.Dispose();
                        }

        // Draw a filled reversible rectangle.
        [TODO]
        public virtual void FillReversibleRectangle
                                (Rectangle rectangle, Color backColor)
                        {
                                // TODO
                        }

}; // class DefaultThemePainter

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

--- NEW FILE ---
/*
 * IThemePainter.cs - Implementation of the
 *                      "System.Windows.Forms.Themes.IThemePainter" 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
{

using System.Drawing;
using System.Drawing.Drawing2D;

internal interface IThemePainter
{
        // Draw a simple button border.
        void DrawBorder(Graphics graphics, Rectangle bounds,
                                        Color color, ButtonBorderStyle style);
        void DrawBorder(Graphics graphics, Rectangle bounds, Color leftColor,
                                int leftWidth, ButtonBorderStyle leftStyle, 
Color topColor,
                                    int topWidth, ButtonBorderStyle topStyle, 
Color rightColor,
                                    int rightWidth, ButtonBorderStyle 
rightStyle,
                                    Color bottomColor, int bottomWidth,
                                    ButtonBorderStyle bottomStyle);

        // Draw a 3D border within a rectangle.
        void DrawBorder3D(Graphics graphics, int x, int y,
                                          int width, int height,
                                          Color foreColor,
                                          Color backColor,
                                          Border3DStyle style,
                                          Border3DSide sides);

        // Draw a button control.
        void DrawButton(Graphics graphics, int x, int y, int width, int height,
                                    ButtonState state, Color foreColor, Color 
backColor,
                                    bool isDefault);

        // Draw a caption button control.
        void DrawCaptionButton
                                (Graphics graphics, int x, int y, int width, 
int height,
                                 CaptionButton button, ButtonState state);

        // Draw a progress bar control.
        void DrawProgressBar(Graphics graphics, int x, int y,
                                                 int width, int height, 
                                                 int steps, int step,
                                                 int value, bool enabled);

        // Draw a progress bar block.
        void DrawBlock(Graphics graphics, int x, int y,
                                  int width, int height, Color color);

        // Draw a check box control.
        void DrawCheckBox(Graphics graphics, int x, int y,
                                      int width, int height, ButtonState state);

        // Draw a combo box's drop down button control.
        void DrawComboButton(Graphics graphics, int x, int y,
                                         int width, int height, ButtonState 
state);

        // Draw a container grab handle.
        void DrawContainerGrabHandle(Graphics graphics, Rectangle rectangle);

        // Draw a focus rectangle.
        void DrawFocusRectangle(Graphics graphics, Rectangle rectangle,
                                                        Color foreColor, Color 
backColor);

        // Draw a grab handle.
        void DrawGrabHandle(Graphics graphics, Rectangle rectangle,
                                                bool primary, bool enabled);

        // Draw a grid of dots.
        void DrawGrid(Graphics graphics, Rectangle area,
                                  Size pixelsBetweenDots, Color backColor);

        // Draw an image in its disabled state.
        void DrawImageDisabled(Graphics graphics, Image image,
                                                   int x, int y, Color 
background);

        // Draw a locked selection frame.
        void DrawLockedFrame(Graphics graphics, Rectangle rectangle, bool 
primary);

        // Draw a menu glyph.
        void DrawMenuGlyph(Graphics graphics, int x, int y, int width,
                                           int height, MenuGlyph glyph);

        // Draw a three-state check box control.
        void DrawMixedCheckBox(Graphics graphics, int x, int y, int width,
                                                   int height, ButtonState 
state);

        // Draw a radio button control.
        void DrawRadioButton(Graphics graphics, int x, int y, int width,
                                                 int height, ButtonState state);

        // Draw a reversible frame.
        void DrawReversibleFrame
                                (Rectangle rectangle, Color backColor, 
FrameStyle style);

        // Draw a reversible line.
        void DrawReversibleLine(Point start, Point end, Color backColor);

        // Draw a scroll button control.
        void DrawScrollButton
                                (Graphics graphics, int x, int y, int width, 
int height,
                                 ScrollButton button, ButtonState state);

        // Draw a selection frame.
        void DrawSelectionFrame
                                (Graphics graphics, bool active, Rectangle 
outsideRect,
                                 Rectangle insideRect, Color backColor);

        // Draw a size grip.
        void DrawSizeGrip(Graphics graphics, Color backColor,
                                          int x, int y, int width, int height);

        // Draw a disabled string.
        void DrawStringDisabled
                                (Graphics graphics, String s, Font font,
                             Color color, RectangleF layoutRectangle,
                                 StringFormat format);

        // Draw a filled reversible rectangle.
        void FillReversibleRectangle(Rectangle rectangle, Color backColor);

}; // class IThemePainter

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

--- NEW FILE ---

all:
        (cd ..; make)

clean:
        (cd ..; make clean)

--- NEW FILE ---
/*
 * ThemeManager.cs - Implementation of the
 *                      "System.Windows.Forms.Themes.ThemeManager" 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
{

internal sealed class ThemeManager
{
        // Internal state.
        private static IThemePainter mainPainter;
        private static IThemePainter systemPainter;

        // Initialize the theme painters.
        static ThemeManager()
                        {
                                mainPainter = new DefaultThemePainter();
                                systemPainter = mainPainter;
                        }

        // Get the main .NET theme painter.
        public static IThemePainter MainPainter
                        {
                                get
                                {
                                        return mainPainter;
                                }
                        }

        // Get the system theme painter, which will usually be the same
        // as the main painter, but may differ in some themes.
        public static IThemePainter SystemPainter
                        {
                                get
                                {
                                        return systemPainter;
                                }
                        }

        // Get the painter for a particular flat style.
        public static IThemePainter PainterForStyle(FlatStyle style)
                        {
                                if(style == FlatStyle.System)
                                {
                                        return SystemPainter;
                                }
                                else
                                {
                                        return MainPainter;
                                }
                        }

}; // class ThemeManager

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





reply via email to

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