2002-02-03 03:44:10 +00:00
|
|
|
// SList.cs - GSList class wrapper implementation
|
|
|
|
//
|
|
|
|
// Authors: Mike Kestner <mkestner@speakeasy.net>
|
|
|
|
//
|
|
|
|
// (c) 2002 Mike Kestner
|
|
|
|
|
|
|
|
namespace GLib {
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// SList Class
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
|
|
|
/// Wrapper class for GSList.
|
|
|
|
/// </remarks>
|
|
|
|
|
2002-04-19 16:17:47 +00:00
|
|
|
public class SList : ArrayList {
|
2002-02-03 03:44:10 +00:00
|
|
|
|
2002-04-25 09:17:54 +00:00
|
|
|
private IntPtr list_ptr;
|
|
|
|
|
|
|
|
[DllImport("gobject-2.0")]
|
|
|
|
static extern void g_slist_free(IntPtr l);
|
|
|
|
|
|
|
|
~SList ()
|
|
|
|
{
|
|
|
|
if (list_ptr != IntPtr.Zero)
|
|
|
|
g_slist_free (list_ptr);
|
|
|
|
}
|
|
|
|
|
2002-06-23 18:49:33 +00:00
|
|
|
[DllImport("gobject-2.0")]
|
|
|
|
static extern IntPtr g_slist_append(IntPtr l, IntPtr d);
|
|
|
|
|
2002-02-03 03:44:10 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Handle Property
|
|
|
|
/// </summary>
|
|
|
|
///
|
|
|
|
/// <remarks>
|
2002-04-19 16:17:47 +00:00
|
|
|
/// A raw GSList reference for marshaling situations.
|
2002-02-03 03:44:10 +00:00
|
|
|
/// </remarks>
|
|
|
|
|
2002-04-19 16:17:47 +00:00
|
|
|
public IntPtr Handle {
|
2002-02-03 03:44:10 +00:00
|
|
|
get {
|
2002-04-25 09:17:54 +00:00
|
|
|
if (list_ptr != IntPtr.Zero)
|
|
|
|
g_slist_free (list_ptr);
|
|
|
|
|
2002-04-19 16:17:47 +00:00
|
|
|
IntPtr l = IntPtr.Zero;
|
|
|
|
foreach (object o in this) {
|
|
|
|
IntPtr data = IntPtr.Zero;
|
|
|
|
if (o is GLib.Object)
|
|
|
|
l = g_slist_append (l, ((GLib.Object)o).Handle);
|
|
|
|
else
|
|
|
|
throw new Exception();
|
2002-02-03 03:44:10 +00:00
|
|
|
}
|
2002-04-25 09:17:54 +00:00
|
|
|
|
|
|
|
list_ptr = l;
|
2002-04-19 16:17:47 +00:00
|
|
|
return l;
|
2002-02-03 03:44:10 +00:00
|
|
|
}
|
|
|
|
}
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* configure.in, makefile, makefile.win32: add gnome.
* doc/index.html, netdoc.xsl: Add gnome.
* gdk/Event.cs: New manual wrap for GdkEvent.
* generator/ClassBase.cs: Add methods GetProperty,
GetPropertyRecursively, GetMethodRecursively.
Move Parent property here from ObjectGen.cs. Pass this pointer
into Property.
* generator/Ctor.cs: Generate docs.
* generator/Method.cs, Property.cs: Tag method as "new" if a
Method/Property with the same name is found in the class hierarchy.
* generator/SignalHandler.cs: Correctly wrap complex signal argument
types. Add gnome directory.
* generator/SymbolTable.cs: Add manually wrapped types hash
(contains GLib.GSList and Gdk.Event). Add method IsManuallyWrapped.
* glib/SList.cs: Add constructor from IntPtr.
* glue/slist.c, glue/event.c: Added (field accessor glue).
* glue/Makefile.am: Update.
* parser/Gtk.metadata: Add new signal renames for new signals
exposed by GdkEvent changes.
* parser/README, parser/build.pl: Add libgnome, libgnomecanvas,
libgnomeui.
* parser/gapi2xml.pl: Handle literal-length array parameters,
and NULL property doc strings.
* sample/: Add new test GnomeHelloWorld.cs.
* gnome/: Added.
* parser/Gnome.metadata: Added.
svn path=/trunk/gtk-sharp/; revision=5461
2002-06-26 08:36:05 +00:00
|
|
|
|
|
|
|
[DllImport("gtksharp")]
|
|
|
|
static extern IntPtr gtksharp_slist_get_data (IntPtr l);
|
|
|
|
[DllImport("gtksharp")]
|
|
|
|
static extern IntPtr gtksharp_slist_get_next (IntPtr l);
|
|
|
|
|
|
|
|
public SList (IntPtr raw)
|
|
|
|
{
|
|
|
|
IntPtr l = raw;
|
|
|
|
while (l != IntPtr.Zero) {
|
|
|
|
Add (gtksharp_slist_get_data (l));
|
|
|
|
l = gtksharp_slist_get_next (l);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-03 03:44:10 +00:00
|
|
|
}
|
|
|
|
}
|