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
This commit is contained in:
Rachel Hestilow 2002-06-26 08:36:05 +00:00
parent 304427af77
commit 02c9fb725c
41 changed files with 2974 additions and 37 deletions

View file

@ -1,3 +1,48 @@
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.
2002-06-25 Mike Kestner <mkestner@speakeasy.net> 2002-06-25 Mike Kestner <mkestner@speakeasy.net>
* generator/gtkapi.xml : lots of fixes, plus GtkHTML! * generator/gtkapi.xml : lots of fixes, plus GtkHTML!

View file

@ -81,6 +81,7 @@ pango/Makefile
atk/Makefile atk/Makefile
gdk/Makefile gdk/Makefile
gtk/Makefile gtk/Makefile
gnome/Makefile
sample/Makefile sample/Makefile
]) ])

View file

@ -237,6 +237,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Atk.StateSet.#ctor">
<summary> StateSet Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Atk.StateSet.IsEmpty"> <member name="M:Atk.StateSet.IsEmpty">
<summary> IsEmpty Method </summary> <summary> IsEmpty Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -1113,6 +1117,10 @@
<summary> AccessibleType Property </summary> <summary> AccessibleType Property </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
</member> </member>
<member name="M:Atk.NoOpObjectFactory.#ctor">
<summary> NoOpObjectFactory Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="T:Atk.Layer"> <member name="T:Atk.Layer">
<summary> Layer enumeration </summary> <summary> Layer enumeration </summary>
<remarks> <remarks>
@ -1158,6 +1166,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Atk.NoOpObject.#ctor(GLib.Object)">
<summary> NoOpObject Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="T:Atk.PropertyValues"> <member name="T:Atk.PropertyValues">
<summary> PropertyValues Struct </summary> <summary> PropertyValues Struct </summary>
<remarks> <remarks>
@ -1168,6 +1180,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Atk.RelationSet.#ctor">
<summary> RelationSet Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Atk.RelationSet.GetRelation(System.Int32)"> <member name="M:Atk.RelationSet.GetRelation(System.Int32)">
<summary> GetRelation Method </summary> <summary> GetRelation Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -1214,6 +1230,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Atk.Relation.#ctor(Atk.Object,System.Int32,Atk.RelationType)">
<summary> Relation Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="P:Atk.Relation.RelationType"> <member name="P:Atk.Relation.RelationType">
<summary> RelationType Property </summary> <summary> RelationType Property </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>

View file

@ -264,6 +264,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.Image.#ctor(Gdk.ImageType,Gdk.Visual,System.Int32,System.Int32)">
<summary> Image Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Image.GetPixel(System.Int32,System.Int32)"> <member name="M:Gdk.Image.GetPixel(System.Int32,System.Int32)">
<summary> GetPixel Method </summary> <summary> GetPixel Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -571,6 +575,30 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.Pixbuf.NewFromXpmData(System.String)">
<summary> Pixbuf Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Pixbuf.#ctor(System.Int32,System.Byte,System.Boolean)">
<summary> Pixbuf Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Pixbuf.#ctor(System.Byte,Gdk.Colorspace,System.Boolean,System.Int32,System.Int32,System.Int32,System.Int32,Gdk.PixbufDestroyNotify,System.IntPtr)">
<summary> Pixbuf Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Pixbuf.#ctor(Gdk.Pixbuf,System.Int32,System.Int32,System.Int32,System.Int32)">
<summary> Pixbuf Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Pixbuf.#ctor(System.String)">
<summary> Pixbuf Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Pixbuf.#ctor(Gdk.Colorspace,System.Boolean,System.Int32,System.Int32,System.Int32)">
<summary> Pixbuf Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Pixbuf.Scale(Gdk.Pixbuf,System.Int32,System.Int32,System.Int32,System.Int32,System.Double,System.Double,System.Double,System.Double,Gdk.InterpType)"> <member name="M:Gdk.Pixbuf.Scale(Gdk.Pixbuf,System.Int32,System.Int32,System.Int32,System.Int32,System.Double,System.Double,System.Double,System.Double,Gdk.InterpType)">
<summary> Scale Method </summary> <summary> Scale Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -676,6 +704,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.PixbufAnimation.#ctor(System.String)">
<summary> PixbufAnimation Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.PixbufAnimation.IsStaticImage"> <member name="M:Gdk.PixbufAnimation.IsStaticImage">
<summary> IsStaticImage Method </summary> <summary> IsStaticImage Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -1106,6 +1138,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.Window.#ctor(Gdk.Window,Gdk.WindowAttr,System.Int32)">
<summary> Window Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Window.PeekChildren"> <member name="M:Gdk.Window.PeekChildren">
<summary> PeekChildren Method </summary> <summary> PeekChildren Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -1539,6 +1575,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.Colormap.#ctor(Gdk.Visual,System.Boolean)">
<summary> Colormap Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.Colormap.FreeColors(Gdk.Color,System.Int32)"> <member name="M:Gdk.Colormap.FreeColors(Gdk.Color,System.Int32)">
<summary> FreeColors Method </summary> <summary> FreeColors Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -1979,6 +2019,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.DragContext.#ctor">
<summary> DragContext Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="T:Gdk.Device"> <member name="T:Gdk.Device">
<summary> Device Class</summary> <summary> Device Class</summary>
<remarks> <remarks>
@ -2920,6 +2964,14 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.PixbufLoader.#ctor(System.String)">
<summary> PixbufLoader Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.PixbufLoader.#ctor">
<summary> PixbufLoader Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.PixbufLoader.Close"> <member name="M:Gdk.PixbufLoader.Close">
<summary> Close Method </summary> <summary> Close Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -3062,11 +3114,23 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.Pixmap.#ctor(Gdk.Window,System.Int32,System.Int32,System.Int32)">
<summary> Pixmap Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="T:Gdk.GC"> <member name="T:Gdk.GC">
<summary> GC Class</summary> <summary> GC Class</summary>
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Gdk.GC.#ctor(Gdk.Drawable,Gdk.GCValues,Gdk.GCValuesMask)">
<summary> GC Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.GC.#ctor(Gdk.Drawable)">
<summary> GC Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Gdk.GC.SetDashes(System.Int32,System.Byte[],System.Int32)"> <member name="M:Gdk.GC.SetDashes(System.Int32,System.Byte[],System.Int32)">
<summary> SetDashes Method </summary> <summary> SetDashes Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>

View file

@ -375,6 +375,15 @@
Constructs a Value from a specified uint. Constructs a Value from a specified uint.
</remarks> </remarks>
</member> </member>
<member name="M:GLib.Value.#ctor(System.IntPtr,System.String,GLib.EnumWrapper)">
<summary>
Value Constructor
</summary>
<remarks>
Constructs a Value from a specified enum wrapper.
</remarks>
</member>
<member name="M:GLib.Value.op_Explicit(GLib.Value)~System.Boolean"> <member name="M:GLib.Value.op_Explicit(GLib.Value)~System.Boolean">
<summary> <summary>
Value to Boolean Conversion Value to Boolean Conversion
@ -441,6 +450,18 @@
object value. object value.
</remarks> </remarks>
</member> </member>
<member name="M:GLib.Value.op_Explicit(GLib.Value)~GLib.UnwrappedObject">
<summary>
Value to Unresolved Object Conversion
</summary>
<remarks>
Extracts an object from a Value without looking up its wrapping
class.
Note, this method will produce an exception if the Value does
not hold a object value.
</remarks>
</member>
<member name="M:GLib.Value.op_Explicit(GLib.Value)~System.IntPtr"> <member name="M:GLib.Value.op_Explicit(GLib.Value)~System.IntPtr">
<summary> <summary>
Value to Pointer Conversion Value to Pointer Conversion
@ -474,6 +495,17 @@
unsigned integer value. unsigned integer value.
</remarks> </remarks>
</member> </member>
<member name="M:GLib.Value.op_Explicit(GLib.Value)~GLib.EnumWrapper">
<summary>
Value to Enum Conversion
</summary>
<remarks>
Extracts an enum from a Value. Note, this method
will produce an exception if the Value does not hold an
enum value.
</remarks>
</member>
<member name="P:GLib.Value.Handle"> <member name="P:GLib.Value.Handle">
<summary> <summary>
Handle Property Handle Property

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,8 @@ Documentation on the following assemblies is available:
<ul><a href="pango-sharp-docs.html">pango</a></ul> <ul><a href="pango-sharp-docs.html">pango</a></ul>
<ul><a href="gdk-sharp-docs.html">gdk</a></ul> <ul><a href="gdk-sharp-docs.html">gdk</a></ul>
<ul><a href="gtk-sharp-docs.html">gtk</a></ul> <ul><a href="gtk-sharp-docs.html">gtk</a></ul>
<p align="right"><i>Last updated Monday, June 24 2002</i></p> <ul><a href="gnome-sharp-docs.html">gnome</a></ul>
<p align="right"><i>Last updated Wednesday, June 25 2002</i></p>
<p align="right"><i>Rachel Hestilow <a href="mailto:hestilow@ximian.com">(hestilow at ximian.com)</a></i></p> <p align="right"><i>Rachel Hestilow <a href="mailto:hestilow@ximian.com">(hestilow at ximian.com)</a></i></p>
</body> </body>
</html> </html>

View file

