2003-10-28 Mike Kestner <mkestner@ximian.com>
* generator/BoxedGen.cs : generate GLib.Value ctors. [fixes #47168] * generator/Property.cs : use new Boxed value ctors. * generator/StructBase.cs : use existing Writer if available. svn path=/trunk/gtk-sharp/; revision=19433
This commit is contained in:
parent
920ec48afd
commit
0cdee479e2
4 changed files with 42 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2003-10-28 Mike Kestner <mkestner@ximian.com>
|
||||||
|
|
||||||
|
* generator/BoxedGen.cs : generate GLib.Value ctors. [fixes #47168]
|
||||||
|
* generator/Property.cs : use new Boxed value ctors.
|
||||||
|
* generator/StructBase.cs : use existing Writer if available.
|
||||||
|
|
||||||
2003-10-27 Moritz Balz <verteiler@mbalz.de>
|
2003-10-27 Moritz Balz <verteiler@mbalz.de>
|
||||||
|
|
||||||
* gdk/Drawable.custom : add a S.D.Rectangle overload for DrawRect.
|
* gdk/Drawable.custom : add a S.D.Rectangle overload for DrawRect.
|
||||||
|
|
|
@ -22,7 +22,28 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public override void Generate (GenerationInfo gen_info)
|
public override void Generate (GenerationInfo gen_info)
|
||||||
{
|
{
|
||||||
|
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
||||||
base.Generate (gen_info);
|
base.Generate (gen_info);
|
||||||
|
sw.WriteLine ("\t\t[DllImport(\"gtksharpglue\")]");
|
||||||
|
sw.WriteLine ("\t\tstatic extern IntPtr gtksharp_value_create (uint gtype);");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\t\t[DllImport(\"libgobject-2.0-0.dll\")]");
|
||||||
|
sw.WriteLine ("\t\tstatic extern void g_value_set_boxed (IntPtr handle, ref " + QualifiedName + " boxed);");
|
||||||
|
sw.WriteLine ();
|
||||||
|
sw.WriteLine ("\t\tpublic static explicit operator GLib.Value (" + QualifiedName + " boxed)");
|
||||||
|
sw.WriteLine ("\t\t{");
|
||||||
|
|
||||||
|
sw.WriteLine ("\t\t\tIntPtr handle = gtksharp_value_create (" + QualifiedName + ".GType);");
|
||||||
|
sw.WriteLine ("\t\t\tg_value_set_boxed (handle, ref boxed);");
|
||||||
|
sw.WriteLine ("\t\t\treturn new GLib.Value (handle, IntPtr.Zero);");
|
||||||
|
sw.WriteLine ("\t\t}");
|
||||||
|
|
||||||
|
sw.WriteLine ("#endregion");
|
||||||
|
AppendCustom(sw, gen_info.CustomDir);
|
||||||
|
sw.WriteLine ("\t}");
|
||||||
|
sw.WriteLine ("}");
|
||||||
|
sw.Close ();
|
||||||
|
gen_info.Writer = null;
|
||||||
Statistics.BoxedCount++;
|
Statistics.BoxedCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,14 +148,15 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine();
|
sw.WriteLine();
|
||||||
} else if (elem.HasAttribute("writeable") && !elem.HasAttribute("construct-only")) {
|
} else if (elem.HasAttribute("writeable") && !elem.HasAttribute("construct-only")) {
|
||||||
sw.WriteLine("\t\t\tset {");
|
sw.WriteLine("\t\t\tset {");
|
||||||
sw.Write("\t\t\t\tSetProperty(" + cname + ", new GLib.Value(");
|
sw.Write("\t\t\t\tSetProperty(" + cname + ", ");
|
||||||
if (table.IsEnum(c_type)) {
|
if (table.IsEnum(c_type)) {
|
||||||
sw.WriteLine("Handle, " + cname + ", new GLib.EnumWrapper ((int) value, {0})));", table.IsEnumFlags (c_type) ? "true" : "false");
|
sw.WriteLine("new GLib.Value(Handle, " + cname + ", new GLib.EnumWrapper ((int) value, {0})));", table.IsEnumFlags (c_type) ? "true" : "false");
|
||||||
} else if (table.IsBoxed (c_type)) {
|
} else if (table.IsBoxed (c_type)) {
|
||||||
sw.WriteLine("Handle, " + cname + ", new GLib.Boxed (value)));");
|
sw.WriteLine("(GLib.Value) (value));");
|
||||||
} else if (table.IsOpaque (c_type)) {
|
} else if (table.IsOpaque (c_type)) {
|
||||||
sw.WriteLine("Handle, " + cname + ", value));");
|
sw.WriteLine("new GLib.Value(Handle, " + cname + ", value));");
|
||||||
} else {
|
} else {
|
||||||
|
sw.Write("new GLib.Value(");
|
||||||
if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) {
|
if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) {
|
||||||
sw.Write(v_type + " ");
|
sw.Write(v_type + " ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,7 +208,13 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
public virtual void Generate (GenerationInfo gen_info)
|
public virtual void Generate (GenerationInfo gen_info)
|
||||||
{
|
{
|
||||||
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
bool need_close = false;
|
||||||
|
if (gen_info.Writer == null) {
|
||||||
|
gen_info.Writer = gen_info.OpenStream (Name);
|
||||||
|
need_close = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
StreamWriter sw = gen_info.Writer;
|
||||||
|
|
||||||
sw.WriteLine ("namespace " + NS + " {");
|
sw.WriteLine ("namespace " + NS + " {");
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
@ -227,6 +233,9 @@ namespace GtkSharp.Generation {
|
||||||
GenCtors (gen_info);
|
GenCtors (gen_info);
|
||||||
GenMethods (gen_info, null, null);
|
GenMethods (gen_info, null, null);
|
||||||
|
|
||||||
|
if (!need_close)
|
||||||
|
return;
|
||||||
|
|
||||||
sw.WriteLine ("#endregion");
|
sw.WriteLine ("#endregion");
|
||||||
AppendCustom(sw, gen_info.CustomDir);
|
AppendCustom(sw, gen_info.CustomDir);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue