[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp .cvsignore,NON
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp .cvsignore,NONE,1.1 DrawingFont.cs,NONE,1.1 DrawingGraphics.cs,NONE,1.1 DrawingHatchBrush.cs,NONE,1.1 DrawingPen.cs,NONE,1.1 DrawingSolidBrush.cs,NONE,1.1 DrawingToolkit.cs,NONE,1.1 DrawingTopLevelWindow.cs,NONE,1.1 DrawingWindow.cs,NONE,1.1 Makefile.am,NONE,1.1 System.Drawing.Xsharp.build,NONE,1.1 |
Date: |
Sat, 07 Jun 2003 18:41:01 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing.Xsharp
In directory subversions:/tmp/cvs-serv12618/System.Drawing.Xsharp
Added Files:
.cvsignore DrawingFont.cs DrawingGraphics.cs
DrawingHatchBrush.cs DrawingPen.cs DrawingSolidBrush.cs
DrawingToolkit.cs DrawingTopLevelWindow.cs DrawingWindow.cs
Makefile.am System.Drawing.Xsharp.build
Log Message:
Add the "System.Drawing" and "System.Drawing.Xsharp" assemblies.
--- NEW FILE ---
Makefile
Makefile.in
.deps
*.dll
--- NEW FILE ---
/*
* DrawingFont.cs - Implementation of fonts for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingFont : IToolkitFont
{
// Internal state.
private System.Drawing.Font properties;
// Constructor.
public DrawingFont(System.Drawing.Font properties)
{
this.properties = properties;
}
// Select this font into a graphics object.
public void Select(IToolkitGraphics _graphics)
{
DrawingGraphics graphics = (_graphics as
DrawingGraphics);
if(graphics != null)
{
// TODO
}
}
// Dispose of this pen.
public void Dispose()
{
// Nothing to do here in this implementation.
}
}; // class DrawingFont
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* DrawingGraphics.cs - Implementation of graphics drawing for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingGraphics : ToolkitGraphicsBase
{
// Internal state.
internal Xsharp.Graphics graphics;
// Constructor.
public DrawingGraphics(IToolkit toolkit, Xsharp.Graphics graphics)
: base(toolkit)
{
this.graphics = graphics;
}
// Dispose of this object.
public override void Dispose()
{
if(graphics != null)
{
graphics.Dispose();
graphics = null;
}
}
// Clear the entire drawing surface.
public override void Clear()
{
graphics.Clear();
}
// Draw a line between two points using the current pen.
public override void DrawLine(int x1, int y1, int x2, int y2)
{
graphics.DrawLine(x1, y1, x2, y2);
}
// Convert an array of "System.Drawing.Point" objects into an array of
// "Xsharp.Point" objects.
private static Xsharp.Point[] ConvertPoints
(System.Drawing.Point[] points, bool dupFirst)
{
Xsharp.Point[] newPoints;
if(dupFirst)
{
newPoints = new Xsharp.Point
[points.Length + 1];
}
else
{
newPoints = new Xsharp.Point
[points.Length];
}
int posn;
for(posn = 0; posn < points.Length; ++posn)
{
newPoints[posn].x = points[posn].X;
newPoints[posn].y = points[posn].Y;
}
if(dupFirst)
{
newPoints[points.Length] = newPoints[0];
}
return newPoints;
}
// Draw a set of connected line seguments using the current pen.
public override void DrawLines(System.Drawing.Point[] points)
{
graphics.DrawLines(ConvertPoints(points,
false));
}
// Draw a polygon using the current pen.
public override void DrawPolygon(System.Drawing.Point[] points)
{
graphics.DrawLines(ConvertPoints(points, true));
}
// Fill a polygon using the current brush.
public override void FillPolygon
(System.Drawing.Point[] points, FillMode
fillMode)
{
if(fillMode == FillMode.Alternate)
{
graphics.FillRule =
FillRule.EvenOddRule;
}
else
{
graphics.FillRule =
FillRule.WindingRule;
}
graphics.FillPolygon(ConvertPoints(points,
false));
}
// Draw an arc within a rectangle defined by four points.
public override void DrawArc
(System.Drawing.Point[] rect,
float startAngle, float sweepAngle)
{
// Slight bug: this won't work for rotated arcs.
int width = rect[1].X - rect[0].X;
int height = rect[2].Y - rect[0].Y;
graphics.DrawArc(rect[0].X, rect[0].Y, width,
height,
startAngle,
sweepAngle);
}
// Draw a pie slice within a rectangle defined by four points.
public override void DrawPie
(System.Drawing.Point[] rect,
float startAngle, float sweepAngle)
{
// Slight bug: this won't work for rotated arcs.
int width = rect[1].X - rect[0].X;
int height = rect[2].Y - rect[0].Y;
graphics.DrawPie(rect[0].X, rect[0].Y, width,
height,
startAngle,
sweepAngle);
}
// Fill a pie slice within a rectangle defined by four points.
public override void FillPie
(System.Drawing.Point[] rect,
float startAngle, float sweepAngle)
{
// Slight bug: this won't work for rotated arcs.
int width = rect[1].X - rect[0].X;
int height = rect[2].Y - rect[0].Y;
graphics.ArcMode = ArcMode.ArcPieSlice;
graphics.FillArc(rect[0].X, rect[0].Y, width,
height,
startAngle,
sweepAngle);
}
// Flush the graphics subsystem
public override void Flush(FlushIntention intention)
{
if(intention == FlushIntention.Flush)
{
((DrawingToolkit)Toolkit).app.Display.Flush();
}
else
{
((DrawingToolkit)Toolkit).app.Display.Sync();
}
}
// Get the HDC associated with this graphics object.
public override IntPtr GetHdc()
{
// We don't use HDC's in this implementation.
return IntPtr.Zero;
}
// Release a HDC that was obtained using "GetHdc()".
public override void ReleaseHdc(IntPtr hdc)
{
// We don't use HDC's in this implementation.
}
// Set the clipping region to empty.
public override void SetClipEmpty()
{
// TODO
}
// Set the clipping region to infinite (i.e. disable clipping).
public override void SetClipInfinite()
{
// TODO
}
// Set the clipping region to a single rectangle.
public override void SetClipRect(int x, int y, int width, int height)
{
// TODO
}
// Set the clipping region to a list of rectangles.
public override void SetClipRects(System.Drawing.Rectangle[] rects)
{
// TODO
}
// Set the clipping region to a complex mask.
public override void SetClipMask(Object mask, int topx, int topy)
{
// TODO
}
}; // class DrawingGraphics
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* DrawingHatchBrush.cs - Implementation of hatch brushes for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingHatchBrush : IToolkitBrush
{
// Internal state.
private HatchStyle style;
private System.Drawing.Color foreColor;
private System.Drawing.Color backColor;
// Constructor.
public DrawingHatchBrush(HatchStyle style,
System.Drawing.Color
foreColor,
System.Drawing.Color
backColor)
{
this.style = style;
this.foreColor = foreColor;
this.backColor = backColor;
}
// Select this brush into a graphics object.
public void Select(IToolkitGraphics _graphics)
{
DrawingGraphics graphics = (_graphics as
DrawingGraphics);
if(graphics != null)
{
// TODO
}
}
// Dispose of this brush.
public void Dispose()
{
// Nothing to do here in this implementation.
}
}; // class DrawingHatchBrush
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* DrawingPen.cs - Implementation of pens for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingPen : IToolkitPen
{
// Internal state.
private Pen properties;
// Constructor.
public DrawingPen(Pen properties)
{
this.properties = properties;
}
// Map the line style from "System.Drawing" to "Xsharp".
private static LineStyle MapLineStyle(DashStyle style)
{
switch(style)
{
// TODO: dashed lines
case DashStyle.Solid:
case DashStyle.Dash:
case DashStyle.Dot:
case DashStyle.DashDot:
case DashStyle.DashDotDot:
case DashStyle.Custom:
default:
return LineStyle.LineSolid;
}
}
// Map the cap style from "System.Drawing" to "Xsharp".
private static CapStyle MapCapStyle(DashCap style)
{
switch(style)
{
case DashCap.Flat:
case DashCap.Triangle:
default:
return CapStyle.CapButt;
case DashCap.Round:
return CapStyle.CapRound;
}
}
// Map the join style from "System.Drawing" to "Xsharp".
private static JoinStyle MapJoinStyle(LineJoin style)
{
switch(style)
{
case LineJoin.Miter:
case LineJoin.MiterClipped:
default:
return JoinStyle.JoinMiter;
case LineJoin.Bevel:
return JoinStyle.JoinBevel;
case LineJoin.Round:
return JoinStyle.JoinRound;
}
}
// Select this pen into a graphics object.
public void Select(IToolkitGraphics _graphics)
{
DrawingGraphics graphics = (_graphics as
DrawingGraphics);
if(graphics != null)
{
Xsharp.Graphics g = graphics.graphics;
g.LineWidth = (int)(properties.Width);
g.LineStyle =
MapLineStyle(properties.DashStyle);
g.CapStyle =
MapCapStyle(properties.DashCap);
g.JoinStyle =
MapJoinStyle(properties.LineJoin);
g.Foreground =
DrawingToolkit.DrawingToXColor
(properties.Color);
// TODO: dashed line patterns
}
}
// Dispose of this pen.
public void Dispose()
{
// Nothing to do here in this implementation.
}
}; // class DrawingPen
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* DrawingSolidBrush.cs - Implementation of solid brushes for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingSolidBrush : IToolkitBrush
{
// Internal state.
private System.Drawing.Color color;
// Constructor.
public DrawingSolidBrush(System.Drawing.Color color)
{
this.color = color;
}
// Select this brush into a graphics object.
public void Select(IToolkitGraphics _graphics)
{
DrawingGraphics graphics = (_graphics as
DrawingGraphics);
if(graphics != null)
{
Xsharp.Graphics g = graphics.graphics;
g.SetFillSolid();
g.Foreground =
DrawingToolkit.DrawingToXColor(color);
}
}
// Dispose of this brush.
public void Dispose()
{
// Nothing to do here in this implementation.
}
}; // class DrawingSolidBrush
}; // namespace System.Drawing.Toolkit;
--- NEW FILE ---
/*
* DrawingToolkit.cs - Implementation of IToolkit for Xsharp.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
public sealed class DrawingToolkit : IToolkit
{
// Internal state.
internal Application app;
internal Widget placeholder;
// Constructor.
public DrawingToolkit()
{
// Create an Xsharp application instance.
app = new Xsharp.Application(null, null);
// Get the placeholder widget for the screen.
placeholder =
app.Display.DefaultScreenOfDisplay.Placeholder;
}
// Run the main event processing loop for the toolkit.
public void Run()
{
app.Run();
}
// Send a quit message to the toolkit, which should cause
// it to exit from the "Run" method.
public void Quit()
{
app.Display.Quit();
}
// Resolve a system color to an RGB value. Returns -1 if the
// system does not support the color and a default should be used.
public int ResolveSystemColor(KnownColor color)
{
return -1;
}
// Create an IToolkitGraphics object from a HDC.
public IToolkitGraphics CreateFromHdc(IntPtr hdc, IntPtr hdevice)
{
// We don't use HDC's in this implementation.
return null;
}
// Create an IToolkitGraphics object from a HWND.
public IToolkitGraphics CreateFromHwnd(IntPtr hwnd)
{
// We don't use HWND's in this implementation.
return null;
}
// Create a solid toolkit brush.
public IToolkitBrush CreateSolidBrush(System.Drawing.Color color)
{
return new DrawingSolidBrush(color);
}
// Create a hatched toolkit brush.
public IToolkitBrush CreateHatchBrush
(HatchStyle style, System.Drawing.Color
foreColor,
System.Drawing.Color backColor)
{
return new DrawingHatchBrush(style, foreColor,
backColor);
}
// Create a linear gradient brush. Returns null if the
// toolkit does not support linear gradient brushes.
public IToolkitBrush CreateLinearGradientBrush
(RectangleF rect, System.Drawing.Color color1,
System.Drawing.Color color2,
LinearGradientMode mode)
{
return null;
}
public IToolkitBrush CreateLinearGradientBrush
(RectangleF rect, System.Drawing.Color color1,
System.Drawing.Color color2, float angle,
bool isAngleScaleable)
{
return null;
}
// Create a toolkit pen from the properties in the specified object.
// If the toolkit does not support the precise combination of pen
// properties, it will return the closest matching pen.
public IToolkitPen CreatePen(Pen pen)
{
return new DrawingPen(pen);
}
// Create a toolkit font from the properties in the specified object.
public IToolkitFont CreateFont(System.Drawing.Font font)
{
// TODO
return null;
}
// Get the handle for the halftone palette. IntPtr.Zero if not
supported.
public IntPtr GetHalftonePalette()
{
return IntPtr.Zero;
}
// Create a top-level application window.
public IToolkitWindow CreateTopLevelWindow(int width, int height)
{
return new DrawingTopLevelWindow
(this, String.Empty, width, height);
}
// Create a top-level dialog shell.
public IToolkitWindow CreateTopLevelDialog
(int width, int height, bool modal, bool
resizable,
IToolkitWindow dialogParent)
{
DrawingTopLevelWindow window;
window = new DrawingTopLevelWindow
(this, String.Empty, width, height);
if(dialogParent is TopLevelWindow)
{
window.TransientFor =
(TopLevelWindow)dialogParent;
}
if(modal)
{
window.InputType =
MotifInputType.ApplicationModal;
}
else
{
window.InputType =
MotifInputType.Modeless;
}
if(!resizable)
{
window.Decorations =
MotifDecorations.Border |
MotifDecorations.Title |
MotifDecorations.Menu;
window.Functions = MotifFunctions.Move |
MotifFunctions.Close;
}
return window;
}
// Create a top-level menu shell.
public IToolkitWindow CreateTopLevelMenu
(int x, int y, int width, int height)
{
// TODO
return null;
}
// Create a child window. If "parent" is null, then the child
// does not yet have a "real" parent - it will be reparented later.
public IToolkitWindow CreateChildWindow
(IToolkitWindow parent, int x, int y, int
width, int height)
{
Widget wparent;
if(parent is Widget)
{
wparent = ((Widget)parent);
}
else
{
wparent = placeholder;
}
return new DrawingWindow(this, wparent, x, y,
width, height);
}
// Map a System.Drawing color into an Xsharp color.
public static Xsharp.Color DrawingToXColor(System.Drawing.Color color)
{
int argb = color.ToArgb();
return new Xsharp.Color((argb >> 16) & 0xFF,
(argb >> 8) & 0xFF, argb & 0xFF);
}
}; // class DrawingToolkit
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* DrawingTopLevelWindow.cs - Implementation of windows for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingTopLevelWindow : TopLevelWindow, IToolkitWindow
{
// Internal state.
private IToolkit toolkit;
// Constructor.
public DrawingTopLevelWindow(IToolkit toolkit, String name,
int width, int
height)
: base(name, width, height)
{
this.toolkit = toolkit;
this.AutoMapChildren = false;
}
// Get the toolkit that owns this window.
public IToolkit Toolkit
{
get
{
return toolkit;
}
}
// Get the current dimensions of this window.
public System.Drawing.Rectangle Dimensions
{
get
{
return new System.Drawing.Rectangle(X,
Y, Width, Height);
}
}
// Get or set the mapped state of the window.
bool IToolkitWindow.IsMapped
{
get
{
return IsMapped;
}
set
{
IsMapped = value;
}
}
// Destroy this window and all of its children.
void IToolkitWindow.Destroy()
{
Destroy();
}
// Move or resize this window.
void IToolkitWindow.MoveResize(int x, int y, int width, int height)
{
Move(x, y);
Resize(width, height);
}
// Raise this window respective to its siblings.
void IToolkitWindow.Raise()
{
Raise();
}
// Lower this window respective to its siblings.
void IToolkitWindow.Lower()
{
Lower();
}
// Iconify the window.
void IToolkitWindow.Iconify()
{
Iconify();
}
// Reparent this window to underneath a new parent.
void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
{
// TODO
}
// Get a toolkit graphics object for this window.
IToolkitGraphics IToolkitWindow.GetGraphics()
{
return new DrawingGraphics
(toolkit, new Xsharp.Graphics(this));
}
// Set the window title (top-level windows only).
void IToolkitWindow.SetTitle(String title)
{
if(title == null)
{
title = String.Empty;
}
Name = title;
}
// Set the background of the window to a solid color.
void IToolkitWindow.SetBackground(System.Drawing.Color color)
{
Background =
DrawingToolkit.DrawingToXColor(color);
}
// Change the set of supported decorations and functions.
void IToolkitWindow.SetFunctions(ToolkitDecorations decorations,
ToolkitFunctions functions)
{
// TODO
}
// Handle a paint event from Xsharp.
protected override void OnPaint(Xsharp.Graphics graphics)
{
if(Expose != null)
{
DrawingGraphics g = new
DrawingGraphics(toolkit, graphics);
System.Drawing.Graphics gr =
ToolkitManager.CreateGraphics(g);
Expose(gr);
gr.Dispose();
}
}
// Event that is emitted for an expose on this window.
public event ToolkitExposeHandler Expose;
}; // class DrawingTopLevelWindow
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* DrawingWindow.cs - Implementation of windows for System.Drawing.
*
* 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.Drawing.Toolkit
{
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Toolkit;
using Xsharp;
internal sealed class DrawingWindow : InputOutputWidget, IToolkitWindow
{
// Internal state.
private IToolkit toolkit;
// Constructor.
public DrawingWindow(IToolkit toolkit, Widget parent,
int x, int y, int width, int
height)
: base(parent, x, y, width, height)
{
this.toolkit = toolkit;
this.AutoMapChildren = false;
}
// Get the toolkit that owns this window.
public IToolkit Toolkit
{
get
{
return toolkit;
}
}
// Get the current dimensions of this window.
public System.Drawing.Rectangle Dimensions
{
get
{
return new System.Drawing.Rectangle(X,
Y, Width, Height);
}
}
// Get or set the mapped state of the window.
bool IToolkitWindow.IsMapped
{
get
{
return IsMapped;
}
set
{
IsMapped = value;
}
}
// Destroy this window and all of its children.
void IToolkitWindow.Destroy()
{
Destroy();
}
// Move or resize this window.
void IToolkitWindow.MoveResize(int x, int y, int width, int height)
{
Move(x, y);
Resize(width, height);
}
// Raise this window respective to its siblings.
void IToolkitWindow.Raise()
{
Raise();
}
// Lower this window respective to its siblings.
void IToolkitWindow.Lower()
{
Lower();
}
// Iconify the window.
void IToolkitWindow.Iconify()
{
// Not used for ordinary windows.
}
// Reparent this window to underneath a new parent.
void IToolkitWindow.Reparent(IToolkitWindow parent, int x, int y)
{
// TODO
}
// Get a toolkit graphics object for this window.
IToolkitGraphics IToolkitWindow.GetGraphics()
{
return new DrawingGraphics
(toolkit, new Xsharp.Graphics(this));
}
// Set the window title (top-level windows only).
void IToolkitWindow.SetTitle(String title)
{
// Not used for ordinary windows.
}
// Set the background of the window to a solid color.
void IToolkitWindow.SetBackground(System.Drawing.Color color)
{
Background =
DrawingToolkit.DrawingToXColor(color);
}
// Change the set of supported decorations and functions.
void IToolkitWindow.SetFunctions(ToolkitDecorations decorations,
ToolkitFunctions functions)
{
// Not used for ordinary windows.
}
// Handle a paint event from Xsharp.
protected override void OnPaint(Xsharp.Graphics graphics)
{
if(Expose != null)
{
DrawingGraphics g = new
DrawingGraphics(toolkit, graphics);
System.Drawing.Graphics gr =
ToolkitManager.CreateGraphics(g);
Expose(gr);
gr.Dispose();
}
}
// Event that is emitted for an expose on this window.
public event ToolkitExposeHandler Expose;
}; // class DrawingWindow
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
.PHONY: System.Drawing.Xsharp.dll
all-local: System.Drawing.Xsharp.dll
System.Drawing.Xsharp.dll:
"$(CSANT)" $(CSANT_FLAGS) -f System.Drawing.Xsharp.build all
CLEANFILES = System.Drawing.Xsharp.dll
pnetassembliesdir = $(libdir)/cscc/lib
pnetassemblies_DATA = System.Drawing.Xsharp.dll
--- NEW FILE ---
<?xml version="1.0"?>
<project name="pnetlib System.Drawing.Xsharp" default="all">
<target name="all">
<!-- Build the primary System.Drawing.Xsharp.dll library -->
<compile output="System.Drawing.Xsharp.dll"
target="library"
unsafe="true"
nostdlib="true"
debug="${CONFIG_DEBUG_LINES}"
optimize="true">
<sources>
<includes name="**/*.cs"/>
</sources>
<references>
<file
name="../System.Drawing/System.Drawing.dll"/>
<file name="../Xsharp/Xsharp.dll"/>
<file name="../System/first/System.dll"/>
<file name="../DotGNU.SSL/DotGNU.SSL.dll"/>
<file name="../runtime/mscorlib.dll"/>
</references>
<arg compiler="cscc" value="-Wno-empty-input"/>
<arg compiler="cscc" value="-fminimize-parameters"/>
<arg compiler="csc" value="/nowarn:626"/>
<arg compiler="csc" value="/nowarn:649"/>
<arg compiler="csc" value="/nowarn:168"/>
<arg compiler="csc" value="/nowarn:67"/>
<arg compiler="csc" value="/nowarn:169"/>
<arg compiler="csc" value="/nowarn:679"/>
</compile>
</target>
</project>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp .cvsignore,NONE,1.1 DrawingFont.cs,NONE,1.1 DrawingGraphics.cs,NONE,1.1 DrawingHatchBrush.cs,NONE,1.1 DrawingPen.cs,NONE,1.1 DrawingSolidBrush.cs,NONE,1.1 DrawingToolkit.cs,NONE,1.1 DrawingTopLevelWindow.cs,NONE,1.1 DrawingWindow.cs,NONE,1.1 Makefile.am,NONE,1.1 System.Drawing.Xsharp.build,NONE,1.1,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Drawing2D AdjustableArrowCap.cs,NONE,1.1 CombineMode.cs,NONE,1.1 CompositingMode.cs,NONE,1.1 CompositingQuality.cs,NONE,1.1 CoordinateSpace.cs,NONE,1.1 CustomLineCap.cs,NONE,1.1 DashCap.cs,NONE,1.1 DashStyle.cs,NONE,1.1 FillMode.cs,NONE,1.1 FlushIntention.cs,NONE,1.1 GraphicsContainer.cs,NONE,1.1 GraphicsPath.cs,NONE,1.1 GraphicsState.cs,NONE,1.1 HatchBrush.cs,NONE,1.1 HatchStyle.cs,NONE,1.1 InterpolationMode.cs,NONE,1.1 LineCap.cs,NONE,1.1 LineJoin.cs,NONE,1.1 LinearGradientBrush.cs,NONE,1.1 LinearGradientMode.cs,NONE,1.1 Makefile,NONE,1.1 Matrix.cs,NONE,1.1 MatrixOrder.cs,NONE,1.1 PathData.cs,NONE,1.1 PathPointType.cs,NONE,1.1 PenAlignment.cs,NONE,1.1 PenType.cs,NONE,1.1 PixelOffsetMode.cs,NONE,1.1 QualityMode.cs,NONE,1.1 RegionData.cs,NONE,1.1 SmoothingMode.cs,NONE,1.1 WarpMode.cs,NONE,1.1 WrapMode.cs,NONE,1.1
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkit.cs,NONE,1.1 IToolkitBrush.cs,NONE,1.1 IToolkitFont.cs,NONE,1.1 IToolkitGraphics.cs,NONE,1.1 IToolkitPen.cs,NONE,1.1 IToolkitPrintSession.cs,NONE,1.1 IToolkitPrinter.cs,NONE,1.1 IToolkitPrintingSystem.cs,NONE,1.1 IToolkitSelectObject.cs,NONE,1.1 IToolkitWindow.cs,NONE,1.1 Makefile,NONE,1.1 NullPrintingSystem.cs,NONE,1.1 ToolkitDecorations.cs,NONE,1.1 ToolkitEventHandlers.cs,NONE,1.1 ToolkitFunctions.cs,NONE,1.1 ToolkitGraphicsBase.cs,NONE,1.1 ToolkitManager.cs,NONE,1.1 UnixPrinter.cs,NONE,1.1 UnixPrintingSystem.cs,NONE,1.1
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Drawing2D AdjustableArrowCap.cs,NONE,1.1 CombineMode.cs,NONE,1.1 CompositingMode.cs,NONE,1.1 CompositingQuality.cs,NONE,1.1 CoordinateSpace.cs,NONE,1.1 CustomLineCap.cs,NONE,1.1 DashCap.cs,NONE,1.1 DashStyle.cs,NONE,1.1 FillMode.cs,NONE,1.1 FlushIntention.cs,NONE,1.1 GraphicsContainer.cs,NONE,1.1 GraphicsPath.cs,NONE,1.1 GraphicsState.cs,NONE,1.1 HatchBrush.cs,NONE,1.1 HatchStyle.cs,NONE,1.1 InterpolationMode.cs,NONE,1.1 LineCap.cs,NONE,1.1 LineJoin.cs,NONE,1.1 LinearGradientBrush.cs,NONE,1.1 LinearGradientMode.cs,NONE,1.1 Makefile,NONE,1.1 Matrix.cs,NONE,1.1 MatrixOrder.cs,NONE,1.1 PathData.cs,NONE,1.1 PathPointType.cs,NONE,1.1 PenAlignment.cs,NONE,1.1 PenType.cs,NONE,1.1 PixelOffsetMode.cs,NONE,1.1 QualityMode.cs,NONE,1.1 RegionData.cs,NONE,1.1 SmoothingMode.cs,NONE,1.1 WarpMode.cs,NONE,1.1 WrapMode.cs,NONE,1.1
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkit.cs,NONE,1.1 IToolkitBrush.cs,NONE,1.1 IToolkitFont.cs,NONE,1.1 IToolkitGraphics.cs,NONE,1.1 IToolkitPen.cs,NONE,1.1 IToolkitPrintSession.cs,NONE,1.1 IToolkitPrinter.cs,NONE,1.1 IToolkitPrintingSystem.cs,NONE,1.1 IToolkitSelectObject.cs,NONE,1.1 IToolkitWindow.cs,NONE,1.1 Makefile,NONE,1.1 NullPrintingSystem.cs,NONE,1.1 ToolkitDecorations.cs,NONE,1.1 ToolkitEventHandlers.cs,NONE,1.1 ToolkitFunctions.cs,NONE,1.1 ToolkitGraphicsBase.cs,NONE,1.1 ToolkitManager.cs,NONE,1.1 UnixPrinter.cs,NONE,1.1 UnixPrintingSystem.cs,NONE,1.1
- Index(es):