2002-06-05 Mike Kestner <mkestner@speakeasy.net>
* generator/Property.cs : Fix get{} GLib.Value passing. * glib/Object.cs : GetProperty passes the GLib.Value now. * glib/Value.cs : Add a ctor to create Values for props. * glue/value.c : add gtksharp_value_create_from_property. svn path=/trunk/gtk-sharp/; revision=5133
This commit is contained in:
parent
1129bd2e78
commit
e1b9f7343a
5 changed files with 41 additions and 11 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2002-06-05 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* generator/Property.cs : Fix get{} GLib.Value passing.
|
||||||
|
* glib/Object.cs : GetProperty passes the GLib.Value now.
|
||||||
|
* glib/Value.cs : Add a ctor to create Values for props.
|
||||||
|
* glue/value.cs : add gtksharp_value_create_from_property.
|
||||||
|
|
||||||
2002-05-29 Mike Kestner <mkestner@speakeasy.net>
|
2002-05-29 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
* */Makefile.in : remove generated source in clean target.
|
* */Makefile.in : remove generated source in clean target.
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace GtkSharp.Generation {
|
||||||
if (name == parent.GetAttribute("name")) {
|
if (name == parent.GetAttribute("name")) {
|
||||||
name += "Prop";
|
name += "Prop";
|
||||||
}
|
}
|
||||||
|
string cname = "\"" + elem.GetAttribute("cname") + "\"";
|
||||||
|
|
||||||
string v_type = "";
|
string v_type = "";
|
||||||
if (SymbolTable.IsEnum(c_type)) {
|
if (SymbolTable.IsEnum(c_type)) {
|
||||||
|
@ -71,8 +72,8 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine("\t\tpublic " + cs_type + " " + name + " {");
|
sw.WriteLine("\t\tpublic " + cs_type + " " + name + " {");
|
||||||
if (elem.HasAttribute("readable")) {
|
if (elem.HasAttribute("readable")) {
|
||||||
sw.WriteLine("\t\t\tget {");
|
sw.WriteLine("\t\t\tget {");
|
||||||
sw.WriteLine("\t\t\t\tGLib.Value val;");
|
sw.WriteLine("\t\t\t\tGLib.Value val = new GLib.Value (Handle, " + cname + ");");
|
||||||
sw.WriteLine("\t\t\t\tGetProperty(\"" + elem.GetAttribute("cname") + "\", out val);");
|
sw.WriteLine("\t\t\t\tGetProperty(" + cname + ", val);");
|
||||||
sw.Write("\t\t\t\treturn (" + cs_type + ") ");
|
sw.Write("\t\t\t\treturn (" + cs_type + ") ");
|
||||||
if (v_type != "") {
|
if (v_type != "") {
|
||||||
sw.Write("(" + v_type + ") ");
|
sw.Write("(" + v_type + ") ");
|
||||||
|
@ -83,7 +84,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
if (elem.HasAttribute("writeable") && !elem.HasAttribute("construct-only")) {
|
if (elem.HasAttribute("writeable") && !elem.HasAttribute("construct-only")) {
|
||||||
sw.WriteLine("\t\t\tset {");
|
sw.WriteLine("\t\t\tset {");
|
||||||
sw.Write("\t\t\t\tSetProperty(\"" + elem.GetAttribute("cname") + "\", new GLib.Value(");
|
sw.Write("\t\t\t\tSetProperty(" + cname + ", new GLib.Value(");
|
||||||
if (v_type != "") {
|
if (v_type != "") {
|
||||||
sw.Write("(" + v_type + ") ");
|
sw.Write("(" + v_type + ") ");
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,10 @@ namespace GLib {
|
||||||
/// Accesses arbitrary data storage on the Object.
|
/// Accesses arbitrary data storage on the Object.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public object GetData (String key)
|
public object GetData (string key)
|
||||||
{
|
{
|
||||||
if (Data == null)
|
if (Data == null)
|
||||||
return null;
|
return String.Empty;
|
||||||
|
|
||||||
return Data [key];
|
return Data [key];
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ namespace GLib {
|
||||||
/// Stores arbitrary data on the Object.
|
/// Stores arbitrary data on the Object.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public void SetData (String key, object val)
|
public void SetData (string key, object val)
|
||||||
{
|
{
|
||||||
if (Data == null)
|
if (Data == null)
|
||||||
Data = new Hashtable ();
|
Data = new Hashtable ();
|
||||||
|
@ -199,13 +199,11 @@ namespace GLib {
|
||||||
|
|
||||||
[DllImport("gobject-2.0")]
|
[DllImport("gobject-2.0")]
|
||||||
static extern void g_object_get_property (
|
static extern void g_object_get_property (
|
||||||
IntPtr obj, string name, out IntPtr val);
|
IntPtr obj, string name, IntPtr val);
|
||||||
|
|
||||||
public void GetProperty (String name, out GLib.Value val)
|
public void GetProperty (String name, GLib.Value val)
|
||||||
{
|
{
|
||||||
IntPtr v;
|
g_object_get_property (Raw, name, val.Handle);
|
||||||
g_object_get_property (Raw, name, out v);
|
|
||||||
val = new GLib.Value (v, v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -40,6 +40,9 @@ namespace GLib {
|
||||||
[DllImport("gtksharpglue")]
|
[DllImport("gtksharpglue")]
|
||||||
static extern IntPtr gtksharp_value_create(TypeFundamentals type);
|
static extern IntPtr gtksharp_value_create(TypeFundamentals type);
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_value_create_from_property(IntPtr obj, string name);
|
||||||
|
|
||||||
// Constructor to wrap a raw GValue ref. We need the dummy param
|
// Constructor to wrap a raw GValue ref. We need the dummy param
|
||||||
// to distinguish this ctor from the TypePointer ctor.
|
// to distinguish this ctor from the TypePointer ctor.
|
||||||
|
|
||||||
|
@ -48,6 +51,20 @@ namespace GLib {
|
||||||
_val = val;
|
_val = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value Constructor
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Constructs a Value corresponding to the type of the
|
||||||
|
/// specified property.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public Value (IntPtr obj, string prop_name)
|
||||||
|
{
|
||||||
|
_val = gtksharp_value_create_from_property (obj, prop_name);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Value Constructor
|
/// Value Constructor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -15,4 +15,11 @@ gtksharp_value_create (GType g_type)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GValue *
|
||||||
|
gtksharp_value_create_from_property (GObject *obj, const gchar* name)
|
||||||
|
{
|
||||||
|
GParamSpec *spec = g_object_class_find_property (
|
||||||
|
G_OBJECT_GET_CLASS (obj), name);
|
||||||
|
return gtksharp_value_create (spec->value_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue