2002-05-02 Mike Kestner <mkestner@speakeasy.net>
* README : Describe the new make procedure. * configure.in : Add the new Makefile generation. * makefile : add the glue dir, make linux the default build, add an install target * */makefile.win32 : temp build files for win32 * */Makefile.in : new configurable make system * */makefile : killed * generator/BoxedGen.cs : Now uses GLib.Boxed * generator/ObjectGen.cs : Use Values for Props. * generator/SymbolTable.cs : Add IsEnum method. * glib/Boxed.cs : Major overhaul. * glib/Object.cs : Remove type specific (Get|Set)Property. Now use GValue based property accessors. * glib/TypeFundamentals.cs : Update to current values. * glib/Value.cs : Refactor to use glue. svn path=/trunk/gtk-sharp/; revision=4236
This commit is contained in:
parent
fa98aa165a
commit
cd73a17587
33 changed files with 513 additions and 524 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
2002-05-02 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* README : Describe the new make procedure.
|
||||
* configure.in : Add the new Makefile generation.
|
||||
* makefile : add the glue dir, make linux the default build,
|
||||
add an install target
|
||||
* */makefile.win32 : temp build files for win32
|
||||
* */Makefile.in : new configurable make system
|
||||
* */makefile : killed
|
||||
* generator/BoxedGen.cs : Now uses GLib.Boxed
|
||||
* generator/ObjectGen.cs : Use Values for Props.
|
||||
* generator/SymbolTable.cs : Add IsEnum method.
|
||||
* glib/Boxed.cs : Major overhaul.
|
||||
* glib/Object.cs : Remove type specific (Get|Set)Property. Now
|
||||
use GValue based property accessors.
|
||||
* glib/TypeFundamentals.cs : Update to current values.
|
||||
* glib/Value.cs : Refactor to use glue.
|
||||
|
||||
2002-04-25 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* autogen.sh : simple config for the glue build
|
||||
|
|
18
README
18
README
|
@ -10,14 +10,24 @@ there and adjust accordingly.
|
|||
Building Gtk#:
|
||||
--------------
|
||||
Currently, it is only possible to compile Gtk# on Win32 using the .Net
|
||||
framework compiler and libraries. Miguel and company will be changing that
|
||||
shortly. The win32 compilation utilizes the cygwin environment for a GNU
|
||||
build environment. To compile the package type:
|
||||
framework compiler and libraries. The build system is in a transitional
|
||||
state at the moment. Windows compilation utilizes the cygwin environment
|
||||
for a GNU build environment. To compile the package type:
|
||||
|
||||
make windows
|
||||
make -f makefile.win32
|
||||
|
||||
in the top level directory.
|
||||
|
||||
The linux build fails due to unresolved issues in mcs. If you would like
|
||||
to help work these issues, the build procedure on linux is the typical:
|
||||
|
||||
configure
|
||||
make
|
||||
make install
|
||||
|
||||
If you are compiling from CVS, you will need libtool and the auto* tools
|
||||
and will need to replace the configure above with autogen.sh.
|
||||
|
||||
Discussion:
|
||||
-----------
|
||||
A mailing list for Gtk# discussion (gtk-sharp-list@ximian.com) is available.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
MCS=mcs
|
||||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: linux
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /out:atk-sharp.dll /recurse:*.cs
|
||||
|
||||
linux:
|
||||
linux: atk-sharp.dll
|
||||
|
||||
atk-sharp.dll: generated/*.cs
|
||||
$(MCS) --unsafe --target library -r ../glib/glib-sharp.dll -r ../pango/pango-sharp.dll -o atk-sharp.dll --recurse *.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
$(CSC) --unsafe --target=library --r=../glib/glib-sharp.dll --r=../pango/pango-sharp.dll --out=atk-sharp.dll --recurse=*.cs
|
||||
|
||||
install: all
|
||||
cp atk-sharp.dll @prefix@/lib
|
||||
|
5
atk/makefile.win32
Normal file
5
atk/makefile.win32
Normal file
|
@ -0,0 +1,5 @@
|
|||
all: windows
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /out:atk-sharp.dll /recurse:*.cs
|
||||
|
|
@ -76,6 +76,12 @@ AC_SUBST(CFLAGS)
|
|||
|
||||
AC_OUTPUT([
|
||||
glue/Makefile
|
||||
glib/Makefile
|
||||
pango/Makefile
|
||||
atk/Makefile
|
||||
gdk/Makefile
|
||||
gtk/Makefile
|
||||
sample/Makefile
|
||||
])
|
||||
|
||||
echo "
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
MCS=mcs
|
||||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: linux
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /r:../atk/atk-sharp.dll /out:gdk-sharp.dll /recurse:*.cs
|
||||
|
||||
linux:
|
||||
linux: gdk-sharp.dll
|
||||
|
||||
gdk-sharp.dll: generated/*.cs
|
||||
$(MCS) --unsafe --target library -r ../glib/glib-sharp.dll -r ../pango/pango-sharp.dll -r ../atk/atk-sharp.dll -o gdk-sharp.dll --recurse *.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
install: all
|
||||
cp gdk-sharp.dll @prefix@/lib
|
||||
|
5
gdk/makefile.win32
Normal file
5
gdk/makefile.win32
Normal file
|
@ -0,0 +1,5 @@
|
|||
all: windows
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /r:../atk/atk-sharp.dll /out:gdk-sharp.dll /recurse:*.cs
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated-stamp
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public String FromNative(String var)
|
||||
{
|
||||
return "(" + QualifiedName + ") GtkSharp.Boxed.GetBoxed(" + var + ")";
|
||||
return "(" + QualifiedName + ") GLib.Boxed.FromNative(" + var + ")";
|
||||
}
|
||||
|
||||
public void Generate (SymbolTable table)
|
||||
|
@ -57,7 +57,7 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine ();
|
||||
|
||||
sw.WriteLine ("\t[StructLayout(LayoutKind.Sequential)]");
|
||||
sw.WriteLine ("\tpublic class " + Name + " : GtkSharp.Boxed {");
|
||||
sw.WriteLine ("\tpublic class " + Name + " : GLib.Boxed {");
|
||||
sw.WriteLine ();
|
||||
|
||||
sw.WriteLine("\t\tpublic " + Name + "(IntPtr raw) : base(raw) {}");
|
||||
|
|
|
@ -160,8 +160,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
char[] ast = {'*'};
|
||||
c_type = c_type.TrimEnd(ast);
|
||||
String cs_type = table.GetCSType(c_type);
|
||||
String m_type;
|
||||
string cs_type = table.GetCSType(c_type);
|
||||
|
||||
XmlElement parent = (XmlElement) prop.ParentNode;
|
||||
name = prop.GetAttribute("name");
|
||||
|
@ -169,20 +168,17 @@ namespace GtkSharp.Generation {
|
|||
name += "Prop";
|
||||
}
|
||||
|
||||
if (table.IsObject(c_type)) {
|
||||
m_type = "GLib.Object";
|
||||
} else if (table.IsBoxed(c_type)) {
|
||||
m_type = "GtkSharp.Boxed";
|
||||
string v_type = "";
|
||||
if (table.IsEnum(c_type)) {
|
||||
v_type = "int";
|
||||
} else if (table.IsInterface(c_type)) {
|
||||
// FIXME: Handle interface props properly.
|
||||
Console.Write("Interface property detected ");
|
||||
Statistics.ThrottledCount++;
|
||||
return true;
|
||||
} else {
|
||||
m_type = table.GetMarshalType(c_type);
|
||||
}
|
||||
|
||||
if ((cs_type == "") || (m_type == "")) {
|
||||
if (cs_type == "") {
|
||||
Console.Write("Property has unknown Type {0} ", c_type);
|
||||
Statistics.ThrottledCount++;
|
||||
return false;
|
||||
|
@ -195,11 +191,11 @@ namespace GtkSharp.Generation {
|
|||
sw.WriteLine("\t\tpublic " + cs_type + " " + name + " {");
|
||||
if (prop.HasAttribute("readable")) {
|
||||
sw.WriteLine("\t\t\tget {");
|
||||
sw.WriteLine("\t\t\t\t" + m_type + " val;");
|
||||
sw.WriteLine("\t\t\t\tGLib.Value val;");
|
||||
sw.WriteLine("\t\t\t\tGetProperty(\"" + prop.GetAttribute("cname") + "\", out val);");
|
||||
sw.Write("\t\t\t\treturn ");
|
||||
if (cs_type != m_type) {
|
||||
sw.Write("(" + cs_type + ") ");
|
||||
sw.Write("\t\t\t\treturn (" + cs_type + ") ");
|
||||
if (v_type != "") {
|
||||
sw.Write("(" + v_type + ") ");
|
||||
}
|
||||
sw.WriteLine("val;");
|
||||
sw.WriteLine("\t\t\t}");
|
||||
|
@ -207,7 +203,11 @@ namespace GtkSharp.Generation {
|
|||
|
||||
if (prop.HasAttribute("writeable") && !prop.HasAttribute("construct-only")) {
|
||||
sw.WriteLine("\t\t\tset {");
|
||||
sw.WriteLine("\t\t\t\tSetProperty(\"" + prop.GetAttribute("cname") + "\", (" + m_type + ") value);");
|
||||
sw.Write("\t\t\t\tSetProperty(\"" + prop.GetAttribute("cname") + "\", new GLib.Value(");
|
||||
if (v_type != "") {
|
||||
sw.Write("(" + v_type + ") ");
|
||||
}
|
||||
sw.WriteLine("value));");
|
||||
sw.WriteLine("\t\t\t}");
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,18 @@ namespace GtkSharp.Generation {
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool IsEnum(string c_type)
|
||||
{
|
||||
c_type = Trim(c_type);
|
||||
if (complex_types.ContainsKey(c_type)) {
|
||||
IGeneratable gen = (IGeneratable) complex_types[c_type];
|
||||
if (gen is EnumGen) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsInterface(string c_type)
|
||||
{
|
||||
c_type = Trim(c_type);
|
||||
|
|
|
@ -1,16 +1,34 @@
|
|||
MCS=mcs
|
||||
SOURCES=BoxedGen.cs \
|
||||
CallbackGen.cs \
|
||||
CodeGenerator.cs \
|
||||
EnumGen.cs \
|
||||
IGeneratable.cs \
|
||||
InterfaceGen.cs \
|
||||
ObjectGen.cs \
|
||||
Parser.cs \
|
||||
SignalHandler.cs \
|
||||
Statistics.cs \
|
||||
StructBase.cs \
|
||||
StructGen.cs \
|
||||
SymbolTable.cs
|
||||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make linux'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: linux
|
||||
|
||||
windows:
|
||||
windows: *.cs
|
||||
$(CSC) /unsafe /out:codegen.exe *.cs
|
||||
./codegen gtkapi.xml
|
||||
|
||||
linux:
|
||||
$(MCS) --unsafe -o codegen.exe -r System.Xml.dll *.cs
|
||||
mono ./codegen.exe gtkapi.xml
|
||||
linux: generated-stamp
|
||||
|
||||
generated-stamp: codegen.exe gtkapi.xml
|
||||
mono ./codegen.exe gtkapi.xml && touch generated-stamp
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
install: all
|
||||
@echo "Nothing to install in generator."
|
||||
|
||||
codegen.exe: *.cs
|
||||
$(MCS) --unsafe -o codegen.exe -r System.Xml.dll *.cs
|
||||
|
|
6
generator/makefile.win32
Normal file
6
generator/makefile.win32
Normal file
|
@ -0,0 +1,6 @@
|
|||
all: windows
|
||||
|
||||
windows: *.cs
|
||||
$(CSC) /unsafe /out:codegen.exe *.cs
|
||||
./codegen gtkapi.xml
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
//
|
||||
// (c) 2001-2002 Mike Kestner
|
||||
|
||||
namespace GtkSharp {
|
||||
namespace GLib {
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// Boxed Class
|
||||
|
@ -19,61 +18,21 @@ namespace GtkSharp {
|
|||
|
||||
public abstract class Boxed {
|
||||
|
||||
IntPtr _raw;
|
||||
private IntPtr raw;
|
||||
|
||||
// Destructor is required since we are allocating unmanaged
|
||||
// heap resources.
|
||||
|
||||
~Boxed ()
|
||||
{
|
||||
Marshal.FreeHGlobal (_raw);
|
||||
}
|
||||
public Boxed () : this (IntPtr.Zero) {}
|
||||
|
||||
/// <summary>
|
||||
/// Boxed Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Dummy constructor needed for subclasses.
|
||||
/// Constructs a Boxed type from a raw ref.
|
||||
/// </remarks>
|
||||
|
||||
public Boxed()
|
||||
public Boxed (IntPtr raw)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Boxed Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Wraps a raw boxed type reference.
|
||||
/// </remarks>
|
||||
|
||||
public Boxed(IntPtr raw)
|
||||
{
|
||||
Raw = raw;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raw Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Gets a marshallable IntPtr.
|
||||
/// </remarks>
|
||||
|
||||
protected IntPtr Raw {
|
||||
get {
|
||||
if (_raw == IntPtr.Zero) {
|
||||
// FIXME: Ugly hack.
|
||||
_raw = Marshal.AllocHGlobal (128);
|
||||
Marshal.StructureToPtr (this, _raw, true);
|
||||
}
|
||||
return _raw;
|
||||
}
|
||||
set {
|
||||
_raw = value;
|
||||
}
|
||||
this.raw = raw;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -84,25 +43,41 @@ namespace GtkSharp {
|
|||
/// Gets a marshallable IntPtr.
|
||||
/// </remarks>
|
||||
|
||||
public IntPtr Handle {
|
||||
public virtual IntPtr Handle {
|
||||
get {
|
||||
return _raw;
|
||||
return raw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetBoxed Shared Method
|
||||
/// Raw Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Gets a managed class representing a raw ref.
|
||||
/// Gets or sets a marshallable IntPtr.
|
||||
/// </remarks>
|
||||
|
||||
public static Boxed GetBoxed (IntPtr raw)
|
||||
{
|
||||
// FIXME: Use the type manager to box the raw ref.
|
||||
return null;
|
||||
protected IntPtr Raw {
|
||||
get {
|
||||
return raw;
|
||||
}
|
||||
set {
|
||||
raw = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// FromNative Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Gets a Boxed type from a raw IntPtr.
|
||||
/// </remarks>
|
||||
|
||||
public static GLib.Boxed FromNative (IntPtr raw)
|
||||
{
|
||||
// FIXME:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
MCS=mcs
|
||||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: linux
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /out:glib-sharp.dll /recurse:*.cs
|
||||
|
||||
linux:
|
||||
linux: glib-sharp.dll
|
||||
|
||||
glib-sharp.dll: *.cs generated/*.cs
|
||||
$(MCS) --unsafe --target library -o glib-sharp.dll --recurse *.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
install: all
|
||||
cp glib-sharp.dll @prefix@/lib || exit 1
|
||||
|
350
glib/Object.cs
350
glib/Object.cs
|
@ -194,148 +194,18 @@ namespace GLib {
|
|||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses a string Property.
|
||||
/// Accesses a Value Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out string val, IntPtr term);
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_object_get_property (
|
||||
IntPtr obj, string name, out IntPtr val);
|
||||
|
||||
public void GetProperty (String name, out String val)
|
||||
public void GetProperty (String name, out GLib.Value val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses a boolean Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out bool val, IntPtr term);
|
||||
|
||||
public void GetProperty (String name, out bool val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses a double Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out double val, IntPtr term);
|
||||
|
||||
public void GetProperty (String name, out double val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses a float Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out float val, IntPtr term);
|
||||
|
||||
public void GetProperty (String name, out float val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses an integer Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out int val, IntPtr term);
|
||||
|
||||
public void GetProperty (String name, out int val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses an unsigned integer Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out uint val, IntPtr term);
|
||||
|
||||
public void GetProperty (String name, out uint val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses an Object Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_get (IntPtr obj, string name,
|
||||
out IntPtr val, IntPtr term);
|
||||
|
||||
public void GetProperty (String name, out GLib.Object val)
|
||||
{
|
||||
IntPtr obj;
|
||||
g_object_get (Raw, name, out obj, new IntPtr (0));
|
||||
val = GLib.Object.GetObject (obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses a Boxed Property.
|
||||
/// </remarks>
|
||||
|
||||
public void GetProperty (String name, out GtkSharp.Boxed val)
|
||||
{
|
||||
IntPtr raw;
|
||||
g_object_get (Raw, name, out raw, new IntPtr (0));
|
||||
val = GtkSharp.Boxed.GetBoxed (raw);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Accesses an IntPtr Property.
|
||||
/// </remarks>
|
||||
|
||||
public void GetProperty (String name, out IntPtr val)
|
||||
{
|
||||
g_object_get (Raw, name, out val, new IntPtr (0));
|
||||
IntPtr v;
|
||||
g_object_get_property (Raw, name, out v);
|
||||
val = new GLib.Value (v, v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -343,209 +213,17 @@ namespace GLib {
|
|||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of a string Property.
|
||||
/// Accesses a Value Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
string val, IntPtr term);
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_object_set_property (
|
||||
IntPtr obj, string name, IntPtr val);
|
||||
|
||||
public void SetProperty (String name, String val)
|
||||
public void SetProperty (String name, GLib.Value val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
g_object_set_property (Raw, name, val.Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of an integer Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
int val, IntPtr term);
|
||||
|
||||
public void SetProperty (String name, int val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of an unsigned integer Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
uint val, IntPtr term);
|
||||
|
||||
public void SetProperty (String name, uint val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of a boolean Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
bool val, IntPtr term);
|
||||
|
||||
public void SetProperty (String name, bool val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of a double Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
double val, IntPtr term);
|
||||
|
||||
public void SetProperty (String name, double val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of a float Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
float val, IntPtr term);
|
||||
|
||||
public void SetProperty (String name, float val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of an IntPtr Property.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0", CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_object_set (IntPtr obj, string name,
|
||||
IntPtr val, IntPtr term);
|
||||
|
||||
public void SetProperty (String name, IntPtr val)
|
||||
{
|
||||
g_object_set (Raw, name, val, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of an Object Property.
|
||||
/// </remarks>
|
||||
|
||||
public void SetProperty (String name, GLib.Object val)
|
||||
{
|
||||
g_object_set (Raw, name, val.Handle, new IntPtr (0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetProperty Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Changes the value of a Boxed Property.
|
||||
/// </remarks>
|
||||
|
||||
public void SetProperty (String name, GtkSharp.Boxed val)
|
||||
{
|
||||
g_object_set (Raw, name, val.Handle, new IntPtr (0));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
[DllImport("gtk-2.0")]
|
||||
static extern void g_object_set_data_full (
|
||||
IntPtr obj,
|
||||
String key,
|
||||
IntPtr data,
|
||||
DestroyNotify destroy );
|
||||
|
||||
|
||||
GParamSpec* g_object_class_find_property (GObjectClass *oclass,
|
||||
const gchar *property_name);
|
||||
GParamSpec** g_object_class_list_properties (GObjectClass *oclass,
|
||||
guint *n_properties);
|
||||
gpointer g_object_ref (gpointer object);
|
||||
void g_object_unref (gpointer object);
|
||||
void g_object_weak_ref (GObject *object,
|
||||
GWeakNotify notify,
|
||||
gpointer data);
|
||||
void g_object_weak_unref (GObject *object,
|
||||
GWeakNotify notify,
|
||||
gpointer data);
|
||||
void g_object_add_weak_pointer (GObject *object,
|
||||
gpointer *weak_pointer_location);
|
||||
void g_object_remove_weak_pointer (GObject *object,
|
||||
gpointer *weak_pointer_location);
|
||||
gpointer g_object_connect (gpointer object,
|
||||
const gchar *signal_spec,
|
||||
...);
|
||||
void g_object_disconnect (gpointer object,
|
||||
const gchar *signal_spec,
|
||||
...);
|
||||
void g_object_set (gpointer object,
|
||||
const gchar *first_property_name,
|
||||
...);
|
||||
void g_object_get (gpointer object,
|
||||
const gchar *first_property_name,
|
||||
...);
|
||||
void g_object_notify (GObject *object,
|
||||
const gchar *property_name);
|
||||
void g_object_freeze_notify (GObject *object);
|
||||
void g_object_thaw_notify (GObject *object);
|
||||
void g_object_set_data_full (GObject *object,
|
||||
const gchar *key,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy);
|
||||
gpointer g_object_steal_data (GObject *object,
|
||||
const gchar *key);
|
||||
gpointer g_object_get_qdata (GObject *object,
|
||||
GQuark quark);
|
||||
void g_object_set_qdata (GObject *object,
|
||||
GQuark quark,
|
||||
gpointer data);
|
||||
void g_object_set_qdata_full (GObject *object,
|
||||
GQuark quark,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy);
|
||||
gpointer g_object_steal_qdata (GObject *object,
|
||||
GQuark quark);
|
||||
void g_object_watch_closure (GObject *object,
|
||||
GClosure *closure);
|
||||
void g_object_run_dispose (GObject *object);
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,24 +15,26 @@ namespace GLib {
|
|||
/// </remarks>
|
||||
|
||||
public enum TypeFundamentals {
|
||||
TypeInvalid,
|
||||
TypeNone,
|
||||
TypeInterface,
|
||||
TypeChar,
|
||||
TypeUChar,
|
||||
TypeBoolean,
|
||||
TypeInt,
|
||||
TypeUInt,
|
||||
TypeLong,
|
||||
TypeULong,
|
||||
TypeEnum,
|
||||
TypeFlags,
|
||||
TypeFloat,
|
||||
TypeDouble,
|
||||
TypeString,
|
||||
TypePointer,
|
||||
TypeBoxed,
|
||||
TypeParam,
|
||||
TypeObject,
|
||||
TypeInvalid = 0 << 2,
|
||||
TypeNone = 1 << 2,
|
||||
TypeInterface = 2 << 2,
|
||||
TypeChar = 3 << 2,
|
||||
TypeUChar = 4 << 2,
|
||||
TypeBoolean = 5 << 2,
|
||||
TypeInt = 6 << 2,
|
||||
TypeUInt = 7 << 2,
|
||||
TypeLong = 8 << 2,
|
||||
TypeULong = 9 << 2,
|
||||
TypeInt64 = 10 << 2,
|
||||
TypeUInt64 = 11 << 2,
|
||||
TypeEnum = 12 << 2,
|
||||
TypeFlags = 13 << 2,
|
||||
TypeFloat = 14 << 2,
|
||||
TypeDouble = 15 << 2,
|
||||
TypeString = 16 << 2,
|
||||
TypePointer = 17 << 2,
|
||||
TypeBoxed = 18 << 2,
|
||||
TypeParam = 19 << 2,
|
||||
TypeObject = 20 << 2,
|
||||
}
|
||||
}
|
||||
|
|
296
glib/Value.cs
296
glib/Value.cs
|
@ -23,7 +23,7 @@ namespace GLib {
|
|||
IntPtr _val;
|
||||
|
||||
|
||||
// Destructor is required since we are allocating unmananged
|
||||
// Destructor is required since we are allocating unmanaged
|
||||
// heap resources.
|
||||
|
||||
[DllImport("glib-2.0")]
|
||||
|
@ -34,36 +34,18 @@ namespace GLib {
|
|||
g_free (_val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Creates an uninitialized Value on the unmanaged heap.
|
||||
/// Use the Init method prior to attempting to assign a
|
||||
/// value to it.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("glib-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern IntPtr g_malloc0 (long n_bytes);
|
||||
// import the glue function to allocate values on heap
|
||||
|
||||
public Value ()
|
||||
[DllImport("gtksharpglue")]
|
||||
static extern IntPtr gtksharp_value_create(TypeFundamentals type);
|
||||
|
||||
// Constructor to wrap a raw GValue ref. We need the dummy param
|
||||
// to distinguish this ctor from the TypePointer ctor.
|
||||
|
||||
public Value (IntPtr val, IntPtr dummy)
|
||||
{
|
||||
_val = g_malloc0 (5 * IntPtr.Size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Creates an initialized Value of the specified type.
|
||||
/// </remarks>
|
||||
|
||||
public Value (TypeFundamentals type) : this ()
|
||||
{
|
||||
Init (type);
|
||||
_val = val;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -74,16 +56,65 @@ namespace GLib {
|
|||
/// Constructs a Value from a specified boolean.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_boolean (IntPtr val,
|
||||
bool data);
|
||||
public Value (bool val) : this ()
|
||||
public Value (bool val)
|
||||
{
|
||||
g_value_init (_val, TypeFundamentals.TypeBoolean);
|
||||
_val = gtksharp_value_create(TypeFundamentals.TypeBoolean);
|
||||
g_value_set_boolean (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Constructs a Value from a specified boxed type.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_boxed (IntPtr val, IntPtr data);
|
||||
public Value (GLib.Boxed val)
|
||||
{
|
||||
_val = gtksharp_value_create(TypeFundamentals.TypeBoxed);
|
||||
g_value_set_boxed (_val, val.Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Constructs a Value from a specified double.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_double (IntPtr val, double data);
|
||||
|
||||
public Value (double val)
|
||||
{
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypeDouble);
|
||||
g_value_set_double (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Constructs a Value from a specified float.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_float (IntPtr val, float data);
|
||||
|
||||
public Value (float val)
|
||||
{
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypeFloat);
|
||||
g_value_set_float (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
|
@ -92,16 +123,49 @@ namespace GLib {
|
|||
/// Constructs a Value from a specified integer.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_int (IntPtr val, int data);
|
||||
|
||||
public Value (int val) : this ()
|
||||
public Value (int val)
|
||||
{
|
||||
g_value_init (_val, TypeFundamentals.TypeInt);
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypeInt);
|
||||
g_value_set_int (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Constructs a Value from a specified object.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_object (IntPtr val, IntPtr data);
|
||||
|
||||
public Value (GLib.Object val)
|
||||
{
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypeObject);
|
||||
g_value_set_object (_val, val.Handle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Constructs a Value from a specified pointer.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_pointer (IntPtr val, IntPtr data);
|
||||
|
||||
public Value (IntPtr val)
|
||||
{
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypePointer);
|
||||
g_value_set_pointer (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
|
@ -110,32 +174,30 @@ namespace GLib {
|
|||
/// Constructs a Value from a specified string.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_value_set_string (IntPtr val,
|
||||
string data);
|
||||
public Value (string val) : this ()
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_string (IntPtr val, string data);
|
||||
|
||||
public Value (string val)
|
||||
{
|
||||
g_value_init (_val, TypeFundamentals.TypeString);
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypeString);
|
||||
g_value_set_string (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init Method
|
||||
/// Value Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Prepares a raw value to hold a specified type.
|
||||
/// Constructs a Value from a specified uint.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_value_init (IntPtr val,
|
||||
TypeFundamentals type);
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern void g_value_set_uint (IntPtr val, uint data);
|
||||
|
||||
public void Init (TypeFundamentals type)
|
||||
public Value (uint val)
|
||||
{
|
||||
g_value_init (_val, type);
|
||||
_val = gtksharp_value_create (TypeFundamentals.TypeUInt);
|
||||
g_value_set_uint (_val, val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -148,8 +210,7 @@ namespace GLib {
|
|||
/// boolean value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern bool g_value_get_boolean (IntPtr val);
|
||||
|
||||
public static explicit operator bool (Value val)
|
||||
|
@ -159,6 +220,67 @@ namespace GLib {
|
|||
return g_value_get_boolean (val._val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to Boxed Conversion
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Extracts a boxed type from a Value. Note, this method
|
||||
/// will produce an exception if the Value does not hold a
|
||||
/// boxed type value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern IntPtr g_value_get_boxed (IntPtr val);
|
||||
|
||||
public static explicit operator GLib.Boxed (Value val)
|
||||
{
|
||||
// FIXME: Insert an appropriate exception here if
|
||||
// _val.type indicates an error.
|
||||
// FIXME: Figure out how to wrap this boxed type
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to Double Conversion
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Extracts a double from a Value. Note, this method
|
||||
/// will produce an exception if the Value does not hold a
|
||||
/// double value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern double g_value_get_double (IntPtr val);
|
||||
|
||||
public static explicit operator double (Value val)
|
||||
{
|
||||
// FIXME: Insert an appropriate exception here if
|
||||
// _val.type indicates an error.
|
||||
return g_value_get_double (val._val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to Float Conversion
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Extracts a float from a Value. Note, this method
|
||||
/// will produce an exception if the Value does not hold a
|
||||
/// float value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern float g_value_get_float (IntPtr val);
|
||||
|
||||
public static explicit operator float (Value val)
|
||||
{
|
||||
// FIXME: Insert an appropriate exception here if
|
||||
// _val.type indicates an error.
|
||||
return g_value_get_float (val._val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to Integer Conversion
|
||||
/// </summary>
|
||||
|
@ -169,8 +291,7 @@ namespace GLib {
|
|||
/// integer value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern int g_value_get_int (IntPtr val);
|
||||
|
||||
public static explicit operator int (Value val)
|
||||
|
@ -180,6 +301,46 @@ namespace GLib {
|
|||
return g_value_get_int (val._val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to Object Conversion
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Extracts an object from a Value. Note, this method
|
||||
/// will produce an exception if the Value does not hold a
|
||||
/// object value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern IntPtr g_value_get_object (IntPtr val);
|
||||
|
||||
public static explicit operator GLib.Object (Value val)
|
||||
{
|
||||
// FIXME: Insert an appropriate exception here if
|
||||
// _val.type indicates an error.
|
||||
return GLib.Object.GetObject(g_value_get_object (val._val));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to Pointer Conversion
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Extracts a pointer from a Value. Note, this method
|
||||
/// will produce an exception if the Value does not hold a
|
||||
/// pointer value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern IntPtr g_value_get_pointer (IntPtr val);
|
||||
|
||||
public static explicit operator IntPtr (Value val)
|
||||
{
|
||||
// FIXME: Insert an appropriate exception here if
|
||||
// _val.type indicates an error.
|
||||
return g_value_get_pointer (val._val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Value to String Conversion
|
||||
/// </summary>
|
||||
|
@ -190,8 +351,7 @@ namespace GLib {
|
|||
/// string value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0",
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern string g_value_get_string (IntPtr val);
|
||||
|
||||
public static explicit operator String (Value val)
|
||||
|
@ -202,14 +362,34 @@ namespace GLib {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// MarshalAs Property
|
||||
/// Value to Unsigned Integer Conversion
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Extracts an uint from a Value. Note, this method
|
||||
/// will produce an exception if the Value does not hold a
|
||||
/// unsigned integer value.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gobject-2.0")]
|
||||
static extern uint g_value_get_uint (IntPtr val);
|
||||
|
||||
public static explicit operator uint (Value val)
|
||||
{
|
||||
// FIXME: Insert an appropriate exception here if
|
||||
// _val.type indicates an error.
|
||||
return g_value_get_uint (val._val);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Read only. Accesses a pointer to the raw GValue.
|
||||
/// </remarks>
|
||||
|
||||
public IntPtr MarshalAs {
|
||||
public IntPtr Handle {
|
||||
get {
|
||||
return _val;
|
||||
}
|
||||
|
|
5
glib/makefile.win32
Normal file
5
glib/makefile.win32
Normal file
|
@ -0,0 +1,5 @@
|
|||
all: windows
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /out:glib-sharp.dll /recurse:*.cs
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -1,15 +1,20 @@
|
|||
MCS=mcs
|
||||
|
||||
all:
|
||||
all: linux
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
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 /out:gtk-sharp.dll /recurse:*.cs
|
||||
|
||||
linux:
|
||||
linux: gtk-sharp.dll
|
||||
|
||||
gtk-sharp.dll: *.cs generated/*.cs
|
||||
$(MCS) --unsafe --target library -r ../glib/glib-sharp.dll -r ../pango/pango-sharp.dll -r ../atk/atk-sharp.dll -r ../gdk/gdk-sharp.dll -o gtk-sharp.dll --recurse *.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
install: all
|
||||
cp gtk-sharp.dll @prefix@/lib
|
||||
|
5
gtk/makefile.win32
Normal file
5
gtk/makefile.win32
Normal file
|
@ -0,0 +1,5 @@
|
|||
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 /out:gtk-sharp.dll /recurse:*.cs
|
||||
|
14
makefile
14
makefile
|
@ -1,11 +1,9 @@
|
|||
DIRS=generator glib pango atk gdk gtk sample
|
||||
DIRS=glue generator glib pango atk gdk gtk sample
|
||||
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
|
||||
CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe
|
||||
MCS=mcs
|
||||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make linux'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: linux
|
||||
|
||||
windows:
|
||||
for i in $(DIRS); do \
|
||||
|
@ -16,8 +14,12 @@ unix:
|
|||
@echo "'make unix' is broken for now."
|
||||
|
||||
linux:
|
||||
(cd glue;make) || exit 1
|
||||
for i in $(DIRS); do \
|
||||
(cd $$i; MCS="$(MCS)" make linux) || exit 1;\
|
||||
(cd $$i; MCS="$(MCS)" make) || exit 1;\
|
||||
done;
|
||||
|
||||
install:
|
||||
for i in $(DIRS); do \
|
||||
(cd $$i; make install) || exit 1; \
|
||||
done;
|
||||
|
||||
|
|
11
makefile.win32
Executable file
11
makefile.win32
Executable file
|
@ -0,0 +1,11 @@
|
|||
DIRS=generator glib pango atk gdk gtk sample
|
||||
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
|
||||
CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe
|
||||
|
||||
all: windows
|
||||
|
||||
windows:
|
||||
for i in $(DIRS); do \
|
||||
(cd $$i; CSC=$(CSC) make -f makefile.win32) || exit 1;\
|
||||
done;
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated
|
||||
Makefile
|
||||
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
MCS=mcs
|
||||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: linux
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /out:pango-sharp.dll /recurse:*.cs
|
||||
|
||||
linux:
|
||||
linux: pango-sharp.dll
|
||||
|
||||
pango-sharp.dll: generated/*.cs
|
||||
$(MCS) --unsafe --target library -r ../glib/glib-sharp.dll -o pango-sharp.dll --recurse *.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
install: all
|
||||
cp pango-sharp.dll @prefix@/lib
|
||||
|
5
pango/makefile.win32
Normal file
5
pango/makefile.win32
Normal file
|
@ -0,0 +1,5 @@
|
|||
all: windows
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /out:pango-sharp.dll /recurse:*.cs
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
*.dll
|
||||
*.exe
|
||||
generated
|
||||
Makefile
|
||||
|
||||
|
|
21
sample/Makefile.in
Executable file
21
sample/Makefile.in
Executable file
|
@ -0,0 +1,21 @@
|
|||
MCS=mcs
|
||||
|
||||
all: linux
|
||||
|
||||
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:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
|
||||
|
||||
linux: gtk-hello-world.exe button.exe
|
||||
|
||||
gtk-hello-world.exe: HelloWorld.cs
|
||||
$(MCS) --unsafe -o gtk-hello-world.exe -r ../glib/glib-sharp.dll -r ../gtk/gtk-sharp.dll -r ../gdk/gdk-sharp.dll HelloWorld.cs
|
||||
|
||||
button.exe: ButtonApp.cs
|
||||
$(MCS) --unsafe -o button.exe -r ../glib/glib-sharp.dll -r ../gtk/gtk-sharp.dll ButtonApp.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
install:
|
||||
|
6
sample/makefile → sample/makefile.win32
Executable file → Normal file
6
sample/makefile → sample/makefile.win32
Executable file → Normal file
|
@ -1,10 +1,6 @@
|
|||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
all: windows
|
||||
|
||||
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:button.exe /r:../glib/glib-sharp.dll /r:../gtk/gtk-sharp.dll ButtonApp.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
Loading…
Reference in a new issue