Ryujinx-GtkSharp/glib/Value.cs
Mike Kestner 91c58501fa 2001-09-19 Mike Kestner <mkestner@speakeasy.net>
* HACKING : New rulez.
	* NOTES: Killed.  We have a mailing list now for this kind of stuff.
	* glib/makefile : New, to build the new glib-sharp.dll target.
	* glib/Object.cs : (GetObject): Commented out. Design problems here.
	IntPtr's can't be used in the manner this code attempts to use them.
	(Data prop): Commented out.  Apparently keyed properties are not
	supported.
	(Object prop): Renamed RawObject, and made it protected.
	(Events): Fixed to cause list to be initialized if null and then
	return the list.
	* glib/ObjectManager.cs : commented out entirely.  Not sure what this
	code is trying to accomplish and it doesn't compile.
	* glib/Value.cs : New attempt at implementing GValues. Doesn't work
	yet.
	* gtk/Button.cs : Updated to use RawObject.
	(Clicked event): s/EmitDeleteEvent/EmitClickedEvent.
	(Button(String)): s/gtk_label_new_with_lable/gtk_button_new_with_label.
	* gtk/Label.cs : Fixed some yank and paste errors where 2 value params
	were getting passed to all the set_* property methods.
	* gtk/Window.cs : Fixed hanging GTK namespace ref.
	* sample/HelloWorld.cs : Fixed hanging GTK namespace ref.

svn path=/trunk/gtk-sharp/; revision=884
2001-09-19 11:37:15 +00:00

78 lines
1.5 KiB
C#
Executable File

// GLib.GValue.cs - GLib Value class implementation
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace GLib {
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct GValueStruct {
uint type;
IntPtr data1;
IntPtr data2;
IntPtr data3;
IntPtr data4;
}
public class GValue {
GValueStruct _val;
/// <summary>
/// GValue Constructor
/// </summary>
///
/// <remarks>
/// Constructs a GValue from a string.
/// </remarks>
[DllImport("gobject-1.3")]
static extern void g_value_set_string (ref GValueStruct val,
String data);
public GValue (String data)
{
g_value_set_string (ref _val, data);
}
/// <summary>
/// GetString Method
/// </summary>
///
/// <remarks>
/// Extracts a string from a GValue. Note, this method
/// will produce an exception if the GValue does not hold a
/// string value.
/// </remarks>
[DllImport("gobject-1.3")]
static extern String g_value_get_string (ref GValueStruct val);
public String GetString ()
{
// FIXME: Insert an appropriate exception here if
// _val.type indicates an error.
return g_value_get_string (ref _val);
}
/// <summary>
/// ValueStruct Property
/// </summary>
///
/// <remarks>
/// Accesses a structure which can be easily marshalled
/// via PInvoke to set properties on GObjects.
/// </remarks>
public GValueStruct ValueStruct {
get {
return _val;
}
}
}
}