@ -37,7 +37,7 @@ namespace GtkSharp.DocGeneration {
primitives["System.Void"] = "void"; primitives["System.Void"] = "void";
/* FIXME: mcs does not support Assembly.GetReferencedAssemblies*/ /* FIXME: mcs does not support Assembly.GetReferencedAssemblies*/
foreach (string asm in new string[] {"glib", "atk", "pango", "gdk"}) { foreach (string asm in new string[] {"glib", "atk", "pango", "gdk", "gtk", "gnome"}) {
string key = asm + "-sharp"; string key = asm + "-sharp";
assemblies[key] = Assembly.Load (key); assemblies[key] = Assembly.Load (key);
} }
@ -63,9 +63,10 @@ namespace GtkSharp.DocGeneration {
} else } else
isArray = false; isArray = false;
if (type.IsArray) Console.WriteLine ("hi " + full);
if (primitives.Contains (full)) { if (primitives.Contains (full)) {
string ret = (string) primitives[full]; string ret = (string) primitives[full];
if (isArray) ret += "[]"; if (isArray || type.IsArray) ret += "[]";
return ret; return ret;
} else { } else {
if (String.Compare (full, 0, current_ns, 0, current_ns.Length) == 0) { if (String.Compare (full, 0, current_ns, 0, current_ns.Length) == 0) {
@ -93,6 +94,7 @@ namespace GtkSharp.DocGeneration {
MethodBase method = null; MethodBase method = null;
MethodBase[] methods; MethodBase[] methods;
if (isCtor) if (isCtor)
{ {
MemberInfo[] bases = type.FindMembers (MemberTypes.Constructor | MemberTypes.Method, BindingFlags.Public | BindingFlags.Instance, Type.FilterName, ".ctor"); MemberInfo[] bases = type.FindMembers (MemberTypes.Constructor | MemberTypes.Method, BindingFlags.Public | BindingFlags.Instance, Type.FilterName, ".ctor");
@ -138,7 +140,8 @@ namespace GtkSharp.DocGeneration {
XmlElement arg_node = (XmlElement) doc.CreateNode ("element", "argument", ""); XmlElement arg_node = (XmlElement) doc.CreateNode ("element", "argument", "");
args_node.AppendChild (arg_node); args_node.AppendChild (arg_node);
arg_node.SetAttribute ("modifiers", modifiers); arg_node.SetAttribute ("modifiers", modifiers);
arg_node.SetAttribute ("type", StringifyType (signature[i])); if (p.ParameterType.IsArray) { Console.WriteLine (p.ParameterType); }
arg_node.SetAttribute ("type", StringifyType (p.ParameterType));
arg_node.SetAttribute ("name", p.Name); arg_node.SetAttribute ("name", p.Name);
i++; i++;
} }

View file

@ -1,4 +1,4 @@
TARGETS = glib pango atk gdk gtk TARGETS = glib pango atk gdk gtk gnome
output_files = $(TARGETS:=-sharp-docs.html) output_files = $(TARGETS:=-sharp-docs.html)
input_files = $(TARGETS:=-sharp-docs.xml) input_files = $(TARGETS:=-sharp-docs.xml)
stage1_files = $(TARGETS:=-sharp-docs-stage1.xml) stage1_files = $(TARGETS:=-sharp-docs-stage1.xml)

View file

@ -131,7 +131,7 @@
<xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable> <xsl:variable name="lcletters">abcdefghijklmnopqrstuvwxyz</xsl:variable>
<xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable> <xsl:variable name="ucletters">ABCDEFGHIJKLMNOPQRSTUVWXYZ</xsl:variable>
<xsl:choose> <xsl:choose>
<xsl:when test="$ns = 'GLib' or $ns = 'Atk' or $ns = 'Pango' or $ns = 'Gdk' or $ns = 'Gtk'"> <xsl:when test="$ns = 'GLib' or $ns = 'Atk' or $ns = 'Pango' or $ns = 'Gdk' or $ns = 'Gtk' or $ns = 'Gnome'">
<a><xsl:attribute name="href"><xsl:value-of select="translate($ns, $ucletters, $lcletters)"/>-sharp-docs.html#<xsl:value-of select="substring-after ($klass, '.')"/></xsl:attribute><xsl:value-of select="$klass"/></a> <a><xsl:attribute name="href"><xsl:value-of select="translate($ns, $ucletters, $lcletters)"/>-sharp-docs.html#<xsl:value-of select="substring-after ($klass, '.')"/></xsl:attribute><xsl:value-of select="$klass"/></a>
</xsl:when> </xsl:when>
<xsl:otherwise><xsl:value-of select="$klass"/> <xsl:otherwise><xsl:value-of select="$klass"/>

View file

@ -40,6 +40,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Pango.Layout.#ctor(Pango.Context)">
<summary> Layout Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Pango.Layout.GetLogAttrs(Pango.LogAttr,System.Int32)"> <member name="M:Pango.Layout.GetLogAttrs(Pango.LogAttr,System.Int32)">
<summary> GetLogAttrs Method </summary> <summary> GetLogAttrs Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>
@ -691,6 +695,10 @@
<remarks> <remarks>
</remarks> </remarks>
</member> </member>
<member name="M:Pango.Context.#ctor">
<summary> Context Constructor </summary>
<remarks> To be completed </remarks>
</member>
<member name="M:Pango.Context.ListFamilies(Pango.FontFamily,System.Int32)"> <member name="M:Pango.Context.ListFamilies(Pango.FontFamily,System.Int32)">
<summary> ListFamilies Method </summary> <summary> ListFamilies Method </summary>
<remarks> To be completed </remarks> <remarks> To be completed </remarks>

28
gdk/Event.cs Normal file
View file

@ -0,0 +1,28 @@
// Gdk.Event.cs - Custom event wrapper
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
// (c) 2002 Rachel Hestilow
namespace Gdk {
using System;
using System.Collections;
using System.Runtime.InteropServices;
public class Event : GLib.Object {
[DllImport("gtksharpglue")]
static extern EventType gtksharp_gdk_event_get_event_type (IntPtr evt);
public Event(IntPtr raw) : base(raw) {}
public EventType Type {
get {
return gtksharp_gdk_event_get_event_type (Handle);
}
}
}
}

View file

@ -30,6 +30,13 @@ namespace GtkSharp.Generation {
} }
} }
public ClassBase Parent {
get {
string parent = Elem.GetAttribute("parent");
return SymbolTable.GetClassGen(parent);
}
}
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) { protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
foreach (XmlNode node in elem.ChildNodes) { foreach (XmlNode node in elem.ChildNodes) {
XmlElement member = (XmlElement) node; XmlElement member = (XmlElement) node;
@ -40,7 +47,7 @@ namespace GtkSharp.Generation {
break; break;
case "property": case "property":
props.Add (member.GetAttribute ("name"), new Property (member)); props.Add (member.GetAttribute ("name"), new Property (member, this));
break; break;
case "signal": case "signal":
@ -170,5 +177,35 @@ namespace GtkSharp.Generation {
{ {
return (Method) methods[name]; return (Method) methods[name];
} }
public Property GetProperty (string name)
{
return (Property) props[name];
}
public virtual Method GetMethodRecursively (string name)
{
ClassBase klass = this;
Method m = null;
while (klass != null && m == null) {
m = (Method) klass.GetMethod (name);
klass = klass.Parent;
}
return m;
}
public virtual Property GetPropertyRecursively (string name)
{
ClassBase klass = this;
Property p = null;
while (klass != null && p == null) {
p = (Property) klass.GetProperty (name);
klass = klass.Parent;
}
return p;
}
} }
} }

View file

@ -86,6 +86,8 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\tstatic extern " + safety + "IntPtr " + cname + isig); sw.WriteLine("\t\tstatic extern " + safety + "IntPtr " + cname + isig);
sw.WriteLine(); sw.WriteLine();
sw.WriteLine("\t\t/// <summary> " + name + " Constructor </summary>");
sw.WriteLine("\t\t/// <remarks> To be completed </remarks>");
if (clashes > 0 && !Preferred) { if (clashes > 0 && !Preferred) {
String mname = cname.Substring(cname.IndexOf("new")); String mname = cname.Substring(cname.IndexOf("new"));
mname = mname.Substring(0,1).ToUpper() + mname.Substring(1); mname = mname.Substring(0,1).ToUpper() + mname.Substring(1);

View file

@ -179,7 +179,7 @@ namespace GtkSharp.Generation {
sw.Write(Name.Substring (3)); sw.Write(Name.Substring (3));
sw.WriteLine(" { "); sw.WriteLine(" { ");
} else { } else {
if (elem.HasAttribute("new_flag")) if (elem.HasAttribute("new_flag") || (container_type.Parent != null && container_type.Parent.GetMethodRecursively (Name) != null))
sw.Write("new "); sw.Write("new ");
sw.Write(s_ret + " " + Name + sig); sw.Write(s_ret + " " + Name + sig);
} }
@ -258,6 +258,8 @@ namespace GtkSharp.Generation {
/* we are generated by the get Method, if there is one */ /* we are generated by the get Method, if there is one */
if (is_set || is_get) if (is_set || is_get)
{ {
if (container_type.GetProperty (Name.Substring (3)) != null)
return;
comp = GetComplement (); comp = GetComplement ();
if (comp != null && comp.Validate () && is_set && parms.AccessorReturnType == comp.s_ret) if (comp != null && comp.Validate () && is_set && parms.AccessorReturnType == comp.s_ret)
return; return;

View file

@ -39,13 +39,6 @@ namespace GtkSharp.Generation {
} }
} }
private ObjectGen Parent {
get {
string parent = Elem.GetAttribute("parent");
return (ObjectGen) SymbolTable.GetClassGen(parent);
}
}
public void Generate () public void Generate ()
{ {
StreamWriter sw = CreateWriter (); StreamWriter sw = CreateWriter ();

View file

@ -14,10 +14,18 @@ namespace GtkSharp.Generation {
public class Property { public class Property {
private XmlElement elem; private XmlElement elem;
private ClassBase container_type;
public Property (XmlElement elem) public string Name {
get {
return elem.GetAttribute ("name");
}
}
public Property (XmlElement elem, ClassBase container_type)
{ {
this.elem = elem; this.elem = elem;
this.container_type = container_type;
} }
public bool Validate () public bool Validate ()
@ -45,6 +53,10 @@ namespace GtkSharp.Generation {
{ {
string c_type = elem.GetAttribute("type"); string c_type = elem.GetAttribute("type");
string cs_type = SymbolTable.GetCSType(c_type); string cs_type = SymbolTable.GetCSType(c_type);
string modifiers = "";
if (elem.HasAttribute("new_flag") || (container_type.Parent != null && container_type.Parent.GetPropertyRecursively (Name) != null))
modifiers = "new ";
XmlElement parent = (XmlElement) elem.ParentNode; XmlElement parent = (XmlElement) elem.ParentNode;
string name = elem.GetAttribute("name"); string name = elem.GetAttribute("name");
@ -76,7 +88,7 @@ namespace GtkSharp.Generation {
sw.WriteLine("\t\t/// <remarks>"); sw.WriteLine("\t\t/// <remarks>");
sw.WriteLine("\t\t/// </remarks>"); sw.WriteLine("\t\t/// </remarks>");
sw.WriteLine("\t\tpublic " + cs_type + " " + name + " {"); sw.WriteLine("\t\tpublic " + modifiers + cs_type + " " + name + " {");
if (elem.HasAttribute("readable")) { if (elem.HasAttribute("readable")) {
sw.WriteLine("\t\t\tget {"); sw.WriteLine("\t\t\tget {");
sw.WriteLine("\t\t\t\tGLib.Value val = new GLib.Value (Handle, " + cname + ");"); sw.WriteLine("\t\t\t\tGLib.Value val = new GLib.Value (Handle, " + cname + ");");

View file

@ -90,6 +90,8 @@ namespace GtkSharp.Generation {
dir = ".." + sep + "atk" + sep + "generated"; dir = ".." + sep + "atk" + sep + "generated";
} else if (key.IndexOf("Pango") >= 0) { } else if (key.IndexOf("Pango") >= 0) {
dir = ".." + sep + "pango" + sep + "generated"; dir = ".." + sep + "pango" + sep + "generated";
} else if (key.IndexOf("Gnome") >= 0) {
dir = ".." + sep + "gnome" + sep + "generated";
} else { } else {
dir = ".." + sep + "glib" + sep + "generated"; dir = ".." + sep + "glib" + sep + "generated";
} }
@ -140,7 +142,13 @@ namespace GtkSharp.Generation {
sw.Write("\t\t\targs.Args[" + (idx-1) + "] "); sw.Write("\t\t\targs.Args[" + (idx-1) + "] ");
sw.WriteLine("= GLib.Object.GetObject(arg" + idx + ");"); sw.WriteLine("= GLib.Object.GetObject(arg" + idx + ");");
} else { } else {
sw.WriteLine("\t\t\targs.Args[" + (idx-1) + "] = arg" + idx + ";"); string ctype = (string) parms[idx];
sw.WriteLine("\t\t\targs.Args[" + (idx-1) + "] = " + SymbolTable.FromNative (ctype, "arg" + idx) + ";");
ClassBase wrapper = SymbolTable.GetClassGen (ctype);
if ((wrapper != null && !(wrapper is InterfaceGen)) || SymbolTable.IsManuallyWrapped (ctype) || SymbolTable.IsBoxed (ctype)) {
sw.WriteLine("\t\t\tif (args.Args[" + (idx-1) + "] == null)");
sw.WriteLine("\t\t\t\targs.Args[{0}] = new {1}(arg{2});", idx-1, SymbolTable.GetCSType (ctype), idx);
}
} }
} }
sw.WriteLine("\t\t\tinst._handler (inst._obj, args);"); sw.WriteLine("\t\t\tinst._handler (inst._obj, args);");

View file

@ -14,6 +14,7 @@ namespace GtkSharp.Generation {
private static Hashtable alias = new Hashtable (); private static Hashtable alias = new Hashtable ();
private static Hashtable complex_types = new Hashtable (); private static Hashtable complex_types = new Hashtable ();
private static Hashtable simple_types; private static Hashtable simple_types;
private static Hashtable manually_wrapped_types;
private static Hashtable dlls; private static Hashtable dlls;
static SymbolTable () static SymbolTable ()
@ -27,6 +28,7 @@ namespace GtkSharp.Generation {
simple_types.Add ("gshort", "short"); simple_types.Add ("gshort", "short");
simple_types.Add ("guint32", "uint"); simple_types.Add ("guint32", "uint");
simple_types.Add ("const-gchar", "string"); simple_types.Add ("const-gchar", "string");
simple_types.Add ("const-char", "string");
simple_types.Add ("gchar", "string"); simple_types.Add ("gchar", "string");
simple_types.Add ("GObject", "GLib.Object"); simple_types.Add ("GObject", "GLib.Object");
simple_types.Add ("gfloat", "float"); simple_types.Add ("gfloat", "float");
@ -62,11 +64,14 @@ namespace GtkSharp.Generation {
simple_types.Add ("GArray", "System.IntPtr"); simple_types.Add ("GArray", "System.IntPtr");
simple_types.Add ("GData", "System.IntPtr"); simple_types.Add ("GData", "System.IntPtr");
simple_types.Add ("GTypeModule", "GLib.Object"); simple_types.Add ("GTypeModule", "GLib.Object");
simple_types.Add ("GSList", "GLib.SList");
simple_types.Add ("GHashTable", "System.IntPtr"); simple_types.Add ("GHashTable", "System.IntPtr");
simple_types.Add ("va_list", "System.IntPtr"); simple_types.Add ("va_list", "System.IntPtr");
simple_types.Add ("GParamSpec", "System.IntPtr"); simple_types.Add ("GParamSpec", "System.IntPtr");
manually_wrapped_types = new Hashtable ();
manually_wrapped_types.Add ("GdkEvent", "Gdk.Event");
manually_wrapped_types.Add ("GSList", "GLib.SList");
dlls = new Hashtable(); dlls = new Hashtable();
dlls.Add("Pango", "pango-1.0"); dlls.Add("Pango", "pango-1.0");
dlls.Add("Atk", "atk-1.0"); dlls.Add("Atk", "atk-1.0");
@ -123,6 +128,13 @@ namespace GtkSharp.Generation {
} else if (complex_types.ContainsKey(c_type)) { } else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type]; IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.FromNative(val); return gen.FromNative(val);
} else if (manually_wrapped_types.ContainsKey(c_type)) {
// FIXME: better way of handling this?
if (c_type == "GSList") {
return "new GLib.SList (" + val + ")";
} else {
return "(" + GetCSType (c_type) + ") GLib.Object.GetObject(" + val + ")";
}
} else { } else {
return ""; return "";
} }
@ -137,6 +149,8 @@ namespace GtkSharp.Generation {
} else if (complex_types.ContainsKey(c_type)) { } else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type]; IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.QualifiedName; return gen.QualifiedName;
} else if (manually_wrapped_types.ContainsKey(c_type)) {
return (string) manually_wrapped_types[c_type];
} else { } else {
return ""; return "";
} }
@ -146,8 +160,12 @@ namespace GtkSharp.Generation {
{ {
c_type = Trim(c_type); c_type = Trim(c_type);
c_type = DeAlias(c_type); c_type = DeAlias(c_type);
if (simple_types.ContainsKey(c_type)) { if (simple_types.ContainsKey(c_type) || manually_wrapped_types.ContainsKey(c_type)) {
string stype = (string) simple_types[c_type]; string stype;
if (simple_types.ContainsKey(c_type))
stype = (string) simple_types[c_type];
else
stype = (string) manually_wrapped_types[c_type];
int dotidx = stype.IndexOf("."); int dotidx = stype.IndexOf(".");
if (dotidx == -1) { if (dotidx == -1) {
return stype; return stype;
@ -168,6 +186,8 @@ namespace GtkSharp.Generation {
c_type = DeAlias(c_type); c_type = DeAlias(c_type);
if (simple_types.ContainsKey(c_type)) { if (simple_types.ContainsKey(c_type)) {
return (string) simple_types[c_type]; return (string) simple_types[c_type];
} else if (manually_wrapped_types.ContainsKey(c_type)) {
return "IntPtr";
} else if (complex_types.ContainsKey(c_type)) { } else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type]; IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.MarshalType; return gen.MarshalType;
@ -182,6 +202,8 @@ namespace GtkSharp.Generation {
c_type = DeAlias(c_type); c_type = DeAlias(c_type);
if (simple_types.ContainsKey(c_type)) { if (simple_types.ContainsKey(c_type)) {
return var_name; return var_name;
} else if (manually_wrapped_types.ContainsKey(c_type)) {
return var_name + ".Handle";
} else if (complex_types.ContainsKey(c_type)) { } else if (complex_types.ContainsKey(c_type)) {
IGeneratable gen = (IGeneratable) complex_types[c_type]; IGeneratable gen = (IGeneratable) complex_types[c_type];
return gen.CallByName(var_name); return gen.CallByName(var_name);
@ -251,6 +273,14 @@ namespace GtkSharp.Generation {
} }
return false; return false;
} }
public static bool IsManuallyWrapped(string c_type)
{
c_type = Trim(c_type);
c_type = DeAlias(c_type);
return manually_wrapped_types.ContainsKey(c_type);
}
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -60,5 +60,20 @@ namespace GLib {
return l; return l;
} }
} }
[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);
}
}
} }
} }

View file

@ -7,6 +7,8 @@ libgtksharpglue_la_SOURCES = \
textiter.c \ textiter.c \
fileselection.c \ fileselection.c \
error.c \ error.c \
event.c \
slist.c \
# #
libgtksharpglue.dll: $(libgtksharpglue_la_OBJECTS) libgtksharpglue.rc libgtksharpglue.def libgtksharpglue.dll: $(libgtksharpglue_la_OBJECTS) libgtksharpglue.rc libgtksharpglue.def

16
glue/event.c Normal file
View file

@ -0,0 +1,16 @@
/* event.c : Glue to access fields in GdkEvent.
*
* Author: Rachel Hestilow <hestilow@ximian.com>
*
* <c> 2002 Rachel Hestilow, Mike Kestner
*/
#include <gdk/gdkevents.h>
GdkEventType
gtksharp_gdk_event_get_event_type (GdkEvent *event)
{
return event->type;
}

21
glue/slist.c Normal file
View file

@ -0,0 +1,21 @@
/* slist.c : Glue to access fields in GSList.
*
* Author: Rachel Hestilow <hestilow@ximian.com>
*
* <c> 2002 Rachel Hestilow, Mike Kestner
*/
#include <glib/gslist.h>
gpointer
gtksharp_slist_get_data (GSList *l)
{
return l->data;
}
GSList*
gtksharp_slist_get_next (GSList *l)
{
return l->next;
}

19
gnome/Makefile.in Executable file
View file

@ -0,0 +1,19 @@
MCS=mcs
all: linux
windows:
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /r:../atk/atk-sharp.dll /r:../gdk/gdk-sharp.dll /r:../gtk/gtk-sharp.dll /out:gnome-sharp.dll /recurse:*.cs
linux: gnome-sharp.dll
gnome-sharp.dll: generated/*.cs
$(MCS) --unsafe --target library -r System.Drawing -L ../glib -L ../pango -L ../atk -L ../gdk -L ../gtk -r glib-sharp -r pango-sharp -r atk-sharp -r gdk-sharp -r gtk-sharp -o gnome-sharp.dll --recurse '*.cs'
clean:
rm -f *.dll
rm -f generated/*
install: all
cp gnome-sharp.dll @prefix@/lib

8
gnome/makefile.win32 Normal file
View file

@ -0,0 +1,8 @@
all: windows
windows:
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /r:../atk/atk-sharp.dll /r:../gdk/gdk-sharp.dll /r:../gtk/gtk-sharp.dll /out:gnome-sharp.dll /recurse:*.cs
docs:
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /r:../atk/atk-sharp.dll /r:../gdk/gdk-sharp.dll /r:../gtk/gtk-sharp.dll /doc:gnome-sharp-docs.xml /out:gnome-sharp.dll /recurse:*.cs

View file

@ -1,4 +1,4 @@
DIRS=generator glib pango atk gdk gtk sample DIRS=generator glib pango atk gdk gtk gnome sample
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT))) ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe
MCS=mcs MCS=mcs

152
parser/Gnome.metadata Normal file
View file

@ -0,0 +1,152 @@
<?xml version="1.0"?>
<metadata>
<!-- renames -->
<rule>
<class name="GnomeClient">
<signal>Connect</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Connected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeClient">
<signal>Disconnect</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Disconnected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Back</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>BackClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Finish</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>FinishClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Cancel</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>CancelClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Next</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>NextClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Prepare</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Prepared</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeIconList">
<signal>FocusIcon</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>IconFocused</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeEntry">
<method>GtkEntry</method>
</class>
<data>
<attribute target="method">
<name>name</name>
<value>GetGtkEntry</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeEntry">
<signal>Activate</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Activated</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeIconList">
<signal>SelectIcon</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>IconSelected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeIconList">
<signal>UnselectIcon</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>IconUnselected</value>
</attribute>
</data>
</rule>
<!-- misc -->
<rule>
<class name="GnomeAbout">
<constructor>gnome_about_new</constructor>
</class>
<data>
<attribute target="param">
<filter level="type">const-gchar**</filter>
<name>array</name>
<value>1</value>
</attribute>
</data>
</rule>
</metadata>

View file

@ -281,7 +281,31 @@
</attribute> </attribute>
</data> </data>
</rule> </rule>
<rule>
<class name="GtkWidget">
<signal>ShowHelp</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>HelpShown</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<method>Event</method>
</class>
<class name="GtkTextTag">
<method>Event</method>
</class>
<data>
<attribute target="method">
<name>name</name>
<value>ProcessEvent</value>
</attribute>
</data>
</rule>
<rule> <rule>
<class name="GtkTextBuffer"> <class name="GtkTextBuffer">
<signal>InsertPixbuf</signal> <signal>InsertPixbuf</signal>
@ -403,6 +427,29 @@
</attribute> </attribute>
</data> </data>
</rule> </rule>
<rule>
<class name="GtkCList">
<signal>SelectRow</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>RowSelected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkCList">
<signal>UnselectRow</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>RowUnselected</value>
</attribute>
</data>
</rule>
<rule> <rule>
<class name="GtkTree"> <class name="GtkTree">
<signal>SelectChild</signal> <signal>SelectChild</signal>

View file

@ -6,5 +6,8 @@ glib-2.0.3
pango-1.0.2 pango-1.0.2
atk-1.0.2 atk-1.0.2
gtk+-2.0.3 gtk+-2.0.3
libgnome-2.0.1
libgnomecanvas-2.0.1
libgnomeui-2.0.1
gtkhtml: cvs branch gnome-2-port files gtkhtml.[ch], gtkhtml-types.h and gtkhtml: cvs branch gnome-2-port files gtkhtml.[ch], gtkhtml-types.h and
gtkhtml-enums.h gtkhtml-enums.h

View file

@ -9,7 +9,10 @@ unlink ($file);
"gtk+-2.0.3/gdk" => "Gdk:gdk-x11-2.0", "gtk+-2.0.3/gdk" => "Gdk:gdk-x11-2.0",
"gtk+-2.0.3/gdk-pixbuf" => "Gdk:gdk_pixbuf-2.0", "gtk+-2.0.3/gdk-pixbuf" => "Gdk:gdk_pixbuf-2.0",
"gtk+-2.0.3/gtk" => "Gtk:gtk-x11-2.0", "gtk+-2.0.3/gtk" => "Gtk:gtk-x11-2.0",
"gtkhtml" => "Gtk:gtkhtml-2"); "libgnome-2.0.1/libgnome" => "Gnome:gnome-2",
"libgnomecanvas-2.0.1/libgnomecanvas" => "Gnome:gnomecanvas-2",
"libgnomeui-2.0.1/libgnomeui" => "Gnome:gnomeui-2",
"gtkhtml/src" => "Gtk:gtkhtml-2");
foreach $dir (keys %srcs) { foreach $dir (keys %srcs) {
($ns, $lib) = split (/:/, $srcs{$dir}); ($ns, $lib) = split (/:/, $srcs{$dir});

View file

@ -486,7 +486,7 @@ sub addParamsElem
$parm =~ /(\S+)\s+(\S+)/; $parm =~ /(\S+)\s+(\S+)/;
$parm_elem->setAttribute('type', $1); $parm_elem->setAttribute('type', $1);
my $name = $2; my $name = $2;
if ($name =~ /(\w+)\[\]/) { if ($name =~ /(\w+)\[.*\]/) {
$name = $1; $name = $1;
$parm_elem->setAttribute('array', "true"); $parm_elem->setAttribute('array', "true");
} }
@ -518,7 +518,7 @@ sub addPropElem
$name = $params[0]; $name = $params[0];
$name =~ s/\"//g; $name =~ s/\"//g;
while ($params[2] !~ /\"\s*\)?$/) { while ($params[2] !~ /(\"|NULL)\s*\)?$/) {
die "Unable to reconstruct doc string.\n" if (!$params[3]); die "Unable to reconstruct doc string.\n" if (!$params[3]);
$params[2] .= ",$params[3]"; $params[2] .= ",$params[3]";
@params = (@params[0..2],@params[4..$#params]); @params = (@params[0..2],@params[4..$#params]);

160
sample/GnomeHelloWorld.cs Normal file
View file

@ -0,0 +1,160 @@
// GnomeHelloWorld.cs - Basic Gnome/Gnome.UI sample app
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
// (c) 2002 Rachel Hestilow
namespace GtkSamples {
using Gtk;
using Gdk;
using GtkSharp;
using Gnome;
using System;
using System.IO;
using System.Drawing;
using System.Runtime.InteropServices;
public struct DemoEntry {
public string program;
public string desc;
public string icon;
public DemoEntry (string program, string desc, string icon)
{
this.program = program;
this.desc = desc;
this.icon = icon;
}
}
public class GnomeHelloWorld {
DemoEntry[] entries;
public GnomeHelloWorld () {
entries = new DemoEntry [3];
entries[0] = new DemoEntry ("button.exe", "Button", "gnome-ccdialog.png");
entries[1] = new DemoEntry ("menu.exe", "Menu", "gnome-gmenu.png");
entries[2] = new DemoEntry ("gtk-hello-world.exe", "Gtk# Hello World", "gnome-mdi.png");
}
string BaseName (string filename)
{
int ind = filename.LastIndexOf (Path.DirectorySeparatorChar);
if (ind != -1)
return filename.Substring (ind);
else
return filename;
}
IconList CreateList ()
{
IconList icons = new IconList (64, new Gtk.Adjustment (IntPtr.Zero), 0);
foreach (DemoEntry entry in entries)
{
icons.Append ("pixmaps" + Path.DirectorySeparatorChar + entry.icon,
entry.desc);
}
icons.IconSelected += new EventHandler (icon_selected_cb);
return icons;
}
Gtk.Widget CreateMenus ()
{
MenuBar bar = new MenuBar ();
Menu file_menu = new Menu ();
MenuItem file_menu_item = new MenuItem ("_File");
file_menu_item.Submenu = file_menu;
MenuItem file_exit = new MenuItem ("E_xit");
file_exit.Activated += new EventHandler (exit_cb);
file_menu.Append (file_exit);
bar.Append (file_menu_item);
Menu help_menu = new Menu ();
MenuItem help_menu_item = new MenuItem ("_Help");
help_menu_item.Submenu = help_menu;
MenuItem file_help = new MenuItem ("_About");
file_help.Activated += new EventHandler (about_cb);
help_menu.Append (file_help);
bar.Append (help_menu_item);
return bar;
}
public Gtk.Window CreateWindow ()
{
Gtk.Window win = new Gtk.Window ("Gnome# Hello World");
win.DeleteEvent += new EventHandler (Window_Delete);
VBox vbox = new VBox (false, 0);
vbox.PackStart (CreateMenus (), false, false, 0);
vbox.PackStart (new Label ("The following demos are available.\nTo run a demo, double click on its icon."), false, false, 4);
vbox.PackStart (CreateList (), true, true, 4);
win.DefaultSize = new Size (250, 130);
win.Add (vbox);
return win;
}
public static int Main (string[] args)
{
Application.Init ();
GnomeHelloWorld hello = new GnomeHelloWorld ();
Window win = hello.CreateWindow ();
win.ShowAll ();
Application.Run ();
return 0;
}
static void Window_Delete (object obj, EventArgs args)
{
SignalArgs sa = (SignalArgs) args;
Application.Quit ();
sa.RetVal = true;
}
static void exit_cb (object o, EventArgs args)
{
Application.Quit ();
}
static void about_cb (object o, EventArgs args)
{
Pixbuf logo = new Pixbuf ("pixmaps" + Path.DirectorySeparatorChar + "gtk-sharp-logo.png");
String[] authors = new string[] {
"Rachel Hestilow (hestilow@ximian.com)"
};
string[] documentors = new string[] {};
About about = new About ("Gnome# Hello World", "0.0.1",
"Copyright (C) 2002 Rachel Hestilow",
"A test application for the GNOME .NET bindings",
authors, documentors, "", logo);
about.Show ();
}
// Wonder what the .NET func to do this is...and if it
// is implemented in mono yet.
[DllImport("glib-2.0")]
static extern bool g_spawn_command_line_async (string command, IntPtr err);
void icon_selected_cb (object obj, EventArgs args)
{
SignalArgs sa = (SignalArgs) args;
int idx = (int) sa.Args[0];
Event ev = (Event) sa.Args[1];
if (ev.Type == EventType.TwoButtonPress) {
g_spawn_command_line_async ("mono " + entries[idx].program, IntPtr.Zero);
}
}
}
}

View file

@ -1,7 +1,7 @@
MCS=mcs MCS=mcs
local_paths=-L ../glib -L ../pango -L ../atk -L ../gdk -L ../gtk local_paths=-L ../glib -L ../pango -L ../atk -L ../gdk -L ../gtk -L ../gnome
all_assemblies=-r glib-sharp -r pango-sharp -r atk-sharp -r gdk-sharp -r gtk-sharp -r System.Drawing all_assemblies=-r glib-sharp -r pango-sharp -r atk-sharp -r gdk-sharp -r gtk-sharp -r gnome-sharp -r System.Drawing
all: linux all: linux
@ -10,11 +10,14 @@ windows:
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /r:../gdk/gdk-sharp.dll HelloWorld.cs $(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /r:../gdk/gdk-sharp.dll HelloWorld.cs
$(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs $(CSC) /unsafe /out:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
linux: gtk-hello-world.exe button.exe menu.exe linux: gtk-hello-world.exe button.exe menu.exe gnome-hello-world.exe
gtk-hello-world.exe: HelloWorld.cs gtk-hello-world.exe: HelloWorld.cs
$(MCS) --unsafe -o gtk-hello-world.exe $(local_paths) $(all_assemblies) HelloWorld.cs $(MCS) --unsafe -o gtk-hello-world.exe $(local_paths) $(all_assemblies) HelloWorld.cs
gnome-hello-world.exe: GnomeHelloWorld.cs
$(MCS) --unsafe -o gnome-hello-world.exe $(local_paths) $(all_assemblies) GnomeHelloWorld.cs
button.exe: ButtonApp.cs button.exe: ButtonApp.cs
$(MCS) --unsafe -o button.exe $(local_paths) $(all_assemblies) ButtonApp.cs $(MCS) --unsafe -o button.exe $(local_paths) $(all_assemblies) ButtonApp.cs

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

152
sources/Gnome.metadata Normal file
View file

@ -0,0 +1,152 @@
<?xml version="1.0"?>
<metadata>
<!-- renames -->
<rule>
<class name="GnomeClient">
<signal>Connect</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Connected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeClient">
<signal>Disconnect</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Disconnected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Back</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>BackClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Finish</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>FinishClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Cancel</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>CancelClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Next</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>NextClicked</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeDruidPage">
<signal>Prepare</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Prepared</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeIconList">
<signal>FocusIcon</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>IconFocused</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeEntry">
<method>GtkEntry</method>
</class>
<data>
<attribute target="method">
<name>name</name>
<value>GetGtkEntry</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeEntry">
<signal>Activate</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>Activated</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeIconList">
<signal>SelectIcon</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>IconSelected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GnomeIconList">
<signal>UnselectIcon</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>IconUnselected</value>
</attribute>
</data>
</rule>
<!-- misc -->
<rule>
<class name="GnomeAbout">
<constructor>gnome_about_new</constructor>
</class>
<data>
<attribute target="param">
<filter level="type">const-gchar**</filter>
<name>array</name>
<value>1</value>
</attribute>
</data>
</rule>
</metadata>

View file

@ -281,7 +281,31 @@
</attribute> </attribute>
</data> </data>
</rule> </rule>
<rule>
<class name="GtkWidget">
<signal>ShowHelp</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>HelpShown</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkWidget">
<method>Event</method>
</class>
<class name="GtkTextTag">
<method>Event</method>
</class>
<data>
<attribute target="method">
<name>name</name>
<value>ProcessEvent</value>
</attribute>
</data>
</rule>
<rule> <rule>
<class name="GtkTextBuffer"> <class name="GtkTextBuffer">
<signal>InsertPixbuf</signal> <signal>InsertPixbuf</signal>
@ -403,6 +427,29 @@
</attribute> </attribute>
</data> </data>
</rule> </rule>
<rule>
<class name="GtkCList">
<signal>SelectRow</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>RowSelected</value>
</attribute>
</data>
</rule>
<rule>
<class name="GtkCList">
<signal>UnselectRow</signal>
</class>
<data>
<attribute target="signal">
<name>name</name>
<value>RowUnselected</value>
</attribute>
</data>
</rule>
<rule> <rule>
<class name="GtkTree"> <class name="GtkTree">
<signal>SelectChild</signal> <signal>SelectChild</signal>

View file

@ -6,5 +6,8 @@ glib-2.0.3
pango-1.0.2 pango-1.0.2
atk-1.0.2 atk-1.0.2
gtk+-2.0.3 gtk+-2.0.3
libgnome-2.0.1
libgnomecanvas-2.0.1
libgnomeui-2.0.1
gtkhtml: cvs branch gnome-2-port files gtkhtml.[ch], gtkhtml-types.h and gtkhtml: cvs branch gnome-2-port files gtkhtml.[ch], gtkhtml-types.h and
gtkhtml-enums.h gtkhtml-enums.h