From 25000abee7d1c8285c11c56abafcfb79d9a7d9fb Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Thu, 27 Sep 2001 17:17:33 +0000 Subject: [PATCH] 2001-09-27 Mike Kestner *.cs : Added .dll extension to a load of DllImports. * makefile : now can make the project with one make windows and on both NT and Win98. * gdk/Event.cs : Fixed some invalid symbol names and commented out a load of stuff. * gdk/SimpleEvent.cs : Relocated file from unnecessary subdir and fixed several event keyword clashing bugs. Need to relocate the EventArgs class out of here into its own file. Fixed loads of typos. * glib/Object.cs : Killed the Constructor, this should be a purely abstract class. made Events property public until I can fix the Signal proxying system's broken reliance on it. * glib/SimpleSignal.cs : Relocated, namespaces, and named this Class. Loads of bugfixes. Still doesn't work worth a damn, but it builds. * glib/TypeFundamentals.cs : New enum for use in the Value code. * glib/Value.cs : Implemented a more opaque approach with heap allocated memory and g_value_init and friends. Still doesn't work. Will probably switch to a more C# like approach and avoid GValues altogether. * gtk/Button.cs : Commented out some brokeness until I can get around to fixing it later. * gtk/Widget.cs : Commented out a bunch of the new signal stuff until I get around to it. * gtk/Window.cs (Title): using g_object_set until I work out the details of the new Value/SetProperty system. It looks like g_object_set will end up being easier to use via PInvoke. svn path=/trunk/gtk-sharp/; revision=1008 --- ChangeLog | 34 ++++++++++++++-- gdk/.cvsignore | 3 ++ gdk/Event.cs | 9 +++-- gdk/Signals/SimpleEvent.cs | 73 ---------------------------------- gdk/SimpleEvent.cs | 73 ++++++++++++++++++++++++++++++++++ gdk/makefile | 1 - glib/Object.cs | 20 ++++------ glib/Signals/Simple.cs | 51 ------------------------ glib/SimpleSignal.cs | 79 +++++++++++++++++++++++++++++++++++++ glib/TypeFundamentals.cs | 38 ++++++++++++++++++ glib/Value.cs | 73 ++++++++++++++++++++++------------ glib/makefile | 1 - gtk/Application.cs | 6 +-- gtk/Button.cs | 7 +++- gtk/Widget.cs | 81 ++++++++++++++++++-------------------- gtk/Window.cs | 17 ++++---- gtk/makefile | 2 - makefile | 15 +++++++ sample/makefile | 2 +- 19 files changed, 355 insertions(+), 230 deletions(-) create mode 100644 gdk/.cvsignore delete mode 100644 gdk/Signals/SimpleEvent.cs create mode 100644 gdk/SimpleEvent.cs delete mode 100644 glib/Signals/Simple.cs create mode 100644 glib/SimpleSignal.cs create mode 100644 glib/TypeFundamentals.cs create mode 100644 makefile diff --git a/ChangeLog b/ChangeLog index 69a2f7084..ba6fb9466 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,41 @@ -2001-09-25 +2001-09-27 Mike Kestner + + *.cs : Added .dll extension to a load of DllImports. + * makefile : now can make the project with one make windows and on + both NT and Win98. + * gdk/Event.cs : Fixed some invalid symbol names and commented out a + load of stuff. + * gdk/SimpleEvent.cs : Relocated file from unnecessary subdir and fixed + several event keyword clashing bugs. Need to relocate the EventArgs + class out of here into its own file. Fixed loads of typos. + * glib/Object.cs : Killed the Constructor, this should be a purely + abstract class. made Events property public until I can fix the Signal + proxying system's broken reliance on it. + * glib/SimpleSignal.cs : Relocated, namespaces, and named this Class. + Loads of bugfixes. Still doesn't work worth a damn, but it builds. + * glib/TypeFundamentals.cs : New enum for use in the Value code. + * glib/Value.cs : Implemented a more opaque approach with heap allocated + memory and g_value_init and friends. Still doesn't work. Will probably + switch to a more C# like approach and avoid GValues altogether. + * gtk/Button.cs : Commented out some brokeness until I can get around + to fixing it later. + * gtk/Widget.cs : Commented out a bunch of the new signal stuff until + I get around to it. + * gtk/Window.cs (Title): using g_object_set until I work out the + details of the new Value/SetProperty system. It looks like g_object_set + will end up being easier to use via PInvoke. + +2001-09-25 Bob Smith + * Added refcounts to delegates to make sure they can be unpined when not needed. -2001-09-21 +2001-09-21 Bob Smith * Signal system totally reworked. It should be stable now. * glib/Object.cs: Rewrote the way the wrapper is kept track of. -2001-09-20 +2001-09-20 Bob Smith * glib/ObjectManager.cs: Nuked. * glib/Object.cs: Keep track of wrapper. diff --git a/gdk/.cvsignore b/gdk/.cvsignore new file mode 100644 index 000000000..4e8ac1c1b --- /dev/null +++ b/gdk/.cvsignore @@ -0,0 +1,3 @@ +*.dll +*.exe + diff --git a/gdk/Event.cs b/gdk/Event.cs index 782d5e32e..1c8d76f5a 100644 --- a/gdk/Event.cs +++ b/gdk/Event.cs @@ -10,8 +10,8 @@ namespace Gdk { Expose = 2, MotionNotify = 3, ButtonPress = 4, - 2ButtonPress = 5, - 3ButtonPress = 6, + TwoButtonPress = 5, + ThreeButtonPress = 6, ButtonRelease = 7, KeyPress = 8, KeyRelease = 9, @@ -60,6 +60,8 @@ namespace Gdk { Marshal.WriteIntPtr(_event, new IntPtr((int)value)); } } + +/* FIXME: Fix or kill later. public EventAny Any { get @@ -67,10 +69,11 @@ namespace Gdk { return (EventAll)this; } } - public static explicit EventAll (Event e) + public static explicit operator EventAll (Event e) { return Marshal.PtrToStructure(e._event, EventAll); } +*/ } [StructLayout(LayoutKind.Sequential)] diff --git a/gdk/Signals/SimpleEvent.cs b/gdk/Signals/SimpleEvent.cs deleted file mode 100644 index f3c8b3dfe..000000000 --- a/gdk/Signals/SimpleEvent.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Gdk.Signals.SimpleEvent.cs - Gdk Simple Event Signal implementation -// -// Author: Bob Smith -// -// (c) 2001 Bob Smith - -namespace Gdk.Signals { - using System; - using System.Runtime.InteropServices; - using Glib; - using Gdk; - - public class SimpleEventArgs : EventArgs { - public SimpleEventArgs(Gdk.Event event) - { - _event = event; - } - private Gdk.Event _event; - public Gdk.Event Event - { - get - { - return _event; - } - } - public static explicit operator Gdk.Event(SimpleEventArgs value) - { - return value.Event; - } - } - - public delegate bool SimpleEventDelegate(IntPtr obj, IntPtr data); - public class SimpleEvent { - public SimpleEvent(){} - private static bool SimpleEventCallback(IntPtr obj, IntPtr e, IntPtr data) - { - Glib.Object o = Glib.Object.GetObject(obj); - EventHandler eh = o.Events[(int)data]; - if (eh != null) - { - EventArgs args = new SimpleEventArgs (new Gdk.Event(e)); - eh(o, args); - } - return true; //FIXME: How do we manage the return value? - } - private static int _simpleRefCount; - private static SimpleEventDelegate _simpleDelegate; - private static GCHandle _simpleEventGCHandle; - public static SimpleEventDelegate Delegate - { - get - { - if (SimpleEvent._simpleEventDelegate == null) - { - SimpleEvent._simpleDelegate = new SimpleEventDelegate(SimpleCallback); - SimpleEvent._simpleGCHandle = GCHandle.Alloc (SimpleEvent._simpleEventDelegate, GCHandleType.Pinned); - } - SimpleEvent._simpleRefCount++; - return SimpleEvent._simpleEventDelegate; - } - } - public static void Unref() - { - SimpleEvent._simpleRefCount--; - if (SimpleEvent._simpleRefCount < 1) - { - SimpleEvent._simpleRefCount = 0; - SimpleEvent._simpleEventGCHandle.free(); - SimpleEvent._simpleDelegate = null; - } - } - } -} diff --git a/gdk/SimpleEvent.cs b/gdk/SimpleEvent.cs new file mode 100644 index 000000000..945945d0e --- /dev/null +++ b/gdk/SimpleEvent.cs @@ -0,0 +1,73 @@ +// Gdk.Signals.SimpleEvent.cs - Gdk Simple Event Signal implementation +// +// Author: Bob Smith +// +// (c) 2001 Bob Smith + +namespace Gdk { + using System; + using System.Runtime.InteropServices; + using GLib; + using Gdk; + + public class SimpleEventArgs : EventArgs { + public SimpleEventArgs(Gdk.Event evnt) + { + _evnt = evnt; + } + private Gdk.Event _evnt; + public Gdk.Event Event + { + get + { + return _evnt; + } + } + public static explicit operator Gdk.Event(SimpleEventArgs value) + { + return value.Event; + } + } + + public delegate bool SimpleEventDelegate(IntPtr obj, IntPtr e, String name); + public class SimpleEvent { + + private static bool SimpleEventCallback (IntPtr obj, IntPtr e, String name) + { + GLib.Object o = GLib.Object.GetObject (obj); + EventHandler eh = (EventHandler) o.Events [name]; + if (eh != null) + { + EventArgs args = new SimpleEventArgs (new Gdk.Event(e)); + eh(o, args); + } + return true; //FIXME: How do we manage the return value? + } + private static int _RefCount; + private static SimpleEventDelegate _Delegate; + private static GCHandle _GCHandle; + public static SimpleEventDelegate Delegate + { + get + { + if (_Delegate == null) + { + _Delegate = new SimpleEventDelegate(SimpleEventCallback); + _GCHandle = GCHandle.Alloc (_Delegate, GCHandleType.Pinned); + } + _RefCount++; + return _Delegate; + } + } + public static void Unref() + { + _RefCount--; + if (_RefCount < 1) + { + _RefCount = 0; + _GCHandle.Free(); + _Delegate = null; + } + } + } +} diff --git a/gdk/makefile b/gdk/makefile index 9acb18090..e730d5bf6 100755 --- a/gdk/makefile +++ b/gdk/makefile @@ -1,4 +1,3 @@ -CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe all: @echo "You must use 'make windows' or 'make unix'." diff --git a/glib/Object.cs b/glib/Object.cs index 62d713157..80e37a1c8 100644 --- a/glib/Object.cs +++ b/glib/Object.cs @@ -1,8 +1,9 @@ // Object.cs - GObject class wrapper implementation // -// Author: Bob Smith +// Authors: Bob Smith +// Mike Kestner // -// (c) 2001 Bob Smith +// (c) 2001 Bob Smith and Mike Kestner namespace GLib { @@ -17,12 +18,7 @@ namespace GLib { { Object obj = (Object)Objects[(int)o]; if (obj != null) return obj; - return new Object(o); //FIXME: Cast up when we know how. - } - - public Object(IntPtr o) - { - RawObject = o; + return null; //FIXME: Call TypeParser here eventually. } private IntPtr _obj; @@ -40,7 +36,7 @@ namespace GLib { } private EventHandlerList _events; - protected EventHandlerList Events + public EventHandlerList Events { get { if (_events == null) @@ -49,8 +45,7 @@ namespace GLib { } } - - [DllImport("gobject-1.3")] + [DllImport("gobject-1.3.dll")] static extern IntPtr g_object_get_data ( IntPtr obj, String key ); @@ -71,7 +66,8 @@ namespace GLib { g_object_set_data (_obj, key, value); } -/* [DllImport("gtk-1.3")] +/* + [DllImport("gtk-1.3.dll")] static extern void g_object_set_data_full ( IntPtr obj, String key, diff --git a/glib/Signals/Simple.cs b/glib/Signals/Simple.cs deleted file mode 100644 index 8b93acc7e..000000000 --- a/glib/Signals/Simple.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Glib.Signals.Simple.cs - Glib Simple Signal implementation -// -// Author: Bob Smith -// -// (c) 2001 Bob Smith - -namespace Glib.Signals { - using System; - using System.Runtime.InteropServices; - using Glib; - - public delegate void SimpleDelegate(IntPtr obj, IntPtr data); - public class Simple { - public Simple(){} - private static void SimpleCallback(IntPtr obj, IntPtr data) - { - Glib.Object o = Glib.Object.GetObject(obj); - EventHandler eh = o.Events[(int)data]; - if (eh != null) - { - eh(o, EventArgs.Empty); - } - } - private static int _simpleRefCount = 0; - private static SimpleDelegate _simpleDelegate; - private static GCHandle _simpleGCHandle; - public static SimpleDelegate Delegate - { - get - { - if (Simple._simpleDelegate == null) - { - Simple._simpleDelegate = new SimpleDelegate(SimpleCallback); - Simple._simpleGCHandle = GCHandle.Alloc (Simple._simpleDelegate, GCHandleType.Pinned); - } - Simple._simpleRefCount++; - return Simple._simpleDelegate; - } - } - public static void Unref() - { - Simple._simpleRefCount--; - if (Simple._simpleRefCount < 1) - { - Simple._simpleRefCount = 0; - Simple._simpleGCHandle.free(); - Simple._simpleDelegate = null; - } - } - } -} diff --git a/glib/SimpleSignal.cs b/glib/SimpleSignal.cs new file mode 100644 index 000000000..4d8dbc375 --- /dev/null +++ b/glib/SimpleSignal.cs @@ -0,0 +1,79 @@ +// GLib.Signals.Simple.cs - GLib Simple Signal implementation +// +// Authors: Bob Smith +// Mike Kestner +// +// (c) 2001 Bob Smith & Mike Kestner + +namespace GLib { + using System; + using System.Runtime.InteropServices; + using GLib; + + /// + /// SimpleDelegate Delegate + /// + /// + /// + /// Used to connect to simple signals which contain no signal- + /// specific data. + /// + + public delegate void SimpleDelegate (IntPtr obj, String name); + + /// + /// SimpleSignal Class + /// + /// + /// + /// Wraps a simple signal which contains no single-specific data. + /// + + public class SimpleSignal { + + private static int _RefCount = 0; + private static SimpleDelegate _Delegate; + private static GCHandle _GCHandle; + + private static void SimpleCallback(IntPtr obj, String name) + { + Object o = Object.GetObject(obj); + EventHandler eh = (EventHandler) o.Events[name]; + if (eh != null) + { + eh(o, EventArgs.Empty); + } + } + + public static SimpleDelegate Delegate + { + get + { + if (_Delegate == null) + { + _Delegate = new SimpleDelegate(SimpleCallback); + +/* FIXME: Can't do this until a layout attribute is defined for SimpleCallback + * apparently, since this throws an ArgumentException:Type does not have a + * layout attribute. + * + * _GCHandle = GCHandle.Alloc (_Delegate, GCHandleType.Pinned); + */ + } + _RefCount++; + return _Delegate; + } + } + + public static void Unref() + { + _RefCount--; + if (_RefCount < 1) + { + _RefCount = 0; + _GCHandle.Free(); + _Delegate = null; + } + } + } +} diff --git a/glib/TypeFundamentals.cs b/glib/TypeFundamentals.cs new file mode 100644 index 000000000..50a3049a5 --- /dev/null +++ b/glib/TypeFundamentals.cs @@ -0,0 +1,38 @@ +// GLib.TypeFundamentals.cs : Standard Types enumeration +// +// Author: Mike Kestner +// +// (c) 2001 Mike Kestner + +namespace GLib { + + /// + /// TypeFundamentals enumeration + /// + /// + /// + /// The built-in types available in GLib. + /// + + public enum TypeFundamentals { + TypeInvalid, + TypeNone, + TypeInterface, + TypeChar, + TypeUChar, + TypeBoolean, + TypeInt, + TypeUInt, + TypeLong, + TypeULong, + TypeEnum, + TypeFlags, + TypeFloat, + TypeDouble, + TypeString, + TypePointer, + TypeBoxed, + TypeParam, + TypeObject, + } +} diff --git a/glib/Value.cs b/glib/Value.cs index 951625620..3d724cfcf 100755 --- a/glib/Value.cs +++ b/glib/Value.cs @@ -1,4 +1,4 @@ -// GLib.GValue.cs - GLib Value class implementation +// GLib.Value.cs - GLib Value class implementation // // Author: Mike Kestner // @@ -9,34 +9,56 @@ namespace GLib { using System; using System.Runtime.InteropServices; - [StructLayout(LayoutKind.Sequential)] - public struct GValueStruct { - uint type; - IntPtr data1; - IntPtr data2; - IntPtr data3; - IntPtr data4; - } + /// + /// Value Class + /// + /// + /// + /// An arbitrary data type similar to a CORBA Any which is used + /// to get and set properties on Objects. + /// - public class GValue { + public class Value { - GValueStruct _val; + IntPtr _val; + // We use g_malloc0 and g_free to put the GValue on the + // heap to avoid some marshalling pain. + [DllImport("glib-1.3.dll")] + static extern IntPtr g_malloc0 (long n_bytes); + [DllImport("glib-1.3.dll")] + static extern void g_free (IntPtr mem); + + [DllImport("gobject-1.3.dll")] + static extern void g_value_init (IntPtr val, + TypeFundamentals type); /// - /// GValue Constructor + /// Value Constructor /// /// /// - /// Constructs a GValue from a string. + /// Constructs a Value from a spectified string. /// - [DllImport("gobject-1.3")] - static extern void g_value_set_string (ref GValueStruct val, + [DllImport("gobject-1.3.dll")] + static extern void g_value_set_string (IntPtr val, String data); + [DllImport("gobject-1.3.dll")] + static extern void g_value_set_boolean (IntPtr val, + bool data); - public GValue (String data) + public Value (bool val) { - g_value_set_string (ref _val, data); + _val = g_malloc0 (5 * IntPtr.Size); + g_value_init (_val, TypeFundamentals.TypeBoolean); + g_value_set_boolean (_val, val); + } + + public Value (String str) + { + _val = g_malloc0 (5 * IntPtr.Size); + g_value_init (_val, TypeFundamentals.TypeString); + g_value_set_string (_val, str); } /// @@ -44,31 +66,30 @@ namespace GLib { /// /// /// - /// Extracts a string from a GValue. Note, this method - /// will produce an exception if the GValue does not hold a + /// Extracts a string from a Value. Note, this method + /// will produce an exception if the Value does not hold a /// string value. /// - [DllImport("gobject-1.3")] - static extern String g_value_get_string (ref GValueStruct val); + [DllImport("gobject-1.3.dll")] + static extern String g_value_get_string (IntPtr val); public String GetString () { // FIXME: Insert an appropriate exception here if // _val.type indicates an error. - return g_value_get_string (ref _val); + return g_value_get_string (_val); } /// - /// ValueStruct Property + /// RawValue Property /// /// /// - /// Accesses a structure which can be easily marshalled - /// via PInvoke to set properties on GObjects. + /// Read only. Accesses a pointer to the Raw GValue. /// - public GValueStruct ValueStruct { + public IntPtr RawValue { get { return _val; } diff --git a/glib/makefile b/glib/makefile index 650a32239..6a558aa6f 100755 --- a/glib/makefile +++ b/glib/makefile @@ -1,4 +1,3 @@ -CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe all: @echo "You must use 'make windows' or 'make unix'." diff --git a/gtk/Application.cs b/gtk/Application.cs index 9574296d1..fd2542c0b 100755 --- a/gtk/Application.cs +++ b/gtk/Application.cs @@ -23,7 +23,7 @@ namespace Gtk { public class Application { - [DllImport("gtk-1.3")] + [DllImport("gtk-1.3.dll")] static extern void gtk_init (ref int argc, ref String[] argv); /// @@ -48,7 +48,7 @@ namespace Gtk { /// Begins the event loop iteration. /// - [DllImport("gtk-1.3")] + [DllImport("gtk-1.3.dll")] static extern void gtk_main (); public static void Run () @@ -65,7 +65,7 @@ namespace Gtk { /// Terminates the event loop iteration. /// - [DllImport("gtk-1.3")] + [DllImport("gtk-1.3.dll")] static extern void gtk_main_quit (); public static void Quit () diff --git a/gtk/Button.cs b/gtk/Button.cs index cd5ae4b01..87024a478 100644 --- a/gtk/Button.cs +++ b/gtk/Button.cs @@ -12,6 +12,7 @@ namespace Gtk { public class Button : Widget { private static readonly string ClickedEvent = "clicked"; +/* public event EventHandler Clicked { add @@ -23,7 +24,7 @@ namespace Gtk { RemoveSimpleEvent (ClickedEvent, value); } } - +*/ /// /// Button Object Constructor /// @@ -37,12 +38,14 @@ namespace Gtk { RawObject = o; } - public ~Button () + ~Button () { + /* FIXME: Find legal way to do this eventually. foreach (EventHandler e in Events[ClickedEvent]) { Clicked -= e; } + */ } /// diff --git a/gtk/Widget.cs b/gtk/Widget.cs index be3b0cc4d..9c3dcd986 100755 --- a/gtk/Widget.cs +++ b/gtk/Widget.cs @@ -8,31 +8,38 @@ namespace Gtk { using System; using System.Runtime.InteropServices; - using Glib; + using GLib; using Gdk; + public class Widget : Object { public Widget() {} - public ~Widget() + ~Widget() { - foreach (EventHandler e in Events[DeleteEvent]) + /* FIXME: Find a valid way to Delete the handlers + foreach (EventHandler e in Events[DelEvName]) { DeleteEvent -= e; } - } - private static readonly string DeleteEvent = "delete-event"; - public event EventHandler DeleteEvent - { - add - { - AddGdkSimpleEvent(DeleteEvent, value); - } - remove - { - RemoveGdkSimpleEvent (DeleteEvent, value); - } + */ } + private static readonly string DelEvName = "delete-event"; + + public event EventHandler DeleteEvent { + add { + if (Events [DelEvName] == null) + ConnectSignal(DelEvName); + + Events.AddHandler(DelEvName, value); + } + remove { + Events.RemoveHandler(DelEvName, value); + if (Events [DelEvName] == null) + DisconnectSignal (DelEvName); + } + } +/* public void AddSimpleEvent(Object type, string name, EventHandler value) { if (Events[type] == null) @@ -42,10 +49,7 @@ namespace Gtk { Events.AddHandler(type, value); } - public void AddSimpleEvent(String type, EventHandle value) - : this (type, type, value) {} - - public void RemoveSimpleEvent(Object type, string name, EventHander value) + public void RemoveSimpleEvent(Object type, string name, EventHandler value) { Events.RemoveHandler(type, value); if (Events[type] == null) @@ -54,9 +58,6 @@ namespace Gtk { } } - public void RemoveSimpleEvent(String type, EventHandle value) - : this (type, type, value) {} - public void AddGdkSimpleEvent(Object type, string name, EventHandler value) { if (Events[type] == null) @@ -66,10 +67,7 @@ namespace Gtk { Events.AddHandler(type, value); } - public void AddGdkSimpleEvent(String type, EventHandle value) - : this (type, type, value) {} - - public void RemoveGdkSimpleEvent(Object type, string name, EventHander value) + public void RemoveGdkSimpleEvent(Object type, string name, EventHandler value) { Events.RemoveHandler(type, value); if (Events[type] == null) @@ -77,42 +75,39 @@ namespace Gtk { DisconnectGdkSimpleEventSignal(name, type); } } - - public void RemoveGdkSimpleEvent(String type, EventHandle value) - : this (type, type, value) {} - - - [DllImport("gtk-1.3")] +*/ + [DllImport("gtk-1.3.dll")] static extern void gtk_signal_connect_full ( IntPtr obj, string evname, SimpleDelegate cb, IntPtr unsupported, - IntPtr data, IntPtr destroycb, + String data, IntPtr destroycb, int objsig, int after ); - public void ConnectSimpleSignal(string name, Object signal) + public void ConnectSignal(string name) { - gtk_signal_connect_full(RawObject, name, Glib.Signals.Simple.Delegate, - new IntPtr (0), new IntPtr (signal.GetHashCode()), + gtk_signal_connect_full(RawObject, name, SimpleSignal.Delegate, + new IntPtr (0), name, new IntPtr (0), 0, 0); } - public void DisconnectSimpleSignal(string name, Object signal) + public void DisconnectSignal(string name) { - Glib.Signals.Simple.Unref(); + SimpleSignal.Unref(); } +/* public void ConnectGdkSimpleSignal(string name, Object signal) { - gtk_signal_connect_full(RawObject, name, Gdk.Signals.SimpleEvent.Delegate, - new IntPtr (0), new IntPtr (signal.GetHashCode()), + gtk_signal_connect_full(RawObject, name, SimpleEvent.Delegate, + new IntPtr (0), name, new IntPtr (0), 0, 0); } public void DisconnectGdkSimpleSignal(string name, Object signal) { - Gdk.Signals.SimpleEvent.Unref(); + SimpleEvent.Unref(); } - +*/ /// /// Show Method /// @@ -121,7 +116,7 @@ namespace Gtk { /// Makes the Widget visible on the display. /// - [DllImport("gtk-1.3")] + [DllImport("gtk-1.3.dll")] static extern void gtk_widget_show (IntPtr obj); public void Show () diff --git a/gtk/Window.cs b/gtk/Window.cs index 32778b5a1..f2f00a681 100755 --- a/gtk/Window.cs +++ b/gtk/Window.cs @@ -39,7 +39,7 @@ namespace Gtk { /// Constructs a new Window of type TopLevel. /// - [DllImport("gtk-1.3")] + [DllImport("gtk-1.3.dll")] static extern IntPtr gtk_window_new (WindowType type); public Window () @@ -73,7 +73,7 @@ namespace Gtk { public bool AllowGrow { get { - GValue val = GetProp ("allow-grow"); + Value val = GetProp ("allow-grow"); return (val != 0); } set { @@ -166,7 +166,7 @@ namespace Gtk { /// The Position of the Window in Screen Coordinates. /// - [DllImport("gtk-1.3")] + [DllImport("gtk-1.3.dll")] static extern void gtk_window_set_position (IntPtr hnd, int x, int y); @@ -186,15 +186,14 @@ namespace Gtk { /// The Title displayed in the Window's Title Bar. /// - [DllImport("gobject-1.3")] - static extern void g_object_set_property (String title, - ref GValueStruct vs); + [DllImport("gobject-1.3.dll")] + static extern void g_object_set (IntPtr obj, String name, + IntPtr val, IntPtr term); public String Title { set { - GValue val = new GValue (value); - GValueStruct vs = val.ValueStruct; - g_object_set_property ("title", ref vs); + g_object_set (RawObject, "title", + Marshal.StringToHGlobalAnsi (value), new IntPtr (0)); } } } diff --git a/gtk/makefile b/gtk/makefile index 01c70b88c..18f7a0aa7 100755 --- a/gtk/makefile +++ b/gtk/makefile @@ -1,5 +1,3 @@ -CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe - all: @echo "You must use 'make windows' or 'make unix'." @echo "'make unix' is broken for now." diff --git a/makefile b/makefile new file mode 100644 index 000000000..8b1b5f7be --- /dev/null +++ b/makefile @@ -0,0 +1,15 @@ +DIRS=glib gdk gtk sample +ROOT=//$(subst \,/,$(subst :\,/,$(SYSTEMROOT))) +CSC=$(ROOT)/microsoft.net/framework/v1.0.2914/csc.exe + +all: + @echo "You must use 'make windows' or 'make unix'." + @echo "'make unix' is broken for now." + +windows: + for i in $(DIRS); do \ + (cd $$i; CSC=$(CSC) make windows) || exit 1;\ + done; + +unix: + @echo "'make unix' is broken for now." diff --git a/sample/makefile b/sample/makefile index 855e14341..d56866e74 100755 --- a/sample/makefile +++ b/sample/makefile @@ -1,4 +1,4 @@ -CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe +CSC=/cygdrive/c/winnt/microsoft.net/framework/v1.0.2914/csc.exe all: @echo "You must use 'make windows' or 'make unix'."