2004-06-02 Mike Kestner <mkestner@ximian.com>

* generator/Field.cs : add field hiding, for manual impl.
	* generator/StructBase.cs : support disable_new, for manual impl.

svn path=/trunk/gtk-sharp/; revision=28715
This commit is contained in:
Mike Kestner 2004-06-02 20:28:42 +00:00
parent c06d83388c
commit 4cc4140ea5
3 changed files with 31 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2004-06-02 Mike Kestner <mkestner@ximian.com>
* generator/Field.cs : add field hiding, for manual impl.
* generator/StructBase.cs : support disable_new, for manual impl.
2004-06-01 Jeroen Zwartepoorte <jeroen@xs4all.nl> 2004-06-01 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* sample/CustomWidget.cs: Add custom widget sample. * sample/CustomWidget.cs: Add custom widget sample.

View file

@ -66,6 +66,12 @@ namespace GtkSharp.Generation {
} }
} }
public bool Hidden {
get {
return elem.HasAttribute("hidden");
}
}
public bool IsArray { public bool IsArray {
get { get {
return elem.HasAttribute("array_len"); return elem.HasAttribute("array_len");
@ -122,6 +128,9 @@ namespace GtkSharp.Generation {
public bool Generate (StreamWriter sw) public bool Generate (StreamWriter sw)
{ {
if (Hidden)
return true;
if (CSType == "") { if (CSType == "") {
Console.WriteLine ("Field has unknown Type {0}", CType); Console.WriteLine ("Field has unknown Type {0}", CType);
Statistics.ThrottledCount++; Statistics.ThrottledCount++;

View file

@ -84,6 +84,12 @@ namespace GtkSharp.Generation {
return var; return var;
} }
private bool DisableNew {
get {
return Elem.HasAttribute ("disable_new");
}
}
protected void GenFields (StreamWriter sw) protected void GenFields (StreamWriter sw)
{ {
Field.bitfields = 0; Field.bitfields = 0;
@ -146,6 +152,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\tpublic static {0} Zero = new {0} ();", QualifiedName); sw.WriteLine ("\t\tpublic static {0} Zero = new {0} ();", QualifiedName);
sw.WriteLine(); sw.WriteLine();
if (!DisableNew) {
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {"); sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {");
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {"); sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {");
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName); sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
@ -155,6 +162,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t\treturn self;"); sw.WriteLine ("\t\t\treturn self;");
sw.WriteLine ("\t\t}"); sw.WriteLine ("\t\t}");
sw.WriteLine (); sw.WriteLine ();
}
foreach (Ctor ctor in Ctors) { foreach (Ctor ctor in Ctors) {
ctor.ForceStatic = true; ctor.ForceStatic = true;