GtkSharp/gnome/CanvasItem.custom
Todd Berman 01e3962bc8 2004-06-04 Todd Berman <tberman@sevenl.net>
* glib/Object.cs: ConnectDefaultHandlers needs to look at public api
        as well for virtual methods.
        * gtk/CellRenderer.custom:
        * gtk/Container.custom:
        * gnome/CanvasItem.custom: Add DefaultSignalHandler to remove the need
        for the static ctor.

svn path=/trunk/gtk-sharp/; revision=28851
2004-06-05 01:01:07 +00:00

219 lines
9 KiB
Plaintext

//
// 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.Realize ();
}
protected static void OverrideRealize (GLib.GType gtype)
{
if (RealizeCallback == null)
RealizeCallback = new RealizeDelegate (Realize_cb);
gnomesharp_canvas_item_override_realize (gtype, RealizeCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Gnome.CanvasItem), ConnectionMethod="OverrideRealize")]
protected virtual void Realize ()
{
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.Point (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);
}
[GLib.DefaultSignalHandler (Type=typeof(Gnome.CanvasItem), ConnectionMethod="OverridePoint")]
protected virtual double Point (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.Draw (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);
}
[GLib.DefaultSignalHandler (Type=typeof(Gnome.CanvasItem), ConnectionMethod="OverrideDraw")]
protected virtual void Draw (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.Render (ref buf);
}
[GLib.DefaultSignalHandler (Type=typeof(Gnome.CanvasItem), ConnectionMethod="OverrideRender")]
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 Render (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, IntPtr clip_path, int flags);
static UpdateDelegate UpdateCallback;
static void Update_cb (IntPtr item, IntPtr affine_ptr, IntPtr clip_path_handle, int flags)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
double[] affine = new double [6];
Marshal.Copy (affine_ptr, affine, 0, 6);
Art.SVP clip_path;
if (clip_path_handle == IntPtr.Zero)
clip_path = Art.SVP.Zero;
else
clip_path = (Art.SVP) Marshal.PtrToStructure (clip_path_handle, typeof(Art.SVP));
obj.Update (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);
}
[GLib.DefaultSignalHandler (Type=typeof(Gnome.CanvasItem), ConnectionMethod="OverrideUpdate")]
protected virtual void Update (double[] affine, ref Art.SVP clip_path, int flags)
{
gnomesharp_canvas_item_base_update (Handle, affine, ref clip_path, flags);
}