2002-08-31 Rachel Hestilow <hestilow@ximian.com>
Proper GList, GSList support. Read-only for now. * glue/list.c: Added. * glue/Makefile.am: Add list.c * glue/type.c: Add function gtksharp_is_object. * glib/ListBase.cs, List.cs: Added. * glib/SList.cs: Inherit from ListBase. * glib/Object.cs: Add static method "IsObject". * generator/Method.cs: Pass on element_type to constructor if specified. * generator/SymbolTable.cs: Move GList to manual types. * sample/GladeViewer.cs: Remove list hacks. * sources/Gnome.metadata: Specify element types for CanvasPathDef.Split and IconList.GetSelection. Rename CanvasPathDef *to methods to properly capitalized *To. * sources/Gtk.metadata: Hide Widget.ListAccelClosures until GClosure is handled properly. * sources/Pango.metadata: Added. * sample/test/TestToolbar.cs: Compile with recent delegate changes. svn path=/trunk/gtk-sharp/; revision=7166
This commit is contained in:
parent
a502336ccf
commit
c8d090f62f
18 changed files with 474 additions and 97 deletions
27
ChangeLog
27
ChangeLog
|
@ -1,3 +1,30 @@
|
||||||
|
2002-08-31 Rachel Hestilow <hestilow@ximian.com>
|
||||||
|
|
||||||
|
Proper GList, GSList support. Read-only for now.
|
||||||
|
|
||||||
|
* glue/list.c: Added.
|
||||||
|
* glue/Makefile.am: Add list.c
|
||||||
|
* glue/type.c: Add function gtksharp_is_object.
|
||||||
|
|
||||||
|
* glib/ListBase.cs, List.cs: Added.
|
||||||
|
* glib/SList.cs: Inherit from ListBase.
|
||||||
|
* glib/Object.cs: Add static method "IsObject".
|
||||||
|
|
||||||
|
* generator/Method.cs: Pass on element_type to constructor
|
||||||
|
if specified.
|
||||||
|
* generator/SymbolTable.cs: Move GList to manual types.
|
||||||
|
|
||||||
|
* sample/GladeViewer.cs: Remove list hacks.
|
||||||
|
|
||||||
|
* sources/Gnome.metadata: Specify element types for
|
||||||
|
CanvasPathDef.Split and IconList.GetSelection. Rename
|
||||||
|
CanvasPathDef *to methods to properly capitalized *To.
|
||||||
|
* sources/Gtk.metadata: Hide Widget.ListAccelClosures until
|
||||||
|
GClosure is handled properly.
|
||||||
|
* sources/Pango.metadata: Added.
|
||||||
|
|
||||||
|
* sample/test/TestToolbar.cs: Compile with recent delegate changes.
|
||||||
|
|
||||||
2002-08-31 Rachel Hestilow <hestilow@ximian.com>
|
2002-08-31 Rachel Hestilow <hestilow@ximian.com>
|
||||||
|
|
||||||
* glib/Idle.cs: Added.
|
* glib/Idle.cs: Added.
|
||||||
|
|
|
@ -1054,7 +1054,7 @@
|
||||||
<parameter type="ArtPoint*" name="p"/>
|
<parameter type="ArtPoint*" name="p"/>
|
||||||
</parameters>
|
</parameters>
|
||||||
</method>
|
</method>
|
||||||
<method name="Curveto" cname="gnome_canvas_path_def_curveto">
|
<method name="CurveTo" cname="gnome_canvas_path_def_curveto">
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter type="gdouble" name="x0"/>
|
<parameter type="gdouble" name="x0"/>
|
||||||
|
@ -1092,21 +1092,21 @@
|
||||||
<method name="Length" cname="gnome_canvas_path_def_length">
|
<method name="Length" cname="gnome_canvas_path_def_length">
|
||||||
<return-type type="gint"/>
|
<return-type type="gint"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="Lineto" cname="gnome_canvas_path_def_lineto">
|
<method name="LineTo" cname="gnome_canvas_path_def_lineto">
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter type="gdouble" name="x"/>
|
<parameter type="gdouble" name="x"/>
|
||||||
<parameter type="gdouble" name="y"/>
|
<parameter type="gdouble" name="y"/>
|
||||||
</parameters>
|
</parameters>
|
||||||
</method>
|
</method>
|
||||||
<method name="LinetoMoving" cname="gnome_canvas_path_def_lineto_moving">
|
<method name="LineToMoving" cname="gnome_canvas_path_def_lineto_moving">
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter type="gdouble" name="x"/>
|
<parameter type="gdouble" name="x"/>
|
||||||
<parameter type="gdouble" name="y"/>
|
<parameter type="gdouble" name="y"/>
|
||||||
</parameters>
|
</parameters>
|
||||||
</method>
|
</method>
|
||||||
<method name="Moveto" cname="gnome_canvas_path_def_moveto">
|
<method name="MoveTo" cname="gnome_canvas_path_def_moveto">
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
<parameters>
|
<parameters>
|
||||||
<parameter type="gdouble" name="x"/>
|
<parameter type="gdouble" name="x"/>
|
||||||
|
@ -1144,7 +1144,7 @@
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="Split" cname="gnome_canvas_path_def_split">
|
<method name="Split" cname="gnome_canvas_path_def_split">
|
||||||
<return-type type="GSList*"/>
|
<return-type type="GSList*" element_type="Gnome.CanvasPathDef"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="Unref" cname="gnome_canvas_path_def_unref">
|
<method name="Unref" cname="gnome_canvas_path_def_unref">
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
|
@ -3038,7 +3038,7 @@
|
||||||
<return-type type="guint"/>
|
<return-type type="guint"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="GetSelection" cname="gnome_icon_list_get_selection">
|
<method name="GetSelection" cname="gnome_icon_list_get_selection">
|
||||||
<return-type type="GList*"/>
|
<return-type type="GList*" element_type="int"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="GetSelectionMode" cname="gnome_icon_list_get_selection_mode">
|
<method name="GetSelectionMode" cname="gnome_icon_list_get_selection_mode">
|
||||||
<return-type type="GtkSelectionMode"/>
|
<return-type type="GtkSelectionMode"/>
|
||||||
|
|
|
@ -9525,7 +9525,7 @@
|
||||||
<method name="IsFocus" cname="gtk_widget_is_focus">
|
<method name="IsFocus" cname="gtk_widget_is_focus">
|
||||||
<return-type type="gboolean"/>
|
<return-type type="gboolean"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="ListAccelClosures" cname="gtk_widget_list_accel_closures">
|
<method name="ListAccelClosures" cname="gtk_widget_list_accel_closures" hidden="1">
|
||||||
<return-type type="GList*"/>
|
<return-type type="GList*"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="Map" cname="gtk_widget_map">
|
<method name="Map" cname="gtk_widget_map">
|
||||||
|
|
|
@ -351,7 +351,7 @@
|
||||||
<return-type type="int"/>
|
<return-type type="int"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="GetLines" cname="pango_layout_get_lines">
|
<method name="GetLines" cname="pango_layout_get_lines">
|
||||||
<return-type type="GSList*"/>
|
<return-type type="GSList*" element_type="Pango.LayoutLine"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="GetLogAttrs" cname="pango_layout_get_log_attrs">
|
<method name="GetLogAttrs" cname="pango_layout_get_log_attrs">
|
||||||
<return-type type="void"/>
|
<return-type type="void"/>
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace GtkSharp.Generation {
|
||||||
private bool initialized = false;
|
private bool initialized = false;
|
||||||
private string sig, isig, call;
|
private string sig, isig, call;
|
||||||
private string rettype, m_ret, s_ret;
|
private string rettype, m_ret, s_ret;
|
||||||
|
private string element_type = null;
|
||||||
private string name, cname, safety;
|
private string name, cname, safety;
|
||||||
private string protection = "public";
|
private string protection = "public";
|
||||||
private bool is_get, is_set;
|
private bool is_get, is_set;
|
||||||
|
@ -146,6 +147,8 @@ namespace GtkSharp.Generation {
|
||||||
m_ret = SymbolTable.GetMarshalReturnType(rettype);
|
m_ret = SymbolTable.GetMarshalReturnType(rettype);
|
||||||
s_ret = SymbolTable.GetCSType(rettype);
|
s_ret = SymbolTable.GetCSType(rettype);
|
||||||
cname = elem.GetAttribute("cname");
|
cname = elem.GetAttribute("cname");
|
||||||
|
if (ret_elem.HasAttribute("element_type"))
|
||||||
|
element_type = ret_elem.GetAttribute("element_type");
|
||||||
bool is_shared = elem.HasAttribute("shared");
|
bool is_shared = elem.HasAttribute("shared");
|
||||||
|
|
||||||
if (ret_elem.HasAttribute("array")) {
|
if (ret_elem.HasAttribute("array")) {
|
||||||
|
@ -390,7 +393,10 @@ namespace GtkSharp.Generation {
|
||||||
else {
|
else {
|
||||||
sw.WriteLine(m_ret + " raw_ret = " + cname + call + ";");
|
sw.WriteLine(m_ret + " raw_ret = " + cname + call + ";");
|
||||||
sw.Write(indent + "\t\t\t");
|
sw.Write(indent + "\t\t\t");
|
||||||
sw.WriteLine(s_ret + " ret = " + SymbolTable.FromNativeReturn(rettype, "raw_ret") + ";");
|
string raw_parms = "raw_ret";
|
||||||
|
if (element_type != null)
|
||||||
|
raw_parms += ", typeof (" + element_type + ")";
|
||||||
|
sw.WriteLine(s_ret + " ret = " + SymbolTable.FromNativeReturn(rettype, raw_parms) + ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ namespace GtkSharp.Generation {
|
||||||
simple_types.Add ("size_t", "int");
|
simple_types.Add ("size_t", "int");
|
||||||
|
|
||||||
// FIXME: These ought to be handled properly.
|
// FIXME: These ought to be handled properly.
|
||||||
simple_types.Add ("GList", "System.IntPtr");
|
|
||||||
simple_types.Add ("GMemChunk", "System.IntPtr");
|
simple_types.Add ("GMemChunk", "System.IntPtr");
|
||||||
simple_types.Add ("GTimeVal", "System.IntPtr");
|
simple_types.Add ("GTimeVal", "System.IntPtr");
|
||||||
simple_types.Add ("GClosure", "System.IntPtr");
|
simple_types.Add ("GClosure", "System.IntPtr");
|
||||||
|
@ -74,6 +73,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
manually_wrapped_types = new Hashtable ();
|
manually_wrapped_types = new Hashtable ();
|
||||||
manually_wrapped_types.Add ("GSList", "GLib.SList");
|
manually_wrapped_types.Add ("GSList", "GLib.SList");
|
||||||
|
manually_wrapped_types.Add ("GList", "GLib.List");
|
||||||
manually_wrapped_types.Add ("GValue", "GLib.Value");
|
manually_wrapped_types.Add ("GValue", "GLib.Value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
71
glib/List.cs
Normal file
71
glib/List.cs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
// List.cs - GList class wrapper implementation
|
||||||
|
//
|
||||||
|
// Authors: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2002 Mike Kestner
|
||||||
|
|
||||||
|
namespace GLib {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List Class
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Wrapper class for GList.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public class List : ListBase {
|
||||||
|
|
||||||
|
[DllImport("glib-2.0")]
|
||||||
|
static extern IntPtr g_list_copy (IntPtr l);
|
||||||
|
|
||||||
|
public override object Clone ()
|
||||||
|
{
|
||||||
|
return new List (g_list_copy (Handle));
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_list_get_data (IntPtr l);
|
||||||
|
|
||||||
|
internal override IntPtr GetData (IntPtr current)
|
||||||
|
{
|
||||||
|
return gtksharp_list_get_data (current);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern IntPtr gtksharp_list_get_next (IntPtr l);
|
||||||
|
|
||||||
|
internal override IntPtr Next (IntPtr current)
|
||||||
|
{
|
||||||
|
return gtksharp_list_get_next (current);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("glib-2.0")]
|
||||||
|
static extern int g_list_length (IntPtr l);
|
||||||
|
|
||||||
|
internal override int Length (IntPtr list)
|
||||||
|
{
|
||||||
|
return g_list_length (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("glib-2.0")]
|
||||||
|
static extern void g_list_free(IntPtr l);
|
||||||
|
|
||||||
|
internal override void Free (IntPtr list)
|
||||||
|
{
|
||||||
|
if (list != IntPtr.Zero)
|
||||||
|
g_list_free (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List (IntPtr raw) : base (raw)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public List (IntPtr raw, Type element_type) : base (raw, element_type)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
176
glib/ListBase.cs
Normal file
176
glib/ListBase.cs
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
// 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>
|
||||||
|
/// ListBase Class
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Base class for GList and GSList.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
internal abstract class ListBase : IDisposable, ICollection, GLib.IWrapper, ICloneable {
|
||||||
|
|
||||||
|
private IntPtr list_ptr = IntPtr.Zero;
|
||||||
|
private int length = -1;
|
||||||
|
private bool managed = false;
|
||||||
|
private Type element_type = null;
|
||||||
|
|
||||||
|
abstract internal IntPtr GetData (IntPtr current);
|
||||||
|
abstract internal IntPtr Next (IntPtr current);
|
||||||
|
abstract internal int Length (IntPtr list);
|
||||||
|
abstract internal void Free (IntPtr list);
|
||||||
|
|
||||||
|
protected ListBase (IntPtr list, Type element_type)
|
||||||
|
{
|
||||||
|
list_ptr = list;
|
||||||
|
this.element_type = element_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ListBase (IntPtr list)
|
||||||
|
{
|
||||||
|
list_ptr = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
~ListBase ()
|
||||||
|
{
|
||||||
|
Console.WriteLine ("entering dispose");
|
||||||
|
Dispose ();
|
||||||
|
Console.WriteLine ("leaving dispose");
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Managed {
|
||||||
|
set { managed = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle Property
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// A raw list reference for marshaling situations.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public IntPtr Handle {
|
||||||
|
get {
|
||||||
|
return list_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal IntPtr Raw {
|
||||||
|
get {
|
||||||
|
return list_ptr;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
if (managed && list_ptr != IntPtr.Zero)
|
||||||
|
Dispose ();
|
||||||
|
list_ptr = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ICollection
|
||||||
|
public int Count {
|
||||||
|
get {
|
||||||
|
if (length == -1)
|
||||||
|
length = Length (list_ptr);
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Synchronization could be tricky here. Hmm.
|
||||||
|
public bool IsSynchronized {
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public object SyncRoot {
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyTo (Array array, int index)
|
||||||
|
{
|
||||||
|
object[] orig = new object[Count];
|
||||||
|
int i = 0;
|
||||||
|
foreach (object o in this)
|
||||||
|
orig[i] = o;
|
||||||
|
|
||||||
|
orig.CopyTo (array, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ListEnumerator : IEnumerator
|
||||||
|
{
|
||||||
|
private IntPtr current = IntPtr.Zero;
|
||||||
|
private ListBase list;
|
||||||
|
|
||||||
|
public ListEnumerator (ListBase list)
|
||||||
|
{
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object Current {
|
||||||
|
get {
|
||||||
|
IntPtr data = list.GetData (current);
|
||||||
|
object ret = null;
|
||||||
|
if (list.element_type != null)
|
||||||
|
{
|
||||||
|
if (list.element_type == typeof (string))
|
||||||
|
ret = Marshal.PtrToStringAnsi (data);
|
||||||
|
else if (list.element_type == typeof (int))
|
||||||
|
ret = (int) data;
|
||||||
|
else if (list.element_type.IsValueType)
|
||||||
|
ret = Marshal.PtrToStructure (data, list.element_type);
|
||||||
|
else
|
||||||
|
ret = Activator.CreateInstance (list.element_type, new object[] {data});
|
||||||
|
}
|
||||||
|
else if (Object.IsObject (data))
|
||||||
|
ret = GLib.Object.GetObject (data);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool MoveNext ()
|
||||||
|
{
|
||||||
|
if (current == IntPtr.Zero)
|
||||||
|
current = list.list_ptr;
|
||||||
|
else
|
||||||
|
current = list.Next (current);
|
||||||
|
return (current != IntPtr.Zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reset ()
|
||||||
|
{
|
||||||
|
current = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// IEnumerable
|
||||||
|
public IEnumerator GetEnumerator ()
|
||||||
|
{
|
||||||
|
return new ListEnumerator (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDisposable
|
||||||
|
public void Dispose ()
|
||||||
|
{
|
||||||
|
if (!managed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (list_ptr != IntPtr.Zero)
|
||||||
|
Free (list_ptr);
|
||||||
|
list_ptr = IntPtr.Zero;
|
||||||
|
length = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ICloneable
|
||||||
|
abstract public object Clone ();
|
||||||
|
}
|
||||||
|
}
|
|
@ -237,5 +237,12 @@ namespace GLib {
|
||||||
g_object_set_property (Raw, name, val.Handle);
|
g_object_set_property (Raw, name, val.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("gtksharpglue")]
|
||||||
|
static extern bool gtksharp_is_object (IntPtr obj);
|
||||||
|
|
||||||
|
internal static bool IsObject (IntPtr obj)
|
||||||
|
{
|
||||||
|
return gtksharp_is_object (obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
namespace GLib {
|
namespace GLib {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -18,62 +17,55 @@ namespace GLib {
|
||||||
/// Wrapper class for GSList.
|
/// Wrapper class for GSList.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public class SList : ArrayList {
|
public class SList : ListBase {
|
||||||
|
|
||||||
private IntPtr list_ptr;
|
[DllImport("glib-2.0")]
|
||||||
|
static extern IntPtr g_slist_copy (IntPtr l);
|
||||||
[DllImport("gobject-2.0")]
|
|
||||||
static extern void g_slist_free(IntPtr l);
|
public override object Clone ()
|
||||||
|
|
||||||
~SList ()
|
|
||||||
{
|
{
|
||||||
if (list_ptr != IntPtr.Zero)
|
return new SList (g_slist_copy (Handle));
|
||||||
g_slist_free (list_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("gobject-2.0")]
|
|
||||||
static extern IntPtr g_slist_append(IntPtr l, IntPtr d);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handle Property
|
|
||||||
/// </summary>
|
|
||||||
///
|
|
||||||
/// <remarks>
|
|
||||||
/// A raw GSList reference for marshaling situations.
|
|
||||||
/// </remarks>
|
|
||||||
|
|
||||||
public IntPtr Handle {
|
|
||||||
get {
|
|
||||||
if (list_ptr != IntPtr.Zero)
|
|
||||||
g_slist_free (list_ptr);
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
list_ptr = l;
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gtksharpglue")]
|
[DllImport("gtksharpglue")]
|
||||||
static extern IntPtr gtksharp_slist_get_data (IntPtr l);
|
static extern IntPtr gtksharp_slist_get_data (IntPtr l);
|
||||||
|
|
||||||
|
internal override IntPtr GetData (IntPtr current)
|
||||||
|
{
|
||||||
|
return gtksharp_slist_get_data (current);
|
||||||
|
}
|
||||||
|
|
||||||
[DllImport("gtksharpglue")]
|
[DllImport("gtksharpglue")]
|
||||||
static extern IntPtr gtksharp_slist_get_next (IntPtr l);
|
static extern IntPtr gtksharp_slist_get_next (IntPtr l);
|
||||||
|
|
||||||
public SList (IntPtr raw)
|
internal override IntPtr Next (IntPtr current)
|
||||||
{
|
{
|
||||||
IntPtr l = raw;
|
return gtksharp_slist_get_next (current);
|
||||||
while (l != IntPtr.Zero) {
|
|
||||||
Add (gtksharp_slist_get_data (l));
|
|
||||||
l = gtksharp_slist_get_next (l);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DllImport("glib-2.0")]
|
||||||
|
static extern int g_slist_length (IntPtr l);
|
||||||
|
|
||||||
|
internal override int Length (IntPtr list)
|
||||||
|
{
|
||||||
|
return g_slist_length (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("glib-2.0")]
|
||||||
|
static extern void g_slist_free(IntPtr l);
|
||||||
|
|
||||||
|
internal override void Free (IntPtr list)
|
||||||
|
{
|
||||||
|
if (list != IntPtr.Zero)
|
||||||
|
g_slist_free (list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SList (IntPtr raw) : base (raw)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public SList (IntPtr raw, Type element_type) : base (raw, element_type)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ BASESOURCES = \
|
||||||
style.c \
|
style.c \
|
||||||
type.c \
|
type.c \
|
||||||
widget.c \
|
widget.c \
|
||||||
|
list.c \
|
||||||
#
|
#
|
||||||
|
|
||||||
GNOMESOURCES = \
|
GNOMESOURCES = \
|
||||||
|
|
21
glue/list.c
Normal file
21
glue/list.c
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/* list.c : Glue to access fields in GList.
|
||||||
|
*
|
||||||
|
* Author: Rachel Hestilow <hestilow@ximian.com>
|
||||||
|
*
|
||||||
|
* <c> 2002 Rachel Hestilow, Mike Kestner
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <glib/glist.h>
|
||||||
|
|
||||||
|
gpointer
|
||||||
|
gtksharp_list_get_data (GList *l)
|
||||||
|
{
|
||||||
|
return l->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
GList*
|
||||||
|
gtksharp_list_get_next (GList *l)
|
||||||
|
{
|
||||||
|
return l->next;
|
||||||
|
}
|
|
@ -13,4 +13,9 @@ gtksharp_get_type_name (GObject *obj)
|
||||||
return G_OBJECT_TYPE_NAME (obj);
|
return G_OBJECT_TYPE_NAME (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gtksharp_is_object (gpointer obj)
|
||||||
|
{
|
||||||
|
return G_IS_OBJECT (obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,6 @@ namespace GladeSamples {
|
||||||
|
|
||||||
public class GladeDemo {
|
public class GladeDemo {
|
||||||
|
|
||||||
// temporary hack until GList is wrapped
|
|
||||||
[DllImport("glib-2.0")]
|
|
||||||
static extern IntPtr g_list_nth_data (IntPtr l, int i);
|
|
||||||
[DllImport("glib-2.0")]
|
|
||||||
static extern int g_list_length (IntPtr l);
|
|
||||||
|
|
||||||
public static void Main (string[] args)
|
public static void Main (string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length < 2) {
|
if (args.Length < 2) {
|
||||||
|
@ -44,11 +38,8 @@ namespace GladeSamples {
|
||||||
Glade.XML.GetWidgetTree (wid) != null);
|
Glade.XML.GetWidgetTree (wid) != null);
|
||||||
|
|
||||||
Console.WriteLine ("\nList of created widgets:");
|
Console.WriteLine ("\nList of created widgets:");
|
||||||
// this is a hack, until GList is wrapped
|
GLib.List l = gxml.GetWidgetPrefix ("");
|
||||||
IntPtr l = gxml.GetWidgetPrefix ("");
|
foreach (Widget w in l) {
|
||||||
int len = g_list_length (l);
|
|
||||||
for (int i = 0; i < len; ++i) {
|
|
||||||
Widget w = GLib.Object.GetObject (g_list_nth_data (l, i)) as Widget;
|
|
||||||
Console.WriteLine ("{0} {1}",
|
Console.WriteLine ("{0} {1}",
|
||||||
w.GetType (),
|
w.GetType (),
|
||||||
Glade.XML.GetWidgetName (w));
|
Glade.XML.GetWidgetName (w));
|
||||||
|
|
|
@ -25,96 +25,96 @@ namespace WidgetViewer {
|
||||||
|
|
||||||
toolbar = new Toolbar ();
|
toolbar = new Toolbar ();
|
||||||
toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New",
|
toolbar.InsertStock (Stock.New, "Stock icon: New", "Toolbar/New",
|
||||||
new SignalFunc (set_small_icon), IntPtr.Zero, -1);
|
new SignalFunc (set_small_icon), -1);
|
||||||
|
|
||||||
toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open",
|
toolbar.InsertStock (Stock.Open, "Stock icon: Open", "Toolbar/Open",
|
||||||
new SignalFunc (set_large_icon), IntPtr.Zero, -1);
|
new SignalFunc (set_large_icon), -1);
|
||||||
|
|
||||||
toolbar.AppendSpace ();
|
toolbar.AppendSpace ();
|
||||||
|
|
||||||
toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips",
|
toolbar.AppendItem ("Toggle tooltips", "toggle showing of tooltips", "Toolbar/Tooltips",
|
||||||
new Image (Stock.DialogInfo, IconSize.LargeToolbar),
|
new Image (Stock.DialogInfo, IconSize.LargeToolbar),
|
||||||
new SignalFunc (toggle_tooltips), IntPtr.Zero);
|
new SignalFunc (toggle_tooltips));
|
||||||
|
|
||||||
toolbar.AppendSpace ();
|
toolbar.AppendSpace ();
|
||||||
|
|
||||||
toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal",
|
toolbar.AppendItem ("Horizontal", "Horizontal layout", "Toolbar/Horizontal",
|
||||||
new Image (Stock.GoForward, IconSize.LargeToolbar),
|
new Image (Stock.GoForward, IconSize.LargeToolbar),
|
||||||
new SignalFunc (set_horizontal), IntPtr.Zero);
|
new SignalFunc (set_horizontal));
|
||||||
|
|
||||||
toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical",
|
toolbar.AppendItem ("Vertical", "Vertical layout", "Toolbar/Vertical",
|
||||||
new Image (Stock.GoUp, IconSize.LargeToolbar),
|
new Image (Stock.GoUp, IconSize.LargeToolbar),
|
||||||
new SignalFunc (set_vertical), IntPtr.Zero);
|
new SignalFunc (set_vertical));
|
||||||
|
|
||||||
toolbar.AppendSpace ();
|
toolbar.AppendSpace ();
|
||||||
|
|
||||||
toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly",
|
toolbar.AppendItem ("Icons", "Only show icons", "Toolbar/IconsOnly",
|
||||||
new Image (Stock.Home, IconSize.LargeToolbar),
|
new Image (Stock.Home, IconSize.LargeToolbar),
|
||||||
new SignalFunc (set_icon_only), IntPtr.Zero);
|
new SignalFunc (set_icon_only));
|
||||||
|
|
||||||
toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly",
|
toolbar.AppendItem ("Text", "Only show Text", "Toolbar/TextOnly",
|
||||||
new Image (Stock.JustifyFill, IconSize.LargeToolbar),
|
new Image (Stock.JustifyFill, IconSize.LargeToolbar),
|
||||||
new SignalFunc (set_text_only), IntPtr.Zero);
|
new SignalFunc (set_text_only));
|
||||||
|
|
||||||
toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both",
|
toolbar.AppendItem ("Both", "Show both Icon & Text", "Toolbar/Both",
|
||||||
new Image (Stock.Index, IconSize.LargeToolbar),
|
new Image (Stock.Index, IconSize.LargeToolbar),
|
||||||
new SignalFunc (set_both), IntPtr.Zero);
|
new SignalFunc (set_both));
|
||||||
|
|
||||||
toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz",
|
toolbar.AppendItem ("Both (Horizontal)", "Show Icon & Text horizontally", "Toolbar/BothHoriz",
|
||||||
new Image (Stock.Index, IconSize.LargeToolbar),
|
new Image (Stock.Index, IconSize.LargeToolbar),
|
||||||
new SignalFunc (set_both_horiz), IntPtr.Zero);
|
new SignalFunc (set_both_horiz));
|
||||||
|
|
||||||
toolbar.AppendSpace ();
|
toolbar.AppendSpace ();
|
||||||
|
|
||||||
toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close",
|
toolbar.InsertStock (Stock.Close, "Stock icon: Close", "Toolbar/Close",
|
||||||
new SignalFunc (Close_Button), IntPtr.Zero, -1);
|
new SignalFunc (Close_Button), -1);
|
||||||
|
|
||||||
window.Add (toolbar);
|
window.Add (toolbar);
|
||||||
window.ShowAll ();
|
window.ShowAll ();
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_small_icon ()
|
static void set_small_icon (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.IconSize = IconSize.SmallToolbar;
|
toolbar.IconSize = IconSize.SmallToolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_large_icon ()
|
static void set_large_icon (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.IconSize = IconSize.LargeToolbar;
|
toolbar.IconSize = IconSize.LargeToolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_icon_only ()
|
static void set_icon_only (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.ToolbarStyle = ToolbarStyle.Icons;
|
toolbar.ToolbarStyle = ToolbarStyle.Icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_text_only ()
|
static void set_text_only (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.ToolbarStyle = ToolbarStyle.Text;
|
toolbar.ToolbarStyle = ToolbarStyle.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_horizontal ()
|
static void set_horizontal (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.Orientation = Orientation.Horizontal;
|
toolbar.Orientation = Orientation.Horizontal;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_vertical ()
|
static void set_vertical (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.Orientation = Orientation.Vertical;
|
toolbar.Orientation = Orientation.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_both ()
|
static void set_both (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.ToolbarStyle = ToolbarStyle.Both;
|
toolbar.ToolbarStyle = ToolbarStyle.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_both_horiz ()
|
static void set_both_horiz (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
|
toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void toggle_tooltips ()
|
static void toggle_tooltips (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
if (showTooltips == true)
|
if (showTooltips == true)
|
||||||
showTooltips = false;
|
showTooltips = false;
|
||||||
|
@ -125,7 +125,7 @@ namespace WidgetViewer {
|
||||||
Console.WriteLine ("Show tooltips: " + showTooltips);
|
Console.WriteLine ("Show tooltips: " + showTooltips);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Close_Button ()
|
static void Close_Button (Gtk.Object obj)
|
||||||
{
|
{
|
||||||
window.Destroy ();
|
window.Destroy ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,50 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</data>
|
</data>
|
||||||
</rule>
|
</rule>
|
||||||
|
<rule>
|
||||||
|
<class name="GnomeCanvasPathDef">
|
||||||
|
<method>Moveto</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="method">
|
||||||
|
<name>name</name>
|
||||||
|
<value>MoveTo</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
<rule>
|
||||||
|
<class name="GnomeCanvasPathDef">
|
||||||
|
<method>Curveto</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="method">
|
||||||
|
<name>name</name>
|
||||||
|
<value>CurveTo</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
<rule>
|
||||||
|
<class name="GnomeCanvasPathDef">
|
||||||
|
<method>Lineto</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="method">
|
||||||
|
<name>name</name>
|
||||||
|
<value>LineTo</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
<rule>
|
||||||
|
<class name="GnomeCanvasPathDef">
|
||||||
|
<method>LinetoMoving</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="method">
|
||||||
|
<name>name</name>
|
||||||
|
<value>LineToMoving</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
|
||||||
<!-- hides -->
|
<!-- hides -->
|
||||||
<rule>
|
<rule>
|
||||||
|
@ -226,4 +270,28 @@
|
||||||
</data>
|
</data>
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
|
<!-- list types -->
|
||||||
|
<rule>
|
||||||
|
<class name="GnomeCanvasPathDef">
|
||||||
|
<method>Split</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="return">
|
||||||
|
<name>element_type</name>
|
||||||
|
<value>Gnome.CanvasPathDef</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
<rule>
|
||||||
|
<class name="GnomeIconList">
|
||||||
|
<method>GetSelection</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="return">
|
||||||
|
<name>element_type</name>
|
||||||
|
<value>int</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
|
||||||
</metadata>
|
</metadata>
|
||||||
|
|
|
@ -1262,20 +1262,15 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</data>
|
</data>
|
||||||
</rule>
|
</rule>
|
||||||
<!-- both temporarily disabled because we do not support
|
|
||||||
Native->Managed delegates (only the other way around) -->
|
|
||||||
<rule>
|
<rule>
|
||||||
|
<class name="GtkWidget">
|
||||||
|
<method>ListAccelClosures</method>
|
||||||
|
</class>
|
||||||
|
<!-- both temporarily disabled because we do not support
|
||||||
|
Native->Managed delegates (only the other way around) -->
|
||||||
<class name="GtkColorSelection">
|
<class name="GtkColorSelection">
|
||||||
<method>SetChangePaletteHook</method>
|
<method>SetChangePaletteHook</method>
|
||||||
</class>
|
</class>
|
||||||
<data>
|
|
||||||
<attribute target="method">
|
|
||||||
<name>hidden</name>
|
|
||||||
<value>1</value>
|
|
||||||
</attribute>
|
|
||||||
</data>
|
|
||||||
</rule>
|
|
||||||
<rule>
|
|
||||||
<class name="GtkTreeView">
|
<class name="GtkTreeView">
|
||||||
<method>GetSearchEqualFunc</method>
|
<method>GetSearchEqualFunc</method>
|
||||||
</class>
|
</class>
|
||||||
|
|
17
sources/Pango.metadata
Normal file
17
sources/Pango.metadata
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<metadata>
|
||||||
|
|
||||||
|
<!-- list types -->
|
||||||
|
<rule>
|
||||||
|
<class name="PangoLayout">
|
||||||
|
<method>GetLines</method>
|
||||||
|
</class>
|
||||||
|
<data>
|
||||||
|
<attribute target="return">
|
||||||
|
<name>element_type</name>
|
||||||
|
<value>Pango.LayoutLine</value>
|
||||||
|
</attribute>
|
||||||
|
</data>
|
||||||
|
</rule>
|
||||||
|
|
||||||
|
</metadata>
|
Loading…
Add table
Reference in a new issue