2002-02-19 Mike Kestner <mkestner@speakeasy.net>
* generator/BoxedGen.cs : Add ctor and method generation. * generator/StructBase.cs : Switch to Raw syntax. * glib/Boxed.cs : Add Handle prop, make Raw protected, and add ctors. * glib/Object.cs : s/RawObject/Raw to simplify generation. svn path=/trunk/gtk-sharp/; revision=2518
This commit is contained in:
parent
ede9016e25
commit
d5d3baa601
6 changed files with 87 additions and 31 deletions
|
@ -1,3 +1,10 @@
|
|||
2002-02-19 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* generator/BoxedGen.cs : Add ctor and method generation.
|
||||
* generator/StructBase.cs : Switch to Raw syntax.
|
||||
* glib/Boxed.cs : Add Handle prop, make Raw protected, and add ctors.
|
||||
* glib/Object.cs : s/RawObject/Raw to simplify generation.
|
||||
|
||||
2002-02-19 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* generator/Statistics.cs : New. Gathers stats about generation.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
namespace GtkSharp.Generation {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
|
@ -23,7 +24,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public String CallByName (String var_name)
|
||||
{
|
||||
return var_name + ".Raw";
|
||||
return var_name + ".Handle";
|
||||
}
|
||||
|
||||
public String FromNative(String var)
|
||||
|
@ -57,6 +58,11 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ("\tpublic class " + Name + " : GtkSharp.Boxed {");
|
||||
sw.WriteLine ();
|
||||
|
||||
sw.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}");
|
||||
sw.WriteLine();
|
||||
|
||||
Hashtable clash_map = new Hashtable();
|
||||
|
||||
foreach (XmlNode node in elem.ChildNodes) {
|
||||
|
||||
XmlElement member = (XmlElement) node;
|
||||
|
@ -72,11 +78,15 @@ namespace GtkSharp.Generation {
|
|||
break;
|
||||
|
||||
case "constructor":
|
||||
Statistics.IgnoreCount++;
|
||||
if (!GenCtor(member, table, sw, clash_map)) {
|
||||
Console.WriteLine(" in boxed " + CName);
|
||||
}
|
||||
break;
|
||||
|
||||
case "method":
|
||||
Statistics.IgnoreCount++;
|
||||
if (!GenMethod(member, table, sw)) {
|
||||
Console.WriteLine(" in boxed " + CName);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -81,9 +81,6 @@ namespace GtkSharp.Generation {
|
|||
switch (node.Name) {
|
||||
case "field":
|
||||
Statistics.IgnoreCount++;
|
||||
//if (!GenField(member, table, sw)) {
|
||||
// Console.WriteLine("in object " + CName);
|
||||
//}
|
||||
break;
|
||||
|
||||
case "callback":
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace GtkSharp.Generation {
|
|||
} else {
|
||||
sw.WriteLine("\t\tpublic " + Name + sig);
|
||||
sw.WriteLine("\t\t{");
|
||||
sw.WriteLine("\t\t\tRawObject = " + cname + call + ";");
|
||||
sw.WriteLine("\t\t\tRaw = " + cname + call + ";");
|
||||
}
|
||||
|
||||
sw.WriteLine("\t\t}");
|
||||
|
|
|
@ -29,6 +29,31 @@ namespace GtkSharp {
|
|||
Marshal.FreeHGlobal (_raw);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Boxed Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Dummy constructor needed for subclasses.
|
||||
/// </remarks>
|
||||
|
||||
public Boxed()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Boxed Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Wraps a raw boxed type reference.
|
||||
/// </remarks>
|
||||
|
||||
public Boxed(IntPtr raw)
|
||||
{
|
||||
Raw = raw;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raw Property
|
||||
/// </summary>
|
||||
|
@ -37,7 +62,7 @@ namespace GtkSharp {
|
|||
/// Gets a marshallable IntPtr.
|
||||
/// </remarks>
|
||||
|
||||
public IntPtr Raw {
|
||||
protected IntPtr Raw {
|
||||
get {
|
||||
if (_raw == IntPtr.Zero) {
|
||||
// FIXME: Ugly hack.
|
||||
|
@ -46,6 +71,23 @@ namespace GtkSharp {
|
|||
}
|
||||
return _raw;
|
||||
}
|
||||
set {
|
||||
_raw = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Gets a marshallable IntPtr.
|
||||
/// </remarks>
|
||||
|
||||
public IntPtr Handle {
|
||||
get {
|
||||
return _raw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -71,11 +71,11 @@ namespace GLib {
|
|||
|
||||
public Object (IntPtr raw)
|
||||
{
|
||||
RawObject = raw;
|
||||
Raw = raw;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RawObject Property
|
||||
/// Raw Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
|
@ -85,7 +85,7 @@ namespace GLib {
|
|||
/// Handle property.
|
||||
/// </remarks>
|
||||
|
||||
protected IntPtr RawObject {
|
||||
protected IntPtr Raw {
|
||||
get {
|
||||
return _obj;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace GLib {
|
|||
///
|
||||
/// <remarks>
|
||||
/// The raw GObject reference associated with this object.
|
||||
/// Subclasses can use RawObject property for read/write
|
||||
/// Subclasses can use Raw property for read/write
|
||||
/// access.
|
||||
/// </remarks>
|
||||
|
||||
|
@ -205,7 +205,7 @@ namespace GLib {
|
|||
public void GetProperty (String name, out String val)
|
||||
{
|
||||
IntPtr propval;
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out propval, new IntPtr (0));
|
||||
val = Marshal.PtrToStringAnsi (propval);
|
||||
|
@ -226,7 +226,7 @@ namespace GLib {
|
|||
|
||||
public void GetProperty (String name, out bool val)
|
||||
{
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out val, new IntPtr (0));
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ namespace GLib {
|
|||
|
||||
public void GetProperty (String name, out double val)
|
||||
{
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out val, new IntPtr (0));
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ namespace GLib {
|
|||
|
||||
public void GetProperty (String name, out float val)
|
||||
{
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out val, new IntPtr (0));
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ namespace GLib {
|
|||
|
||||
public void GetProperty (String name, out int val)
|
||||
{
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out val, new IntPtr (0));
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ namespace GLib {
|
|||
|
||||
public void GetProperty (String name, out uint val)
|
||||
{
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out val, new IntPtr (0));
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ namespace GLib {
|
|||
public void GetProperty (String name, out GLib.Object val)
|
||||
{
|
||||
IntPtr obj;
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out obj, new IntPtr (0));
|
||||
val = GLib.Object.GetObject (obj);
|
||||
|
@ -339,7 +339,7 @@ namespace GLib {
|
|||
public void GetProperty (String name, out GtkSharp.Boxed val)
|
||||
{
|
||||
IntPtr raw;
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out raw, new IntPtr (0));
|
||||
val = GtkSharp.Boxed.GetBoxed (raw);
|
||||
|
@ -358,7 +358,7 @@ namespace GLib {
|
|||
|
||||
public void GetProperty (String name, out IntPtr val)
|
||||
{
|
||||
g_object_get (RawObject,
|
||||
g_object_get (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
out val, new IntPtr (0));
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, String val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
Marshal.StringToHGlobalAnsi (val),
|
||||
new IntPtr (0));
|
||||
|
@ -402,7 +402,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, int val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val, new IntPtr (0));
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, uint val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val, new IntPtr (0));
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, bool val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val, new IntPtr (0));
|
||||
}
|
||||
|
@ -462,7 +462,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, double val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val, new IntPtr (0));
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, float val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val, new IntPtr (0));
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, IntPtr val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val, new IntPtr (0));
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, GLib.Object val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val.Handle, new IntPtr (0));
|
||||
}
|
||||
|
@ -527,9 +527,9 @@ namespace GLib {
|
|||
|
||||
public void SetProperty (String name, GtkSharp.Boxed val)
|
||||
{
|
||||
g_object_set (RawObject,
|
||||
g_object_set (Raw,
|
||||
Marshal.StringToHGlobalAnsi (name),
|
||||
val.Raw, new IntPtr (0));
|
||||
val.Handle, new IntPtr (0));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue