mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 02:25:37 +00:00
9877690874
* generator/InterfaceGen.cs (Generate): gen the EventHandlers for sigs * generator/Signal.cs (GetHandlerName): kill this and split it into EventHandlerName and EventHandlerArgsName props instead of the ugly out param hack. (GenEventHandler): make public void and add gen_info param. open stream with gen_info. use new *Name props. (Generate): only gen the EventHandler if we're genning the container, not for implementors. svn path=/trunk/gtk-sharp/; revision=18684
62 lines
1.4 KiB
C#
62 lines
1.4 KiB
C#
// GtkSharp.Generation.InterfaceGen.cs - The Interface Generatable.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001-2002 Mike Kestner
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
public class InterfaceGen : ClassBase, IGeneratable {
|
|
|
|
public InterfaceGen (XmlElement ns, XmlElement elem) : base (ns, elem) {}
|
|
|
|
public void Generate ()
|
|
{
|
|
GenerationInfo gen_info = new GenerationInfo (NSElem);
|
|
Generate (gen_info);
|
|
}
|
|
|
|
public void Generate (GenerationInfo gen_info)
|
|
{
|
|
StreamWriter sw = gen_info.Writer = gen_info.OpenStream (Name);
|
|
|
|
sw.WriteLine ("namespace " + NS + " {");
|
|
sw.WriteLine ();
|
|
sw.WriteLine ("\tusing System;");
|
|
sw.WriteLine ();
|
|
sw.WriteLine ("#region Autogenerated code");
|
|
sw.WriteLine ("\tpublic interface " + Name + " : GLib.IWrapper {");
|
|
sw.WriteLine ();
|
|
|
|
foreach (Signal sig in sigs.Values) {
|
|
if (sig.Validate ()) {
|
|
sig.GenerateDecl (sw);
|
|
sig.GenEventHandler (gen_info);
|
|
}
|
|
}
|
|
|
|
foreach (Method method in methods.Values) {
|
|
if (IgnoreMethod (method))
|
|
continue;
|
|
|
|
if (method.Validate ())
|
|
method.GenerateDecl (sw);
|
|
}
|
|
|
|
AppendCustom (sw, gen_info.CustomDir);
|
|
|
|
sw.WriteLine ("\t}");
|
|
sw.WriteLine ("#endregion");
|
|
sw.WriteLine ("}");
|
|
sw.Close ();
|
|
gen_info.Writer = null;
|
|
Statistics.IFaceCount++;
|
|
}
|
|
}
|
|
}
|
|
|