diff --git a/ChangeLog b/ChangeLog index 67a107e2d..82f9d2987 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-06-02 Mike Kestner + + * generator/Field.cs : add field hiding, for manual impl. + * generator/StructBase.cs : support disable_new, for manual impl. + 2004-06-01 Jeroen Zwartepoorte * sample/CustomWidget.cs: Add custom widget sample. diff --git a/generator/Field.cs b/generator/Field.cs index 246032024..c71ee6531 100644 --- a/generator/Field.cs +++ b/generator/Field.cs @@ -66,6 +66,12 @@ namespace GtkSharp.Generation { } } + public bool Hidden { + get { + return elem.HasAttribute("hidden"); + } + } + public bool IsArray { get { return elem.HasAttribute("array_len"); @@ -122,6 +128,9 @@ namespace GtkSharp.Generation { public bool Generate (StreamWriter sw) { + if (Hidden) + return true; + if (CSType == "") { Console.WriteLine ("Field has unknown Type {0}", CType); Statistics.ThrottledCount++; diff --git a/generator/StructBase.cs b/generator/StructBase.cs index b80b41126..e7d74f373 100644 --- a/generator/StructBase.cs +++ b/generator/StructBase.cs @@ -84,6 +84,12 @@ namespace GtkSharp.Generation { return var; } + private bool DisableNew { + get { + return Elem.HasAttribute ("disable_new"); + } + } + protected void GenFields (StreamWriter sw) { Field.bitfields = 0; @@ -146,15 +152,17 @@ namespace GtkSharp.Generation { sw.WriteLine ("\t\tpublic static {0} Zero = new {0} ();", QualifiedName); sw.WriteLine(); - sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {"); - sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {"); - sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName); - sw.WriteLine ("\t\t\t}"); - sw.WriteLine ("\t\t\t{0} self = new {0}();", QualifiedName); - sw.WriteLine ("\t\t\tself = ({0}) Marshal.PtrToStructure (raw, self.GetType ());", QualifiedName); - sw.WriteLine ("\t\t\treturn self;"); - sw.WriteLine ("\t\t}"); - sw.WriteLine (); + if (!DisableNew) { + sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {"); + sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {"); + sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName); + sw.WriteLine ("\t\t\t}"); + sw.WriteLine ("\t\t\t{0} self = new {0}();", QualifiedName); + sw.WriteLine ("\t\t\tself = ({0}) Marshal.PtrToStructure (raw, self.GetType ());", QualifiedName); + sw.WriteLine ("\t\t\treturn self;"); + sw.WriteLine ("\t\t}"); + sw.WriteLine (); + } foreach (Ctor ctor in Ctors) { ctor.ForceStatic = true;