2001-09-27 Mike Kestner <mkestner@speakeasy.net>

*.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
This commit is contained in:
Mike Kestner 2001-09-27 17:17:33 +00:00
parent 699238daad
commit 25000abee7
19 changed files with 355 additions and 230 deletions

View file

@ -1,13 +1,41 @@
2001-09-25 2001-09-27 Mike Kestner <mkestner@speakeasy.net>
*.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 <bob@thestuff.net>
* Added refcounts to delegates to make sure they can be unpined when * Added refcounts to delegates to make sure they can be unpined when
not needed. not needed.
2001-09-21 2001-09-21 Bob Smith <bob@thestuff.net>
* Signal system totally reworked. It should be stable now. * Signal system totally reworked. It should be stable now.
* glib/Object.cs: Rewrote the way the wrapper is kept track of. * glib/Object.cs: Rewrote the way the wrapper is kept track of.
2001-09-20 2001-09-20 Bob Smith <bob@thestuff.net>
* glib/ObjectManager.cs: Nuked. * glib/ObjectManager.cs: Nuked.
* glib/Object.cs: Keep track of wrapper. * glib/Object.cs: Keep track of wrapper.

3
gdk/.cvsignore Normal file
View file

@ -0,0 +1,3 @@
*.dll
*.exe

View file

@ -10,8 +10,8 @@ namespace Gdk {
Expose = 2, Expose = 2,
MotionNotify = 3, MotionNotify = 3,
ButtonPress = 4, ButtonPress = 4,
2ButtonPress = 5, TwoButtonPress = 5,
3ButtonPress = 6, ThreeButtonPress = 6,
ButtonRelease = 7, ButtonRelease = 7,
KeyPress = 8, KeyPress = 8,
KeyRelease = 9, KeyRelease = 9,
@ -60,6 +60,8 @@ namespace Gdk {
Marshal.WriteIntPtr(_event, new IntPtr((int)value)); Marshal.WriteIntPtr(_event, new IntPtr((int)value));
} }
} }
/* FIXME: Fix or kill later.
public EventAny Any public EventAny Any
{ {
get get
@ -67,10 +69,11 @@ namespace Gdk {
return (EventAll)this; return (EventAll)this;
} }
} }
public static explicit EventAll (Event e) public static explicit operator EventAll (Event e)
{ {
return Marshal.PtrToStructure(e._event, EventAll); return Marshal.PtrToStructure(e._event, EventAll);
} }
*/
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]

View file

@ -1,73 +0,0 @@
// Gdk.Signals.SimpleEvent.cs - Gdk Simple Event Signal implementation
//
// Author: Bob Smith <bob@thestuff.net>
//
// (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;
}
}
}
}

73
gdk/SimpleEvent.cs Normal file
View file

@ -0,0 +1,73 @@
// Gdk.Signals.SimpleEvent.cs - Gdk Simple Event Signal implementation
//
// Author: Bob Smith <bob@thestuff.net>
//
// (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;
}
}
}
}

View file

@ -1,4 +1,3 @@
CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe
all: all:
@echo "You must use 'make windows' or 'make unix'." @echo "You must use 'make windows' or 'make unix'."

View file

@ -1,8 +1,9 @@
// Object.cs - GObject class wrapper implementation // Object.cs - GObject class wrapper implementation
// //
// Author: Bob Smith <bob@thestuff.net> // Authors: Bob Smith <bob@thestuff.net>
// Mike Kestner <mkestner@speakeasy.net>
// //
// (c) 2001 Bob Smith // (c) 2001 Bob Smith and Mike Kestner
namespace GLib { namespace GLib {
@ -17,12 +18,7 @@ namespace GLib {
{ {
Object obj = (Object)Objects[(int)o]; Object obj = (Object)Objects[(int)o];
if (obj != null) return obj; if (obj != null) return obj;
return new Object(o); //FIXME: Cast up when we know how. return null; //FIXME: Call TypeParser here eventually.
}
public Object(IntPtr o)
{
RawObject = o;
} }
private IntPtr _obj; private IntPtr _obj;
@ -40,7 +36,7 @@ namespace GLib {
} }
private EventHandlerList _events; private EventHandlerList _events;
protected EventHandlerList Events public EventHandlerList Events
{ {
get { get {
if (_events == null) if (_events == null)
@ -49,8 +45,7 @@ namespace GLib {
} }
} }
[DllImport("gobject-1.3.dll")]
[DllImport("gobject-1.3")]
static extern IntPtr g_object_get_data ( static extern IntPtr g_object_get_data (
IntPtr obj, IntPtr obj,
String key ); String key );
@ -71,7 +66,8 @@ namespace GLib {
g_object_set_data (_obj, key, value); g_object_set_data (_obj, key, value);
} }
/* [DllImport("gtk-1.3")] /*
[DllImport("gtk-1.3.dll")]
static extern void g_object_set_data_full ( static extern void g_object_set_data_full (
IntPtr obj, IntPtr obj,
String key, String key,

View file

@ -1,51 +0,0 @@
// Glib.Signals.Simple.cs - Glib Simple Signal implementation
//
// Author: Bob Smith <bob@thestuff.net>
//
// (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;
}
}
}
}

79
glib/SimpleSignal.cs Normal file
View file

@ -0,0 +1,79 @@
// GLib.Signals.Simple.cs - GLib Simple Signal implementation
//
// Authors: Bob Smith <bob@thestuff.net>
// Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Bob Smith & Mike Kestner
namespace GLib {
using System;
using System.Runtime.InteropServices;
using GLib;
/// <summary>
/// SimpleDelegate Delegate
/// </summary>
///
/// <remarks>
/// Used to connect to simple signals which contain no signal-
/// specific data.
/// </remarks>
public delegate void SimpleDelegate (IntPtr obj, String name);
/// <summary>
/// SimpleSignal Class
/// </summary>
///
/// <remarks>
/// Wraps a simple signal which contains no single-specific data.
/// </remarks>
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;
}
}
}
}

38
glib/TypeFundamentals.cs Normal file
View file

@ -0,0 +1,38 @@
// GLib.TypeFundamentals.cs : Standard Types enumeration
//
// Author: Mike Kestner <mkestner@speakeasy.net>
//
// (c) 2001 Mike Kestner
namespace GLib {
/// <summary>
/// TypeFundamentals enumeration
/// </summary>
///
/// <remarks>
/// The built-in types available in GLib.
/// </remarks>
public enum TypeFundamentals {
TypeInvalid,
TypeNone,
TypeInterface,
TypeChar,
TypeUChar,
TypeBoolean,
TypeInt,
TypeUInt,
TypeLong,
TypeULong,
TypeEnum,
TypeFlags,
TypeFloat,
TypeDouble,
TypeString,
TypePointer,
TypeBoxed,
TypeParam,
TypeObject,
}
}

View file

@ -1,4 +1,4 @@
// GLib.GValue.cs - GLib Value class implementation // GLib.Value.cs - GLib Value class implementation
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //
@ -9,34 +9,56 @@ namespace GLib {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct GValueStruct {
uint type;
IntPtr data1;
IntPtr data2;
IntPtr data3;
IntPtr data4;
}
public class GValue {
GValueStruct _val;
/// <summary> /// <summary>
/// GValue Constructor /// Value Class
/// </summary> /// </summary>
/// ///
/// <remarks> /// <remarks>
/// Constructs a GValue from a string. /// An arbitrary data type similar to a CORBA Any which is used
/// to get and set properties on Objects.
/// </remarks> /// </remarks>
[DllImport("gobject-1.3")] public class Value {
static extern void g_value_set_string (ref GValueStruct val,
String data);
public GValue (String data) 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);
/// <summary>
/// Value Constructor
/// </summary>
///
/// <remarks>
/// Constructs a Value from a spectified string.
/// </remarks>
[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 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);
} }
/// <summary> /// <summary>
@ -44,31 +66,30 @@ namespace GLib {
/// </summary> /// </summary>
/// ///
/// <remarks> /// <remarks>
/// Extracts a string from a GValue. Note, this method /// Extracts a string from a Value. Note, this method
/// will produce an exception if the GValue does not hold a /// will produce an exception if the Value does not hold a
/// string value. /// string value.
/// </remarks> /// </remarks>
[DllImport("gobject-1.3")] [DllImport("gobject-1.3.dll")]
static extern String g_value_get_string (ref GValueStruct val); static extern String g_value_get_string (IntPtr val);
public String GetString () public String GetString ()
{ {
// FIXME: Insert an appropriate exception here if // FIXME: Insert an appropriate exception here if
// _val.type indicates an error. // _val.type indicates an error.
return g_value_get_string (ref _val); return g_value_get_string (_val);
} }
/// <summary> /// <summary>
/// ValueStruct Property /// RawValue Property
/// </summary> /// </summary>
/// ///
/// <remarks> /// <remarks>
/// Accesses a structure which can be easily marshalled /// Read only. Accesses a pointer to the Raw GValue.
/// via PInvoke to set properties on GObjects.
/// </remarks> /// </remarks>
public GValueStruct ValueStruct { public IntPtr RawValue {
get { get {
return _val; return _val;
} }

View file

@ -1,4 +1,3 @@
CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe
all: all:
@echo "You must use 'make windows' or 'make unix'." @echo "You must use 'make windows' or 'make unix'."

View file

@ -23,7 +23,7 @@ namespace Gtk {
public class Application { public class Application {
[DllImport("gtk-1.3")] [DllImport("gtk-1.3.dll")]
static extern void gtk_init (ref int argc, ref String[] argv); static extern void gtk_init (ref int argc, ref String[] argv);
/// <summary> /// <summary>
@ -48,7 +48,7 @@ namespace Gtk {
/// Begins the event loop iteration. /// Begins the event loop iteration.
/// </remarks> /// </remarks>
[DllImport("gtk-1.3")] [DllImport("gtk-1.3.dll")]
static extern void gtk_main (); static extern void gtk_main ();
public static void Run () public static void Run ()
@ -65,7 +65,7 @@ namespace Gtk {
/// Terminates the event loop iteration. /// Terminates the event loop iteration.
/// </remarks> /// </remarks>
[DllImport("gtk-1.3")] [DllImport("gtk-1.3.dll")]
static extern void gtk_main_quit (); static extern void gtk_main_quit ();
public static void Quit () public static void Quit ()

View file

@ -12,6 +12,7 @@ namespace Gtk {
public class Button : Widget { public class Button : Widget {
private static readonly string ClickedEvent = "clicked"; private static readonly string ClickedEvent = "clicked";
/*
public event EventHandler Clicked public event EventHandler Clicked
{ {
add add
@ -23,7 +24,7 @@ namespace Gtk {
RemoveSimpleEvent (ClickedEvent, value); RemoveSimpleEvent (ClickedEvent, value);
} }
} }
*/
/// <summary> /// <summary>
/// Button Object Constructor /// Button Object Constructor
/// </summary> /// </summary>
@ -37,12 +38,14 @@ namespace Gtk {
RawObject = o; RawObject = o;
} }
public ~Button () ~Button ()
{ {
/* FIXME: Find legal way to do this eventually.
foreach (EventHandler e in Events[ClickedEvent]) foreach (EventHandler e in Events[ClickedEvent])
{ {
Clicked -= e; Clicked -= e;
} }
*/
} }
/// <summary> /// <summary>

View file

@ -8,31 +8,38 @@ namespace Gtk {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Glib; using GLib;
using Gdk; using Gdk;
public class Widget : Object { public class Widget : Object {
public Widget() {} 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; 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) public void AddSimpleEvent(Object type, string name, EventHandler value)
{ {
if (Events[type] == null) if (Events[type] == null)
@ -42,10 +49,7 @@ namespace Gtk {
Events.AddHandler(type, value); Events.AddHandler(type, value);
} }
public void AddSimpleEvent(String type, EventHandle value) public void RemoveSimpleEvent(Object type, string name, EventHandler value)
: this (type, type, value) {}
public void RemoveSimpleEvent(Object type, string name, EventHander value)
{ {
Events.RemoveHandler(type, value); Events.RemoveHandler(type, value);
if (Events[type] == null) 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) public void AddGdkSimpleEvent(Object type, string name, EventHandler value)
{ {
if (Events[type] == null) if (Events[type] == null)
@ -66,10 +67,7 @@ namespace Gtk {
Events.AddHandler(type, value); Events.AddHandler(type, value);
} }
public void AddGdkSimpleEvent(String type, EventHandle value) public void RemoveGdkSimpleEvent(Object type, string name, EventHandler value)
: this (type, type, value) {}
public void RemoveGdkSimpleEvent(Object type, string name, EventHander value)
{ {
Events.RemoveHandler(type, value); Events.RemoveHandler(type, value);
if (Events[type] == null) if (Events[type] == null)
@ -77,42 +75,39 @@ namespace Gtk {
DisconnectGdkSimpleEventSignal(name, type); DisconnectGdkSimpleEventSignal(name, type);
} }
} }
*/
public void RemoveGdkSimpleEvent(String type, EventHandle value) [DllImport("gtk-1.3.dll")]
: this (type, type, value) {}
[DllImport("gtk-1.3")]
static extern void gtk_signal_connect_full ( static extern void gtk_signal_connect_full (
IntPtr obj, string evname, IntPtr obj, string evname,
SimpleDelegate cb, IntPtr unsupported, SimpleDelegate cb, IntPtr unsupported,
IntPtr data, IntPtr destroycb, String data, IntPtr destroycb,
int objsig, int after ); 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, gtk_signal_connect_full(RawObject, name, SimpleSignal.Delegate,
new IntPtr (0), new IntPtr (signal.GetHashCode()), new IntPtr (0), name,
new IntPtr (0), 0, 0); 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) public void ConnectGdkSimpleSignal(string name, Object signal)
{ {
gtk_signal_connect_full(RawObject, name, Gdk.Signals.SimpleEvent.Delegate, gtk_signal_connect_full(RawObject, name, SimpleEvent.Delegate,
new IntPtr (0), new IntPtr (signal.GetHashCode()), new IntPtr (0), name,
new IntPtr (0), 0, 0); new IntPtr (0), 0, 0);
} }
public void DisconnectGdkSimpleSignal(string name, Object signal) public void DisconnectGdkSimpleSignal(string name, Object signal)
{ {
Gdk.Signals.SimpleEvent.Unref(); SimpleEvent.Unref();
} }
*/
/// <summary> /// <summary>
/// Show Method /// Show Method
/// </summary> /// </summary>
@ -121,7 +116,7 @@ namespace Gtk {
/// Makes the Widget visible on the display. /// Makes the Widget visible on the display.
/// </remarks> /// </remarks>
[DllImport("gtk-1.3")] [DllImport("gtk-1.3.dll")]
static extern void gtk_widget_show (IntPtr obj); static extern void gtk_widget_show (IntPtr obj);
public void Show () public void Show ()

View file

@ -39,7 +39,7 @@ namespace Gtk {
/// Constructs a new Window of type TopLevel. /// Constructs a new Window of type TopLevel.
/// </remarks> /// </remarks>
[DllImport("gtk-1.3")] [DllImport("gtk-1.3.dll")]
static extern IntPtr gtk_window_new (WindowType type); static extern IntPtr gtk_window_new (WindowType type);
public Window () public Window ()
@ -73,7 +73,7 @@ namespace Gtk {
public bool AllowGrow { public bool AllowGrow {
get { get {
GValue val = GetProp ("allow-grow"); Value val = GetProp ("allow-grow");
return (val != 0); return (val != 0);
} }
set { set {
@ -166,7 +166,7 @@ namespace Gtk {
/// The Position of the Window in Screen Coordinates. /// The Position of the Window in Screen Coordinates.
/// </remarks> /// </remarks>
[DllImport("gtk-1.3")] [DllImport("gtk-1.3.dll")]
static extern void gtk_window_set_position (IntPtr hnd, static extern void gtk_window_set_position (IntPtr hnd,
int x, int y); int x, int y);
@ -186,15 +186,14 @@ namespace Gtk {
/// The Title displayed in the Window's Title Bar. /// The Title displayed in the Window's Title Bar.
/// </remarks> /// </remarks>
[DllImport("gobject-1.3")] [DllImport("gobject-1.3.dll")]
static extern void g_object_set_property (String title, static extern void g_object_set (IntPtr obj, String name,
ref GValueStruct vs); IntPtr val, IntPtr term);
public String Title { public String Title {
set { set {
GValue val = new GValue (value); g_object_set (RawObject, "title",
GValueStruct vs = val.ValueStruct; Marshal.StringToHGlobalAnsi (value), new IntPtr (0));
g_object_set_property ("title", ref vs);
} }
} }
} }

View file

@ -1,5 +1,3 @@
CSC=/cygdrive/c/windows/microsoft.net/framework/v1.0.2914/csc.exe
all: all:
@echo "You must use 'make windows' or 'make unix'." @echo "You must use 'make windows' or 'make unix'."
@echo "'make unix' is broken for now." @echo "'make unix' is broken for now."

15
makefile Normal file
View file

@ -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."

View file

@ -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: all:
@echo "You must use 'make windows' or 'make unix'." @echo "You must use 'make windows' or 'make unix'."