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
This commit is contained in:
parent
a0901fea5e
commit
9e64b802b5
3 changed files with 261 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2004-04-04 John Luke <jluke@cfl.rr.com>
|
||||
|
||||
* vte/Vte.metadata: mark argv and envv parameters to
|
||||
|
|
|
@ -57,3 +57,152 @@
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
/* canvasitem.c : Glue for accessing fields in a GnomeCanvasItem
|
||||
*
|
||||
* Author: Duncan Mak (duncan@ximian.com)
|
||||
* Mike Kestner (mkestner@ximian.com)
|
||||
*
|
||||
* (C) Ximian, INc.
|
||||
* Copyright (C) 2001-2003 Ximian, Inc.
|
||||
* Copyright (C) 2004 Novell, Inc.
|
||||
*/
|
||||
|
||||
#include <libgnomecanvas/gnome-canvas.h>
|
||||
|
@ -15,4 +17,107 @@ gtksharp_gnome_canvas_item_get_canvas (GnomeCanvasItem *item)
|
|||
return item->canvas;
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_base_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_base_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
|
||||
{
|
||||
GnomeCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
|
||||
if (parent->update)
|
||||
(*parent->update) (item, affine, clip_path, flags);
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_override_update (GType gtype, gpointer cb);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_override_update (GType gtype, gpointer cb)
|
||||
{
|
||||
GnomeCanvasItemClass *klass = g_type_class_peek (gtype);
|
||||
if (!klass)
|
||||
klass = g_type_class_ref (gtype);
|
||||
((GnomeCanvasItemClass *) klass)->update = cb;
|
||||
}
|
||||
|
||||
gdouble gnomesharp_canvas_item_base_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item);
|
||||
|
||||
gdouble
|
||||
gnomesharp_canvas_item_base_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item)
|
||||
{
|
||||
GnomeCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
|
||||
return (*parent->point) (item, x, y, cx, cy, actual_item);
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_override_point (GType gtype, gpointer cb);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_override_point (GType gtype, gpointer cb)
|
||||
{
|
||||
GnomeCanvasItemClass *klass = g_type_class_peek (gtype);
|
||||
if (!klass)
|
||||
klass = g_type_class_ref (gtype);
|
||||
((GnomeCanvasItemClass *) klass)->point = cb;
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_base_realize (GnomeCanvasItem *item);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_base_realize (GnomeCanvasItem *item)
|
||||
{
|
||||
GnomeCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
|
||||
if (parent->realize)
|
||||
(*parent->realize) (item);
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_override_realize (GType gtype, gpointer cb);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_override_realize (GType gtype, gpointer cb)
|
||||
{
|
||||
GnomeCanvasItemClass *klass = g_type_class_peek (gtype);
|
||||
if (!klass)
|
||||
klass = g_type_class_ref (gtype);
|
||||
((GnomeCanvasItemClass *) klass)->realize = cb;
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_base_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_base_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
|
||||
{
|
||||
GnomeCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
|
||||
if (parent->draw)
|
||||
(*parent->draw) (item, drawable, x, y, width, height);
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_override_draw (GType gtype, gpointer cb);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_override_draw (GType gtype, gpointer cb)
|
||||
{
|
||||
GnomeCanvasItemClass *klass = g_type_class_peek (gtype);
|
||||
if (!klass)
|
||||
klass = g_type_class_ref (gtype);
|
||||
((GnomeCanvasItemClass *) klass)->draw = cb;
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_base_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_base_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
|
||||
{
|
||||
GnomeCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
|
||||
if (parent->render)
|
||||
(*parent->render) (item, buf);
|
||||
}
|
||||
|
||||
void gnomesharp_canvas_item_override_render (GType gtype, gpointer cb);
|
||||
|
||||
void
|
||||
gnomesharp_canvas_item_override_render (GType gtype, gpointer cb)
|
||||
{
|
||||
GnomeCanvasItemClass *klass = g_type_class_peek (gtype);
|
||||
if (!klass)
|
||||
klass = g_type_class_ref (gtype);
|
||||
((GnomeCanvasItemClass *) klass)->render = cb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue