diff --git a/ChangeLog b/ChangeLog index 3dec16beb..de98dfd7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-08-17 Duncan Mak + + * gnome/CanvasProxy.cs: + * gnome/GtkSharp.BoundsHandler.cs: + * gnome/GtkSharp.DrawHandler.cs: + * gnome/GtkSharp.PointHandler.cs: + * gnome/GtkSharp.RenderHandler.cs: + * gnome/GtkSharp.UpdateHandler.cs: C# glue for subclassing CanvasItems. + + * glue/canvas-proxy-marshal.c: + * glue/canvas-proxy-marshal.h: + * glue/canvas-proxy-marshal.list: + * glue/canvas-proxy.c: Added the coverage signal. + 2002-08-17 Duncan Mak * glue/canvas-proxy.c: diff --git a/glue/canvas-proxy-marshal.c b/glue/canvas-proxy-marshal.c index 5ae2ca300..913385024 100644 --- a/glue/canvas-proxy-marshal.c +++ b/glue/canvas-proxy-marshal.c @@ -223,3 +223,42 @@ g_cclosure_user_marshal_VOID__OBJECT_INT_INT_INT_INT (GClosure *closure, data2); } +/* POINTER:OBJECT (canvas-proxy-marshal.list:5) */ +void +g_cclosure_user_marshal_POINTER__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data) +{ + typedef gpointer (*GMarshalFunc_POINTER__OBJECT) (gpointer data1, + gpointer arg_1, + gpointer data2); + register GMarshalFunc_POINTER__OBJECT callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + gpointer v_return; + + g_return_if_fail (return_value != NULL); + g_return_if_fail (n_param_values == 2); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_POINTER__OBJECT) (marshal_data ? marshal_data : cc->callback); + + v_return = callback (data1, + g_marshal_value_peek_object (param_values + 1), + data2); + + g_value_set_pointer (return_value, v_return); +} + diff --git a/glue/canvas-proxy-marshal.h b/glue/canvas-proxy-marshal.h index 94f055828..b9bb99660 100644 --- a/glue/canvas-proxy-marshal.h +++ b/glue/canvas-proxy-marshal.h @@ -38,6 +38,14 @@ extern void g_cclosure_user_marshal_VOID__OBJECT_INT_INT_INT_INT (GClosure * gpointer invocation_hint, gpointer marshal_data); +/* POINTER:OBJECT (canvas-proxy-marshal.list:5) */ +extern void g_cclosure_user_marshal_POINTER__OBJECT (GClosure *closure, + GValue *return_value, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint, + gpointer marshal_data); + G_END_DECLS #endif /* __g_cclosure_user_marshal_MARSHAL_H__ */ diff --git a/glue/canvas-proxy-marshal.list b/glue/canvas-proxy-marshal.list index 070e17e5e..3bb5848c5 100644 --- a/glue/canvas-proxy-marshal.list +++ b/glue/canvas-proxy-marshal.list @@ -2,3 +2,4 @@ VOID:OBJECT,DOUBLE,POINTER,INT DOUBLE:OBJECT,DOUBLE,DOUBLE,INT,INT,POINTER VOID:OBJECT,POINTER,POINTER,POINTER,POINTER VOID:OBJECT,INT,INT,INT,INT +POINTER:OBJECT diff --git a/glue/canvas-proxy.c b/glue/canvas-proxy.c index 78ee39889..21843f24d 100644 --- a/glue/canvas-proxy.c +++ b/glue/canvas-proxy.c @@ -90,6 +90,15 @@ gtksharp_canvas_proxy_class_init (CanvasProxyClass *class) g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 0); + /* ArtUta *(* coverage) (GnomeCanvasItem *item); */ + proxy_signals [COVERAGE] = g_signal_new ("coverage", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GnomeCanvasItemClass, coverage), + NULL, NULL, + g_cclosure_user_marshal_POINTER__OBJECT, + G_TYPE_POINTER, 0); + /* void (* draw) (GnomeCanvasItem *item, GdkDrawable *drawable, */ /* int x, int y, int width, int height); */ proxy_signals [DRAW] = g_signal_new ("draw", diff --git a/gnome/CanvasProxy.cs b/gnome/CanvasProxy.cs new file mode 100644 index 000000000..bb429ab59 --- /dev/null +++ b/gnome/CanvasProxy.cs @@ -0,0 +1,149 @@ +// +// CanvasProxy.cs - For subclassing CanvasItems +// +// Author: Duncan Mak (duncan@ximian.com) +// +// 2002 (C) Copyright, Ximian, Inc. +// + +using System; + +namespace Gnome { + + public class CanvasProxy : Gnome.CanvasItem + { + public CanvasProxy (IntPtr raw) + : base (raw) + { + } + + protected CanvasProxy () : base () + { + } + + public event GtkSharp.UpdateHandler Update { + add { + throw new NotImplementedException (); + } + + remove { + EventList.RemoveHandler ("update", value); + if (EventList ["update"] == null) + Signals.Remove ("update"); + } + } + + public event EventHandler Realize { + add { + if (EventList["realize"] == null) + Signals["realize"] = new GtkSharp.voidObjectSignal(this, Handle, "realize", value, System.Type.GetType("EventArgs")); + EventList.AddHandler("realize", value); + } + remove { + EventList.RemoveHandler("realize", value); + if (EventList["realize"] == null) + Signals.Remove("realize"); + } + } + + public event EventHandler Unrealize { + add { + if (EventList["unrealize"] == null) + Signals["unrealize"] = new GtkSharp.voidObjectSignal(this, Handle, "unrealize", value, System.Type.GetType("EventArgs")); + EventList.AddHandler("unrealize", value); + } + remove { + EventList.RemoveHandler("unrealize", value); + if (EventList["unrealize"] == null) + Signals.Remove("unrealize"); + } + } + + public event EventHandler Map { + add { + if (EventList["map"] == null) + Signals["map"] = new GtkSharp.voidObjectSignal(this, Handle, "map", value, System.Type.GetType("EventArgs")); + EventList.AddHandler("map", value); + } + remove { + EventList.RemoveHandler("map", value); + if (EventList["map"] == null) + Signals.Remove("map"); + } + } + + public event EventHandler Unmap { + add { + if (EventList["unmap"] == null) + Signals["unmap"] = new GtkSharp.voidObjectSignal(this, Handle, "unmap", value, System.Type.GetType("EventArgs")); + EventList.AddHandler("unmap", value); + } + remove { + EventList.RemoveHandler("unmap", value); + if (EventList["unmap"] == null) + Signals.Remove("unmap"); + } + } + + public event EventHandler Coverage { + add { + throw new NotImplementedException (); + } + + remove { + EventList.RemoveHandler ("coverage", value); + if (EventList ["coverage"] == null) + Signals.Remove ("coverage"); + } + } + + + public event GtkSharp.DrawHandler Draw { + add { + throw new NotImplementedException (); + } + + remove { + EventList.RemoveHandler ("draw", value); + if (EventList ["draw"] == null) + Signals.Remove ("draw"); + } + } + + public event GtkSharp.RenderHandler Render { + add { + throw new NotImplementedException (); + } + + remove { + EventList.RemoveHandler ("render", value); + if (EventList ["render"] == null) + Signals.Remove ("render"); + } + } + + public event GtkSharp.PointHandler Point { + add { + throw new NotImplementedException (); + } + + remove { + EventList.RemoveHandler ("point", value); + if (EventList ["point"] == null) + Signals.Remove ("point"); + } + } + + public event GtkSharp.BoundsHandler Bounds { + add { + throw new NotImplementedException (); + } + + remove { + EventList.RemoveHandler ("bounds", value); + if (EventList ["bounds"] == null) + Signals.Remove ("bounds"); + } + } + } +} diff --git a/gnome/GtkSharp.BoundsHandler.cs b/gnome/GtkSharp.BoundsHandler.cs new file mode 100644 index 000000000..1dd805bcb --- /dev/null +++ b/gnome/GtkSharp.BoundsHandler.cs @@ -0,0 +1,51 @@ +// +// GtkSharp.BoundsHandler.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// 2002 (C) Copyright, Ximian, Inc. +// + +namespace GtkSharp { + + using System; + + /// BoundsHandler Delegate + /// + /// Delegate signature for Bounds Event handlers + /// + + public delegate void BoundsHandler(object o, BoundsArgs args); + + /// BoundsArgs Class + /// + /// Arguments for Bounds Event handlers + /// + + public class BoundsArgs : GtkSharp.SignalArgs { + + public double [] X1 { + get { + return (double []) Args [0]; + } + } + + public double [] Y1 { + get { + return (double []) Args [1]; + } + } + + public double [] X2 { + get { + return (double []) Args [2]; + } + } + + public double [] Y2 { + get { + return (double []) Args [3]; + } + } + } +} diff --git a/gnome/GtkSharp.DrawHandler.cs b/gnome/GtkSharp.DrawHandler.cs new file mode 100644 index 000000000..0cf6533d5 --- /dev/null +++ b/gnome/GtkSharp.DrawHandler.cs @@ -0,0 +1,57 @@ +// +// GtkSharp.DrawHandler.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// 2002 (C) Copyright, Ximian, Inc. +// + +namespace GtkSharp { + + using System; + + /// DrawHandler Delegate + /// + /// Delegate signature for Draw Event handlers + /// + + public delegate void DrawHandler(object o, DrawArgs args); + + /// DrawArgs Class + /// + /// Arguments for Draw Event handlers + /// + + public class DrawArgs : GtkSharp.SignalArgs { + + public Gdk.Drawable Drawable { + get { + return (Gdk.Drawable) Args [0]; + } + } + + public int X { + get { + return (int) Args [1]; + } + } + + public int Y { + get { + return (int) Args [2]; + } + } + + public int Width { + get { + return (int) Args [3]; + } + } + + public int Height { + get { + return (int) Args [4]; + } + } + } +} diff --git a/gnome/GtkSharp.PointHandler.cs b/gnome/GtkSharp.PointHandler.cs new file mode 100644 index 000000000..946dc1ea3 --- /dev/null +++ b/gnome/GtkSharp.PointHandler.cs @@ -0,0 +1,57 @@ +// +// GtkSharp.PointHandler.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// 2002 (C) Copyright, Ximian, Inc. +// + +namespace GtkSharp { + + using System; + + /// PointHandler Delegate + /// + /// Delegate signature for Point Event handlers + /// + + public delegate void PointHandler(object o, PointArgs args); + + /// PointArgs Class + /// + /// Arguments for Point Event handlers + /// + + public class PointArgs : GtkSharp.SignalArgs { + + public double X { + get { + return (double) Args [0]; + } + } + + public double Y { + get { + return (double) Args [1]; + } + } + + public int CX { + get { + return (int) Args [2]; + } + } + + public int CY { + get { + return (int) Args [3]; + } + } + + public Gnome.CanvasItem [] ActualItem { + get { + return (Gnome.CanvasItem []) Args [4]; + } + } + } +} diff --git a/gnome/GtkSharp.RenderHandler.cs b/gnome/GtkSharp.RenderHandler.cs new file mode 100644 index 000000000..f22959e06 --- /dev/null +++ b/gnome/GtkSharp.RenderHandler.cs @@ -0,0 +1,33 @@ +// +// GtkSharp.RenderHandler.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// 2002 (C) Copyright, Ximian, Inc. +// + +namespace GtkSharp { + + using System; + + /// RenderHandler Delegate + /// + /// Delegate signature for Render Event handlers + /// + + public delegate void RenderHandler(object o, RenderArgs args); + + /// RenderArgs Class + /// + /// Arguments for Render Event handlers + /// + + public class RenderArgs : GtkSharp.SignalArgs { + + public Gnome.CanvasBuf Buf { + get { + return (Gnome.CanvasBuf) Args [0]; + } + } + } +} diff --git a/gnome/GtkSharp.UpdateHandler.cs b/gnome/GtkSharp.UpdateHandler.cs new file mode 100644 index 000000000..8851a2c7a --- /dev/null +++ b/gnome/GtkSharp.UpdateHandler.cs @@ -0,0 +1,45 @@ +// +// GtkSharp.CanvasUpdateHandler.cs +// +// Author: Duncan Mak (duncan@ximian.com) +// +// 2002 (C) Copyright, Ximian, Inc. +// + +namespace GtkSharp { + + using System; + + /// CanvasUpdateHandler Delegate + /// + /// Delegate signature for CanvasUpdate Event handlers + /// + + public delegate void UpdateHandler (object o, UpdateArgs args); + + /// CanvasUpdateArgs Class + /// + /// Arguments for CanvasUpdate Event handlers + /// + + public class UpdateArgs : GtkSharp.SignalArgs { + + public double [] Affine { + get { + return (double []) Args [0]; + } + } + + public Art.SVP ClipPath { + get { + return (Art.SVP) Args [1]; + } + } + + public int Flags { + get { + return (int) Args [2]; + } + } + } +}