2002-07-26 06:08:52 +00:00
|
|
|
// GtkSharp.Generation.BoxedGen.cs - The Boxed Generatable.
|
2002-01-17 00:26:46 +00:00
|
|
|
//
|
|
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
2002-07-26 06:08:52 +00:00
|
|
|
// (c) 2001 Mike Kestner
|
2002-01-17 00:26:46 +00:00
|
|
|
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
public class BoxedGen : StructBase, IGeneratable {
|
|
|
|
|
2002-06-21 20:25:43 +00:00
|
|
|
public BoxedGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
2002-01-17 00:26:46 +00:00
|
|
|
|
2003-10-05 00:20:17 +00:00
|
|
|
public void Generate ()
|
2002-02-08 23:56:27 +00:00
|
|
|
{
|
2003-10-05 00:20:17 +00:00
|
|
|
GenerationInfo gen_info = new GenerationInfo (NSElem);
|
|
|
|
Generate (gen_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void Generate (GenerationInfo gen_info)
|
|
|
|
{
|
2003-10-28 15:45:35 +00:00
|
|
|
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
2003-10-05 00:20:17 +00:00
|
|
|
base.Generate (gen_info);
|
2003-10-28 15:45:35 +00:00
|
|
|
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;
|
2002-02-19 03:12:47 +00:00
|
|
|
Statistics.BoxedCount++;
|
2002-01-17 00:26:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|