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:
parent
c06d83388c
commit
4cc4140ea5
3 changed files with 31 additions and 9 deletions
|
@ -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.
|
||||||
|
|
|
@ -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++;
|
||||||
|
|
|
@ -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,15 +152,17 @@ 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();
|
||||||
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {");
|
if (!DisableNew) {
|
||||||
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {");
|
sw.WriteLine ("\t\tpublic static " + QualifiedName + " New(IntPtr raw) {");
|
||||||
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
|
sw.WriteLine ("\t\t\tif (raw == IntPtr.Zero) {");
|
||||||
sw.WriteLine ("\t\t\t}");
|
sw.WriteLine ("\t\t\t\treturn {0}.Zero;", QualifiedName);
|
||||||
sw.WriteLine ("\t\t\t{0} self = new {0}();", QualifiedName);
|
sw.WriteLine ("\t\t\t}");
|
||||||
sw.WriteLine ("\t\t\tself = ({0}) Marshal.PtrToStructure (raw, self.GetType ());", QualifiedName);
|
sw.WriteLine ("\t\t\t{0} self = new {0}();", QualifiedName);
|
||||||
sw.WriteLine ("\t\t\treturn self;");
|
sw.WriteLine ("\t\t\tself = ({0}) Marshal.PtrToStructure (raw, self.GetType ());", QualifiedName);
|
||||||
sw.WriteLine ("\t\t}");
|
sw.WriteLine ("\t\t\treturn self;");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ("\t\t}");
|
||||||
|
sw.WriteLine ();
|
||||||
|
}
|
||||||
|
|
||||||
foreach (Ctor ctor in Ctors) {
|
foreach (Ctor ctor in Ctors) {
|
||||||
ctor.ForceStatic = true;
|
ctor.ForceStatic = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue