2002-08-17 Duncan Mak <duncan@ximian.com>

* 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.

svn path=/trunk/gtk-sharp/; revision=6708
This commit is contained in:
Duncan Mak 2002-08-17 10:38:17 +00:00
parent 40dd8134e3
commit d58e384ec1
11 changed files with 463 additions and 0 deletions

View File

@ -1,3 +1,17 @@
2002-08-17 Duncan Mak <duncan@ximian.com>
* 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 <duncan@ximian.com>
* glue/canvas-proxy.c:

View File

@ -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);
}

View File

@ -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__ */

View File

@ -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

View File

@ -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",

149
gnome/CanvasProxy.cs Normal file
View File

@ -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");
}
}
}
}

View File

@ -0,0 +1,51 @@
//
// GtkSharp.BoundsHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace GtkSharp {
using System;
/// <summary> BoundsHandler Delegate </summary>
/// <remarks>
/// Delegate signature for Bounds Event handlers
/// </remarks>
public delegate void BoundsHandler(object o, BoundsArgs args);
/// <summary> BoundsArgs Class </summary>
/// <remarks>
/// Arguments for Bounds Event handlers
/// </remarks>
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];
}
}
}
}

View File

@ -0,0 +1,57 @@
//
// GtkSharp.DrawHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace GtkSharp {
using System;
/// <summary> DrawHandler Delegate </summary>
/// <remarks>
/// Delegate signature for Draw Event handlers
/// </remarks>
public delegate void DrawHandler(object o, DrawArgs args);
/// <summary> DrawArgs Class </summary>
/// <remarks>
/// Arguments for Draw Event handlers
/// </remarks>
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];
}
}
}
}

View File

@ -0,0 +1,57 @@
//
// GtkSharp.PointHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace GtkSharp {
using System;
/// <summary> PointHandler Delegate </summary>
/// <remarks>
/// Delegate signature for Point Event handlers
/// </remarks>
public delegate void PointHandler(object o, PointArgs args);
/// <summary> PointArgs Class </summary>
/// <remarks>
/// Arguments for Point Event handlers
/// </remarks>
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];
}
}
}
}

View File

@ -0,0 +1,33 @@
//
// GtkSharp.RenderHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace GtkSharp {
using System;
/// <summary> RenderHandler Delegate </summary>
/// <remarks>
/// Delegate signature for Render Event handlers
/// </remarks>
public delegate void RenderHandler(object o, RenderArgs args);
/// <summary> RenderArgs Class </summary>
/// <remarks>
/// Arguments for Render Event handlers
/// </remarks>
public class RenderArgs : GtkSharp.SignalArgs {
public Gnome.CanvasBuf Buf {
get {
return (Gnome.CanvasBuf) Args [0];
}
}
}
}

View File

@ -0,0 +1,45 @@
//
// GtkSharp.CanvasUpdateHandler.cs
//
// Author: Duncan Mak (duncan@ximian.com)
//
// 2002 (C) Copyright, Ximian, Inc.
//
namespace GtkSharp {
using System;
/// <summary> CanvasUpdateHandler Delegate </summary>
/// <remarks>
/// Delegate signature for CanvasUpdate Event handlers
/// </remarks>
public delegate void UpdateHandler (object o, UpdateArgs args);
/// <summary> CanvasUpdateArgs Class </summary>
/// <remarks>
/// Arguments for CanvasUpdate Event handlers
/// </remarks>
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];
}
}
}
}