From 01e3962bc8d5a1d9fa9a5e86772314c2b8abd9d6 Mon Sep 17 00:00:00 2001 From: Todd Berman Date: Sat, 5 Jun 2004 01:01:07 +0000 Subject: [PATCH] 2004-06-04 Todd Berman * 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 --- ChangeLog | 9 +++++++++ glib/Object.cs | 2 +- gnome/CanvasItem.custom | 5 +++++ gtk/CellRenderer.custom | 7 +++++-- gtk/Container.custom | 1 + sample/CustomCellRenderer.cs | 6 ------ 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 129c1c941..f686acc27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-06-04 Todd Berman + + * 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. + 2004-06-04 Todd Berman * gnome/CanvasItem.custom: Changed from OnXXX vmethods to XXX vmethods diff --git a/glib/Object.cs b/glib/Object.cs index 5b75631cd..a6b7c0d46 100644 --- a/glib/Object.cs +++ b/glib/Object.cs @@ -102,7 +102,7 @@ namespace GLib { private static void ConnectDefaultHandlers (GType gtype, System.Type t) { - foreach (MethodInfo minfo in t.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly)) { + foreach (MethodInfo minfo in t.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly)) { MethodInfo baseinfo = minfo.GetBaseDefinition (); if (baseinfo == minfo) continue; diff --git a/gnome/CanvasItem.custom b/gnome/CanvasItem.custom index 5e2f7f37d..60bab70fb 100644 --- a/gnome/CanvasItem.custom +++ b/gnome/CanvasItem.custom @@ -80,6 +80,7 @@ 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); @@ -111,6 +112,7 @@ 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; @@ -143,6 +145,7 @@ 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); @@ -164,6 +167,7 @@ obj.Render (ref buf); } + [GLib.DefaultSignalHandler (Type=typeof(Gnome.CanvasItem), ConnectionMethod="OverrideRender")] protected static void OverrideRender (GLib.GType gtype) { if (RenderCallback == null) @@ -206,6 +210,7 @@ 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); diff --git a/gtk/CellRenderer.custom b/gtk/CellRenderer.custom index 720501383..3e70aebf4 100644 --- a/gtk/CellRenderer.custom +++ b/gtk/CellRenderer.custom @@ -42,7 +42,8 @@ GetSizeCallback = new GetSizeDelegate (GetSize_cb); gtksharp_cellrenderer_override_get_size (gtype, GetSizeCallback); } - + + [GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideGetSize")] public virtual void GetSize(Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height) { gtksharp_cellrenderer_base_get_size(Handle, widget.Handle, ref cell_area, out x_offset, out y_offset, out width, out height); } @@ -73,6 +74,7 @@ gtksharp_cellrenderer_override_render (gtype, RenderCallback); } + [GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideRender")] protected virtual void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags) { gtksharp_cellrenderer_base_render (Handle, window.Handle, widget.Handle, background_area, cell_area, expose_area, flags); @@ -105,7 +107,8 @@ [DllImport("gtksharpglue")] static extern IntPtr gtksharp_cellrenderer_base_start_editing(IntPtr raw, IntPtr evnt, IntPtr widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, int flags); - + + [GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideStartEditing")] public virtual Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) { IntPtr raw_ret = gtksharp_cellrenderer_base_start_editing(Handle, evnt.Handle, widget.Handle, path, ref background_area, ref cell_area, (int) flags); Gtk.CellEditable ret = (Gtk.CellEditable) GLib.Object.GetObject(raw_ret); diff --git a/gtk/Container.custom b/gtk/Container.custom index a050390e5..572bc8e4a 100644 --- a/gtk/Container.custom +++ b/gtk/Container.custom @@ -104,6 +104,7 @@ protected static void OverrideForall (GLib.GType gtype) gtksharp_container_override_forall (gtype, ForallCallback); } +[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideForall")] protected virtual void ForAll (bool include_internals, CallbackInvoker invoker) { gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data); diff --git a/sample/CustomCellRenderer.cs b/sample/CustomCellRenderer.cs index 47cf3b845..06c5e64dd 100644 --- a/sample/CustomCellRenderer.cs +++ b/sample/CustomCellRenderer.cs @@ -26,12 +26,6 @@ public class CustomCellRenderer : CellRenderer } } - static CustomCellRenderer () - { - OverrideGetSize (GLib.Object.LookupGType (typeof (CustomCellRenderer))); - OverrideRender (GLib.Object.LookupGType (typeof (CustomCellRenderer))); - } - public override void GetSize (Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height) { int calc_width = (int) this.Xpad * 2 + 100;