* generator/ChildProperty.cs:

* generator/Property.cs: Fix child property names.

svn path=/trunk/gtk-sharp/; revision=35835
This commit is contained in:
Dan Winship 2004-11-08 17:48:27 +00:00
parent cb30686a86
commit 9084ce3133
3 changed files with 31 additions and 15 deletions

View file

@ -1,3 +1,8 @@
2004-11-08 Dan Winship <danw@novell.com>
* generator/ChildProperty.cs:
* generator/Property.cs: Fix child property names.
2004-11-07 Jeroen Zwartepoorte <jeroen@xs4all.nl>
* gtk/Gtk.metadata: Fix some TreeModelFilter stuff (similar to

View file

@ -28,24 +28,31 @@ namespace GtkSharp.Generation {
public ChildProperty (XmlElement elem, ClassBase container_type) : base (elem, container_type) {}
protected override string QuotedPropertyName (string cname) {
if (cname.StartsWith ("child_"))
return "\"" + cname.Substring (6) + "\"";
else
return "\"" + cname + "\"";
}
protected override string PropertyHeader (ref string indent, string modifiers, string cs_type, string name) {
return "";
}
protected override string GetterHeader (string modifiers, string cs_type, string name) {
return "public " + modifiers + cs_type + " Get" + name + " (Widget w)";
return "public " + modifiers + cs_type + " Get" + name + " (Widget child)";
}
protected override string RawGetter (string cname) {
return "ChildGetProperty (w, " + cname + ")";
protected override string RawGetter (string qpname) {
return "ChildGetProperty (child, " + qpname + ")";
}
protected override string SetterHeader (string modifiers, string cs_type, string name) {
return "public " + modifiers + "void Set" + name + " (Widget w, " + cs_type + " value)";
return "public " + modifiers + "void Set" + name + " (Widget child, " + cs_type + " value)";
}
protected override string RawSetter (string cname) {
return "ChildSetProperty(w, " + cname + ", val)";
protected override string RawSetter (string qpname) {
return "ChildSetProperty(child, " + qpname + ", val)";
}
protected override string PropertyFooter (string indent) {

View file

@ -66,6 +66,10 @@ namespace GtkSharp.Generation {
return true;
}
protected virtual string QuotedPropertyName (string cname) {
return "\"" + cname + "\"";
}
protected virtual string PropertyHeader (ref string indent, string modifiers, string cs_type, string name) {
string header;
@ -78,16 +82,16 @@ namespace GtkSharp.Generation {
return "get";
}
protected virtual string RawGetter (string cname) {
return "GetProperty (" + cname + ")";
protected virtual string RawGetter (string qpname) {
return "GetProperty (" + qpname + ")";
}
protected virtual string SetterHeader (string modifiers, string cs_type, string name) {
return "set";
}
protected virtual string RawSetter (string cname) {
return "SetProperty(" + cname + ", val)";
protected virtual string RawSetter (string qpname) {
return "SetProperty(" + qpname + ", val)";
}
protected virtual string PropertyFooter (string indent) {
@ -111,7 +115,7 @@ namespace GtkSharp.Generation {
if (name == container_type.Name) {
name += "Prop";
}
string cname = "\"" + elem.GetAttribute("cname") + "\"";
string qpname = QuotedPropertyName (elem.GetAttribute("cname"));
string v_type = "";
if (table.IsEnum(c_type)) {
@ -177,7 +181,7 @@ namespace GtkSharp.Generation {
sw.WriteLine();
} else if (elem.HasAttribute("readable")) {
sw.WriteLine(indent + GetterHeader (modifiers, cs_type, name) + " {");
sw.WriteLine(indent + "\tGLib.Value val = " + RawGetter (cname) + ";");
sw.WriteLine(indent + "\tGLib.Value val = " + RawGetter (qpname) + ";");
if (table.IsObject (c_type)) {
sw.WriteLine(indent + "\tSystem.IntPtr raw_ret = (System.IntPtr) {0} val;", v_type);
sw.WriteLine(indent + "\t" + cs_type + " ret = " + table.FromNativeReturn(c_type, "raw_ret") + ";");
@ -207,11 +211,11 @@ namespace GtkSharp.Generation {
sw.WriteLine(indent + SetterHeader (modifiers, cs_type, name) + " {");
sw.Write(indent + "\tGLib.Value val = ");
if (table.IsEnum(c_type)) {
sw.WriteLine("new GLib.Value(this, " + cname + ", new GLib.EnumWrapper ((int) value, {0}));", table.IsEnumFlags (c_type) ? "true" : "false");
sw.WriteLine("new GLib.Value(this, " + qpname + ", new GLib.EnumWrapper ((int) value, {0}));", table.IsEnumFlags (c_type) ? "true" : "false");
} else if (table.IsBoxed (c_type)) {
sw.WriteLine("(GLib.Value) value;");
} else if (table.IsOpaque (c_type)) {
sw.WriteLine("new GLib.Value(Handle, " + cname + ", value);");
sw.WriteLine("new GLib.Value(Handle, " + qpname + ", value);");
} else {
sw.Write("new GLib.Value(");
if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) {
@ -219,7 +223,7 @@ namespace GtkSharp.Generation {
}
sw.WriteLine("value);");
}
sw.WriteLine(indent + "\t" + RawSetter (cname) + ";");
sw.WriteLine(indent + "\t" + RawSetter (qpname) + ";");
sw.WriteLine(indent + "\tval.Dispose ();");
sw.WriteLine(indent + "}");
}