зеркало из
1
0
Форкнуть 0

* dia/CanvasItem.custom: Added Mario Fuentes work on extending

CanvasItem's
        * dia/glue/dia-canvas-item.c: Ditto

svn path=/trunk/diacanvas-sharp/; revision=31707
This commit is contained in:
Martin Willemoes Hansen 2004-08-01 10:53:41 +00:00
Родитель d22d8b27d9
Коммит c709e35498
3 изменённых файлов: 250 добавлений и 2 удалений

Просмотреть файл

@ -8,6 +8,9 @@
dashstyle is far out in the future.
* sample/CanvasTextBox.cs: Make text fit
* sample/sample.cs: Ditto
* dia/CanvasItem.custom: Added Mario Fuentes work on extending
CanvasItem's
* dia/glue/dia-canvas-item.c: Ditto
2004-07-28 Martin Willemoes Hansen <mwh@sysrq.dk>

Просмотреть файл

@ -1,8 +1,10 @@
// CanvasItem.Custom - customizations
//
// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
// Authors: Martin Willemoes Hansen <mwh@sysrq.dk>
// Mario Fuentes <mario@gnome.cl>
//
// Copyright (C) 2003 2004 Martin Willemoes Hansen
// Copyright (C) 2004 Mario Fuentes <mario@gnome.cl>
//
// This code is inserted after the automatically generated code.
@ -31,3 +33,149 @@ public Dia.Canvas Canvas
{
set { diasharp_canvas_item_set_canvas (Handle, value.Handle); }
}
delegate void UpdateDelegate (IntPtr item, IntPtr affine_ptr);
static UpdateDelegate UpdateCallback;
static void Update_Callback (IntPtr item, IntPtr affine_ptr)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
double []affine = new double[6];
Marshal.Copy (affine_ptr, affine, 0, 6);
obj.Update (affine);
}
[DllImport("diacanvassharpglue")]
static extern void diasharp_canvas_item_override_update (GLib.GType gtype, UpdateDelegate callback);
static void OverrideUpdate (GLib.GType gtype)
{
if (UpdateCallback == null)
UpdateCallback += new UpdateDelegate (Update_Callback);
diasharp_canvas_item_override_update (gtype, UpdateCallback);
}
[DllImport("diacanvassharpglue")]
static extern void diasharp_canvas_item_base_update (IntPtr handle, double [] affine);
protected void BaseUpdate (double [] affine)
{
diasharp_canvas_item_base_update (Handle, affine);
}
[GLib.DefaultSignalHandler (Type=typeof(Dia.CanvasItem), ConnectionMethod="OverrideUpdate")]
protected virtual void Update (double [] affine)
{
BaseUpdate (affine);
}
delegate bool GetShapeIterDelegate (IntPtr item, ref CanvasIter iter);
static GetShapeIterDelegate GetShapeIterCallback;
static bool GetShapeIter_Callback (IntPtr item, ref CanvasIter iter)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
return obj.GetShapeIterFunc (ref iter);
}
[DllImport("diacanvassharpglue")]
static extern void diasharp_canvas_item_override_get_shape_iter (GLib.GType gtype, GetShapeIterDelegate callback);
static void OverrideGetShapeIter (GLib.GType gtype)
{
if (GetShapeIterCallback == null)
GetShapeIterCallback += new GetShapeIterDelegate (GetShapeIter_Callback);
diasharp_canvas_item_override_get_shape_iter (gtype, GetShapeIterCallback);
}
[DllImport("diacanvasharpglue")]
static extern bool dia_canvas_item_base_get_shape_iter(IntPtr raw, ref Dia.CanvasIter iter);
[GLib.DefaultSignalHandler (Type=typeof(Dia.CanvasItem), ConnectionMethod="OverrideGetShapeIter")]
protected virtual bool GetShapeIterFunc (ref CanvasIter iter)
{
bool ret_val = dia_canvas_item_base_get_shape_iter (Handle, ref iter);
return ret_val;
}
delegate bool ShapeNextDelegate (IntPtr item, ref CanvasIter iter);
static ShapeNextDelegate ShapeNextCallback;
static bool ShapeNext_Callback (IntPtr item, ref CanvasIter iter)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
return obj.ShapeNextFunc (ref iter);
}
[DllImport("diacanvassharpglue")]
static extern void diasharp_canvas_item_override_shape_next (GLib.GType gtype, ShapeNextDelegate callback);
static void OverrideShapeNext (GLib.GType gtype)
{
if (ShapeNextCallback == null)
ShapeNextCallback += new ShapeNextDelegate (ShapeNext_Callback);
diasharp_canvas_item_override_shape_next (gtype, ShapeNextCallback);
}
[DllImport("diacanvassharpglue")]
static extern bool dia_canvas_item_base_shape_next(IntPtr raw, ref Dia.CanvasIter iter);
[GLib.DefaultSignalHandler (Type=typeof(Dia.CanvasItem), ConnectionMethod="OverrideShapeNext")]
protected virtual bool ShapeNextFunc (ref CanvasIter iter)
{
bool ret_val = dia_canvas_item_base_shape_next (Handle, ref iter);
return ret_val;
}
delegate Shape ShapeValueDelegate (IntPtr item, ref CanvasIter iter);
static ShapeValueDelegate ShapeValueCallback;
static Shape ShapeValue_Callback (IntPtr item, ref CanvasIter iter)
{
CanvasItem obj = GLib.Object.GetObject (item, false) as CanvasItem;
return obj.ShapeValueFunc (ref iter);
}
[DllImport("diacanvassharpglue")]
static extern void diasharp_canvas_item_override_shape_value (GLib.GType gtype, ShapeValueDelegate callback);
static void OverrideShapeValue (GLib.GType gtype)
{
if (ShapeValueCallback == null)
ShapeValueCallback += new ShapeValueDelegate (ShapeValue_Callback);
diasharp_canvas_item_override_shape_value (gtype, ShapeValueCallback);
}
[DllImport("diacanvassharpglue")]
static extern IntPtr dia_canvas_item_base_shape_value (IntPtr raw, ref Dia.CanvasIter iter);
[GLib.DefaultSignalHandler (Type=typeof(Dia.CanvasItem), ConnectionMethod="OverrideShapeValue")]
protected virtual Shape ShapeValueFunc (ref CanvasIter iter)
{
Console.WriteLine ("protected virtual Shape ShapeValueFunc (ref CanvasIter iter)");
IntPtr raw_ret = dia_canvas_item_base_shape_value (Handle, ref iter);
Shape ret;
if (raw_ret == IntPtr.Zero)
ret = null;
else
ret = new Dia.Shape(raw_ret);
return ret;
}

