GtkSharp/gnome/CanvasItem.custom
Mike Kestner 9e64b802b5 2004-04-04 Mike Kestner <mkestner@ximian.com>
* gnome/glue/canvasitem.c : add glue to override VMs.
	* gnome/CanvasItem.cs : expose virtual methods for update, point,
	realize, draw, and render.

svn path=/trunk/gtk-sharp/; revision=25040
2004-04-05 15:11:37 +00:00

208 lines
8.4 KiB
Text

//
// Gnome.CanvasItem.custom - Gnome CanvasItem class customizations
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
// Copyright (C) 2002 Rachel Hestilow
//
// This code is inserted after the automatically generated code.
//
[DllImport("gnomecanvas-2")]
static extern System.IntPtr gnome_canvas_item_new (IntPtr group, GLib.GType type, IntPtr null_terminator);
[DllImport("libgobject-2.0-0.dll")]
static extern void g_object_ref (IntPtr raw);
public CanvasItem (Gnome.CanvasGroup group, GLib.GType type)
: base (gnome_canvas_item_new (group.Handle, type, IntPtr.Zero))
{
g_object_ref (Handle);
}
[DllImport("gnomesharpglue")]
static extern IntPtr gtksharp_gnome_canvas_item_get_canvas (IntPtr i);
public Canvas Canvas {
get { return GLib.Object.GetObject (gtksharp_gnome_canvas_item_get_canvas (this.Handle), false) as Canvas; }
}
[DllImport("gnomecanvas-2")]
static extern void gnome_canvas_item_affine_relative(IntPtr raw, double[] affine);
public void AffineRelative (out double[] affine) {
affine = new double [6];
gnome_canvas_item_affine_relative(Handle, affine);
}
[DllImport("gnomecanvas-2")]
static extern void gnome_canvas_item_affine_absolute(IntPtr raw, double[] affine);
public void AffineAbsolute (out double[] affine) {
affine = new double [6];
gnome_canvas_item_affine_absolute(Handle, affine);
}
[DllImport("gnomecanvas-2")]
static extern void gnome_canvas_item_i2c_affine(IntPtr raw, double[] affine);
public void I2cAffine(out double[] affine) {
affine = new double [6];
gnome_canvas_item_i2c_affine(Handle, affine);
}
[DllImport("gnomecanvas-2")]
static extern void gnome_canvas_item_i2w_affine(IntPtr raw, double[] affine);
public void I2wAffine(out double[] affine) {
affine = new double [6];
gnome_canvas_item_i2w_affine(Handle, affine);
}
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_base_realize (IntPtr handle);
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_override_realize (GLib.GType gtype, RealizeDelegate cb);
delegate void RealizeDelegate (IntPtr item);
static RealizeDelegate RealizeCallback;
static void Realize_cb (IntPtr item)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
obj.OnRealize ();
}
protected static void OverrideRealize (GLib.GType gtype)
{
if (RealizeCallback == null)
RealizeCallback = new RealizeDelegate (Realize_cb);
gnomesharp_canvas_item_override_realize (gtype, RealizeCallback);
}
protected virtual void OnRealize ()
{
gnomesharp_canvas_item_base_realize (Handle);
}
[DllImport("gnomesharpglue")]
static extern double gnomesharp_canvas_item_base_point (IntPtr handle, double x, double y, int cx, int cy, out IntPtr actual_item_handle);
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_override_point (GLib.GType gtype, PointDelegate cb);
delegate double PointDelegate (IntPtr item, double x, double y, int cx, int cy, out IntPtr actual_item_handle);
static PointDelegate PointCallback;
static double Point_cb (IntPtr item, double x, double y, int cx, int cy, out IntPtr actual_item_handle)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
CanvasItem actual_item;
double result = obj.OnPoint (x, y, cx, cy, out actual_item);
actual_item_handle = actual_item != null ? actual_item.Handle : IntPtr.Zero;
return result;
}
protected static void OverridePoint (GLib.GType gtype)
{
if (PointCallback == null)
PointCallback = new PointDelegate (Point_cb);
gnomesharp_canvas_item_override_point (gtype, PointCallback);
}
protected virtual double OnPoint (double x, double y, int cx, int cy, out CanvasItem actual_item)
{
IntPtr actual_item_handle;
double result = gnomesharp_canvas_item_base_point (Handle, x, y, cx, cy, out actual_item_handle);
actual_item = GLib.Object.GetObject (actual_item_handle, false) as CanvasItem;
return result;
}
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_base_draw (IntPtr handle, IntPtr drawable, int x, int y, int width, int height);
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_override_draw (GLib.GType gtype, DrawDelegate cb);
delegate void DrawDelegate (IntPtr handle, IntPtr drawable, int x, int y, int width, int height);
static DrawDelegate DrawCallback;
static void Draw_cb (IntPtr handle, IntPtr drawable_handle, int x, int y, int width, int height)
{
CanvasItem obj = GLib.Object.GetObject (handle, false) as CanvasItem;
Gdk.Drawable drawable = GLib.Object.GetObject (drawable_handle, false) as Gdk.Drawable;
obj.OnDraw (drawable, x, y, width, height);
}
protected static void OverrideDraw (GLib.GType gtype)
{
if (DrawCallback == null)
DrawCallback = new DrawDelegate (Draw_cb);
gnomesharp_canvas_item_override_draw (gtype, DrawCallback);
}
protected virtual void OnDraw (Gdk.Drawable drawable, int x, int y, int width, int height)
{
gnomesharp_canvas_item_base_draw (Handle, drawable.Handle, x, y, width, height);
}
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_base_render (IntPtr handle, ref CanvasBuf buf);
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_override_render (GLib.GType gtype, RenderDelegate cb);
delegate void RenderDelegate (IntPtr handle, ref CanvasBuf buf);
static RenderDelegate RenderCallback;
static void Render_cb (IntPtr handle, ref CanvasBuf buf)
{
CanvasItem obj = GLib.Object.GetObject (handle, false) as CanvasItem;
obj.OnRender (ref buf);
}
protected static void OverrideRender (GLib.GType gtype)
{
if (RenderCallback == null)
RenderCallback = new RenderDelegate (Render_cb);
gnomesharp_canvas_item_override_render (gtype, RenderCallback);
}
protected virtual void OnRender (ref CanvasBuf buf)
{
gnomesharp_canvas_item_base_render (Handle, ref buf);
}
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_base_update (IntPtr handle, double[] affine, ref Art.SVP clip_path, int flags);
[DllImport("gnomesharpglue")]
static extern void gnomesharp_canvas_item_override_update (GLib.GType gtype, UpdateDelegate cb);
delegate void UpdateDelegate (IntPtr item, IntPtr affine_ptr, ref Art.SVP clip_path, int flags);
static UpdateDelegate UpdateCallback;
static void Update_cb (IntPtr item, IntPtr affine_ptr, ref Art.SVP clip_path, int flags)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
double[] affine = new double [6];
Marshal.Copy (affine_ptr, affine, 0, 6);
obj.OnUpdate (affine, ref clip_path, flags);
}
protected static void OverrideUpdate (GLib.GType gtype)
{
if (UpdateCallback == null)
UpdateCallback = new UpdateDelegate (Update_cb);
gnomesharp_canvas_item_override_update (gtype, UpdateCallback);
}
protected virtual void OnUpdate (double[] affine, ref Art.SVP clip_path, int flags)
{
gnomesharp_canvas_item_base_update (Handle, affine, ref clip_path, flags);
}