* generator/ClassBase.cs:
* generator/ObjectGen.cs: Move child property handling from ClassBase to ObjectGen (as suggested by Mike) since it's only used there svn path=/trunk/gtk-sharp/; revision=36398
This commit is contained in:
parent
69eabbd1a3
commit
30cc0b8109
3 changed files with 46 additions and 39 deletions
|
@ -1,3 +1,10 @@
|
|||
2004-11-22 Dan Winship <danw@novell.com>
|
||||
|
||||
* generator/ClassBase.cs:
|
||||
* generator/ObjectGen.cs: Move child property handling from
|
||||
ClassBase to ObjectGen (as suggested by Mike) since it's only
|
||||
used there
|
||||
|
||||
2004-11-18 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/InterfaceGen.cs : beginnings of a real
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public class ClassBase : GenBase {
|
||||
protected Hashtable props = new Hashtable();
|
||||
protected Hashtable childprops = new Hashtable();
|
||||
protected Hashtable sigs = new Hashtable();
|
||||
protected Hashtable methods = new Hashtable();
|
||||
protected ArrayList interfaces = null;
|
||||
|
@ -94,13 +93,6 @@ namespace GtkSharp.Generation {
|
|||
props.Add (name, new Property (member, this));
|
||||
break;
|
||||
|
||||
case "childprop":
|
||||
name = member.GetAttribute("name");
|
||||
while (props.ContainsKey(name))
|
||||
name += "mangled";
|
||||
childprops.Add (name, new ChildProperty (member, this));
|
||||
break;
|
||||
|
||||
case "signal":
|
||||
name = member.GetAttribute("name");
|
||||
while (sigs.ContainsKey(name))
|
||||
|
@ -139,7 +131,6 @@ namespace GtkSharp.Generation {
|
|||
switch (name) {
|
||||
case "method":
|
||||
case "property":
|
||||
case "childprop":
|
||||
case "signal":
|
||||
case "implements":
|
||||
case "constructor":
|
||||
|
@ -214,36 +205,6 @@ namespace GtkSharp.Generation {
|
|||
}
|
||||
}
|
||||
|
||||
protected void GenChildProperties (GenerationInfo gen_info)
|
||||
{
|
||||
if (childprops.Count == 0)
|
||||
return;
|
||||
|
||||
StreamWriter sw = gen_info.Writer;
|
||||
|
||||
sw.WriteLine ("\t\tpublic class " + Name + "Child : Gtk.Container.ContainerChild {");
|
||||
sw.WriteLine ("\t\t\tinternal " + Name + "Child (Gtk.Container parent, Gtk.Widget child) : base (parent, child) {}");
|
||||
sw.WriteLine ("");
|
||||
|
||||
foreach (ChildProperty prop in childprops.Values) {
|
||||
if (prop.Validate ())
|
||||
prop.Generate (gen_info, "\t\t\t");
|
||||
else
|
||||
Console.WriteLine("in Object " + QualifiedName);
|
||||
}
|
||||
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ("");
|
||||
|
||||
sw.WriteLine ("\t\tpublic override Gtk.Container.ContainerChild this [Gtk.Widget child] {");
|
||||
sw.WriteLine ("\t\t\tget {");
|
||||
sw.WriteLine ("\t\t\t\treturn new " + Name + "Child (this, child);");
|
||||
sw.WriteLine ("\t\t\t}");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ("");
|
||||
|
||||
}
|
||||
|
||||
public void GenSignals (GenerationInfo gen_info, ClassBase implementor)
|
||||
{
|
||||
if (sigs == null)
|
||||
|
|
|
@ -32,11 +32,13 @@ namespace GtkSharp.Generation {
|
|||
|
||||
private ArrayList strings = new ArrayList();
|
||||
private ArrayList vm_nodes = new ArrayList();
|
||||
private Hashtable childprops = new Hashtable();
|
||||
private static Hashtable dirs = new Hashtable ();
|
||||
|
||||
public ObjectGen (XmlElement ns, XmlElement elem) : base (ns, elem)
|
||||
{
|
||||
foreach (XmlNode node in elem.ChildNodes) {
|
||||
string name;
|
||||
|
||||
if (!(node is XmlElement)) continue;
|
||||
XmlElement member = (XmlElement) node;
|
||||
|
@ -55,6 +57,13 @@ namespace GtkSharp.Generation {
|
|||
strings.Add (node);
|
||||
break;
|
||||
|
||||
case "childprop":
|
||||
name = member.GetAttribute ("name");
|
||||
while (childprops.ContainsKey (name))
|
||||
name += "mangled";
|
||||
childprops.Add (name, new ChildProperty (member, this));
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!IsNodeNameHandled (node.Name))
|
||||
Console.WriteLine ("Unexpected node " + node.Name + " in " + CName);
|
||||
|
@ -247,6 +256,36 @@ namespace GtkSharp.Generation {
|
|||
base.GenCtors (gen_info);
|
||||
}
|
||||
|
||||
protected void GenChildProperties (GenerationInfo gen_info)
|
||||
{
|
||||
if (childprops.Count == 0)
|
||||
return;
|
||||
|
||||
StreamWriter sw = gen_info.Writer;
|
||||
|
||||
sw.WriteLine ("\t\tpublic class " + Name + "Child : Gtk.Container.ContainerChild {");
|
||||
sw.WriteLine ("\t\t\tinternal " + Name + "Child (Gtk.Container parent, Gtk.Widget child) : base (parent, child) {}");
|
||||
sw.WriteLine ("");
|
||||
|
||||
foreach (ChildProperty prop in childprops.Values) {
|
||||
if (prop.Validate ())
|
||||
prop.Generate (gen_info, "\t\t\t");
|
||||
else
|
||||
Console.WriteLine("in Object " + QualifiedName);
|
||||
}
|
||||
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ("");
|
||||
|
||||
sw.WriteLine ("\t\tpublic override Gtk.Container.ContainerChild this [Gtk.Widget child] {");
|
||||
sw.WriteLine ("\t\t\tget {");
|
||||
sw.WriteLine ("\t\t\t\treturn new " + Name + "Child (this, child);");
|
||||
sw.WriteLine ("\t\t\t}");
|
||||
sw.WriteLine ("\t\t}");
|
||||
sw.WriteLine ("");
|
||||
|
||||
}
|
||||
|
||||
private void GenVMGlue (GenerationInfo gen_info, XmlElement elem)
|
||||
{
|
||||
StreamWriter sw = gen_info.GlueWriter;
|
||||
|
|
Loading…
Reference in a new issue