From 77d1b452f5f041a7973f91c4fff66429af17ad4a Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Tue, 1 Jun 2004 18:00:09 +0000 Subject: [PATCH] 2004-06-01 Mike Kestner * generator/ObjectGen.cs : generate protected ctor () for all GLib.Objects that don't have any ctors. * gtk/CellRenderer.custom : remove ctor (). * gtkhtml/Gtk.metadata : add a disable_void_ctor rule for HTML. svn path=/trunk/gtk-sharp/; revision=28645 --- ChangeLog | 7 +++++++ generator/ObjectGen.cs | 13 +++++++++++++ gtk/CellRenderer.custom | 9 --------- gtkhtml/Gtk.metadata | 17 +++++++++-------- 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d1f8c47d..62ea8608a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-06-01 Mike Kestner + + * generator/ObjectGen.cs : generate protected ctor () for all + GLib.Objects that don't have any ctors. + * gtk/CellRenderer.custom : remove ctor (). + * gtkhtml/Gtk.metadata : add a disable_void_ctor rule for HTML. + 2004-06-01 Mike Kestner * gtk/Gtk.metadata : mark SizeRequest requisition as out, not ref. diff --git a/generator/ObjectGen.cs b/generator/ObjectGen.cs index 1481a74d6..d69429226 100644 --- a/generator/ObjectGen.cs +++ b/generator/ObjectGen.cs @@ -48,6 +48,12 @@ namespace GtkSharp.Generation { } } + private bool DisableVoidCtor { + get { + return Elem.HasAttribute ("disable_void_ctor"); + } + } + private class DirectoryInfo { public string assembly_name; public Hashtable objects; @@ -202,6 +208,13 @@ namespace GtkSharp.Generation { gen_info.Writer.WriteLine(); gen_info.Writer.WriteLine("\t\tprotected " + Name + "(GLib.GType gtype) : base(gtype) {}"); gen_info.Writer.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}"); + if (ctors.Count == 0 && !DisableVoidCtor) { + gen_info.Writer.WriteLine(); + gen_info.Writer.WriteLine("\t\tprotected " + Name + "() : base(IntPtr.Zero)"); + gen_info.Writer.WriteLine("\t\t{"); + gen_info.Writer.WriteLine("\t\t\tCreateNativeObject (new string [0], new GLib.Value [0]);"); + gen_info.Writer.WriteLine("\t\t}"); + } gen_info.Writer.WriteLine(); base.GenCtors (gen_info); diff --git a/gtk/CellRenderer.custom b/gtk/CellRenderer.custom index 32fc6e019..cb8c10ae9 100644 --- a/gtk/CellRenderer.custom +++ b/gtk/CellRenderer.custom @@ -8,15 +8,6 @@ // This code is inserted after the automatically generated code. // - public CellRenderer () : base (IntPtr.Zero) - { - if (GetType () != typeof (CellRenderer)) { - CreateNativeObject (new string[0], new GLib.Value[0]); - return; - } - throw new InvalidOperationException ("You MUST subclass this class"); - } - [DllImport("gtksharpglue")] static extern void gtksharp_cellrenderer_base_get_size (IntPtr handle, IntPtr widget, Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height); diff --git a/gtkhtml/Gtk.metadata b/gtkhtml/Gtk.metadata index b21b84b89..81979b5a7 100644 --- a/gtkhtml/Gtk.metadata +++ b/gtkhtml/Gtk.metadata @@ -1,13 +1,14 @@ - 1 - 1 - OnCommand - Begin - Begin - 1 - const-guchar* - 1 + 1 + 1 + 1 + OnCommand + Begin + Begin + 1 + const-guchar* + 1