2001-09-19 Mike Kestner <mkestner@speakeasy.net>
* HACKING : New rulez. * NOTES: Killed. We have a mailing list now for this kind of stuff. * glib/makefile : New, to build the new glib-sharp.dll target. * glib/Object.cs : (GetObject): Commented out. Design problems here. IntPtr's can't be used in the manner this code attempts to use them. (Data prop): Commented out. Apparently keyed properties are not supported. (Object prop): Renamed RawObject, and made it protected. (Events): Fixed to cause list to be initialized if null and then return the list. * glib/ObjectManager.cs : commented out entirely. Not sure what this code is trying to accomplish and it doesn't compile. * glib/Value.cs : New attempt at implementing GValues. Doesn't work yet. * gtk/Button.cs : Updated to use RawObject. (Clicked event): s/EmitDeleteEvent/EmitClickedEvent. (Button(String)): s/gtk_label_new_with_lable/gtk_button_new_with_label. * gtk/Label.cs : Fixed some yank and paste errors where 2 value params were getting passed to all the set_* property methods. * gtk/Window.cs : Fixed hanging GTK namespace ref. * sample/HelloWorld.cs : Fixed hanging GTK namespace ref. svn path=/trunk/gtk-sharp/; revision=884
This commit is contained in:
parent
b4c11b3210
commit
91c58501fa
16 changed files with 244 additions and 112 deletions
33
ChangeLog
33
ChangeLog
|
@ -1,3 +1,36 @@
|
||||||
|
2001-09-19 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* HACKING : New rulez.
|
||||||
|
* NOTES: Killed. We have a mailing list now for this kind of stuff.
|
||||||
|
* glib/makefile : New, to build the new glib-sharp.dll target.
|
||||||
|
* glib/Object.cs : (GetObject): Commented out. Design problems here.
|
||||||
|
IntPtr's can't be used in the manner this code attempts to use them.
|
||||||
|
(Data prop): Commented out. Apparently keyed properties are not
|
||||||
|
supported.
|
||||||
|
(Object prop): Renamed RawObject, and made it protected.
|
||||||
|
(Events): Fixed to cause list to be initialized if null and then
|
||||||
|
return the list.
|
||||||
|
* glib/ObjectManager.cs : commented out entirely. Not sure what this
|
||||||
|
code is trying to accomplish and it doesn't compile.
|
||||||
|
* glib/Value.cs : New attempt at implementing GValues. Doesn't work
|
||||||
|
yet.
|
||||||
|
* gtk/Button.cs : Updated to use RawObject.
|
||||||
|
(Clicked event): s/EmitDeleteEvent/EmitClickedEvent.
|
||||||
|
(Button(String)): s/gtk_label_new_with_lable/gtk_button_new_with_label.
|
||||||
|
* gtk/Label.cs : Fixed some yank and paste errors where 2 value params
|
||||||
|
were getting passed to all the set_* property methods.
|
||||||
|
* gtk/Window.cs : Fixed hanging GTK namespace ref.
|
||||||
|
* sample/HelloWorld.cs : Fixed hanging GTK namespace ref.
|
||||||
|
|
||||||
|
|
||||||
|
2001-09-18 Bob Smith <bob@thestuff.net>
|
||||||
|
|
||||||
|
* glib/Object.cs : Moved parts of gtk/Object.cs here, and added
|
||||||
|
static GetObject method and a Data property.
|
||||||
|
* glib/ObjectManager.cs : New.
|
||||||
|
* gtk/Object.cs : removed some GObject wrapping code.
|
||||||
|
* gtk/*.cs : Updated namespace from GTK to Gtk.
|
||||||
|
|
||||||
2001-09-18 Bob Smith <bob@thestuff.net>
|
2001-09-18 Bob Smith <bob@thestuff.net>
|
||||||
|
|
||||||
* gtk/Object.cs : Added EventList and Object properties.
|
* gtk/Object.cs : Added EventList and Object properties.
|
||||||
|
|
19
HACKING
Executable file
19
HACKING
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
Please please please hack on gtk-sharp.
|
||||||
|
|
||||||
|
Okay, now for the details.
|
||||||
|
|
||||||
|
Prior to checking anything into CVS, please send a patch to the mailing list
|
||||||
|
(gtk-sharp-list@ximian.com) for approval. Any patches should be submitted in
|
||||||
|
diff -u format. Also, it is assumed that the submitter has verified that the
|
||||||
|
patch does not break the build, and hopefully that it doesn't break runtime.
|
||||||
|
|
||||||
|
Second, patches without Documentation comments will be seriously frowned upon,
|
||||||
|
if not outright rejected. All classes, methods, properties, events, etc...
|
||||||
|
that are non-private should be documented with XML comment tags. At a minimum,
|
||||||
|
the summary and remarks tags, plus returns and params, if applicable.
|
||||||
|
|
||||||
|
Third, Make a ChangeLog entry. Get credit for your hard work, and let me know
|
||||||
|
who I need to get cranky with at a glance, instead of having to do cvs history
|
||||||
|
reports. :-)
|
||||||
|
|
||||||
|
Fourth, please please please hack on gtk-sharp.
|
39
NOTES
39
NOTES
|
@ -1,39 +0,0 @@
|
||||||
Mike,
|
|
||||||
|
|
||||||
We have some problems. Some methods are going to return a gtk widget which
|
|
||||||
will need to be wrapped again into a c# class. This will have a nasty
|
|
||||||
reaction when callbacks are added to the wrapper, then the wrapper is nuked
|
|
||||||
when complete. It will leave a rogue pointer of some kind laying around, and
|
|
||||||
callbacks won't work as expected.
|
|
||||||
|
|
||||||
Proposed solution:
|
|
||||||
Every GTK# class is a wrapper class. With a constructor for a GtkWidget* and
|
|
||||||
one for a default _new. Events are done as in CVS, except that the events
|
|
||||||
object will need to be bound to the GtkWidget owning it, and when a wrapper
|
|
||||||
is created, that Events object is resurected. This way, even if there is no
|
|
||||||
wrapper in existance, signals will function properly, and multiple wrappers
|
|
||||||
will work properly too. The event object will register a delete signal with
|
|
||||||
the widget so that when its nuked, it has a chance to free itself. Are we
|
|
||||||
going to have to tell the garbage collector to stay away from this class?
|
|
||||||
We might need our own class for this, and this class might not be able to be
|
|
||||||
written in c#.
|
|
||||||
|
|
||||||
|
|
||||||
Problem number two is with taking an arbitrary GtkWidget, and constructing a
|
|
||||||
wrapper as needed. Which wrapper is created? A simple GtkWidget wouldnt work
|
|
||||||
too well if the GtkWidget is really a button. We need to deside how to
|
|
||||||
handle this. Should we just return a GtkWidget, and force the developer to
|
|
||||||
pass the GtkWidget back to a constructor for the desided apon Widget wrapper?
|
|
||||||
How does gtk itself deal with this? Are we going to need a database of
|
|
||||||
widget wrappers for this?
|
|
||||||
|
|
||||||
Posible solution:
|
|
||||||
How does (ToType)GtkWidget work in c#. If the type you want to cast from is
|
|
||||||
not of the right type, but the ToType contains a constructor for GtkWidget,
|
|
||||||
will the cast succeed? If so, this will work quite nicely. Everything is a
|
|
||||||
GtkWidget object, and cast bindings as needed. If this does not work, can
|
|
||||||
the cast operator be overridden some how? If so, good deal. If not again,
|
|
||||||
see if System.Reflection has anything that will help in conjunction with the
|
|
||||||
GTK Type system.
|
|
||||||
|
|
||||||
Bob
|
|
3
glib/.cvsignore
Executable file
3
glib/.cvsignore
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
|
@ -4,12 +4,15 @@
|
||||||
//
|
//
|
||||||
// (c) 2001 Bob Smith
|
// (c) 2001 Bob Smith
|
||||||
|
|
||||||
namespace Glib {
|
namespace GLib {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public class Object {
|
public class Object {
|
||||||
|
|
||||||
|
/*
|
||||||
public static Object GetObject(IntPtr o)
|
public static Object GetObject(IntPtr o)
|
||||||
{
|
{
|
||||||
if (o == null) throw new ArgumentNullException ();
|
if (o == null) throw new ArgumentNullException ();
|
||||||
|
@ -22,18 +25,15 @@ namespace Glib {
|
||||||
{
|
{
|
||||||
Object = o;
|
Object = o;
|
||||||
}
|
}
|
||||||
protected IntPtr _obj;
|
*/
|
||||||
|
private IntPtr _obj;
|
||||||
|
|
||||||
private IntPtr Object
|
protected IntPtr RawObject
|
||||||
{
|
{
|
||||||
get
|
get {
|
||||||
{
|
|
||||||
return _obj;
|
return _obj;
|
||||||
}
|
}
|
||||||
set
|
set {
|
||||||
{
|
|
||||||
if (value == null) throw new ArgumentNullException ();
|
|
||||||
_objectManager = null;
|
|
||||||
_obj = value;
|
_obj = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,18 +41,19 @@ namespace Glib {
|
||||||
private EventHandlerList _events;
|
private EventHandlerList _events;
|
||||||
protected EventHandlerList Events
|
protected EventHandlerList Events
|
||||||
{
|
{
|
||||||
get
|
get {
|
||||||
{
|
if (_events == null)
|
||||||
if (_events != null) return _events;
|
_events = new EventHandlerList ();
|
||||||
_events = new EventHandlerList ();
|
return _events;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("gtk-1.3")]
|
/*
|
||||||
|
[DllImport("gobject-1.3")]
|
||||||
static extern IntPtr g_object_get_data (
|
static extern IntPtr g_object_get_data (
|
||||||
IntPtr object,
|
IntPtr object,
|
||||||
String key );
|
String key );
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gobject-1.3")]
|
||||||
static extern void g_object_set_data (
|
static extern void g_object_set_data (
|
||||||
IntPtr object,
|
IntPtr object,
|
||||||
String key,
|
String key,
|
||||||
|
@ -76,7 +77,6 @@ namespace Glib {
|
||||||
IntPtr data,
|
IntPtr data,
|
||||||
DestroyNotify destroy );
|
DestroyNotify destroy );
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
void (*GObjectGetPropertyFunc) (GObject *object,
|
void (*GObjectGetPropertyFunc) (GObject *object,
|
||||||
guint property_id,
|
guint property_id,
|
||||||
|
|
|
@ -4,15 +4,14 @@
|
||||||
//
|
//
|
||||||
// (c) 2001 Bob Smith
|
// (c) 2001 Bob Smith
|
||||||
|
|
||||||
namespace Glib {
|
namespace GLib {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
protected delegate void DestroyNotify (IntPtr data);
|
/*
|
||||||
|
|
||||||
public class ObjectManager {
|
public class ObjectManager {
|
||||||
public ObjectManager(IntPtr o, Glib.Object go)
|
public ObjectManager(IntPtr o, Object go)
|
||||||
{
|
{
|
||||||
if (o == null || go -- null) throw new ArgumentNullException ();
|
if (o == null || go -- null) throw new ArgumentNullException ();
|
||||||
_gobj = go;
|
_gobj = go;
|
||||||
|
@ -23,6 +22,8 @@ namespace Glib {
|
||||||
}
|
}
|
||||||
public Glib.Object gobj;
|
public Glib.Object gobj;
|
||||||
|
|
||||||
|
protected delegate void DestroyNotify (IntPtr data);
|
||||||
|
|
||||||
private void DestroyNotifyEvent (IntPtr data)
|
private void DestroyNotifyEvent (IntPtr data)
|
||||||
{
|
{
|
||||||
gobj.gh.Free();
|
gobj.gh.Free();
|
||||||
|
@ -30,4 +31,5 @@ namespace Glib {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
77
glib/Value.cs
Executable file
77
glib/Value.cs
Executable file
|
@ -0,0 +1,77 @@
|
||||||
|
// GLib.GValue.cs - GLib Value class implementation
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
//
|
||||||
|
// (c) 2001 Mike Kestner
|
||||||
|
|
||||||
|
namespace GLib {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
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>
|
||||||
|
/// GValue Constructor
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Constructs a GValue from a string.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
[DllImport("gobject-1.3")]
|
||||||
|
static extern void g_value_set_string (ref GValueStruct val,
|
||||||
|
String data);
|
||||||
|
|
||||||
|
public GValue (String data)
|
||||||
|
{
|
||||||
|
g_value_set_string (ref _val, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// GetString Method
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Extracts a string from a GValue. Note, this method
|
||||||
|
/// will produce an exception if the GValue does not hold a
|
||||||
|
/// string value.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
[DllImport("gobject-1.3")]
|
||||||
|
static extern String g_value_get_string (ref GValueStruct val);
|
||||||
|
|
||||||
|
public String GetString ()
|
||||||
|
{
|
||||||
|
// FIXME: Insert an appropriate exception here if
|
||||||
|
// _val.type indicates an error.
|
||||||
|
return g_value_get_string (ref _val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ValueStruct Property
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// <remarks>
|
||||||
|
/// Accesses a structure which can be easily marshalled
|
||||||
|
/// via PInvoke to set properties on GObjects.
|
||||||
|
/// </remarks>
|
||||||
|
|
||||||
|
public GValueStruct ValueStruct {
|
||||||
|
get {
|
||||||
|
return _val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
glib/makefile
Executable file
11
glib/makefile
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
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."
|
||||||
|
|
||||||
|
windows:
|
||||||
|
$(CSC) /unsafe /target:library /out:glib-sharp.dll /recurse:*.cs
|
||||||
|
|
||||||
|
unix:
|
||||||
|
@echo "'make unix' is broken for now."
|
|
@ -18,7 +18,7 @@ namespace Gtk {
|
||||||
{
|
{
|
||||||
if (Events[ClickedEvent] == null)
|
if (Events[ClickedEvent] == null)
|
||||||
{
|
{
|
||||||
ConnectSignal ("clicked", new SimpleCallback (EmitDeleteEvent));
|
ConnectSignal ("clicked", new SimpleCallback (EmitClickedEvent));
|
||||||
}
|
}
|
||||||
Events.AddHandler (ClickedEvent, value);
|
Events.AddHandler (ClickedEvent, value);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace Gtk {
|
||||||
|
|
||||||
public Button (IntPtr o)
|
public Button (IntPtr o)
|
||||||
{
|
{
|
||||||
Object = o;
|
RawObject = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -60,11 +60,11 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern IntPtr gtk_label_new_with_label (String str);
|
static extern IntPtr gtk_button_new_with_label (String str);
|
||||||
|
|
||||||
public Button (String str)
|
public Button (String str)
|
||||||
{
|
{
|
||||||
Object = gtk_button_new_with_label (str);
|
RawObject = gtk_button_new_with_label (str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
40
gtk/Label.cs
40
gtk/Label.cs
|
@ -21,7 +21,7 @@ namespace Gtk {
|
||||||
|
|
||||||
public Label (IntPtr o)
|
public Label (IntPtr o)
|
||||||
{
|
{
|
||||||
Object = o;
|
RawObject = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -37,7 +37,7 @@ namespace Gtk {
|
||||||
|
|
||||||
public Label (String str)
|
public Label (String str)
|
||||||
{
|
{
|
||||||
Object = gtk_label_new (str);
|
RawObject = gtk_label_new (str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -49,18 +49,18 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern void gtk_label_set_text (IntPtr hnd, const String str);
|
static extern void gtk_label_set_text (IntPtr hnd, String str);
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern String gtk_label_get_text (IntPtr hnd);
|
static extern String gtk_label_get_text (IntPtr hnd);
|
||||||
|
|
||||||
public String Text {
|
public String Text {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return gtk_label_get_text (Object);
|
return gtk_label_get_text (RawObject);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_text (Object, value);
|
gtk_label_set_text (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,12 +73,12 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern void gtk_label_set_markup (IntPtr hnd, const String str);
|
static extern void gtk_label_set_markup (IntPtr hnd, String str);
|
||||||
|
|
||||||
public String Markup {
|
public String Markup {
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_markup (Object, value);
|
gtk_label_set_markup (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,23 +89,23 @@ namespace Gtk {
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Parsed content.
|
/// Parsed content.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/*
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern void gtk_label_set_label (IntPtr hnd, const String str);
|
static extern void gtk_label_set_label (IntPtr hnd, String str);
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern String gtk_label_get_label (IntPtr hnd);
|
static extern String gtk_label_get_label (IntPtr hnd);
|
||||||
|
|
||||||
public String Label {
|
public String Label {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return gtk_label_get_label (Object);
|
return gtk_label_get_label (RawObject);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_label (Object, value);
|
gtk_label_set_label (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Selectable Property
|
/// Selectable Property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -122,11 +122,11 @@ namespace Gtk {
|
||||||
public bool Selectable {
|
public bool Selectable {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return gtk_label_get_selectable (Object);
|
return gtk_label_get_selectable (RawObject);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_selectable (Object, value, value);
|
gtk_label_set_selectable (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,11 +146,11 @@ namespace Gtk {
|
||||||
public bool UseUnderline {
|
public bool UseUnderline {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return gtk_label_get_use_underline (Object);
|
return gtk_label_get_use_underline (RawObject);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_use_underline (Object, value, value);
|
gtk_label_set_use_underline (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,11 +170,11 @@ namespace Gtk {
|
||||||
public bool UseMarkup {
|
public bool UseMarkup {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return gtk_label_get_use_markup (Object);
|
return gtk_label_get_use_markup (RawObject);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_use_markup (Object, value, value);
|
gtk_label_set_use_markup (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,11 +194,11 @@ namespace Gtk {
|
||||||
public bool LineWrap {
|
public bool LineWrap {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return gtk_label_get_line_wrap (Object);
|
return gtk_label_get_line_wrap (RawObject);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_label_set_line_wrap (Object, value, value);
|
gtk_label_set_line_wrap (RawObject, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,10 @@
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.ComponentModel;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
public abstract class Object : GLib.Object {
|
||||||
public abstract class Object : Glib.Object {
|
|
||||||
|
|
||||||
protected delegate void SimpleCallback (IntPtr obj);
|
protected delegate void SimpleCallback (IntPtr obj);
|
||||||
|
|
||||||
|
@ -25,7 +24,7 @@ namespace Gtk {
|
||||||
|
|
||||||
protected void ConnectSignal (string name, SimpleCallback cb)
|
protected void ConnectSignal (string name, SimpleCallback cb)
|
||||||
{
|
{
|
||||||
gtk_signal_connect_full (obj, name, cb,
|
gtk_signal_connect_full (RawObject, name, cb,
|
||||||
new IntPtr (0), new IntPtr (0),
|
new IntPtr (0), new IntPtr (0),
|
||||||
new IntPtr (0), 0, 0);
|
new IntPtr (0), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Gtk {
|
||||||
|
|
||||||
public void Show ()
|
public void Show ()
|
||||||
{
|
{
|
||||||
gtk_widget_show (obj);
|
gtk_widget_show (RawObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// GTK.Window.cs - GTK Window class implementation
|
// Gtk.Window.cs - GTK Window class implementation
|
||||||
//
|
//
|
||||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||||
//
|
//
|
||||||
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
namespace Gtk {
|
namespace Gtk {
|
||||||
|
|
||||||
|
using GLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
@ -27,7 +28,7 @@ namespace Gtk {
|
||||||
|
|
||||||
public Window (IntPtr o)
|
public Window (IntPtr o)
|
||||||
{
|
{
|
||||||
Object = o;
|
RawObject = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -39,11 +40,11 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gtk-1.3")]
|
||||||
static extern IntPtr gtk_window_new (GTK.WindowType type);
|
static extern IntPtr gtk_window_new (WindowType type);
|
||||||
|
|
||||||
public Window ()
|
public Window ()
|
||||||
{
|
{
|
||||||
Object = gtk_window_new (WindowType.TopLevel);
|
RawObject = gtk_window_new (WindowType.TopLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -71,8 +72,13 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public bool AllowGrow {
|
public bool AllowGrow {
|
||||||
get {;}
|
get {
|
||||||
set {;}
|
GValue val = GetProp ("allow-grow");
|
||||||
|
return (val != 0);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProp ("allow-grow", new GValue (value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -85,8 +91,13 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public bool AllowShrink {
|
public bool AllowShrink {
|
||||||
get {;}
|
get {
|
||||||
set {;}
|
GValue val = GetProp ("allow-shrink");
|
||||||
|
return (val != 0);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProp ("allow-shrink", new GValue (value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -98,8 +109,13 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public Size DefaultSize {
|
public Size DefaultSize {
|
||||||
get {;}
|
get {
|
||||||
set {;}
|
GValue val = GetProp ("default-size");
|
||||||
|
return (val != 0);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProp ("default-size", new GValue (value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -112,8 +128,13 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public bool DestroyWithParent {
|
public bool DestroyWithParent {
|
||||||
get {;}
|
get {
|
||||||
set {;}
|
GValue val = GetProp ("allow-grow");
|
||||||
|
return (val != 0);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProp ("allow-grow", new GValue (value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -128,8 +149,13 @@ namespace Gtk {
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
public bool IsModal {
|
public bool IsModal {
|
||||||
get {;}
|
get {
|
||||||
set {;}
|
GValue val = GetProp ("allow-grow");
|
||||||
|
return (val != 0);
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
SetProp ("allow-grow", new GValue (value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -148,7 +174,7 @@ namespace Gtk {
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
gtk_window_set_position (
|
gtk_window_set_position (
|
||||||
obj, value.X, value.Y);
|
RawObject, value.X, value.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,14 +186,15 @@ namespace Gtk {
|
||||||
/// The Title displayed in the Window's Title Bar.
|
/// The Title displayed in the Window's Title Bar.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
||||||
[DllImport("gtk-1.3")]
|
[DllImport("gobject-1.3")]
|
||||||
static extern void gtk_window_set_title (IntPtr hnd,
|
static extern void g_object_set_property (String title,
|
||||||
String title);
|
ref GValueStruct vs);
|
||||||
|
|
||||||
public String Title {
|
public String Title {
|
||||||
set
|
set {
|
||||||
{
|
GValue val = new GValue (value);
|
||||||
gtk_window_set_title (Object, value);
|
GValueStruct vs = val.ValueStruct;
|
||||||
|
g_object_set_property ("title", ref vs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ all:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
$(CSC) /unsafe /target:library /out:gtk-sharp.dll /recurse:*.cs
|
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /out:gtk-sharp.dll /recurse:*.cs
|
||||||
|
|
||||||
unix:
|
unix:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
namespace GtkSamples {
|
namespace GtkSamples {
|
||||||
|
|
||||||
using GTK;
|
using Gtk;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
public class HelloWorld {
|
public class HelloWorld {
|
||||||
|
|
|
@ -5,7 +5,7 @@ all:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../gtk/gtk-sharp.dll /recurse:*.cs
|
$(CSC) /unsafe /out:gtk-hello-world.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll /recurse:*.cs
|
||||||
|
|
||||||
unix:
|
unix:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
Loading…
Reference in a new issue