mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
![Rachel Hestilow](/assets/img/avatar_default.png)
* parser/Gnome.metadata, Gtk.metadata: More conflict fixes. * parser/build.pl: Fully qualify all lib names. (Gtk+ packages are now LFS-compliant in Debian...) * parser/gapi2xml.pl: Fix for whitespace in fields, defines, and docs. * generator/BoxedGen.cs: Remove extraneous CallByName definition, add "override" keyword to FromNative. (Generate): Generate methods after fields. * generator/ClassBase.cs: Change CallByName, FromNative to virtual. (.ctor): Ignore "hidden" nodes. Set container on signal. (GenSignals, GenMethods): Add "implementor" argument for interface use. (Get(Method|Signal|Property)Recursively): Rework to correctly recurse interfaces. (Implements): Added. * generator/Ctor.cs (Initialize): Move clash initialization completely out of Generate, so we can check for collisions. * generator/Method.cs (GenerateDeclCommon): Check for duplicates, for "new" keyword. (Generate): Add "implementor" argument. * generator/ObjectGen.cs (Generate): Initialize ctor clashes on this and all parents, before generating. (Ctors, InitializeCtors): Added. * generator/Signal.cs: Store the container_type, check for collisions. * generator/StructGen.cs: Add "override" keyword to overriden methods. * gtk/FileSelection.custom (ActionArea): Add "new" keyword. svn path=/trunk/gtk-sharp/; revision=5782
97 lines
2.6 KiB
C#
97 lines
2.6 KiB
C#
// GtkSharp.Generation.Signal.cs - The Signal Generatable.
|
|
//
|
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
//
|
|
// (c) 2001-2002 Mike Kestner
|
|
|
|
namespace GtkSharp.Generation {
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
public class Signal {
|
|
|
|
private string marsh;
|
|
private string name;
|
|
private XmlElement elem;
|
|
private ClassBase container_type;
|
|
|
|
public Signal (XmlElement elem, ClassBase container_type)
|
|
{
|
|
this.elem = elem;
|
|
this.name = elem.GetAttribute ("name");
|
|
this.container_type = container_type;
|
|
}
|
|
|
|
public string Name {
|
|
get {
|
|
return name;
|
|
}
|
|
set {
|
|
name = value;
|
|
}
|
|
}
|
|
|
|
public bool Validate ()
|
|
{
|
|
marsh = SignalHandler.GetName(elem);
|
|
if ((Name == "") || (marsh == "")) {
|
|
Console.Write ("bad signal " + Name);
|
|
Statistics.ThrottledCount++;
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public void GenerateDecl (StreamWriter sw)
|
|
{
|
|
GenComments (sw);
|
|
if (elem.HasAttribute("new_flag") || (container_type != null && container_type.GetSignalRecursively (Name) != null))
|
|
sw.Write("new ");
|
|
|
|
sw.WriteLine ("\t\tevent EventHandler " + Name + ";");
|
|
}
|
|
|
|
public void GenComments (StreamWriter sw)
|
|
{
|
|
sw.WriteLine();
|
|
sw.WriteLine("\t\t/// <summary> " + Name + " Event </summary>");
|
|
sw.WriteLine("\t\t/// <remarks>");
|
|
// FIXME: Generate some signal docs
|
|
sw.WriteLine("\t\t/// </remarks>");
|
|
}
|
|
|
|
public void Generate (StreamWriter sw, ClassBase implementor, bool gen_docs)
|
|
{
|
|
string cname = "\"" + elem.GetAttribute("cname") + "\"";
|
|
marsh = "GtkSharp." + marsh;
|
|
|
|
if (gen_docs)
|
|
GenComments (sw);
|
|
sw.Write("\t\tpublic ");
|
|
if (elem.HasAttribute("new_flag") || (container_type != null && container_type.GetSignalRecursively (Name) != null) || (implementor != null && implementor.GetSignalRecursively (Name) != null))
|
|
sw.Write("new ");
|
|
sw.WriteLine("event EventHandler " + Name + " {");
|
|
sw.WriteLine("\t\t\tadd {");
|
|
sw.WriteLine("\t\t\t\tif (EventList[" + cname + "] == null)");
|
|
sw.Write("\t\t\t\t\tSignals[" + cname + "] = new " + marsh);
|
|
sw.WriteLine("(this, Handle, " + cname + ", value);");
|
|
sw.WriteLine("\t\t\t\tEventList.AddHandler(" + cname + ", value);");
|
|
sw.WriteLine("\t\t\t}");
|
|
sw.WriteLine("\t\t\tremove {");
|
|
sw.WriteLine("\t\t\t\tEventList.RemoveHandler(" + cname + ", value);");
|
|
sw.WriteLine("\t\t\t\tif (EventList[" + cname + "] == null)");
|
|
sw.WriteLine("\t\t\t\t\tSignals.Remove(" + cname + ");");
|
|
sw.WriteLine("\t\t\t}");
|
|
sw.WriteLine("\t\t}");
|
|
sw.WriteLine();
|
|
|
|
Statistics.SignalCount++;
|
|
}
|
|
}
|
|
}
|
|
|