Просмотреть файл

@ -1,8 +1,10 @@
/* dia-canvas-item.c : Glue for accessing fields in the DiaCanvasItem class.
*
* Author: Martin Willemoes Hansen
* Authors: Martin Willemoes Hansen
* Mario Fuentes <mario@gnome.cl>
*
* Copyright (C) 2003 Martin Willemoes Hansen
* Copyright (C) 2004 Mario Fuentes <mario@gnome.cl>
*
*/
@ -11,6 +13,14 @@
/* Forward declarations */
GList * diasharp_canvas_item_get_handles (DiaCanvasItem * item);
void diasharp_canvas_item_set_canvas (DiaCanvasItem * item, DiaCanvas * canvas);
void diasharp_canvas_item_base_update (DiaCanvasItem *item, gdouble *affine);
void diasharp_canvas_item_override_update (GType gtype, gpointer callback);
gboolean diasharp_canvas_item_base_get_shape_iter (DiaCanvasItem *item, DiaCanvasIter *iter);
void diasharp_canvas_item_override_get_shape_iter (GType gtype, gpointer callback);
gboolean diasharp_canvas_item_base_shape_next (DiaCanvasItem *item, DiaCanvasIter *iter);
void diasharp_canvas_item_override_shape_next (GType gtype, gpointer callback);
DiaShape *diasharp_canvas_item_base_shape_value (DiaCanvasItem *item, DiaCanvasIter *iter);
void diasharp_canvas_item_override_shape_value (GType gtype, gpointer callback);
/* */
GList *
@ -26,3 +36,90 @@ diasharp_canvas_item_set_canvas (DiaCanvasItem * item, DiaCanvas * canvas)
item->canvas = canvas;
}
void
diasharp_canvas_item_base_update (DiaCanvasItem *item, gdouble *affine)
{
DiaCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
if (parent->update)
(*parent->update) (item, affine);
}
void
diasharp_canvas_item_override_update (GType gtype, gpointer callback)
{
DiaCanvasItemClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((DiaCanvasItemClass *) klass)->update = callback;
}
gboolean
diasharp_canvas_item_base_get_shape_iter (DiaCanvasItem *item, DiaCanvasIter *iter)
{
DiaCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
if (parent->get_shape_iter)
return ((*parent->get_shape_iter) (item, iter));
return FALSE;
}
void
diasharp_canvas_item_override_get_shape_iter (GType gtype, gpointer callback)
{
DiaCanvasItemClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((DiaCanvasItemClass *) klass)->get_shape_iter = callback;
}
gboolean
diasharp_canvas_item_base_shape_next (DiaCanvasItem *item, DiaCanvasIter *iter)
{
DiaCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
if (parent->shape_next)
return ((*parent->shape_next) (item, iter));
return FALSE;
}
void
diasharp_canvas_item_override_shape_next (GType gtype, gpointer callback)
{
DiaCanvasItemClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((DiaCanvasItemClass *) klass)->shape_next = callback;
}
DiaShape *
diasharp_canvas_item_base_shape_value (DiaCanvasItem *item, DiaCanvasIter *iter)
{
DiaCanvasItemClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (item));
if (parent->shape_value)
return ((*parent->shape_value) (item, iter));
return NULL;
}
void
diasharp_canvas_item_override_shape_value (GType gtype, gpointer callback)
{
DiaCanvasItemClass *klass;
klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((DiaCanvasItemClass *) klass)->shape_value = callback;
}