mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-08 07:53:17 +02:00
* glib/Value.cs: add new constructors for enum and boxed values
that take the name of the type rather than an object/property name pair; this way they work for both GObject properties and GtkContainer child properties. * glib/glue/value.c (gtksharp_value_create_from_type_name): glue for that * glib/Opaque.cs (GetOpaque): Fix this. * generator/Property.cs (Generate): Use the new GLib.Value constructors. (Fixes setting of enum-valued child properties.) svn path=/trunk/gtk-sharp/; revision=36174
This commit is contained in:
parent
acdb2f73da
commit
598f8e28e5
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2004-11-16 Dan Winship <danw@novell.com>
|
||||||
|
|
||||||
|
* glib/Value.cs: add new constructors for enum and boxed values
|
||||||
|
that take the name of the type rather than an object/property
|
||||||
|
name pair; this way they work for both GObject properties and
|
||||||
|
GtkContainer child properties.
|
||||||
|
|
||||||
|
* glib/glue/value.c (gtksharp_value_create_from_type_name): glue
|
||||||
|
for that
|
||||||
|
|
||||||
|
* glib/Opaque.cs (GetOpaque): Fix this.
|
||||||
|
|
||||||
|
* generator/Property.cs (Generate): Use the new GLib.Value
|
||||||
|
constructors. (Fixes setting of enum-valued child properties.)
|
||||||
|
|
||||||
2004-11-15 Dan Winship <danw@novell.com>
|
2004-11-15 Dan Winship <danw@novell.com>
|
||||||
|
|
||||||
* gtk/glue/container.c (gtksharp_container_get_focus_child): New
|
* gtk/glue/container.c (gtksharp_container_get_focus_child): New
|
||||||
|
@ -211,11 +211,11 @@ namespace GtkSharp.Generation {
|
|||||||
sw.WriteLine(indent + SetterHeader (modifiers, cs_type, name) + " {");
|
sw.WriteLine(indent + SetterHeader (modifiers, cs_type, name) + " {");
|
||||||
sw.Write(indent + "\tGLib.Value val = ");
|
sw.Write(indent + "\tGLib.Value val = ");
|
||||||
if (table.IsEnum(c_type)) {
|
if (table.IsEnum(c_type)) {
|
||||||
sw.WriteLine("new GLib.Value(this, " + qpname + ", new GLib.EnumWrapper ((int) value, {0}));", table.IsEnumFlags (c_type) ? "true" : "false");
|
sw.WriteLine("new GLib.Value(new GLib.EnumWrapper ((int) value, {0}), \"{1}\");", table.IsEnumFlags (c_type) ? "true" : "false", c_type);
|
||||||
} else if (table.IsBoxed (c_type)) {
|
} else if (table.IsBoxed (c_type)) {
|
||||||
sw.WriteLine("(GLib.Value) value;");
|
sw.WriteLine("(GLib.Value) value;");
|
||||||
} else if (table.IsOpaque (c_type)) {
|
} else if (table.IsOpaque (c_type)) {
|
||||||
sw.WriteLine("new GLib.Value(Handle, " + qpname + ", value);");
|
sw.WriteLine("new GLib.Value(value, \"{0}\");", c_type);
|
||||||
} else {
|
} else {
|
||||||
sw.Write("new GLib.Value(");
|
sw.Write("new GLib.Value(");
|
||||||
if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) {
|
if (v_type != "" && !(table.IsObject (c_type) || table.IsOpaque (c_type))) {
|
||||||
|
@ -54,7 +54,7 @@ namespace GLib {
|
|||||||
|
|
||||||
public static Opaque GetOpaque(IntPtr o)
|
public static Opaque GetOpaque(IntPtr o)
|
||||||
{
|
{
|
||||||
Opaque obj = (Opaque)Opaques[(int)o];
|
Opaque obj = (Opaque)Opaques[o];
|
||||||
if (obj != null) return obj;
|
if (obj != null) return obj;
|
||||||
return null; //FIXME: Call TypeParser here eventually.
|
return null; //FIXME: Call TypeParser here eventually.
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,9 @@ namespace GLib {
|
|||||||
[DllImport("glibsharpglue-2.0")]
|
[DllImport("glibsharpglue-2.0")]
|
||||||
static extern IntPtr gtksharp_value_create_from_type_and_property(ref GLib.Value val, IntPtr gtype, string name);
|
static extern IntPtr gtksharp_value_create_from_type_and_property(ref GLib.Value val, IntPtr gtype, string name);
|
||||||
|
|
||||||
|
[DllImport("glibsharpglue-2.0")]
|
||||||
|
static extern IntPtr gtksharp_value_create_from_type_name(ref GLib.Value val, string type_name);
|
||||||
|
|
||||||
public void Dispose ()
|
public void Dispose ()
|
||||||
{
|
{
|
||||||
g_value_unset (ref this);
|
g_value_unset (ref this);
|
||||||
@ -82,20 +85,15 @@ namespace GLib {
|
|||||||
[DllImport("libgobject-2.0-0.dll")]
|
[DllImport("libgobject-2.0-0.dll")]
|
||||||
static extern void g_value_set_boxed (ref Value val, IntPtr data);
|
static extern void g_value_set_boxed (ref Value val, IntPtr data);
|
||||||
|
|
||||||
/*
|
public Value (Opaque val, string type_name)
|
||||||
public Value (GLib.Boxed val)
|
|
||||||
{
|
{
|
||||||
_val = gtksharp_value_create(GType.Boxed);
|
type = IntPtr.Zero;
|
||||||
//g_value_set_boxed (_val, val.Handle);
|
pad_1 = pad_2 = 0;
|
||||||
|
gtksharp_value_create_from_type_name (ref this, type_name);
|
||||||
|
g_value_set_boxed (ref this, val.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Value (IntPtr obj, string prop_name, Boxed val)
|
[Obsolete]
|
||||||
{
|
|
||||||
_val = gtksharp_value_create_from_property (obj, prop_name);
|
|
||||||
//g_value_set_boxed (_val, val.Handle);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public Value (IntPtr obj, string prop_name, Opaque val)
|
public Value (IntPtr obj, string prop_name, Opaque val)
|
||||||
{
|
{
|
||||||
type = IntPtr.Zero;
|
type = IntPtr.Zero;
|
||||||
@ -172,6 +170,18 @@ namespace GLib {
|
|||||||
[DllImport("libgobject-2.0-0.dll")]
|
[DllImport("libgobject-2.0-0.dll")]
|
||||||
static extern void g_value_set_char (ref Value val, char data);
|
static extern void g_value_set_char (ref Value val, char data);
|
||||||
|
|
||||||
|
public Value (EnumWrapper wrap, string type_name)
|
||||||
|
{
|
||||||
|
type = IntPtr.Zero;
|
||||||
|
pad_1 = pad_2 = 0;
|
||||||
|
gtksharp_value_create_from_type_name (ref this, type_name);
|
||||||
|
if (wrap.flags)
|
||||||
|
g_value_set_flags (ref this, (uint) (int) wrap);
|
||||||
|
else
|
||||||
|
g_value_set_enum (ref this, (int) wrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
public Value (GLib.Object obj, string prop_name, EnumWrapper wrap)
|
public Value (GLib.Object obj, string prop_name, EnumWrapper wrap)
|
||||||
{
|
{
|
||||||
type = IntPtr.Zero;
|
type = IntPtr.Zero;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
void gtksharp_value_create_from_property (GValue *value, GObject *obj, const gchar* name);
|
void gtksharp_value_create_from_property (GValue *value, GObject *obj, const gchar* name);
|
||||||
void gtksharp_value_create_from_type_and_property (GValue *value, GType gtype, const gchar* name);
|
void gtksharp_value_create_from_type_and_property (GValue *value, GType gtype, const gchar* name);
|
||||||
|
void gtksharp_value_create_from_type_name (GValue *value, const gchar *type_name);
|
||||||
GType gtksharp_value_get_value_type (GValue *value);
|
GType gtksharp_value_get_value_type (GValue *value);
|
||||||
gboolean glibsharp_value_holds_flags (GValue *value);
|
gboolean glibsharp_value_holds_flags (GValue *value);
|
||||||
/* */
|
/* */
|
||||||
@ -42,6 +43,12 @@ gtksharp_value_create_from_type_and_property (GValue *value, GType gtype, const
|
|||||||
g_value_init (value, spec->value_type);
|
g_value_init (value, spec->value_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtksharp_value_create_from_type_name (GValue *value, const gchar *type_name)
|
||||||
|
{
|
||||||
|
g_value_init (value, g_type_from_name (type_name));
|
||||||
|
}
|
||||||
|
|
||||||
GType
|
GType
|
||||||
gtksharp_value_get_value_type (GValue *value)
|
gtksharp_value_get_value_type (GValue *value)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user