2009-04-13 Christian Hoff <christian_hoff@gmx.net>

Add support for virtual methods(vm) to the generator.

	* parser/gapi2xml.pl: Generate a class_struct element with
	all members of the class structure. Dump the first (instance)
	parameter for signal and vm elements. Bump up parser version.
	* generator/GObjectVM.cs: Added. Support for GObject virtual methods.
	* generator/DefaultSignalHandler.cs: Signal specific part of vm
	generation.
	* generator/InterfaceVM.cs: New class for interface vms.
	* generator/ObjectBase.cs: Parse the class struct.

svn path=/trunk/gtk-sharp/; revision=131604
This commit is contained in:
Christian Hoff 2009-04-13 17:44:48 +00:00
parent edf5b066e1
commit 291ee61b2d
58 changed files with 6617 additions and 4219 deletions

View file

@ -1,3 +1,15 @@
2009-04-13 Christian Hoff <christian_hoff@gmx.net>
Add support for virtual methods(vm) to the generator.
* parser/gapi2xml.pl: Generate a class_struct element with
all members of the class structure. Dump the first (instance)
parameter for signal and vm elements. Bump up parser version.
* generator/GObjectVM.cs: Added. Support for GObject virtual methods.
* generator/DefaultSignalHandler.cs: Signal specific part of vm
generation.
* generator/InterfaceVM.cs: New class for interface vms.
* generator/ObjectBase.cs: Parse the class struct.
2009-04-09 Mike Kestner <mkestner@novell.com>
* glib/ListBase.cs: fix g_object_unref dllimport lib.

View file

@ -25,9 +25,16 @@
<attr path="/api/namespace/object[@cname='AtkObject']/method[@name='RefAccessibleChild']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='AtkObject']/method[@name='RefRelationSet']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='AtkObject']/method[@name='RefStateSet']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='AtkObject']/virtual_method[@cname='ref_child']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='AtkObject']/virtual_method[@cname='ref_state_set']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='AtkObjectFactory']/virtual_method" name="override_in">declaring_class</attr>
<attr path="/api/namespace/object[@cname='AtkRelation']/constructor[@cname='atk_relation_new']/*/*[@name='targets']" name="array">1</attr>
<attr path="/api/namespace/object[@cname='AtkRelation']/*[@name='GetTarget']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='AtkRelation']/method[@name='GetTarget']/return-type" name="element_type">AtkObject*</attr>
<attr path="/api/namespace/object[@cname='AtkUtil']/virtual_method" name="override_in">declaring_class</attr>
<attr path="/api/namespace/object[@cname='AtkUtil']/virtual_method[@name='AddGlobalEventListener']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='AtkUtil']/virtual_method[@name='RemoveGlobalEventListener']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='AtkUtil']/virtual_method[@name='RemoveKeyEventListener']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='AtkAttribute']/method[@name='SetFree']" name="hidden">1</attr>
<attr path="/api/namespace/interface[@cname='AtkText']/*[@name='GetRunAttributes']/return-type" name="element_type">AtkAttribute*</attr>
<attr path="/api/namespace/interface[@cname='AtkText']/*[@name='GetDefaultAttributes']/return-type" name="element_type">AtkAttribute*</attr>

View file

@ -21,271 +21,6 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_get_uri (IntPtr type, GetUriDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr GetUriDelegate (IntPtr raw, int i);
static GetUriDelegate GetUriCallback;
static IntPtr GetUri_cb (IntPtr raw, int i)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return GLib.Marshaller.StringToPtrGStrdup (obj.OnGetUri (i));
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideGetUri (GLib.GType gtype)
{
if (GetUriCallback == null)
GetUriCallback = new GetUriDelegate (GetUri_cb);
atksharp_hyperlink_override_get_uri (gtype.Val, GetUriCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetUri")]
protected virtual string OnGetUri (int i)
{
return null;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_get_object (IntPtr type, GetObjectDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr GetObjectDelegate (IntPtr raw, int i);
static GetObjectDelegate GetObjectCallback;
static IntPtr GetObject_cb (IntPtr raw, int i)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
Atk.Object ret = obj.OnGetObject (i);
return ret == null ? IntPtr.Zero : ret.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideGetObject (GLib.GType gtype)
{
if (GetObjectCallback == null)
GetObjectCallback = new GetObjectDelegate (GetObject_cb);
atksharp_hyperlink_override_get_object (gtype.Val, GetObjectCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetObject")]
protected virtual Atk.Object OnGetObject (int i)
{
return null;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_get_end_index (IntPtr type, GetEndIndexDelegate cb);
[GLib.CDeclCallback]
delegate int GetEndIndexDelegate (IntPtr raw);
static GetEndIndexDelegate GetEndIndexCallback;
static int GetEndIndex_cb (IntPtr raw)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return obj.OnGetEndIndex ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return -1;
}
static void OverrideGetEndIndex (GLib.GType gtype)
{
if (GetEndIndexCallback == null)
GetEndIndexCallback = new GetEndIndexDelegate (GetEndIndex_cb);
atksharp_hyperlink_override_get_end_index (gtype.Val, GetEndIndexCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetEndIndex")]
protected virtual int OnGetEndIndex ()
{
return -1;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_get_start_index (IntPtr type, GetStartIndexDelegate cb);
[GLib.CDeclCallback]
delegate int GetStartIndexDelegate (IntPtr raw);
static GetStartIndexDelegate GetStartIndexCallback;
static int GetStartIndex_cb (IntPtr raw)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return obj.OnGetStartIndex ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return -1;
}
static void OverrideGetStartIndex (GLib.GType gtype)
{
if (GetStartIndexCallback == null)
GetStartIndexCallback = new GetStartIndexDelegate (GetStartIndex_cb);
atksharp_hyperlink_override_get_start_index (gtype.Val, GetStartIndexCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetStartIndex")]
protected virtual int OnGetStartIndex ()
{
return -1;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_is_valid (IntPtr type, IsValidDelegate cb);
[GLib.CDeclCallback]
delegate bool IsValidDelegate (IntPtr raw);
static IsValidDelegate IsValidCallback;
static bool IsValid_cb (IntPtr raw)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return obj.OnIsValid ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return false;
}
static void OverrideIsValid (GLib.GType gtype)
{
if (IsValidCallback == null)
IsValidCallback = new IsValidDelegate (IsValid_cb);
atksharp_hyperlink_override_is_valid (gtype.Val, IsValidCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideIsValid")]
protected virtual bool OnIsValid()
{
return false;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_get_n_anchors (IntPtr type, GetNAnchorsDelegate cb);
[GLib.CDeclCallback]
delegate int GetNAnchorsDelegate (IntPtr raw);
static GetNAnchorsDelegate GetNAnchorsCallback;
static int GetNAnchors_cb (IntPtr raw)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return obj.OnGetNAnchors ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return 0;
}
static void OverrideGetNAnchors (GLib.GType gtype)
{
if (GetNAnchorsCallback == null)
GetNAnchorsCallback = new GetNAnchorsDelegate (GetNAnchors_cb);
atksharp_hyperlink_override_get_n_anchors (gtype.Val, GetNAnchorsCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideGetNAnchors")]
protected virtual int OnGetNAnchors ()
{
return 0;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_link_state (IntPtr type, LinkStateDelegate cb);
[GLib.CDeclCallback]
delegate uint LinkStateDelegate (IntPtr raw);
static LinkStateDelegate LinkStateCallback;
static uint LinkState_cb (IntPtr raw)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return obj.OnLinkState ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return 0;
}
static void OverrideLinkState (GLib.GType gtype)
{
if (LinkStateCallback == null)
LinkStateCallback = new LinkStateDelegate (LinkState_cb);
atksharp_hyperlink_override_link_state (gtype.Val, LinkStateCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideLinkState")]
protected virtual uint OnLinkState ()
{
return 0;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_hyperlink_override_is_selected_link (IntPtr type, IsSelectedLinkDelegate cb);
[GLib.CDeclCallback]
delegate bool IsSelectedLinkDelegate (IntPtr raw);
static IsSelectedLinkDelegate IsSelectedLinkCallback;
static bool IsSelectedLink_cb (IntPtr raw)
{
try {
Atk.Hyperlink obj = GLib.Object.GetObject (raw, false) as Atk.Hyperlink;
return obj.OnIsSelectedLink ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return false;
}
static void OverrideIsSelectedLink (GLib.GType gtype)
{
if (IsSelectedLinkCallback == null)
IsSelectedLinkCallback = new IsSelectedLinkDelegate (IsSelectedLink_cb);
atksharp_hyperlink_override_is_selected_link (gtype.Val, IsSelectedLinkCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Hyperlink), ConnectionMethod="OverrideIsSelectedLink")]
protected virtual bool OnIsSelectedLink ()
{
return false;
}
protected void EmitLinkActivated ()
{
GLib.Signal.Emit (this, "link_activated");

View file

@ -15,7 +15,6 @@ customs = \
Hyperlink.custom \
Misc.custom \
Object.custom \
ObjectFactory.custom \
SelectionAdapter.custom \
TextAdapter.custom \
Util.custom

View file

@ -21,64 +21,6 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("atksharpglue-2")]
static extern int atksharp_misc_override_threads_enter (IntPtr type, ThreadDelegate cb);
[GLib.CDeclCallback]
delegate void ThreadDelegate (IntPtr raw);
static ThreadDelegate ThreadsEnterCallback;
static void ThreadsEnter_cb (IntPtr raw)
{
try {
Atk.Misc __obj = GLib.Object.GetObject (raw, false) as Atk.Misc;
__obj.OnThreadsEnter ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
static void OverrideThreadsEnter (GLib.GType gtype)
{
if (ThreadsEnterCallback == null)
ThreadsEnterCallback = new ThreadDelegate (ThreadsEnter_cb);
atksharp_misc_override_threads_enter (gtype.Val, ThreadsEnterCallback);
}
[GLib.DefaultSignalHandler (Type=typeof (Atk.Misc), ConnectionMethod="OverrideThreadsEnter")]
protected virtual void OnThreadsEnter ()
{
}
[DllImport("atksharpglue-2")]
static extern int atksharp_misc_override_threads_leave (IntPtr type, ThreadDelegate cb);
static ThreadDelegate ThreadsLeaveCallback;
static void ThreadsLeave_cb (IntPtr raw)
{
try {
Atk.Misc __obj = GLib.Object.GetObject (raw, false) as Atk.Misc;
__obj.OnThreadsLeave ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
static void OverrideThreadsLeave (GLib.GType gtype)
{
if (ThreadsLeaveCallback == null)
ThreadsLeaveCallback = new ThreadDelegate (ThreadsLeave_cb);
atksharp_misc_override_threads_leave (gtype.Val, ThreadsLeaveCallback);
}
[GLib.DefaultSignalHandler (Type=typeof (Atk.Misc), ConnectionMethod="OverrideThreadsLeave")]
protected virtual void OnThreadsLeave ()
{
}
[DllImport("atksharpglue-2")]
static extern void atksharp_misc_set_singleton_instance (IntPtr misc);

View file

@ -21,77 +21,6 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("atksharpglue-2")]
static extern void atksharp_object_override_get_n_children (IntPtr type, NChildrenDelegate cb);
[GLib.CDeclCallback]
delegate int NChildrenDelegate (IntPtr raw);
static NChildrenDelegate NChildrenCallback;
static int NChildren_cb (IntPtr raw)
{
try {
Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object;
return obj.OnGetNChildren ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return 0;
}
static void OverrideNChildren (GLib.GType gtype)
{
if (NChildrenCallback == null)
NChildrenCallback = new NChildrenDelegate (NChildren_cb);
atksharp_object_override_get_n_children (gtype.Val, NChildrenCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideNChildren")]
protected virtual int OnGetNChildren() {
return 0;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_object_override_ref_child (IntPtr type, RefChildDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr RefChildDelegate (IntPtr raw, int i);
static RefChildDelegate RefChildCallback;
[DllImport("libgobject-2.0-0.dll")]
static extern IntPtr g_object_ref (IntPtr handle);
static IntPtr RefChild_cb (IntPtr raw, int i)
{
try {
Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object;
Atk.Object child = obj.OnRefChild (i);
if (child != null)
g_object_ref (child.Handle);
return child == null ? IntPtr.Zero : child.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideRefChild (GLib.GType gtype)
{
if (RefChildCallback == null)
RefChildCallback = new RefChildDelegate (RefChild_cb);
atksharp_object_override_ref_child (gtype.Val, RefChildCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefChild")]
protected virtual Atk.Object OnRefChild (int i) {
return null;
}
protected void EmitChildrenChanged (ChildrenChangedDetail detail, uint child_index, Atk.Object child)
{
GLib.Signal.Emit (this,
@ -110,125 +39,11 @@
GLib.Signal.Emit (this, "visible-data-changed");
}
[DllImport("atksharpglue-2")]
static extern void atksharp_object_override_ref_state_set (IntPtr type, RefStateSetDelegate cb);
[DllImport("atksharpglue-2")]
static extern IntPtr atksharp_object_base_ref_state_set (IntPtr atk_obj);
[GLib.CDeclCallback]
delegate IntPtr RefStateSetDelegate (IntPtr raw);
static RefStateSetDelegate RefStateSetCallback;
static IntPtr RefStateSet_cb (IntPtr raw)
{
try {
Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object;
Atk.StateSet state_set = obj.OnRefStateSet ();
if (state_set != null)
g_object_ref (state_set.Handle);
return state_set == null ? IntPtr.Zero : state_set.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideRefStateSet (GLib.GType gtype)
{
if (RefStateSetCallback == null)
RefStateSetCallback = new RefStateSetDelegate (RefStateSet_cb);
atksharp_object_override_ref_state_set (gtype.Val, RefStateSetCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefStateSet")]
protected virtual Atk.StateSet OnRefStateSet ()
{
IntPtr raw = atksharp_object_base_ref_state_set (Handle);
return GLib.Object.GetObject (raw, true) as StateSet;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_object_override_get_index_in_parent (IntPtr type, IndexInParentDelegate cb);
[GLib.CDeclCallback]
delegate int IndexInParentDelegate (IntPtr raw);
static IndexInParentDelegate IndexInParentCallback;
static int IndexInParent_cb (IntPtr raw)
{
try {
Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object;
return obj.OnGetIndexInParent ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return -1;
}
static void OverrideIndexInParent (GLib.GType gtype)
{
if (IndexInParentCallback == null)
IndexInParentCallback = new IndexInParentDelegate (IndexInParent_cb);
atksharp_object_override_get_index_in_parent (gtype.Val, IndexInParentCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideIndexInParent")]
protected virtual int OnGetIndexInParent() {
return -1;
}
public void NotifyStateChange (Atk.StateType state, bool value) {
NotifyStateChange ((ulong)state, value);
}
[DllImport("atksharpglue-2")]
static extern void atksharp_object_override_ref_relation_set (IntPtr type, RefRelationSetDelegate cb);
[DllImport("atksharpglue-2")]
static extern IntPtr atksharp_object_base_ref_relation_set (IntPtr atk_obj);
[GLib.CDeclCallback]
delegate IntPtr RefRelationSetDelegate (IntPtr raw);
static RefRelationSetDelegate RefRelationSetCallback;
static IntPtr RefRelationSet_cb (IntPtr raw)
{
try {
Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object;
Atk.RelationSet relation_set = obj.OnRefRelationSet ();
if (relation_set != null)
g_object_ref (relation_set.Handle);
return relation_set == null ? IntPtr.Zero : relation_set.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideRefRelationSet (GLib.GType gtype)
{
if (RefRelationSetCallback == null)
RefRelationSetCallback = new RefRelationSetDelegate (RefRelationSet_cb);
atksharp_object_override_ref_relation_set (gtype.Val, RefRelationSetCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefRelationSet")]
protected virtual Atk.RelationSet OnRefRelationSet ()
{
IntPtr raw = atksharp_object_base_ref_relation_set (Handle);
return GLib.Object.GetObject (raw, true) as RelationSet;
}
protected void EmitFocusEvent (bool gained)
{
GLib.Signal.Emit (this, "focus-event", gained);
}

View file

@ -1,124 +0,0 @@
// ObjectFactory.custom - Atk ObjectFactory class customizations
//
// Author: Mike Gorse <mgorse@novell.com>
//
// Copyright (c) 2008 Novell, Inc.
//
// This code is inserted after the automatically generated code.
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport("atksharpglue-2")]
static extern void atksharp_object_factory_override_create_accessible (IntPtr type, CreateAccessibleDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr CreateAccessibleDelegate (IntPtr raw);
static CreateAccessibleDelegate CreateAccessibleCallback;
[DllImport("libgobject-2.0-0.dll")]
static extern IntPtr g_object_ref (IntPtr handle);
static IntPtr CreateAccessible_cb (IntPtr raw)
{
try {
Atk.ObjectFactory obj = GLib.Object.GetObject (raw, false) as Atk.ObjectFactory;
Atk.Object ret = obj.OnCreateAccessible ();
if (ret != null)
g_object_ref (ret.Handle);
return ret == null ? IntPtr.Zero : ret.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideCreateAccessible (GLib.GType gtype)
{
if (CreateAccessibleCallback == null)
CreateAccessibleCallback = new CreateAccessibleDelegate (CreateAccessible_cb);
atksharp_object_factory_override_create_accessible (gtype.Val, CreateAccessibleCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.ObjectFactory), ConnectionMethod="OverrideCreateAccessible")]
protected virtual Atk.Object OnCreateAccessible ()
{
return null;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_object_factory_override_invalidate (IntPtr type, InvalidateDelegate cb);
[GLib.CDeclCallback]
delegate void InvalidateDelegate (IntPtr raw);
static InvalidateDelegate InvalidateCallback;
static void Invalidate_cb (IntPtr raw)
{
try {
Atk.ObjectFactory obj = GLib.Object.GetObject (raw, false) as Atk.ObjectFactory;
obj.OnInvalidate ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
static void OverrideInvalidate (GLib.GType gtype)
{
if (InvalidateCallback == null)
InvalidateCallback = new InvalidateDelegate (Invalidate_cb);
atksharp_object_factory_override_invalidate (gtype.Val, InvalidateCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.ObjectFactory), ConnectionMethod="OverrideInvalidate")]
protected virtual void OnInvalidate ()
{
}
[DllImport("atksharpglue-2")]
static extern void atksharp_object_factory_override_get_accessible_type (IntPtr type, GetAccessibleTypeDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr GetAccessibleTypeDelegate (IntPtr raw);
static GetAccessibleTypeDelegate GetAccessibleTypeCallback;
static IntPtr GetAccessibleType_cb (IntPtr raw)
{
try {
Atk.ObjectFactory obj = GLib.Object.GetObject (raw, false) as Atk.ObjectFactory;
return obj.OnGetAccessibleType ().Val;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
static void OverrideGetAccessibleType (GLib.GType gtype)
{
if (GetAccessibleTypeCallback == null)
GetAccessibleTypeCallback = new GetAccessibleTypeDelegate (GetAccessibleType_cb);
atksharp_object_factory_override_get_accessible_type (gtype.Val, GetAccessibleTypeCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.ObjectFactory), ConnectionMethod="OverrideGetAccessibleType")]
protected virtual GLib.GType OnGetAccessibleType ()
{
return GLib.GType.Invalid;
}

View file

@ -80,63 +80,6 @@
}
}
class KeySnoopFuncInvoker {
AtkSharp.KeySnoopFuncNative native_cb;
IntPtr data;
internal KeySnoopFuncInvoker (AtkSharp.KeySnoopFuncNative native_cb, IntPtr data)
{
this.native_cb = native_cb;
this.data = data;
}
internal KeySnoopFunc Handler {
get {
return new KeySnoopFunc (InvokeNative);
}
}
int InvokeNative (KeyEventStruct evnt)
{
IntPtr native_evnt = GLib.Marshaller.StructureToPtrAlloc (evnt);
int result = native_cb (native_evnt, data);
evnt = KeyEventStruct.New (native_evnt);
Marshal.FreeHGlobal (native_evnt);
return result;
}
}
[GLib.CDeclCallback]
delegate uint AddKeyEventListenerNativeDelegate (AtkSharp.KeySnoopFuncNative native_func, IntPtr data);
static AddKeyEventListenerDelegate add_key_event_listener_handler;
static AddKeyEventListenerNativeDelegate add_key_event_listener_callback;
static uint AddKeyEventListenerCallback (AtkSharp.KeySnoopFuncNative func, IntPtr data)
{
try {
return add_key_event_listener_handler (new KeySnoopFuncInvoker (func, data).Handler);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return 0;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_util_override_add_key_event_listener (AddKeyEventListenerNativeDelegate cb);
public delegate uint AddKeyEventListenerDelegate (KeySnoopFunc listener);
public static AddKeyEventListenerDelegate AddKeyEventListenerHandler {
set {
add_key_event_listener_handler = value;
if (add_key_event_listener_callback == null)
add_key_event_listener_callback = new AddKeyEventListenerNativeDelegate (AddKeyEventListenerCallback);
atksharp_util_override_add_key_event_listener (add_key_event_listener_callback);
}
}
static RemoveListenerDelegate remove_key_event_listener_handler;
static RemoveListenerNativeDelegate remove_key_event_listener_callback;
@ -160,114 +103,3 @@
atksharp_util_override_remove_key_event_listener (remove_key_event_listener_callback);
}
}
[GLib.CDeclCallback]
delegate IntPtr GetRootNativeDelegate ();
static GetRootDelegate get_root_handler;
static GetRootNativeDelegate get_root_callback;
static IntPtr GetRootCallback ()
{
try {
return get_root_handler ().Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_util_override_get_root (GetRootNativeDelegate cb);
public delegate Atk.Object GetRootDelegate ();
public static GetRootDelegate GetRootHandler {
set {
get_root_handler = value;
if (value == null)
atksharp_util_override_get_root (null);
else {
if (get_root_callback == null)
get_root_callback = new GetRootNativeDelegate (GetRootCallback);
atksharp_util_override_get_root (get_root_callback);
}
}
}
[GLib.CDeclCallback]
delegate IntPtr GetToolkitNameNativeDelegate ();
static GetToolkitNameDelegate get_toolkit_name_handler;
static GetToolkitNameNativeDelegate get_toolkit_name_callback;
static string toolkit_name;
static IntPtr toolkit_name_native;
static IntPtr GetToolkitNameCallback ()
{
try {
string name = get_toolkit_name_handler ();
if (name != toolkit_name) {
GLib.Marshaller.Free (toolkit_name_native);
toolkit_name_native = GLib.Marshaller.StringToPtrGStrdup (name);
toolkit_name = name;
}
return toolkit_name_native;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_util_override_get_toolkit_name (GetToolkitNameNativeDelegate cb);
public delegate string GetToolkitNameDelegate ();
public static GetToolkitNameDelegate GetToolkitNameHandler {
set {
get_toolkit_name_handler = value;
if (get_toolkit_name_callback == null)
get_toolkit_name_callback = new GetToolkitNameNativeDelegate (GetToolkitNameCallback);
atksharp_util_override_get_toolkit_name (get_toolkit_name_callback);
}
}
[GLib.CDeclCallback]
delegate IntPtr GetToolkitVersionNativeDelegate ();
static GetToolkitVersionDelegate get_toolkit_version_handler;
static GetToolkitVersionNativeDelegate get_toolkit_version_callback;
static string toolkit_version;
static IntPtr toolkit_version_native;
static IntPtr GetToolkitVersionCallback ()
{
try {
string version = get_toolkit_version_handler ();
if (version != toolkit_version) {
GLib.Marshaller.Free (toolkit_version_native);
toolkit_version_native = GLib.Marshaller.StringToPtrGStrdup (version);
toolkit_version = version;
}
return toolkit_version_native;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
return IntPtr.Zero;
}
[DllImport("atksharpglue-2")]
static extern void atksharp_util_override_get_toolkit_version (GetToolkitVersionNativeDelegate cb);
public delegate string GetToolkitVersionDelegate ();
public static GetToolkitVersionDelegate GetToolkitVersionHandler {
set {
get_toolkit_version_handler = value;
if (get_toolkit_version_callback == null)
get_toolkit_version_callback = new GetToolkitVersionNativeDelegate (GetToolkitVersionCallback);
atksharp_util_override_get_toolkit_version (get_toolkit_version_callback);
}
}

File diff suppressed because it is too large Load diff

View file

@ -3,10 +3,7 @@ lib_LTLIBRARIES = libatksharpglue-2.la
libatksharpglue_2_la_LDFLAGS = -module -avoid-version -no-undefined
libatksharpglue_2_la_SOURCES = \
hyperlink.c \
misc.c \
object.c \
object_factory.c \
util.c \
vmglueheaders.h

View file

@ -1,117 +0,0 @@
/* hyperlink.c : Glue for overriding vms of AtkHyperlink
*
* Author: Mike Gorse <mgorse@novell.com>
*
* Copyright (c) 2008 Novell, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the Lesser GNU General
* Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <atk/atk.h>
void atksharp_hyperlink_override_get_uri (GType gtype, gpointer cb);
void atksharp_hyperlink_override_get_object (GType gtype, gpointer cb);
void atksharp_hyperlink_override_get_end_index (GType gtype, gpointer cb);
void atksharp_hyperlink_override_get_start_index (GType gtype, gpointer cb);
void atksharp_hyperlink_override_is_valid (GType gtype, gpointer cb);
void atksharp_hyperlink_override_get_n_anchors (GType gtype, gpointer cb);
void atksharp_hyperlink_override_link_state (GType gtype, gpointer cb);
void atksharp_hyperlink_override_is_selected_link (GType gtype, gpointer cb);
void
atksharp_hyperlink_override_get_uri (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->get_uri = cb;
}
void
atksharp_hyperlink_override_get_object (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->get_object = cb;
}
void
atksharp_hyperlink_override_get_end_index (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->get_end_index = cb;
}
void
atksharp_hyperlink_override_get_start_index (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->get_start_index = cb;
}
void
atksharp_hyperlink_override_is_valid (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->is_valid = cb;
}
void
atksharp_hyperlink_override_get_n_anchors (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->get_n_anchors = cb;
}
void
atksharp_hyperlink_override_link_state (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->link_state = cb;
}
void
atksharp_hyperlink_override_is_selected_link (GType gtype, gpointer cb)
{
AtkHyperlinkClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkHyperlinkClass *) klass)->is_selected_link = cb;
}

View file

@ -21,29 +21,6 @@
#include <atk/atk.h>
void atksharp_misc_override_threads_enter (GType gtype, gpointer cb);
void
atksharp_misc_override_threads_enter (GType gtype, gpointer cb)
{
AtkMiscClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkMiscClass *) klass)->threads_enter = cb;
}
void atksharp_misc_override_threads_leave (GType gtype, gpointer cb);
void
atksharp_misc_override_threads_leave (GType gtype, gpointer cb)
{
AtkMiscClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkMiscClass *) klass)->threads_leave = cb;
}
void atksharp_misc_set_singleton_instance (AtkMisc *misc);
void

View file

@ -1,103 +0,0 @@
/* object.c : Glue for overriding vms of AtkObject
*
* Author: Andres G. Aragoneses <aaragoneses@novell.com>
*
* Copyright (c) 2008 Novell, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the Lesser GNU General
* Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <atk/atk.h>
void atksharp_object_override_get_n_children (GType gtype, gpointer cb);
void atksharp_object_override_ref_child (GType gtype, gpointer cb);
void atksharp_object_override_ref_state_set (GType gtype, gpointer cb);
AtkStateSet* atksharp_object_base_ref_state_set (AtkObject *base);
void atksharp_object_override_get_index_in_parent (GType gtype, gpointer cb);
void atksharp_object_override_ref_relation_set (GType gtype, gpointer cb);
AtkRelationSet* atksharp_object_base_ref_relation_set (AtkObject *base);
void
atksharp_object_override_get_n_children (GType gtype, gpointer cb)
{
AtkObjectClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkObjectClass *) klass)->get_n_children = cb;
}
void
atksharp_object_override_ref_child (GType gtype, gpointer cb)
{
AtkObjectClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkObjectClass *) klass)->ref_child = cb;
}
void
atksharp_object_override_ref_state_set (GType gtype, gpointer cb)
{
AtkObjectClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkObjectClass *) klass)->ref_state_set = cb;
}
AtkStateSet*
atksharp_object_base_ref_state_set (AtkObject *atk_obj)
{
AtkObjectClass *parent = g_type_class_peek (ATK_TYPE_OBJECT);
if (parent->ref_state_set)
return (*parent->ref_state_set) (atk_obj);
return NULL;
}
void
atksharp_object_override_get_index_in_parent (GType gtype, gpointer cb)
{
AtkObjectClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkObjectClass *) klass)->get_index_in_parent = cb;
}
void
atksharp_object_override_ref_relation_set (GType gtype, gpointer cb)
{
AtkObjectClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((AtkObjectClass *) klass)->ref_relation_set = cb;
}
AtkRelationSet*
atksharp_object_base_ref_relation_set (AtkObject *atk_obj)
{
AtkObjectClass *parent = g_type_class_peek (ATK_TYPE_OBJECT);
if (parent->ref_relation_set)
return (*parent->ref_relation_set) (atk_obj);
return NULL;
}

View file

@ -1,56 +0,0 @@
/* object.c : Glue for overriding vms of AtkObject
*
* Author: Andres G. Aragoneses <aaragoneses@novell.com>
*
* Copyright (c) 2008 Novell, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the Lesser GNU General
* Public License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <atk/atk.h>
void atksharp_object_factory_override_create_accessible (GType gtype, gpointer cb);
void atksharp_object_factory_override_invalidate (GType gtype, gpointer cb);
void atksharp_object_factory_override_get_accessible_type (GType gtype, gpointer cb);
void
atksharp_object_factory_override_create_accessible (GType gtype, gpointer cb)
{
AtkObjectFactoryClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
klass->create_accessible = cb;
}
void
atksharp_object_factory_override_invalidate (GType gtype, gpointer cb)
{
AtkObjectFactoryClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
klass->invalidate = cb;
}
void
atksharp_object_factory_override_get_accessible_type (GType gtype, gpointer cb)
{
AtkObjectFactoryClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
klass->get_accessible_type = cb;
}

View file

@ -23,11 +23,7 @@
void atksharp_util_override_add_global_event_listener (gpointer cb);
void atksharp_util_override_remove_global_event_listener (gpointer cb);
void atksharp_util_override_add_key_event_listener (gpointer cb);
void atksharp_util_override_remove_key_event_listener (gpointer cb);
void atksharp_util_override_get_root (gpointer cb);
void atksharp_util_override_get_toolkit_name (gpointer cb);
void atksharp_util_override_get_toolkit_version (gpointer cb);
void
atksharp_util_override_add_global_event_listener (gpointer cb)
@ -47,15 +43,6 @@ atksharp_util_override_remove_global_event_listener (gpointer cb)
((AtkUtilClass *) klass)->remove_global_event_listener = cb;
}
void
atksharp_util_override_add_key_event_listener (gpointer cb)
{
AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
if (!klass)
klass = g_type_class_ref (ATK_TYPE_UTIL);
((AtkUtilClass *) klass)->add_key_event_listener = cb;
}
void
atksharp_util_override_remove_key_event_listener (gpointer cb)
{
@ -65,30 +52,4 @@ atksharp_util_override_remove_key_event_listener (gpointer cb)
((AtkUtilClass *) klass)->remove_key_event_listener = cb;
}
void
atksharp_util_override_get_root (gpointer cb)
{
AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
if (!klass)
klass = g_type_class_ref (ATK_TYPE_UTIL);
((AtkUtilClass *) klass)->get_root = cb;
}
void
atksharp_util_override_get_toolkit_name (gpointer cb)
{
AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
if (!klass)
klass = g_type_class_ref (ATK_TYPE_UTIL);
((AtkUtilClass *) klass)->get_toolkit_name = cb;
}
void
atksharp_util_override_get_toolkit_version (gpointer cb)
{
AtkUtilClass *klass = g_type_class_peek (ATK_TYPE_UTIL);
if (!klass)
klass = g_type_class_ref (ATK_TYPE_UTIL);
((AtkUtilClass *) klass)->get_toolkit_version = cb;
}

View file

@ -1,10 +1,11 @@
#!/usr/bin/perl
#!/bin/sh
#
# gapi-cdecl-insert : Inserts il into an assembly for CDecl callback delegates.
#
# Authors: Mike Kestner <mkestner@novell.com>
# Author: Christian Hoff <christian_hoff@gmx.net>
#
# Copyright (c) 2005 Novell, Inc.
# Copyright (c) 2009 Christian Hoff
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@ -20,45 +21,47 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
die "Usage: gapi-cdecl-insert [--keyfile=<file>] <assembly_path>\n" if ($ARGV > 2);
foreach $arg (@ARGV) {
if ($arg =~ /--keyfile=(.*)/) {
$key = $1;
} elsif (-e $arg) {
$assembly = $arg;
} else {
die "Usage: gapi-cdecl-insert [--keyfile=<file>] <assembly_path>\n";
}
}
usage="Usage: gapi-cdecl-insert [--keyfile=<file>] <assembly_path>";
while [ $1 ]; do
arg=`expr "$1" : '--keyfile=\(.*\)'`
if [ $? -eq 0 ]; then # check whether "expr" has returned an error code
if [ -z $keyfile ]; then
keyfile=$arg
else
echo -e "--keyfile option cannot be defined multiple times\n${usage}"
fi
else
if [ -z $assembly ]; then
assembly=$1
else
echo -e "Only one input file allowed\n${usage}"
exit 1
fi
fi
shift # Replaces $1 with next param
done
if [ -n "$keyfile" -a ! -r "$keyfile" ]; then
echo -e "${0}: ERROR: Assembly key file \"$keyfile\" does not exist"
exit 2
fi
if [ ! -r "$assembly" ]; then
echo -e "${0}: ERROR: Assembly \"$assembly\" does not exist"
exit 3
fi
if (`which ildasm 2> /dev/null`) {
$dasm = "ildasm /out:";
} else {
$dasm = "monodis --output=";
}
if ($assembly =~ /(.*)\.dll/) {
$basename = $1;
`$dasm$basename.raw $assembly`;
open(INFILE, $basename . ".raw") || die "Couldn't open $basename.raw\n";
open(OUTFILE, "> $basename.il") || die "Couldn't open $basename.il\n";
while ($line = <INFILE>) {
$insert = 1 if ($line =~ /\.custom instance void .*GLib\.CDeclCallbackAttribute/);
if ($insert && $line =~ /(.*)\s+(Invoke\s*\(.*)/) {
print OUTFILE "$1 modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl) $2";
$insert = 0;
next;
}
print OUTFILE $line;
}
`ilasm /DLL /QUIET $basename.il`;
`sn -R $assembly gtk-sharp.snk` if ($key);
unlink "$basename.raw";
unlink "$basename.il";
unlink "$basename.res";
} else {
print "This script only works for dlls.\nUsage: gapi-cdecl-insert [--keyfile=<file>] <dll_path>\n";
}
echo -e "${0}: Executing ildasm"
echo `ildasm ${assembly} /out:${assembly}.raw`
echo -e "${0}: Parsing generated IL"
sed 's/^[ \t]*\.custom instance void .*GLib\.CDeclCallbackAttribute::\.ctor.*$/.custom instance void [mscorlib]System\.Runtime\.InteropServices\.UnmanagedFunctionPointerAttribute::\.ctor\(valuetype [mscorlib]System\.Runtime\.InteropServices\.CallingConvention\) = \( 01 00 02 00 00 00 00 00 \) /' < ${assembly}.raw > ${assembly}.il
rm "$assembly"
echo -e "${0}: Executing ilasm"
if [ -z $keyfile ]; then
echo `ilasm /quiet /dll /output=${assembly} /resource=${assembly}.res ${assembly}.il`
else
echo `ilasm /quiet /dll /output=${assembly} /resource=${assembly}.res /key=${keyfile} ${assembly}.il`
fi
rm "${assembly}.raw"
rm "${assembly}.il"
rm "${assembly}.res"

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<api parser_version="1">
<api parser_version="2">
<!--
This file was automatically generated.
@ -519,6 +519,9 @@
</parameters>
</callback>
<object name="AppLaunchContext" cname="GdkAppLaunchContext" parent="GAppLaunchContext">
<class_struct cname="GdkAppLaunchContextClass">
<field name="ParentClass" cname="parent_class" type="GAppLaunchContextClass" />
</class_struct>
<field name="Priv" cname="priv" type="GdkAppLaunchContextPrivate*" />
<method name="GetType" cname="gdk_app_launch_context_get_type" shared="true">
<return-type type="GType" />
@ -562,6 +565,9 @@
</method>
</object>
<object name="Colormap" cname="GdkColormap" parent="GObject">
<class_struct cname="GdkColormapClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<field name="Size" cname="size" type="gint" access="public" />
<field name="Colors" cname="colors" type="GdkColor*" access="public" />
<field name="Visual" cname="visual" type="GdkVisual*" />
@ -709,6 +715,14 @@
</method>
</object>
<object name="Display" cname="GdkDisplay" parent="GObject">
<class_struct cname="GdkDisplayClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method vm="get_display_name" />
<method vm="get_n_screens" />
<method vm="get_screen" />
<method vm="get_default_screen" />
<method signal_vm="closed" />
</class_struct>
<field name="QueuedEvents" cname="queued_events" type="GList*" />
<field name="QueuedTail" cname="queued_tail" type="GList*" />
<field name="ButtonClickTime" cname="button_click_time" array_len="2" type="guint32" />
@ -721,38 +735,30 @@
<field name="DoubleClickDistance" cname="double_click_distance" type="guint" />
<field name="ButtonX" cname="button_x" array_len="2" type="gint" />
<field name="ButtonY" cname="button_y" array_len="2" type="gint" />
<signal name="Closed" cname="closed" when="LAST" field_name="closed">
<return-type type="void" />
<parameters>
<parameter type="gboolean" name="is_error" />
</parameters>
</signal>
<virtual_method name="GetDisplayName" cname="get_display_name">
<return-type type="const-gchar*" />
<parameters>
<parameter type="GdkDisplay*" name="display" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetNScreens" cname="get_n_screens">
<return-type type="gint" />
<parameters>
<parameter type="GdkDisplay*" name="display" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetScreen" cname="get_screen">
<return-type type="GdkScreen*" />
<parameters>
<parameter type="GdkDisplay*" name="display" />
<parameter type="gint" name="screen_num" />
</parameters>
</virtual_method>
<virtual_method name="GetDefaultScreen" cname="get_default_screen">
<return-type type="GdkScreen*" />
<parameters>
<parameter type="GdkDisplay*" name="display" />
</parameters>
<parameters />
</virtual_method>
<signal name="Closed" cname="closed" when="LAST" field_name="closed">
<return-type type="void" />
<parameters>
<parameter type="GdkDisplay*" name="display" />
<parameter type="gboolean" name="is_error" />
</parameters>
</signal>
<method name="AddClientMessageFilter" cname="gdk_display_add_client_message_filter">
<return-type type="void" />
<parameters>
@ -929,10 +935,13 @@
</method>
</object>
<object name="DisplayManager" cname="GdkDisplayManager" parent="GObject">
<class_struct cname="GdkDisplayManagerClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method signal_vm="display_opened" />
</class_struct>
<signal name="DisplayOpened" cname="display-opened" when="LAST" field_name="display_opened">
<return-type type="void" />
<parameters>
<parameter type="GdkDisplayManager*" name="display_manager" />
<parameter type="GdkDisplay*" name="display" />
</parameters>
</signal>
@ -957,6 +966,9 @@
</method>
</object>
<object name="DragContext" cname="GdkDragContext" parent="GObject">
<class_struct cname="GdkDragContextClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<field name="Protocol" cname="protocol" type="GdkDragProtocol" access="public" />
<field name="IsSource" cname="is_source" type="gboolean" access="public" />
<field name="SourceWindow" cname="source_window" type="GdkWindow*" access="public" />
@ -979,10 +991,51 @@
</method>
</object>
<object name="Drawable" cname="GdkDrawable" parent="GObject">
<class_struct cname="GdkDrawableClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method vm="create_gc" />
<method vm="draw_rectangle" />
<method vm="draw_arc" />
<method vm="draw_polygon" />
<method vm="draw_text" />
<method vm="draw_text_wc" />
<method vm="draw_drawable" />
<method vm="draw_points" />
<method vm="draw_segments" />
<method vm="draw_lines" />
<method vm="draw_glyphs" />
<method vm="draw_image" />
<method vm="get_depth" />
<method vm="get_size" />
<method vm="set_colormap" />
<method vm="get_colormap" />
<method vm="get_visual" />
<method vm="get_screen" />
<method vm="get_image" />
<method vm="get_clip_region" />
<method vm="get_visible_region" />
<method vm="get_composite_drawable" />
<method vm="draw_pixbuf" />
<method vm="_copy_to_image" />
<method vm="draw_glyphs_transformed" />
<method vm="draw_trapezoids" />
<method vm="ref_cairo_surface" />
<method vm="_gdk_reserved4" />
<method vm="_gdk_reserved5" />
<method vm="_gdk_reserved6" />
<method vm="_gdk_reserved7" />
<method vm="_gdk_reserved9" />
<method vm="_gdk_reserved10" />
<method vm="_gdk_reserved11" />
<method vm="_gdk_reserved12" />
<method vm="_gdk_reserved13" />
<method vm="_gdk_reserved14" />
<method vm="_gdk_reserved15" />
<method vm="_gdk_reserved16" />
</class_struct>
<virtual_method name="CreateGc" cname="create_gc">
<return-type type="GdkGC*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGCValues*" name="values" />
<parameter type="GdkGCValuesMask" name="mask" />
</parameters>
@ -990,7 +1043,6 @@
<virtual_method name="DrawRectangle" cname="draw_rectangle">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="gboolean" name="filled" />
<parameter type="gint" name="x" />
@ -1002,7 +1054,6 @@
<virtual_method name="DrawArc" cname="draw_arc">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="gboolean" name="filled" />
<parameter type="gint" name="x" />
@ -1016,7 +1067,6 @@
<virtual_method name="DrawPolygon" cname="draw_polygon">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="gboolean" name="filled" />
<parameter type="GdkPoint*" name="points" />
@ -1026,7 +1076,6 @@
<virtual_method name="DrawText" cname="draw_text">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkFont*" name="font" />
<parameter type="GdkGC*" name="gc" />
<parameter type="gint" name="x" />
@ -1038,7 +1087,6 @@
<virtual_method name="DrawTextWc" cname="draw_text_wc">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkFont*" name="font" />
<parameter type="GdkGC*" name="gc" />
<parameter type="gint" name="x" />
@ -1050,7 +1098,6 @@
<virtual_method name="DrawDrawable" cname="draw_drawable">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkDrawable*" name="src" />
<parameter type="gint" name="xsrc" />
@ -1064,7 +1111,6 @@
<virtual_method name="DrawPoints" cname="draw_points">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkPoint*" name="points" />
<parameter type="gint" name="npoints" />
@ -1073,7 +1119,6 @@
<virtual_method name="DrawSegments" cname="draw_segments">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkSegment*" name="segs" />
<parameter type="gint" name="nsegs" />
@ -1082,7 +1127,6 @@
<virtual_method name="DrawLines" cname="draw_lines">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkPoint*" name="points" />
<parameter type="gint" name="npoints" />
@ -1091,7 +1135,6 @@
<virtual_method name="DrawGlyphs" cname="draw_glyphs">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="PangoFont*" name="font" />
<parameter type="gint" name="x" />
@ -1102,7 +1145,6 @@
<virtual_method name="DrawImage" cname="draw_image">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkImage*" name="image" />
<parameter type="gint" name="xsrc" />
@ -1115,14 +1157,11 @@
</virtual_method>
<virtual_method name="GetDepth" cname="get_depth">
<return-type type="gint" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetSize" cname="get_size">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="gint*" name="width" />
<parameter type="gint*" name="height" />
</parameters>
@ -1130,32 +1169,24 @@
<virtual_method name="SetColormap" cname="set_colormap">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkColormap*" name="cmap" />
</parameters>
</virtual_method>
<virtual_method name="GetColormap" cname="get_colormap">
<return-type type="GdkColormap*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetVisual" cname="get_visual">
<return-type type="GdkVisual*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetScreen" cname="get_screen">
<return-type type="GdkScreen*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetImage" cname="get_image">
<return-type type="GdkImage*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="gint" name="x" />
<parameter type="gint" name="y" />
<parameter type="gint" name="width" />
@ -1164,20 +1195,15 @@
</virtual_method>
<virtual_method name="GetClipRegion" cname="get_clip_region">
<return-type type="GdkRegion*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetVisibleRegion" cname="get_visible_region">
<return-type type="GdkRegion*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GetCompositeDrawable" cname="get_composite_drawable">
<return-type type="GdkDrawable*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="gint" name="x" />
<parameter type="gint" name="y" />
<parameter type="gint" name="width" />
@ -1189,7 +1215,6 @@
<virtual_method name="DrawPixbuf" cname="draw_pixbuf">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkPixbuf*" name="pixbuf" />
<parameter type="gint" name="src_x" />
@ -1206,7 +1231,6 @@
<virtual_method name="CopyToImage" cname="_copy_to_image">
<return-type type="GdkImage*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkImage*" name="image" />
<parameter type="gint" name="src_x" />
<parameter type="gint" name="src_y" />
@ -1219,7 +1243,6 @@
<virtual_method name="DrawGlyphsTransformed" cname="draw_glyphs_transformed">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="PangoMatrix*" name="matrix" />
<parameter type="PangoFont*" name="font" />
@ -1231,7 +1254,6 @@
<virtual_method name="DrawTrapezoids" cname="draw_trapezoids">
<return-type type="void" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkTrapezoid*" name="trapezoids" />
<parameter type="gint" name="n_trapezoids" />
@ -1239,9 +1261,43 @@
</virtual_method>
<virtual_method name="RefCairoSurface" cname="ref_cairo_surface">
<return-type type="cairo_surface_t*" />
<parameters>
<parameter type="GdkDrawable*" name="drawable" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="GdkReserved4" cname="_gdk_reserved4" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved5" cname="_gdk_reserved5" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved6" cname="_gdk_reserved6" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved7" cname="_gdk_reserved7" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved9" cname="_gdk_reserved9" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved10" cname="_gdk_reserved10" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved11" cname="_gdk_reserved11" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved12" cname="_gdk_reserved12" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved13" cname="_gdk_reserved13" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved14" cname="_gdk_reserved14" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved15" cname="_gdk_reserved15" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved16" cname="_gdk_reserved16" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<method name="DrawArc" cname="gdk_draw_arc">
<return-type type="void" />
@ -1624,6 +1680,16 @@
</method>
</object>
<object name="GC" cname="GdkGC" parent="GObject">
<class_struct cname="GdkGCClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method vm="get_values" />
<method vm="set_values" />
<method vm="set_dashes" />
<method vm="_gdk_reserved1" />
<method vm="_gdk_reserved2" />
<method vm="_gdk_reserved3" />
<method vm="_gdk_reserved4" />
</class_struct>
<field name="ClipXOrigin" cname="clip_x_origin" type="gint" />
<field name="ClipYOrigin" cname="clip_y_origin" type="gint" />
<field name="TsXOrigin" cname="ts_x_origin" type="gint" />
@ -1632,14 +1698,12 @@
<virtual_method name="GetValues" cname="get_values">
<return-type type="void" />
<parameters>
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkGCValues*" name="values" />
</parameters>
</virtual_method>
<virtual_method name="SetValues" cname="set_values">
<return-type type="void" />
<parameters>
<parameter type="GdkGC*" name="gc" />
<parameter type="GdkGCValues*" name="values" />
<parameter type="GdkGCValuesMask" name="mask" />
</parameters>
@ -1647,12 +1711,23 @@
<virtual_method name="SetDashes" cname="set_dashes">
<return-type type="void" />
<parameters>
<parameter type="GdkGC*" name="gc" />
<parameter type="gint" name="dash_offset" />
<parameter type="gint8" array="true" name="dash_list" />
<parameter type="gint" name="n" />
</parameters>
</virtual_method>
<virtual_method name="GdkReserved1" cname="_gdk_reserved1" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved2" cname="_gdk_reserved2" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved3" cname="_gdk_reserved3" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="GdkReserved4" cname="_gdk_reserved4" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<method name="Copy" cname="gdk_gc_copy">
<return-type type="void" />
<parameters>
@ -1829,6 +1904,9 @@
</method>
</object>
<object name="Image" cname="GdkImage" parent="GObject">
<class_struct cname="GdkImageClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<field name="Type" cname="type" type="GdkImageType" access="public" />
<field name="Visual" cname="visual" type="GdkVisual*" access="public" />
<field name="ByteOrder" cname="byte_order" type="GdkByteOrder" access="public" />
@ -1894,18 +1972,19 @@
</method>
</object>
<object name="Keymap" cname="GdkKeymap" parent="GObject">
<class_struct cname="GdkKeymapClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method signal_vm="direction_changed" />
<method signal_vm="keys_changed" />
</class_struct>
<field name="Display" cname="display" type="GdkDisplay*" />
<signal name="DirectionChanged" cname="direction-changed" when="LAST" field_name="direction_changed">
<return-type type="void" />
<parameters>
<parameter type="GdkKeymap*" name="keymap" />
</parameters>
<parameters />
</signal>
<signal name="KeysChanged" cname="keys-changed" when="LAST" field_name="keys_changed">
<return-type type="void" />
<parameters>
<parameter type="GdkKeymap*" name="keymap" />
</parameters>
<parameters />
</signal>
<method name="GetDefault" cname="gdk_keymap_get_default" shared="true">
<return-type type="GdkKeymap*" />
@ -1962,6 +2041,9 @@
</method>
</object>
<object name="PangoRenderer" cname="GdkPangoRenderer" parent="PangoRenderer">
<class_struct cname="GdkPangoRendererClass">
<field name="ParentClass" cname="parent_class" type="PangoRendererClass" />
</class_struct>
<field name="Priv" cname="priv" type="GdkPangoRendererPrivate*" />
<property name="Screen" cname="screen" type="GdkScreen" readable="true" writeable="true" construct-only="true" />
<method name="GetDefault" cname="gdk_pango_renderer_get_default" shared="true">
@ -2006,6 +2088,9 @@
</method>
</object>
<object name="Pixmap" cname="GdkPixmap" parent="GObject">
<class_struct cname="GdkPixmapObjectClass">
<field name="ParentClass" cname="parent_class" type="GdkDrawableClass" />
</class_struct>
<method name="ColormapCreateFromXpm" cname="gdk_pixmap_colormap_create_from_xpm" shared="true">
<return-type type="GdkPixmap*" />
<parameters>
@ -2105,6 +2190,12 @@
</constructor>
</object>
<object name="Screen" cname="GdkScreen" parent="GObject">
<class_struct cname="GdkScreenClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method signal_vm="size_changed" />
<method signal_vm="composited_changed" />
<method signal_vm="monitors_changed" />
</class_struct>
<field name="Closed" cname="closed" bits="1" type="guint" />
<field name="NormalGcs" cname="normal_gcs" array_len="32" type="GdkGC*" />
<field name="ExposureGcs" cname="exposure_gcs" array_len="32" type="GdkGC*" />
@ -2114,21 +2205,15 @@
<property name="Resolution" cname="resolution" type="gdouble" readable="true" writeable="true" />
<signal name="SizeChanged" cname="size-changed" when="LAST" field_name="size_changed">
<return-type type="void" />
<parameters>
<parameter type="GdkScreen*" name="screen" />
</parameters>
<parameters />
</signal>
<signal name="CompositedChanged" cname="composited-changed" when="LAST" field_name="composited_changed">
<return-type type="void" />
<parameters>
<parameter type="GdkScreen*" name="screen" />
</parameters>
<parameters />
</signal>
<signal name="MonitorsChanged" cname="monitors-changed" when="LAST" field_name="monitors_changed">
<return-type type="void" />
<parameters>
<parameter type="GdkScreen*" name="screen" />
</parameters>
<parameters />
</signal>
<method name="BroadcastClientMessage" cname="gdk_screen_broadcast_client_message">
<return-type type="void" />
@ -2341,6 +2426,9 @@
</method>
</object>
<object name="Window" cname="GdkWindow" parent="GObject">
<class_struct cname="GdkWindowObjectClass">
<field name="ParentClass" cname="parent_class" type="GdkDrawableClass" />
</class_struct>
<method name="AddFilter" cname="gdk_window_add_filter">
<return-type type="void" />
<parameters>
@ -5457,6 +5545,9 @@
</method>
</object>
<object name="PixbufAniAnim" cname="GdkPixbufAniAnim" parent="GdkPixbufAnimation">
<class_struct cname="GdkPixbufAniAnimClass">
<field name="ParentClass" cname="parent_class" type="GdkPixbufAnimationClass" />
</class_struct>
<field name="TotalTime" cname="total_time" type="int" />
<field name="NFrames" cname="n_frames" type="int" />
<field name="NPixbufs" cname="n_pixbufs" type="int" />
@ -5470,6 +5561,9 @@
</method>
</object>
<object name="PixbufAniAnimIter" cname="GdkPixbufAniAnimIter" parent="GdkPixbufAnimationIter">
<class_struct cname="GdkPixbufAniAnimIterClass">
<field name="ParentClass" cname="parent_class" type="GdkPixbufAnimationIterClass" />
</class_struct>
<field name="AniAnim" cname="ani_anim" type="GdkPixbufAniAnim*" />
<field name="StartTime" cname="start_time" type="GTimeVal" />
<field name="CurrentTime" cname="current_time" type="GTimeVal" />
@ -5481,6 +5575,9 @@
</method>
</object>
<object name="PixbufGifAnim" cname="GdkPixbufGifAnim" parent="GdkPixbufAnimation">
<class_struct cname="GdkPixbufGifAnimClass">
<field name="ParentClass" cname="parent_class" type="GdkPixbufAnimationClass" />
</class_struct>
<field name="NFrames" cname="n_frames" type="int" />
<field name="TotalTime" cname="total_time" type="int" />
<field name="Frames" cname="frames" type="GList*" />
@ -5502,6 +5599,9 @@
</method>
</object>
<object name="PixbufGifAnimIter" cname="GdkPixbufGifAnimIter" parent="GdkPixbufAnimationIter">
<class_struct cname="GdkPixbufGifAnimIterClass">
<field name="ParentClass" cname="parent_class" type="GdkPixbufAnimationIterClass" />
</class_struct>
<field name="GifAnim" cname="gif_anim" type="GdkPixbufGifAnim*" />
<field name="StartTime" cname="start_time" type="GTimeVal" />
<field name="CurrentTime" cname="current_time" type="GTimeVal" />
@ -5513,25 +5613,28 @@
</method>
</object>
<object name="PixbufLoader" cname="GdkPixbufLoader" parent="GObject">
<class_struct cname="GdkPixbufLoaderClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method signal_vm="size_prepared" />
<method signal_vm="area_prepared" />
<method signal_vm="area_updated" />
<method signal_vm="closed" />
</class_struct>
<field name="Priv" cname="priv" type="gpointer" />
<signal name="SizePrepared" cname="size-prepared" when="LAST" field_name="size_prepared">
<return-type type="void" />
<parameters>
<parameter type="GdkPixbufLoader*" name="loader" />
<parameter type="int" name="width" />
<parameter type="int" name="height" />
</parameters>
</signal>
<signal name="AreaPrepared" cname="area-prepared" when="LAST" field_name="area_prepared">
<return-type type="void" />
<parameters>
<parameter type="GdkPixbufLoader*" name="loader" />
</parameters>
<parameters />
</signal>
<signal name="AreaUpdated" cname="area-updated" when="LAST" field_name="area_updated">
<return-type type="void" />
<parameters>
<parameter type="GdkPixbufLoader*" name="loader" />
<parameter type="int" name="x" />
<parameter type="int" name="y" />
<parameter type="int" name="width" />
@ -5540,9 +5643,7 @@
</signal>
<signal name="Closed" cname="closed" when="LAST" field_name="closed">
<return-type type="void" />
<parameters>
<parameter type="GdkPixbufLoader*" name="loader" />
</parameters>
<parameters />
</signal>
<method name="Close" cname="gdk_pixbuf_loader_close">
<return-type type="gboolean" />
@ -5592,6 +5693,9 @@
</method>
</object>
<object name="PixbufSimpleAnim" cname="GdkPixbufSimpleAnim" parent="GdkPixbufAnimation">
<class_struct cname="GdkPixbufSimpleAnimClass">
<field name="ParentClass" cname="parent_class" type="GdkPixbufAnimationClass" />
</class_struct>
<method name="AddFrame" cname="gdk_pixbuf_simple_anim_add_frame">
<return-type type="void" />
<parameters>

View file

@ -207,7 +207,7 @@ namespace GtkSharp.Generation {
GenInvoker (gen_info, sw);
sw.WriteLine ("\tinternal class " + Name + "Wrapper {");
sw.WriteLine ();
ManagedCallString call = new ManagedCallString (parms, false);
ManagedCallString call = new ManagedCallString (parms);
sw.WriteLine ("\t\tpublic " + retval.MarshalType + " NativeCallback (" + parms.ImportSignature + ")");
sw.WriteLine ("\t\t{");
string unconditional = call.Unconditional ("\t\t\t");

View file

@ -32,7 +32,6 @@ namespace GtkSharp.Generation {
public abstract class ClassBase : GenBase {
protected Hashtable props = new Hashtable();
protected Hashtable fields = new Hashtable();
protected Hashtable sigs = new Hashtable();
protected Hashtable methods = new Hashtable();
protected ArrayList interfaces = new ArrayList();
protected ArrayList managed_interfaces = new ArrayList();
@ -49,12 +48,6 @@ namespace GtkSharp.Generation {
}
}
public Hashtable Signals {
get {
return sigs;
}
}
public ClassBase Parent {
get {
string parent = Elem.GetAttribute("parent");
@ -107,13 +100,6 @@ namespace GtkSharp.Generation {
fields.Add (name, new ObjectField (member, this));
break;
case "signal":
name = member.GetAttribute("name");
while (sigs.ContainsKey(name))
name += "mangled";
sigs.Add (name, new Signal (member, this));
break;
case "implements":
ParseImplements (member);
break;
@ -130,8 +116,6 @@ namespace GtkSharp.Generation {
public override bool Validate ()
{
if (Parent != null && !Parent.ValidateForSubclass ())
return false;
foreach (string iface in interfaces) {
InterfaceGen igen = SymbolTable.Table[iface] as InterfaceGen;
if (igen == null) {
@ -156,16 +140,6 @@ namespace GtkSharp.Generation {
props.Remove (prop.Name);
invalids.Clear ();
foreach (Signal sig in sigs.Values) {
if (!sig.Validate ()) {
Console.WriteLine ("in type " + QualifiedName);
invalids.Add (sig);
}
}
foreach (Signal sig in invalids)
sigs.Remove (sig.Name);
invalids.Clear ();
foreach (ObjectField field in fields.Values) {
if (!field.Validate ()) {
Console.WriteLine ("in type " + QualifiedName);
@ -199,23 +173,6 @@ namespace GtkSharp.Generation {
return true;
}
public virtual bool ValidateForSubclass ()
{
ArrayList invalids = new ArrayList ();
foreach (Signal sig in sigs.Values) {
if (!sig.Validate ()) {
Console.WriteLine ("in type " + QualifiedName);
invalids.Add (sig);
}
}
foreach (Signal sig in invalids)
sigs.Remove (sig.Name);
invalids.Clear ();
return true;
}
public bool IsDeprecated {
get {
return deprecated;
@ -238,7 +195,7 @@ namespace GtkSharp.Generation {
}
}
protected bool IsNodeNameHandled (string name)
protected virtual bool IsNodeNameHandled (string name)
{
switch (name) {
case "method":
@ -264,15 +221,6 @@ namespace GtkSharp.Generation {
prop.Generate (gen_info, "\t\t", implementor);
}
public void GenSignals (GenerationInfo gen_info, ClassBase implementor)
{
if (sigs == null)
return;
foreach (Signal sig in sigs.Values)
sig.Generate (gen_info, implementor);
}
protected void GenFields (GenerationInfo gen_info)
{
foreach (ObjectField field in fields.Values)
@ -339,11 +287,6 @@ namespace GtkSharp.Generation {
return (Property) props[name];
}
public Signal GetSignal (string name)
{
return (Signal) sigs[name];
}
public Method GetMethodRecursively (string name)
{
return GetMethodRecursively (name, false);
@ -383,33 +326,6 @@ namespace GtkSharp.Generation {
return p;
}
public Signal GetSignalRecursively (string name)
{
return GetSignalRecursively (name, false);
}
public virtual Signal GetSignalRecursively (string name, bool check_self)
{
Signal p = null;
if (check_self)
p = GetSignal (name);
if (p == null && Parent != null)
p = Parent.GetSignalRecursively (name, true);
if (check_self && p == null) {
foreach (string iface in interfaces) {
ClassBase igen = SymbolTable.Table.GetClassGen (iface);
if (igen == null)
continue;
p = igen.GetSignalRecursively (name, true);
if (p != null)
break;
}
}
return p;
}
public bool Implements (string iface)
{
if (interfaces.Contains (iface))

49
generator/ClassField.cs Normal file
View file

@ -0,0 +1,49 @@
// GtkSharp.Generation.ClassField.cs - used in class structures
//
// Copyright (c) 2009 Christian Hoff
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.IO;
using System.Xml;
public class ClassField {
string name;
IGeneratable igen;
public ClassField (XmlElement elem)
{
name = elem.GetAttribute ("name");
igen = SymbolTable.Table [elem.GetAttribute ("type")];
}
public string Name {
get {
return name;
}
}
public IGeneratable Generatable {
get {
return igen;
}
}
}
}

View file

@ -0,0 +1,146 @@
// GtkSharp.Generation.DefaultSignalHandler.cs - The default signal handler generatable
//
// Author: Christian Hoff <christian_hoff@gmx.net>
//
// Copyright (c) 2008 Novell Inc.
// Copyright (c) 2008-2009 Christian Hoff
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GtkSharp.Generation {
using System;
using System.IO;
using System.Xml;
public class DefaultSignalHandler : GObjectVM {
private string signal_name;
public DefaultSignalHandler (XmlElement elem, ObjectBase container_type) : base (elem, container_type)
{
signal_name = elem.GetAttribute ("cname");
}
public override string CName {
get {
return elem.GetAttribute ("field_name");
}
}
protected override bool CanGenerate (GenerationInfo gen_info, ObjectBase implementor)
{
return true;
}
protected override void GenerateOverride (GenerationInfo gen_info, ObjectBase implementor)
{
StreamWriter sw = gen_info.Writer;
if (!base.CanGenerate (gen_info, implementor)) {
GenerateOverrideBody (sw);
sw.WriteLine ("\t\t\tOverrideVirtualMethod (gtype, \"{0}\", callback);", signal_name);
sw.WriteLine ("\t\t}");
} else
base.GenerateOverride (gen_info, implementor);
}
protected override void GenerateUnmanagedInvocation (GenerationInfo gen_info, ObjectBase implementor)
{
if (!base.CanGenerate (gen_info, implementor))
GenerateChainVirtualMethod (gen_info.Writer, implementor);
else
base.GenerateUnmanagedInvocation (gen_info, implementor);
}
private void GenerateChainVirtualMethod (StreamWriter sw, ObjectBase implementor)
{
GenerateMethodBody (sw, implementor);
if (retval.IsVoid)
sw.WriteLine ("\t\t\tGLib.Value ret = GLib.Value.Empty;");
else
sw.WriteLine ("\t\t\tGLib.Value ret = new GLib.Value (" + ReturnGType + ");");
sw.WriteLine ("\t\t\tGLib.ValueArray inst_and_params = new GLib.ValueArray (" + (parms.Count + 1) + ");");
sw.WriteLine ("\t\t\tGLib.Value[] vals = new GLib.Value [" + (parms.Count + 1) + "];");
sw.WriteLine ("\t\t\tvals [0] = new GLib.Value (this);");
sw.WriteLine ("\t\t\tinst_and_params.Append (vals [0]);");
string cleanup = "";
for (int i = 0; i < parms.Count; i++) {
Parameter p = parms [i];
if (p.PassAs != "") {
if (SymbolTable.Table.IsBoxed (p.CType)) {
if (p.PassAs == "ref")
sw.WriteLine ("\t\t\tvals [" + (i + 1) + "] = new GLib.Value (" + p.Name + ");");
else
sw.WriteLine ("\t\t\tvals [" + (i + 1) + "] = new GLib.Value ((GLib.GType)typeof (" + p.CSType + "));");
cleanup += "\t\t\t" + p.Name + " = (" + p.CSType + ") vals [" + i + "];\n";
} else {
if (p.PassAs == "ref")
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = GLib.Marshaller.StructureToPtrAlloc (" + p.Generatable.CallByName (p.Name) + ");");
else
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.MarshalType + ")));");
sw.WriteLine ("\t\t\tvals [" + (i + 1) + "] = new GLib.Value (" + p.Name + "_ptr);");
cleanup += "\t\t\t" + p.Name + " = " + p.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n";
cleanup += "\t\t\tMarshal.FreeHGlobal (" + p.Name + "_ptr);\n";
}
} else if (p.IsLength && i > 0 && parms [i - 1].IsString)
sw.WriteLine ("\t\t\tvals [" + (i + 1) + "] = new GLib.Value (System.Text.Encoding.UTF8.GetByteCount (" + parms [i-1].Name + "));");
else
sw.WriteLine ("\t\t\tvals [" + (i + 1) + "] = new GLib.Value (" + p.Name + ");");
sw.WriteLine ("\t\t\tinst_and_params.Append (vals [" + (i + 1) + "]);");
}
sw.WriteLine ("\t\t\tg_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);");
if (cleanup != "")
sw.WriteLine (cleanup);
sw.WriteLine ("\t\t\tforeach (GLib.Value v in vals)");
sw.WriteLine ("\t\t\t\tv.Dispose ();");
if (!retval.IsVoid) {
IGeneratable igen = SymbolTable.Table [retval.CType];
sw.WriteLine ("\t\t\t" + retval.CSType + " result = (" + (igen is EnumGen ? retval.CSType + ") (Enum" : retval.CSType) + ") ret;");
sw.WriteLine ("\t\t\tret.Dispose ();");
sw.WriteLine ("\t\t\treturn result;");
}
sw.WriteLine ("\t\t}\n");
}
private string ReturnGType {
get {
IGeneratable igen = SymbolTable.Table [retval.CType];
if (igen is ObjectGen)
return "GLib.GType.Object";
if (igen is BoxedGen)
return retval.CSType + ".GType";
if (igen is EnumGen)
return retval.CSType + "GType.GType";
switch (retval.CSType) {
case "bool":
return "GLib.GType.Boolean";
case "string":
return "GLib.GType.String";
case "int":
return "GLib.GType.Int";
default:
throw new Exception (retval.CSType);
}
}
}
}
}

368
generator/GObjectVM.cs Normal file
View file

@ -0,0 +1,368 @@
// GtkSharp.Generation.GObjectVM.cs - GObject specific part of VM creation
//
// Author: Christian Hoff <christian_hoff@gmx.net>
//
// Copyright (c) 2007 Novell, Inc.
// Copyright (c) 2009 Christian Hoff
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.IO;
using System.Xml;
public class GObjectVM : VirtualMethod
{
protected string class_struct_name;
const bool force_glue_generation = false;
public GObjectVM (XmlElement elem, ObjectBase container_type) : base (elem, container_type)
{
parms.HideData = false;
this.Protection = "protected";
class_struct_name = container_type.ClassStructName;
}
// Some types don't install headers. In that case, the glue code will not compile.
bool BlockGlue {
get {
return elem.GetAttribute ("block_glue") == "1";
}
}
protected override string CallString {
get {
return String.Format ("{0} ({1})", IsStatic ? this.CName + "_handler" : "On" + this.Name, call.ToString ());
}
}
public void Generate (GenerationInfo gen_info, ObjectBase implementor)
{
if (!CanGenerate (gen_info, implementor))
throw new NotSupportedException (String.Format ("Cannot generate virtual method {0}.{1}. Make sure a writable glue path was provided to the generator.", container_type.Name, this.CallString));
GenerateOverride (gen_info, implementor);
GenerateCallback (gen_info.Writer, implementor);
if (!IsStatic)
GenerateUnmanagedInvocation (gen_info, implementor);
}
protected virtual bool CanGenerate (GenerationInfo gen_info, ObjectBase implementor)
{
if (implementor != null || this.CName.Length == 0 || CodeType == VMCodeType.None || (CodeType == VMCodeType.Glue && !gen_info.GlueEnabled))
return false;
else
return true;
}
enum VMCodeType {
None,
Managed,
Glue
}
VMCodeType CodeType {
get {
if (container_type.ParserVersion == 1 || force_glue_generation) {
if (BlockGlue)
return VMCodeType.None;
else
return VMCodeType.Glue;
} else
return VMCodeType.Managed;
}
}
enum VMOverrideType {
Unspecified,
DeclaringClass,
ImplementingClass
}
/* There are basically two types of static virtual methods:
* 1. VMs overridden in the declaring class (e.g. AtkUtil vms):
* The VM is overridden in the class in which it is declared and not in the derived classes. In that case, the GAPI generates a static XYZHandler property
* in the declaring class.
* 2. VMs overridden in derived classes (e.g. GIO is_supported vms):
* As with nonstatic vms, this VM type hooks into the class structure field of derived classes. This type is currently unsupported as it is rarely used
* and we would need anonymous methods for the callback (we are using only *one* callback method; the callback does not know to which type that method call
* has to be redirected).
*/
VMOverrideType OverrideType {
get {
if (IsStatic) {
switch (elem.GetAttribute ("override_in")) {
case "declaring_class":
return VMOverrideType.DeclaringClass;
case "implementing_class":
return VMOverrideType.ImplementingClass;
default:
return VMOverrideType.Unspecified;
}
} else
return VMOverrideType.ImplementingClass;
}
}
protected virtual void GenerateOverride (GenerationInfo gen_info, ObjectBase implementor)
{
if (CodeType == VMCodeType.Glue)
GenerateOverride_glue (gen_info);
else
GenerateOverride_managed (gen_info.Writer);
}
protected virtual void GenerateUnmanagedInvocation (GenerationInfo gen_info, ObjectBase implementor)
{
if (CodeType == VMCodeType.Glue)
GenerateUnmanagedInvocation_glue (gen_info);
else
GenerateUnmanagedInvocation_managed (gen_info);
}
protected void GenerateOverrideBody (StreamWriter sw)
{
sw.WriteLine ("\t\tstatic {0}NativeDelegate {0}_cb_delegate;", Name);
sw.WriteLine ("\t\tstatic " + Name + "NativeDelegate " + Name + "VMCallback {");
sw.WriteLine ("\t\t\tget {");
sw.WriteLine ("\t\t\t\tif ({0}_cb_delegate == null)", Name);
sw.WriteLine ("\t\t\t\t\t{0}_cb_delegate = new {0}NativeDelegate ({0}_cb);", Name);
sw.WriteLine ("\t\t\t\treturn {0}_cb_delegate;", Name);
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
if (IsStatic) {
sw.WriteLine ("\t\tpublic delegate {0} {1}Delegate ({2});", retval.CSType, Name, Signature.ToString ());
sw.WriteLine ("\t\tstatic {0}Delegate {1}_handler;", Name, CName);
sw.WriteLine ();
sw.WriteLine ("\t\tpublic static " + Name + "Delegate " + Name + "Handler {");
sw.WriteLine ("\t\t\tset {");
sw.WriteLine ("\t\t\t\t{0}_handler = value;", CName);
sw.WriteLine ("\t\t\t\tOverride{0} ((GLib.GType) typeof ({1}), value == null ? null : {0}VMCallback);", Name, container_type.Name);
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}");
} else {
sw.WriteLine ("\t\tstatic void Override{0} (GLib.GType gtype)", this.Name);
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tOverride{0} (gtype, {0}VMCallback);", this.Name);
sw.WriteLine ("\t\t}");
}
sw.WriteLine ();
sw.WriteLine ("\t\tstatic void Override{0} (GLib.GType gtype, {0}NativeDelegate callback)", this.Name);
sw.WriteLine ("\t\t{");
}
protected void GenerateOverride_managed (StreamWriter sw)
{
GenerateOverrideBody (sw);
// Override VM; class_offset var is generated by object generatable
sw.WriteLine ("\t\t\t{0} class_iface = GetClassStruct (gtype, false);", class_struct_name);
sw.WriteLine ("\t\t\tclass_iface.{0} = callback;", this.Name);
sw.WriteLine ("\t\t\tOverrideClassStruct (gtype, class_iface);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
protected void GenerateMethodBody (StreamWriter sw, ClassBase implementor)
{
sw.WriteLine ("\t\t[GLib.DefaultSignalHandler(Type=typeof(" + (implementor != null ? implementor.QualifiedName : container_type.QualifiedName) + "), ConnectionMethod=\"Override" + this.Name +"\")]");
sw.Write ("\t\t{0} ", this.Protection);
if (this.modifiers != "")
sw.Write ("{0} ", this.modifiers);
sw.WriteLine ("virtual {0} On{1} ({2})", retval.CSType, this.Name, Signature.ToString ());
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\t{0}Internal{1} ({2});", retval.IsVoid ? "" : "return ", this.Name, Signature.GetCallString (false));
sw.WriteLine ("\t\t}");
sw.WriteLine ();
// This method is to be invoked from existing VM implementations in the .customs
sw.WriteLine ("\t\tprivate {0} Internal{1} ({2})", retval.CSType, this.Name, Signature.ToString ());
sw.WriteLine ("\t\t{");
}
void GenerateUnmanagedInvocation_managed (GenerationInfo gen_info)
{
StreamWriter sw = gen_info.Writer;
string native_call = "this.Handle";
if (parms.Count > 0)
native_call += ", " + Body.GetCallString (false);
this.GenerateMethodBody (sw, null);
// Find the first unmanaged ancestor
sw.WriteLine ("\t\t\t{0}NativeDelegate unmanaged = GetClassStruct (this.LookupGType ().ThresholdType, true).{0};", this.Name);
sw.Write ("\t\t\tif (unmanaged == null) ");
if (parms.HasOutParam)
sw.WriteLine ("throw new InvalidOperationException (\"No base method to invoke\");");
else if (retval.IsVoid)
sw.WriteLine ("return;");
else
sw.WriteLine ("return {0};", retval.DefaultValue);
sw.WriteLine ();
Body.Initialize (gen_info);
sw.Write ("\t\t\t");
if (!retval.IsVoid)
sw.Write ("{0} __result = ", retval.MarshalType);
sw.WriteLine ("unmanaged ({0});", native_call);
Body.Finish (gen_info.Writer, "");
if(!retval.IsVoid)
sw.WriteLine ("\t\t\treturn {0};", retval.FromNative ("__result"));
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
/* old glue code. This code is to be used if
* a) the generated api file is version 1
* b) an old Mono version(< 2.4) is being used
* Punt it when we drop support for the parser version 1.
*/
private string CastFromInt (string type)
{
return type != "int" ? "(" + type + ") " : "";
}
private string GlueSignature {
get {
string[] glue_params = new string [this.IsStatic ? parms.Count + 1 : parms.Count + 2];
glue_params [0] = class_struct_name + " *class_struct";
if (!IsStatic)
glue_params [1] = container_type.CName + "* inst";
for (int i = 0; i < parms.Count; i++)
glue_params [i + (IsStatic ? 1 : 2)] = parms [i].CType.Replace ("const-", "const ") + " " + parms [i].Name;
return String.Join (", ", glue_params);
}
}
private string DefaultGlueValue {
get {
if (retval.IGen is EnumGen)
return String.Format ("({0}) 0", retval.CType);
string val = retval.DefaultValue;
switch (val) {
case "null":
return "NULL";
case "false":
return "FALSE";
case "true":
return "TRUE";
case "GLib.GType.None":
return "G_TYPE_NONE";
default:
return val;
}
}
}
void GenerateOverride_glue (GenerationInfo gen_info)
{
StreamWriter glue = gen_info.GlueWriter;
StreamWriter sw = gen_info.Writer;
string glue_name = String.Format ("{0}sharp_{1}_override_{2}", container_type.NS.ToLower ().Replace (".", "_"), container_type.Name.ToLower (), CName);
sw.WriteLine ("\t\t[DllImport (\"{0}\")]", gen_info.GluelibName);
sw.WriteLine ("\t\tstatic extern void {0} (IntPtr class_struct, {1}NativeDelegate cb);", glue_name, Name);
sw.WriteLine ();
glue.WriteLine ("void {0} ({1} *class_struct, gpointer cb);\n", glue_name, class_struct_name);
glue.WriteLine ("void\n{0} ({1} *class_struct, gpointer cb)", glue_name, class_struct_name);
glue.WriteLine ("{");
glue.WriteLine ("\tclass_struct->{0} = cb;", CName);
glue.WriteLine ("}");
glue.WriteLine ();
GenerateOverrideBody (sw);
sw.WriteLine ("\t\t\t{0} (gtype.ClassPtr, callback);", glue_name);
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
void GenerateUnmanagedInvocation_glue (GenerationInfo gen_info)
{
StreamWriter glue = gen_info.GlueWriter;
string glue_name = String.Format ("{0}sharp_{1}_invoke_{2}", container_type.NS.ToLower ().Replace (".", "_"), container_type.Name.ToLower (), CName);
glue.WriteLine ("{0} {1} ({2});\n", retval.CType.Replace ("const-", "const "), glue_name, GlueSignature);
glue.WriteLine ("{0}\n{1} ({2})", retval.CType.Replace ("const-", "const "), glue_name, GlueSignature);
glue.WriteLine ("{");
glue.Write ("\tif (class_struct->{0})\n\t\t", CName);
if (!retval.IsVoid)
glue.Write ("return ");
string[] call_args = new string [IsStatic ? parms.Count : parms.Count + 1];
if (!IsStatic)
call_args [0] = "inst";
for (int i = 0; i < parms.Count; i++)
call_args [IsStatic ? i : i + 1] = parms[i].Name;
glue.WriteLine ("(* class_struct->{0}) ({1});", CName, String.Join (", ", call_args));
if (!retval.IsVoid)
glue.WriteLine ("\treturn " + DefaultGlueValue + ";");
glue.WriteLine ("}");
glue.WriteLine ();
StreamWriter sw = gen_info.Writer;
sw.WriteLine ("\t\t[DllImport (\"{0}\")]", gen_info.GluelibName);
sw.Write ("\t\tstatic extern {0} {1} (IntPtr class_struct", retval.MarshalType, glue_name);
if (!IsStatic)
sw.Write (", IntPtr inst");
if (parms.Count > 0)
sw.Write (", {0}", parms.ImportSignature);
sw.WriteLine (");");
sw.WriteLine ();
GenerateMethodBody (sw, null);
Body.Initialize (gen_info, false, false, String.Empty);
string glue_call_string = "this.LookupGType ().ThresholdType.ClassPtr";
if (!IsStatic)
glue_call_string += ", Handle";
if (parms.Count > 0)
glue_call_string += ", " + Body.GetCallString (false);
sw.Write ("\t\t\t");
if (!retval.IsVoid)
sw.Write ("{0} __result = ", retval.MarshalType);
sw.WriteLine ("{0} ({1});", glue_name, glue_call_string);
Body.Finish (gen_info.Writer, "");
if(!retval.IsVoid)
sw.WriteLine ("\t\t\treturn {0};", retval.FromNative ("__result"));
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
public override bool Validate ()
{
if (!base.Validate ()) return false;
bool is_valid = true;
if (this.IsStatic) {
switch (OverrideType) {
case VMOverrideType.Unspecified:
Console.Write ("Static virtual methods can only be generated if you provide info on how to override this method via the metadata ");
is_valid = false;
break;
case VMOverrideType.ImplementingClass:
Console.Write ("Overriding static virtual methods in the implementing class is not supported yet ");
is_valid = false;
break;
}
}
if (!is_valid)
Console.WriteLine (" (in virtual method {0}.{1})", container_type.QualifiedName, this.Name);
return is_valid;
}
}
}

View file

@ -80,18 +80,6 @@ namespace GtkSharp.Generation {
}
glue_sw.WriteLine ("");
}
glue_sw.WriteLine ("const gchar *__prefix = \"__gtksharp_\";\n");
glue_sw.WriteLine ("#define HAS_PREFIX(a) (*((guint64 *)(a)) == *((guint64 *) __prefix))\n");
glue_sw.WriteLine ("static GObjectClass *");
glue_sw.WriteLine ("get_threshold_class (GObject *obj)");
glue_sw.WriteLine ("{");
glue_sw.WriteLine ("\tGType gtype = G_TYPE_FROM_INSTANCE (obj);");
glue_sw.WriteLine ("\twhile (HAS_PREFIX (g_type_name (gtype)))");
glue_sw.WriteLine ("\t\tgtype = g_type_parent (gtype);");
glue_sw.WriteLine ("\tGObjectClass *klass = g_type_class_peek (gtype);");
glue_sw.WriteLine ("\tif (klass == NULL) klass = g_type_class_ref (gtype);");
glue_sw.WriteLine ("\treturn klass;");
glue_sw.WriteLine ("}\n");
glue_enabled = true;
}
}

View file

@ -30,27 +30,22 @@ namespace GtkSharp.Generation {
public class InterfaceGen : ObjectBase {
bool consume_only;
ArrayList vms = new ArrayList ();
ArrayList members = new ArrayList ();
public InterfaceGen (XmlElement ns, XmlElement elem) : base (ns, elem)
public InterfaceGen (XmlElement ns, XmlElement elem) : base (ns, elem, true)
{
consume_only = elem.HasAttribute ("consume_only");
foreach (XmlNode node in elem.ChildNodes) {
switch (node.Name) {
case "virtual_method":
VirtualMethod vm = new VirtualMethod (node as XmlElement, this);
vms.Add (vm);
members.Add (vm);
break;
if (!(node is XmlElement)) continue;
XmlElement member = (XmlElement) node;
switch (member.Name) {
case "signal":
object sig = sigs [(node as XmlElement).GetAttribute ("name")];
object sig = sigs [member.GetAttribute ("name")];
if (sig == null)
sig = new Signal (node as XmlElement, this);
members.Add (sig);
break;
default:
if (!IsNodeNameHandled (node.Name))
if (!base.IsNodeNameHandled (node.Name))
Console.WriteLine ("Unexpected node " + node.Name + " in " + CName);
break;
}
@ -85,48 +80,16 @@ namespace GtkSharp.Generation {
return base.ValidateForSubclass ();
}
string IfaceName {
get {
return Name + "Iface";
}
}
void GenerateIfaceStruct (StreamWriter sw)
{
sw.WriteLine ("\t\tstatic " + IfaceName + " iface;");
sw.WriteLine ();
sw.WriteLine ("\t\tstruct " + IfaceName + " {");
sw.WriteLine ("\t\t\tpublic IntPtr gtype;");
sw.WriteLine ("\t\t\tpublic IntPtr itype;");
sw.WriteLine ();
foreach (object member in members) {
if (member is Signal) {
Signal sig = member as Signal;
sw.WriteLine ("\t\t\tpublic IntPtr {0};", sig.CName.Replace ("\"", "").Replace ("-", "_"));
} else if (member is VirtualMethod) {
VirtualMethod vm = member as VirtualMethod;
bool has_target = methods [vm.Name] != null;
if (!has_target)
Console.WriteLine ("Interface " + QualifiedName + " virtual method " + vm.Name + " has no matching method to invoke.");
string type = has_target && vm.IsValid ? vm.Name + "Delegate" : "IntPtr";
sw.WriteLine ("\t\t\tpublic " + type + " " + vm.CName + ";");
}
}
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
void GenerateStaticCtor (StreamWriter sw)
{
sw.WriteLine ("\t\tstatic {0} iface;", class_struct_name);
sw.WriteLine ();
sw.WriteLine ("\t\tstatic " + Name + "Adapter ()");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tGLib.GType.Register (_gtype, typeof({0}Adapter));", Name);
foreach (VirtualMethod vm in vms) {
bool has_target = methods [vm.Name] != null;
if (has_target && vm.IsValid)
sw.WriteLine ("\t\t\tiface.{0} = new {1}Delegate ({1}Callback);", vm.CName, vm.Name);
foreach (InterfaceVM vm in interface_vms) {
if (vm.IsValid)
sw.WriteLine ("\t\t\tiface.{0} = new {0}NativeDelegate ({0}_cb);", vm.Name);
}
sw.WriteLine ("\t\t}");
sw.WriteLine ();
@ -134,11 +97,14 @@ namespace GtkSharp.Generation {
void GenerateInitialize (StreamWriter sw)
{
sw.WriteLine ("\t\tstatic void Initialize (IntPtr ifaceptr, IntPtr data)");
sw.WriteLine ("\t\tstatic int class_offset = 2 * IntPtr.Size;"); // Class size of GTypeInterface struct
sw.WriteLine ();
sw.WriteLine ("\t\tstatic void Initialize (IntPtr ptr, IntPtr data)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\t" + IfaceName + " native_iface = (" + IfaceName + ") Marshal.PtrToStructure (ifaceptr, typeof (" + IfaceName + "));");
foreach (VirtualMethod vm in vms)
sw.WriteLine ("\t\t\tnative_iface." + vm.CName + " = iface." + vm.CName + ";");
sw.WriteLine ("\t\t\tIntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\t{0} native_iface = ({0}) Marshal.PtrToStructure (ifaceptr, typeof ({0}));", class_struct_name);
foreach (InterfaceVM vm in interface_vms)
sw.WriteLine ("\t\t\tnative_iface." + vm.Name + " = iface." + vm.Name + ";");
sw.WriteLine ("\t\t\tMarshal.StructureToPtr (native_iface, ifaceptr, false);");
sw.WriteLine ("\t\t\tGCHandle gch = (GCHandle) data;");
sw.WriteLine ("\t\t\tgch.Free ();");
@ -148,13 +114,10 @@ namespace GtkSharp.Generation {
void GenerateCallbacks (StreamWriter sw)
{
foreach (VirtualMethod vm in vms) {
if (methods [vm.Name] != null) {
sw.WriteLine ();
vm.GenerateCallback (sw);
foreach (InterfaceVM vm in interface_vms) {
vm.GenerateCallback (sw, null);
}
}
}
void GenerateCtors (StreamWriter sw)
{
@ -174,6 +137,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
sw.WriteLine ("\t\tpublic " + Name + "Adapter (IntPtr handle)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tif (!_gtype.IsInstance (handle))");
@ -262,7 +226,7 @@ namespace GtkSharp.Generation {
sw.WriteLine ();
if (!IsConsumeOnly) {
GenerateIfaceStruct (sw);
GenerateClassStruct (sw);
GenerateStaticCtor (sw);
GenerateCallbacks (sw);
GenerateInitialize (sw);
@ -315,9 +279,10 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\t" + access + " interface " + Name + "Implementor : GLib.IWrapper {");
sw.WriteLine ();
Hashtable vm_table = new Hashtable ();
foreach (VirtualMethod vm in vms)
foreach (InterfaceVM vm in interface_vms) {
vm_table [vm.Name] = vm;
foreach (VirtualMethod vm in vms) {
}
foreach (InterfaceVM vm in interface_vms) {
if (vm_table [vm.Name] == null)
continue;
else if (!vm.IsValid) {
@ -325,7 +290,7 @@ namespace GtkSharp.Generation {
continue;
} else if (vm.IsGetter || vm.IsSetter) {
string cmp_name = (vm.IsGetter ? "Set" : "Get") + vm.Name.Substring (3);
VirtualMethod cmp = vm_table [cmp_name] as VirtualMethod;
InterfaceVM cmp = vm_table [cmp_name] as InterfaceVM;
if (cmp != null && (cmp.IsGetter || cmp.IsSetter)) {
if (vm.IsSetter)
cmp.GenerateDeclaration (sw, vm);

97
generator/InterfaceVM.cs Normal file
View file

@ -0,0 +1,97 @@
// GtkSharp.Generation.InterfaceVM.cs - interface-specific part of VM creation
//
// Author: Christian Hoff <christian_hoff@gmx.net>
//
// Copyright (c) 2009 Christian Hoff
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
// License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.IO;
using System.Xml;
public class InterfaceVM : VirtualMethod
{
private Method target;
public InterfaceVM (XmlElement elem, Method target, ObjectBase container_type) : base (elem, container_type)
{
this.target = target;
parms.HideData = true;
this.Protection = "public";
}
public bool IsGetter {
get {
return HasGetterName && ((!retval.IsVoid && parms.Count == 0) || (retval.IsVoid && parms.Count == 1 && parms [0].PassAs == "out"));
}
}
public bool IsSetter {
get {
if (!HasSetterName || !retval.IsVoid)
return false;
if (parms.Count == 1 || (parms.Count == 3 && parms [0].Scope == "notified"))
return true;
else
return false;
}
}
protected override string CallString {
get {
if (IsGetter)
return (target.Name.StartsWith ("Get") ? target.Name.Substring (3) : target.Name);
else if (IsSetter)
return target.Name.Substring (3) + " = " + call;
else
return target.Name + " (" + call + ")";
}
}
public void GenerateDeclaration (StreamWriter sw, InterfaceVM complement)
{
if (IsGetter) {
string name = Name.StartsWith ("Get") ? Name.Substring (3) : Name;
string type = retval.IsVoid ? parms [0].CSType : retval.CSType;
if (complement != null && complement.parms [0].CSType == type)
sw.WriteLine ("\t\t" + type + " " + name + " { get; set; }");
else {
sw.WriteLine ("\t\t" + type + " " + name + " { get; }");
if (complement != null)
sw.WriteLine ("\t\t" + complement.retval.CSType + " " + complement.Name + " (" + complement.Signature + ");");
}
} else if (IsSetter)
sw.WriteLine ("\t\t" + parms[0].CSType + " " + Name.Substring (3) + " { set; }");
else
sw.WriteLine ("\t\t" + retval.CSType + " " + Name + " (" + Signature + ");");
}
public override bool Validate ()
{
if (target == null) {
Console.WriteLine ("Virtual method {0}->{1} has no matching target to invoke", container_type.CName, CName);
return false;
}
return base.Validate ();
}
}
}

View file

@ -13,20 +13,24 @@ sources = \
CallbackGen.cs \
ChildProperty.cs \
ClassBase.cs \
ClassField.cs \
ClassGen.cs \
CodeGenerator.cs \
ConstFilenameGen.cs \
ConstStringGen.cs \
Ctor.cs \
DefaultSignalHandler.cs \
EnumGen.cs \
FieldBase.cs \
GenBase.cs \
GenerationInfo.cs \
GObjectVM.cs \
HandleBase.cs \
IAccessor.cs \
IGeneratable.cs \
IManualMarshaler.cs \
InterfaceGen.cs \
InterfaceVM.cs \
LPGen.cs \
LPUGen.cs \
ManagedCallString.cs \

View file

@ -33,9 +33,9 @@ namespace GtkSharp.Generation {
string user_data_param = null;
string destroy_param = null;
public ManagedCallString (Parameters parms, bool drop_first)
public ManagedCallString (Parameters parms)
{
for (int i = drop_first ? 1 : 0; i < parms.Count; i ++) {
for (int i = 0; i < parms.Count; i ++) {
Parameter p = parms [i];
if (p.IsLength && i > 0 && parms [i-1].IsString)
continue;

View file

@ -29,13 +29,15 @@ namespace GtkSharp.Generation {
string call_fmt;
string from_fmt;
public MarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt) : base (ctype, type, "null")
public MarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt, string default_value) : base (ctype, type, default_value)
{
this.mtype = mtype;
this.call_fmt = call_fmt;
this.from_fmt = from_fmt;
}
public MarshalGen (string ctype, string type, string mtype, string call_fmt, string from_fmt) : this (ctype, type, mtype, call_fmt, from_fmt, "null") { }
public override string MarshalType {
get {
return mtype;

View file

@ -27,10 +27,9 @@ namespace GtkSharp.Generation {
public abstract class MethodBase {
XmlElement elem;
protected XmlElement elem;
protected ClassBase container_type;
Parameters parms;
bool is_static = false;
protected Parameters parms;
string mods = String.Empty;
string name;
private string protection = "public";
@ -77,7 +76,7 @@ namespace GtkSharp.Generation {
}
}
public string CName {
public virtual string CName {
get {
return SymbolTable.Table.MangleName (elem.GetAttribute ("cname"));
}
@ -109,10 +108,9 @@ namespace GtkSharp.Generation {
public bool IsStatic {
get {
return is_static;
return parms.Static;
}
set {
is_static = value;
parms.Static = value;
}
}
@ -149,6 +147,7 @@ namespace GtkSharp.Generation {
}
}
public string Protection {
get { return protection; }
set { protection = value; }

View file

@ -3,6 +3,7 @@
// Authors: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2005 Novell, Inc.
// Copyright (c) 2009 Christian Hoff
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
@ -22,15 +23,274 @@
namespace GtkSharp.Generation {
using System;
using System.Collections;
using System.IO;
using System.Xml;
public abstract class ObjectBase : HandleBase {
bool is_interface;
protected string class_struct_name = null;
ArrayList class_members = new ArrayList ();
protected ArrayList class_fields = new ArrayList ();
// The default handlers of these signals need to be overridden with g_signal_override_class_closure
protected ArrayList virtual_methods = new ArrayList ();
// virtual methods that are generated as an IntPtr in the class struct
protected ArrayList hidden_vms = new ArrayList ();
protected ArrayList interface_vms = new ArrayList ();
protected Hashtable sigs = new Hashtable();
protected ObjectBase (XmlElement ns, XmlElement elem) : base (ns, elem) {}
protected ObjectBase (XmlElement ns, XmlElement elem, bool is_interface) : base (ns, elem)
{
this.is_interface = is_interface;
XmlElement class_elem = null;
Hashtable vms = new Hashtable ();
Hashtable signal_vms = new Hashtable ();
if (this.ParserVersion == 1)
class_struct_name = this.CName + (is_interface ? "Iface" : "Class");
foreach (XmlNode node in elem.ChildNodes) {
if (!(node is XmlElement)) continue;
XmlElement member = node as XmlElement;
switch (node.Name) {
case "virtual_method":
if (this.ParserVersion == 1) {
if (is_interface) // Generating non-signal GObject virtual methods is not supported in compatibility mode
AddVM (member, false, is_interface);
} else
vms.Add (member.GetAttribute ("cname"), member);
break;
case "signal":
if (this.ParserVersion == 1 || member.GetAttribute ("field_name") == "")
AddVM (member, true, is_interface);
else
signal_vms.Add (member.GetAttribute ("field_name"), member);
if (member.GetAttribute ("hidden") != "1") {
string name = member.GetAttribute("name");
while (sigs.ContainsKey(name))
name += "mangled";
sigs.Add (name, new Signal (member, this));
}
break;
case "class_struct":
class_elem = member;
break;
}
}
if (class_elem == null) return;
class_struct_name = class_elem.GetAttribute ("cname");
for (int node_idx = 0; node_idx < class_elem.ChildNodes.Count; node_idx++) {
XmlNode node = class_elem.ChildNodes [node_idx];
if (!(node is XmlElement)) continue;
XmlElement member = (XmlElement) node;
switch (member.Name) {
case "method":
string vm_name;
XmlElement vm_elem;
bool is_signal_vm = member.HasAttribute ("signal_vm");
if (is_signal_vm) {
vm_name = member.GetAttribute ("signal_vm");
vm_elem = signal_vms [vm_name] as XmlElement;
} else {
vm_name = member.GetAttribute ("vm");
vm_elem = vms [vm_name] as XmlElement;
}
AddVM (vm_elem, is_signal_vm, is_interface);
break;
case "field":
if (node_idx == 0) continue; // Parent class
ClassField field = new ClassField (member);
class_fields.Add (field);
class_members.Add (field);
break;
default:
Console.WriteLine ("Unexpected node " + member.Name + " in " + class_elem.GetAttribute ("cname"));
break;
}
}
}
VirtualMethod AddVM (XmlElement vm_elem, bool is_signal_vm, bool is_interface)
{
VirtualMethod vm;
if (is_signal_vm)
vm = new DefaultSignalHandler (vm_elem, this);
else if (is_interface)
vm = new InterfaceVM (vm_elem, methods [vm_elem.GetAttribute ("name")] as Method, this);
else
vm = new GObjectVM (vm_elem, this);
if (vm_elem.GetAttribute ("padding") == "true" || vm_elem.GetAttribute ("hidden") == "1")
hidden_vms.Add (vm);
else {
if (vm is GObjectVM)
virtual_methods.Add (vm);
else
interface_vms.Add (vm);
}
if (vm.CName != "")
class_members.Add (vm);
return vm;
}
protected override bool IsNodeNameHandled (string name)
{
switch (name) {
case "virtual_method":
case "signal":
case "class_struct":
return true;
default:
return base.IsNodeNameHandled (name);
}
}
public override string FromNative (string var, bool owned)
{
return "GLib.Object.GetObject(" + var + (owned ? ", true" : "") + ") as " + QualifiedName;
}
public string ClassStructName {
get {
return class_struct_name;
}
}
protected void GenerateClassStruct (StreamWriter sw)
{
if (class_struct_name == null) return;
sw.WriteLine ("\t\t[StructLayout (LayoutKind.Sequential)]");
sw.WriteLine ("\t\tstruct " + class_struct_name + " {");
foreach (object member in class_members) {
if (member is VirtualMethod) {
VirtualMethod vm = member as VirtualMethod;
if (hidden_vms.Contains (vm) || (is_interface && vm is DefaultSignalHandler))
sw.WriteLine ("\t\t\tIntPtr {0};", vm.Name);
else
sw.WriteLine ("\t\t\tpublic {0}NativeDelegate {0};", vm.Name);
} else if (member is ClassField) {
ClassField field = member as ClassField;
sw.WriteLine ("\t\t\tpublic {0} {1};", field.Generatable.MarshalReturnType, field.Name);
}
}
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
public Hashtable Signals {
get {
return sigs;
}
}
public Signal GetSignal (string name)
{
return sigs[name] as Signal;
}
public Signal GetSignalRecursively (string name)
{
return GetSignalRecursively (name, false);
}
public virtual Signal GetSignalRecursively (string name, bool check_self)
{
Signal p = null;
if (check_self)
p = GetSignal (name);
if (p == null && Parent != null)
p = (Parent as ObjectBase).GetSignalRecursively (name, true);
if (check_self && p == null) {
foreach (string iface in interfaces) {
InterfaceGen igen = SymbolTable.Table.GetClassGen (iface) as InterfaceGen;
if (igen == null)
continue;
p = igen.GetSignalRecursively (name, true);
if (p != null)
break;
}
}
return p;
}
public void GenSignals (GenerationInfo gen_info, ObjectBase implementor)
{
foreach (Signal sig in sigs.Values)
sig.Generate (gen_info, implementor);
}
public void GenVirtualMethods (GenerationInfo gen_info, ObjectBase implementor)
{
foreach (GObjectVM vm in virtual_methods)
vm.Generate (gen_info, implementor);
}
public override bool Validate ()
{
if (Parent != null && !(Parent as ObjectBase).ValidateForSubclass ())
return false;
ArrayList invalids = new ArrayList ();
foreach (GObjectVM vm in virtual_methods)
if (!vm.Validate ())
invalids.Add (vm);
foreach (VirtualMethod invalid_vm in invalids) {
virtual_methods.Remove (invalid_vm);
hidden_vms.Add (invalid_vm);
}
invalids.Clear ();
foreach (InterfaceVM vm in interface_vms)
if (!vm.Validate ())
invalids.Add (vm);
foreach (InterfaceVM invalid_vm in invalids) {
interface_vms.Remove (invalid_vm);
hidden_vms.Add (invalid_vm);
}
invalids.Clear ();
foreach (Signal sig in sigs.Values) {
if (!sig.Validate ()) {
Console.WriteLine ("in type " + QualifiedName);
invalids.Add (sig);
}
}
foreach (Signal sig in invalids)
sigs.Remove (sig.Name);
return base.Validate ();
}
public virtual bool ValidateForSubclass ()
{
ArrayList invalids = new ArrayList ();
foreach (Signal sig in sigs.Values) {
if (!sig.Validate ()) {
Console.WriteLine ("in type " + QualifiedName);
invalids.Add (sig);
}
}
foreach (Signal sig in invalids)
sigs.Remove (sig.Name);
invalids.Clear ();
return true;
}
}
}

View file

@ -32,17 +32,15 @@ namespace GtkSharp.Generation {
private ArrayList custom_attrs = new ArrayList();
private ArrayList strings = new ArrayList();
private ArrayList vm_nodes = new ArrayList();
private Hashtable childprops = new Hashtable();
private static Hashtable dirs = new Hashtable ();
public ObjectGen (XmlElement ns, XmlElement elem) : base (ns, elem)
public ObjectGen (XmlElement ns, XmlElement elem) : base (ns, elem, false)
{
foreach (XmlNode node in elem.ChildNodes) {
string name;
if (!(node is XmlElement)) continue;
XmlElement member = (XmlElement) node;
if (member.HasAttribute ("hidden") && member.GetAttribute ("hidden") == "1") continue;
switch (node.Name) {
case "callback":
@ -53,16 +51,12 @@ namespace GtkSharp.Generation {
custom_attrs.Add (member.InnerXml);
break;
case "virtual_method":
Statistics.IgnoreCount++;
break;
case "static-string":
strings.Add (node);
break;
case "childprop":
name = member.GetAttribute ("name");
string name = member.GetAttribute ("name");
while (childprops.ContainsKey (name))
name += "mangled";
childprops.Add (name, new ChildProperty (member, this));
@ -184,7 +178,7 @@ namespace GtkSharp.Generation {
bool has_sigs = (sigs != null && sigs.Count > 0);
if (!has_sigs) {
foreach (string iface in interfaces) {
ClassBase igen = table.GetClassGen (iface);
InterfaceGen igen = table.GetClassGen (iface) as InterfaceGen;
if (igen != null && igen.Signals != null) {
has_sigs = true;
break;
@ -196,15 +190,7 @@ namespace GtkSharp.Generation {
GenSignals (gen_info, null);
}
if (vm_nodes.Count > 0) {
if (gen_info.GlueEnabled) {
GenVirtualMethods (gen_info);
} else {
Statistics.VMIgnored = true;
Statistics.ThrottledCount += vm_nodes.Count;
}
}
GenClassMembers (gen_info, cs_parent);
GenMethods (gen_info, null, null);
if (interfaces.Count != 0) {
@ -226,10 +212,11 @@ namespace GtkSharp.Generation {
foreach (string iface in interfaces) {
if (Parent != null && Parent.Implements (iface))
continue;
ClassBase igen = table.GetClassGen (iface);
InterfaceGen igen = table.GetClassGen (iface) as InterfaceGen;
igen.GenMethods (gen_info, collisions, this);
igen.GenProperties (gen_info, this);
igen.GenSignals (gen_info, this);
igen.GenVirtualMethods (gen_info, this);
}
}
@ -310,37 +297,41 @@ namespace GtkSharp.Generation {
}
private void GenVMGlue (GenerationInfo gen_info, XmlElement elem)
void GenClassMembers (GenerationInfo gen_info, string cs_parent)
{
StreamWriter sw = gen_info.GlueWriter;
GenVirtualMethods (gen_info, null);
string vm_name = elem.GetAttribute ("cname");
string method = gen_info.GluelibName + "_" + NS + Name + "_override_" + vm_name;
if (class_struct_name == null || this.ParserVersion == 1) return;
StreamWriter sw = gen_info.Writer;
GenerateClassStruct (sw);
if (cs_parent == "")
sw.WriteLine ("\t\tstatic uint class_offset = 0;");
else
sw.WriteLine ("\t\tstatic uint class_offset = ((GLib.GType) typeof ({0})).ClassSize;", cs_parent);
sw.WriteLine ("\t\tstatic Hashtable class_structs;");
sw.WriteLine ();
sw.WriteLine ("void " + method + " (GType type, gpointer cb);");
sw.WriteLine ("\t\tstatic {0} GetClassStruct (GLib.GType gtype, bool use_cache)", class_struct_name);
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tif (class_structs == null)");
sw.WriteLine ("\t\t\t\tclass_structs = new Hashtable ();");
sw.WriteLine ();
sw.WriteLine ("\t\t\tif (use_cache && class_structs.Contains (gtype))");
sw.WriteLine ("\t\t\t\treturn ({0}) class_structs [gtype];", class_struct_name);
sw.WriteLine ("\t\t\telse {");
sw.WriteLine ("\t\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\t\t{0} class_struct = ({0}) Marshal.PtrToStructure (class_ptr, typeof ({0}));", class_struct_name);
sw.WriteLine ("\t\t\t\tif (use_cache)");
sw.WriteLine ("\t\t\t\t\tclass_structs.Add (gtype, class_struct);");
sw.WriteLine ("\t\t\t\treturn class_struct;");
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
sw.WriteLine ("\t\tstatic void OverrideClassStruct (GLib.GType gtype, {0} class_struct)", class_struct_name);
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tIntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 () + class_offset);");
sw.WriteLine ("\t\t\tMarshal.StructureToPtr (class_struct, class_ptr, false);");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
sw.WriteLine ("void");
sw.WriteLine (method + " (GType type, gpointer cb)");
sw.WriteLine ("{");
sw.WriteLine ("\t{0} *klass = ({0} *) g_type_class_peek (type);", NS + Name + "Class");
sw.WriteLine ("\tklass->" + vm_name + " = cb;");
sw.WriteLine ("}");
}
static bool vmhdrs_needed = true;
private void GenVirtualMethods (GenerationInfo gen_info)
{
if (vmhdrs_needed) {
gen_info.GlueWriter.WriteLine ("#include <glib-object.h>");
gen_info.GlueWriter.WriteLine ("#include \"vmglueheaders.h\"");
gen_info.GlueWriter.WriteLine ();
vmhdrs_needed = false;
}
foreach (XmlElement elem in vm_nodes) {
GenVMGlue (gen_info, elem);
}
}
/* Keep this in sync with the one in glib/GType.cs */

View file

@ -506,12 +506,18 @@ namespace GtkSharp.Generation {
ArrayList param_list = new ArrayList ();
XmlElement elem;
bool first_is_instance;
public Parameters (XmlElement elem)
public Parameters (XmlElement elem) : this (elem, false) { }
public Parameters (XmlElement elem, bool first_is_instance)
{
if (elem == null)
valid = true;
this.elem = elem;
this.first_is_instance = first_is_instance;
if (first_is_instance)
is_static = false;
}
public int Count {
@ -616,7 +622,7 @@ namespace GtkSharp.Generation {
if (elem == null)
return false;
for (int i = 0; i < elem.ChildNodes.Count; i++) {
for (int i = first_is_instance ? 1 : 0; i < elem.ChildNodes.Count; i++) {
XmlElement parm = elem.ChildNodes [i] as XmlElement;
if (parm == null || parm.Name != "parameter")
continue;
@ -630,7 +636,7 @@ namespace GtkSharp.Generation {
if ((p.CSType == "") || (p.Name == "") ||
(p.MarshalType == "") || (SymbolTable.Table.CallByName(p.CType, p.Name) == "")) {
Console.Write("Name: " + p.Name + " Type: " + p.CType + " ");
Console.Write ("Invalid parameter {0} of type {1}", p.Name, p.CType);
Clear ();
return false;
}

View file

@ -28,7 +28,7 @@ namespace GtkSharp.Generation {
using System.Xml;
public class Parser {
const int curr_parser_version = 1;
const int curr_parser_version = 2;
private XmlDocument Load (string filename)
{

View file

@ -82,7 +82,7 @@ namespace GtkSharp.Generation {
}
IGeneratable igen;
IGeneratable IGen {
public IGeneratable IGen {
get {
if (igen == null)
igen = SymbolTable.Table [CType];

View file

@ -35,15 +35,15 @@ namespace GtkSharp.Generation {
XmlElement elem;
ReturnValue retval;
Parameters parms;
ClassBase container_type;
ObjectBase container_type;
public Signal (XmlElement elem, ClassBase container_type)
public Signal (XmlElement elem, ObjectBase container_type)
{
this.elem = elem;
name = elem.GetAttribute ("name");
marshaled = elem.GetAttribute ("manual") == "true";
retval = new ReturnValue (elem ["return-type"]);
parms = new Parameters (elem["parameters"]);
parms = new Parameters (elem["parameters"], container_type.ParserVersion == 1 ? true : false);
this.container_type = container_type;
}
@ -154,75 +154,29 @@ namespace GtkSharp.Generation {
}
}
string ClassFieldName {
get {
return elem.HasAttribute ("field_name") ? elem.GetAttribute("field_name") : String.Empty;
}
}
private bool HasOutParams {
get {
foreach (Parameter p in parms) {
if (p.PassAs == "out")
return true;
}
return false;
}
}
private bool IsEventHandler {
get {
return retval.CSType == "void" && parms.Count == 1 && (parms [0].Generatable is ObjectGen || parms [0].Generatable is InterfaceGen);
}
}
private bool IsVoid {
get {
return retval.CSType == "void";
}
}
private string ReturnGType {
get {
IGeneratable igen = SymbolTable.Table [retval.CType];
if (igen is ObjectGen)
return "GLib.GType.Object";
if (igen is BoxedGen)
return retval.CSType + ".GType";
if (igen is EnumGen)
return retval.CSType + "GType.GType";
switch (retval.CSType) {
case "bool":
return "GLib.GType.Boolean";
case "string":
return "GLib.GType.String";
case "int":
return "GLib.GType.Int";
default:
throw new Exception (retval.CSType);
}
return retval.CSType == "void" && parms.Count == 0;
}
}
public string GenArgsInitialization (StreamWriter sw)
{
if (parms.Count > 1)
sw.WriteLine("\t\t\t\targs.Args = new object[" + (parms.Count - 1) + "];");
if (parms.Count > 0)
sw.WriteLine("\t\t\t\targs.Args = new object[" + parms.Count + "];");
string finish = "";
for (int idx = 1; idx < parms.Count; idx++) {
for (int idx = 0; idx < parms.Count; idx++) {
Parameter p = parms [idx];
IGeneratable igen = p.Generatable;
if (p.PassAs != "out") {
if (igen is ManualGen) {
sw.WriteLine("\t\t\t\tif (arg{0} == IntPtr.Zero)", idx);
sw.WriteLine("\t\t\t\t\targs.Args[{0}] = null;", idx - 1);
sw.WriteLine("\t\t\t\t\targs.Args[{0}] = null;", idx);
sw.WriteLine("\t\t\t\telse {");
sw.WriteLine("\t\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
sw.WriteLine("\t\t\t\t\targs.Args[" + idx + "] = " + p.FromNative ("arg" + idx) + ";");
sw.WriteLine("\t\t\t\t}");
} else
sw.WriteLine("\t\t\t\targs.Args[" + (idx - 1) + "] = " + p.FromNative ("arg" + idx) + ";");
sw.WriteLine("\t\t\t\targs.Args[" + idx + "] = " + p.FromNative ("arg" + idx) + ";");
}
if (igen is StructBase && p.PassAs == "ref")
finish += "\t\t\t\tif (arg" + idx + " != IntPtr.Zero) System.Runtime.InteropServices.Marshal.StructureToPtr (args.Args[" + (idx-1) + "], arg" + idx + ", false);\n";
@ -234,12 +188,12 @@ namespace GtkSharp.Generation {
public void GenArgsCleanup (StreamWriter sw, string finish)
{
if (IsVoid && finish.Length == 0)
if (retval.IsVoid && finish.Length == 0)
return;
sw.WriteLine("\n\t\t\ttry {");
sw.Write (finish);
if (!IsVoid) {
if (!retval.IsVoid) {
if (retval.CSType == "bool") {
sw.WriteLine ("\t\t\t\tif (args.RetVal == null)");
sw.WriteLine ("\t\t\t\t\treturn false;");
@ -260,10 +214,15 @@ namespace GtkSharp.Generation {
if (IsEventHandler)
return;
string native_signature = "IntPtr inst";
if (parms.Count > 0)
native_signature += ", " + CallbackSig;
native_signature += ", IntPtr gch";
sw.WriteLine ("\t\t[GLib.CDeclCallback]");
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + DelegateName + " (" + CallbackSig + ", IntPtr gch);");
sw.WriteLine ("\t\tdelegate {0} {1} ({2});", retval.ToNativeType, DelegateName, native_signature);
sw.WriteLine ();
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + CallbackName + " (" + CallbackSig + ", IntPtr gch)");
sw.WriteLine ("\t\tstatic {0} {1} ({2})", retval.ToNativeType, CallbackName, native_signature);
sw.WriteLine("\t\t{");
sw.WriteLine("\t\t\t{0} args = new {0} ();", EventArgsQualifiedName);
sw.WriteLine("\t\t\ttry {");
@ -273,7 +232,7 @@ namespace GtkSharp.Generation {
sw.WriteLine();
string finish = GenArgsInitialization (sw);
sw.WriteLine("\t\t\t\t{0} handler = ({0}) sig.Handler;", EventHandlerQualifiedName);
sw.WriteLine("\t\t\t\thandler (GLib.Object.GetObject (arg0), args);");
sw.WriteLine("\t\t\t\thandler (GLib.Object.GetObject (inst), args);");
sw.WriteLine("\t\t\t} catch (Exception e) {");
sw.WriteLine("\t\t\t\tGLib.ExceptionManager.RaiseUnhandledException (e, false);");
sw.WriteLine("\t\t\t}");
@ -282,7 +241,7 @@ namespace GtkSharp.Generation {
sw.WriteLine();
}
private bool NeedNew (ClassBase implementor)
private bool NeedNew (ObjectBase implementor)
{
return elem.HasAttribute ("new_flag") ||
(container_type != null && container_type.GetSignalRecursively (Name) != null) ||
@ -306,16 +265,16 @@ namespace GtkSharp.Generation {
sw.WriteLine ("\tpublic delegate void " + EventHandlerName + "(object o, " + EventArgsName + " args);");
sw.WriteLine ();
sw.WriteLine ("\tpublic class " + EventArgsName + " : GLib.SignalArgs {");
for (int i = 1; i < parms.Count; i++) {
for (int i = 0; i < parms.Count; i++) {
sw.WriteLine ("\t\tpublic " + parms[i].CSType + " " + parms[i].StudlyName + "{");
if (parms[i].PassAs != "out") {
sw.WriteLine ("\t\t\tget {");
sw.WriteLine ("\t\t\t\treturn (" + parms[i].CSType + ") Args[" + (i - 1) + "];");
sw.WriteLine ("\t\t\t\treturn (" + parms[i].CSType + ") Args[" + i + "];");
sw.WriteLine ("\t\t\t}");
}
if (parms[i].PassAs != "") {
sw.WriteLine ("\t\t\tset {");
sw.WriteLine ("\t\t\t\tArgs[" + (i - 1) + "] = (" + parms[i].CSType + ")value;");
sw.WriteLine ("\t\t\t\tArgs[" + i + "] = (" + parms[i].CSType + ")value;");
sw.WriteLine ("\t\t\t}");
}
sw.WriteLine ("\t\t}");
@ -326,221 +285,7 @@ namespace GtkSharp.Generation {
sw.Close ();
}
private void GenVMDeclaration (StreamWriter sw, ClassBase implementor)
{
VMSignature vmsig = new VMSignature (parms);
sw.WriteLine ("\t\t[GLib.DefaultSignalHandler(Type=typeof(" + (implementor != null ? implementor.QualifiedName : container_type.QualifiedName) + "), ConnectionMethod=\"Override" + Name +"\")]");
sw.Write ("\t\tprotected ");
if (NeedNew (implementor))
sw.Write ("new ");
sw.WriteLine ("virtual {0} {1} ({2})", retval.CSType, "On" + Name, vmsig.ToString ());
}
private string CastFromInt (string type)
{
return type != "int" ? "(" + type + ") " : "";
}
private string GlueCallString {
get {
string result = "Handle";
for (int i = 1; i < parms.Count; i++) {
Parameter p = parms [i];
IGeneratable igen = p.Generatable;
if (i > 1 && parms [i - 1].IsString && p.IsLength && p.PassAs == String.Empty) {
string string_name = parms [i - 1].Name;
result += ", " + igen.CallByName (CastFromInt (p.CSType) + "System.Text.Encoding.UTF8.GetByteCount (" + string_name + ")");
continue;
}
p.CallName = p.Name;
string call_parm = p.CallString;
if (p.IsUserData && parms.IsHidden (p) && !parms.HideData && (i == 1 || parms [i - 1].Scope != "notified")) {
call_parm = "IntPtr.Zero";
}
result += ", " + call_parm;
}
return result;
}
}
private string GlueSignature {
get {
string result = String.Empty;
for (int i = 0; i < parms.Count; i++)
result += parms[i].CType.Replace ("const-", "const ") + " " + parms[i].Name + (i == parms.Count-1 ? "" : ", ");
return result;
}
}
private string DefaultGlueValue {
get {
string val = retval.DefaultValue;
switch (val) {
case "null":
return "NULL";
case "false":
return "FALSE";
case "true":
return "TRUE";
default:
return val;
}
}
}
private void GenGlueVirtualMethod (GenerationInfo gen_info)
{
StreamWriter glue = gen_info.GlueWriter;
string glue_name = String.Format ("{0}sharp_{1}_base_{2}", container_type.NS.ToLower ().Replace (".", "_"), container_type.Name.ToLower (), ClassFieldName);
glue.WriteLine ("{0} {1} ({2});\n", retval.CType, glue_name, GlueSignature);
glue.WriteLine ("{0}\n{1} ({2})", retval.CType, glue_name, GlueSignature);
glue.WriteLine ("{");
glue.WriteLine ("\t{0}Class *klass = ({0}Class *) get_threshold_class (G_OBJECT ({1}));", container_type.CName, parms[0].Name);
glue.Write ("\tif (klass->{0})\n\t\t", ClassFieldName);
if (!IsVoid)
glue.Write ("return ");
glue.Write ("(* klass->{0}) (", ClassFieldName);
for (int i = 0; i < parms.Count; i++)
glue.Write (parms[i].Name + (i == parms.Count - 1 ? "" : ", "));
glue.WriteLine (");");
if (!IsVoid)
glue.WriteLine ("\treturn " + DefaultGlueValue + ";");
glue.WriteLine ("}");
StreamWriter sw = gen_info.Writer;
sw.WriteLine ("\t\t[DllImport (\"{0}\")]", gen_info.GluelibName);
sw.WriteLine ("\t\tstatic extern {0} {1} ({2});\n", retval.MarshalType, glue_name, parms.ImportSignature);
GenVMDeclaration (sw, null);
sw.WriteLine ("\t\t{");
MethodBody body = new MethodBody (parms);
body.Initialize (gen_info, false, false, String.Empty);
sw.WriteLine ("\t\t\t{0}{1} ({2});", IsVoid ? "" : retval.MarshalType + " __ret = ", glue_name, GlueCallString);
body.Finish (sw, "");
if (!IsVoid)
sw.WriteLine ("\t\t\treturn {0};", retval.FromNative ("__ret"));
sw.WriteLine ("\t\t}\n");
}
private void GenChainVirtualMethod (StreamWriter sw, ClassBase implementor)
{
GenVMDeclaration (sw, implementor);
sw.WriteLine ("\t\t{");
if (IsVoid)
sw.WriteLine ("\t\t\tGLib.Value ret = GLib.Value.Empty;");
else
sw.WriteLine ("\t\t\tGLib.Value ret = new GLib.Value (" + ReturnGType + ");");
sw.WriteLine ("\t\t\tGLib.ValueArray inst_and_params = new GLib.ValueArray (" + parms.Count + ");");
sw.WriteLine ("\t\t\tGLib.Value[] vals = new GLib.Value [" + parms.Count + "];");
sw.WriteLine ("\t\t\tvals [0] = new GLib.Value (this);");
sw.WriteLine ("\t\t\tinst_and_params.Append (vals [0]);");
string cleanup = "";
for (int i = 1; i < parms.Count; i++) {
Parameter p = parms [i];
if (p.PassAs != "") {
if (SymbolTable.Table.IsBoxed (p.CType)) {
if (p.PassAs == "ref")
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + ");");
else
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value ((GLib.GType)typeof (" + p.CSType + "));");
cleanup += "\t\t\t" + p.Name + " = (" + p.CSType + ") vals [" + i + "];\n";
} else {
if (p.PassAs == "ref")
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = GLib.Marshaller.StructureToPtrAlloc (" + p.Generatable.CallByName (p.Name) + ");");
else
sw.WriteLine ("\t\t\tIntPtr " + p.Name + "_ptr = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (" + p.MarshalType + ")));");
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + "_ptr);");
cleanup += "\t\t\t" + p.Name + " = " + p.FromNative ("(" + p.MarshalType + ") Marshal.PtrToStructure (" + p.Name + "_ptr, typeof (" + p.MarshalType + "))") + ";\n";
cleanup += "\t\t\tMarshal.FreeHGlobal (" + p.Name + "_ptr);\n";
}
} else if (p.IsLength && parms [i - 1].IsString)
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (System.Text.Encoding.UTF8.GetByteCount (" + parms [i-1].Name + "));");
else
sw.WriteLine ("\t\t\tvals [" + i + "] = new GLib.Value (" + p.Name + ");");
sw.WriteLine ("\t\t\tinst_and_params.Append (vals [" + i + "]);");
}
sw.WriteLine ("\t\t\tg_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);");
if (cleanup != "")
sw.WriteLine (cleanup);
sw.WriteLine ("\t\t\tforeach (GLib.Value v in vals)");
sw.WriteLine ("\t\t\t\tv.Dispose ();");
if (!IsVoid) {
IGeneratable igen = SymbolTable.Table [retval.CType];
sw.WriteLine ("\t\t\t" + retval.CSType + " result = (" + (igen is EnumGen ? retval.CSType + ") (Enum" : retval.CSType) + ") ret;");
sw.WriteLine ("\t\t\tret.Dispose ();");
sw.WriteLine ("\t\t\treturn result;");
}
sw.WriteLine ("\t\t}\n");
}
private void GenDefaultHandlerDelegate (GenerationInfo gen_info, ClassBase implementor)
{
StreamWriter sw = gen_info.Writer;
StreamWriter glue;
bool use_glue = gen_info.GlueEnabled && implementor == null && ClassFieldName.Length > 0;
string glue_name = String.Empty;
ManagedCallString call = new ManagedCallString (parms, true);
sw.WriteLine ("\t\t[GLib.CDeclCallback]");
sw.WriteLine ("\t\tdelegate " + retval.ToNativeType + " " + Name + "VMDelegate (" + parms.ImportSignature + ");\n");
if (use_glue) {
glue = gen_info.GlueWriter;
glue_name = String.Format ("{0}sharp_{1}_override_{2}", container_type.NS.ToLower ().Replace (".", "_"), container_type.Name.ToLower (), ClassFieldName);
sw.WriteLine ("\t\t[DllImport (\"{0}\")]", gen_info.GluelibName);
sw.WriteLine ("\t\tstatic extern void {0} (IntPtr gtype, {1}VMDelegate cb);\n", glue_name, Name);
glue.WriteLine ("void {0} (GType gtype, gpointer cb);\n", glue_name);
glue.WriteLine ("void\n{0} (GType gtype, gpointer cb)", glue_name);
glue.WriteLine ("{");
glue.WriteLine ("\tGObjectClass *klass = g_type_class_peek (gtype);");
glue.WriteLine ("\tif (klass == NULL)");
glue.WriteLine ("\t\tklass = g_type_class_ref (gtype);");
glue.WriteLine ("\t(({0} *)klass)->{1} = cb;", container_type.CName + "Class", ClassFieldName);
glue.WriteLine ("}\n");
}
sw.WriteLine ("\t\tstatic {0} {1};\n", Name + "VMDelegate", Name + "VMCallback");
sw.WriteLine ("\t\tstatic " + retval.ToNativeType + " " + Name.ToLower() + "_cb (" + parms.ImportSignature + ")");
sw.WriteLine ("\t\t{");
string unconditional = call.Unconditional ("\t\t\t");
if (unconditional.Length > 0)
sw.WriteLine (unconditional);
sw.WriteLine ("\t\t\ttry {");
sw.WriteLine ("\t\t\t\t{0} {1}_managed = GLib.Object.GetObject ({1}, false) as {0};", implementor != null ? implementor.Name : container_type.Name, parms[0].Name);
sw.Write (call.Setup ("\t\t\t\t"));
sw.Write ("\t\t\t\t{0}", IsVoid ? "" : retval.CSType == retval.ToNativeType ? "return " : retval.CSType + " raw_ret = ");
sw.WriteLine ("{2}_managed.{0} ({1});", "On" + Name, call.ToString (), parms[0].Name);
sw.Write (call.Finish ("\t\t\t\t"));
if (!IsVoid && retval.CSType != retval.ToNativeType)
sw.WriteLine ("\t\t\t\treturn {0};", SymbolTable.Table.ToNativeReturn (retval.CType, "raw_ret"));
sw.WriteLine ("\t\t\t} catch (Exception e) {");
bool fatal = HasOutParams || !IsVoid;
sw.WriteLine ("\t\t\t\tGLib.ExceptionManager.RaiseUnhandledException (e, " + (fatal ? "true" : "false") + ");");
if (fatal) {
sw.WriteLine ("\t\t\t\t// NOTREACHED: above call doesn't return");
sw.WriteLine ("\t\t\t\tthrow e;");
}
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}\n");
sw.WriteLine ("\t\tprivate static void Override" + Name + " (GLib.GType gtype)");
sw.WriteLine ("\t\t{");
sw.WriteLine ("\t\t\tif (" + Name + "VMCallback == null)");
sw.WriteLine ("\t\t\t\t" + Name + "VMCallback = new " + Name + "VMDelegate (" + Name.ToLower() + "_cb);");
if (use_glue)
sw.WriteLine ("\t\t\t{0} (gtype.Val, {1}VMCallback);", glue_name, Name);
else
sw.WriteLine ("\t\t\tOverrideVirtualMethod (gtype, " + CName + ", " + Name + "VMCallback);");
sw.WriteLine ("\t\t}\n");
}
public void GenEvent (StreamWriter sw, ClassBase implementor, string target)
public void GenEvent (StreamWriter sw, ObjectBase implementor, string target)
{
string args_type = IsEventHandler ? "" : ", typeof (" + EventArgsQualifiedName + ")";
@ -566,18 +311,13 @@ namespace GtkSharp.Generation {
sw.WriteLine();
}
public void Generate (GenerationInfo gen_info, ClassBase implementor)
public void Generate (GenerationInfo gen_info, ObjectBase implementor)
{
StreamWriter sw = gen_info.Writer;
if (implementor == null)
GenEventHandler (gen_info);
GenDefaultHandlerDelegate (gen_info, implementor);
if (gen_info.GlueEnabled && implementor == null && ClassFieldName.Length > 0)
GenGlueVirtualMethod (gen_info);
else
GenChainVirtualMethod (sw, implementor);
GenEvent (sw, implementor, "this");
Statistics.SignalCount++;

View file

@ -45,6 +45,7 @@ namespace GtkSharp.Generation {
// Simple easily mapped types
AddType (new SimpleGen ("void", "void", String.Empty));
AddType (new SimpleGen ("gpointer", "IntPtr", "IntPtr.Zero"));
AddType (new SimpleGen ("AtkFunction", "IntPtr", "IntPtr.Zero")); // function definition used for padding
AddType (new SimpleGen ("gboolean", "bool", "false"));
AddType (new SimpleGen ("gint", "int", "0"));
AddType (new SimpleGen ("guint", "uint", "0"));
@ -121,7 +122,7 @@ namespace GtkSharp.Generation {
AddType (new MarshalGen ("gunichar", "char", "uint", "GLib.Marshaller.CharToGUnichar ({0})", "GLib.Marshaller.GUnicharToChar ({0})"));
AddType (new MarshalGen ("time_t", "System.DateTime", "IntPtr", "GLib.Marshaller.DateTimeTotime_t ({0})", "GLib.Marshaller.time_tToDateTime ({0})"));
AddType (new MarshalGen ("GString", "string", "IntPtr", "new GLib.GString ({0}).Handle", "GLib.GString.PtrToString ({0})"));
AddType (new MarshalGen ("GType", "GLib.GType", "IntPtr", "{0}.Val", "new GLib.GType({0})"));
AddType (new MarshalGen ("GType", "GLib.GType", "IntPtr", "{0}.Val", "new GLib.GType({0})", "GLib.GType.None"));
AddType (new ByRefGen ("GValue", "GLib.Value"));
AddType (new SimpleGen ("GDestroyNotify", "GLib.DestroyNotify", "null"));

View file

@ -32,13 +32,13 @@ namespace GtkSharp.Generation {
public VMSignature (Parameters parms)
{
bool has_cb = parms.HideData;
for (int i = 1; i < parms.Count; i++) {
for (int i = 0; i < parms.Count; i++) {
Parameter p = parms [i];
if (i > 1 && p.IsLength && parms [i - 1].IsString)
if (i > 0 && p.IsLength && parms [i - 1].IsString)
continue;
if (p.IsCount && ((i > 1 && parms [i - 1].IsArray) || (i < parms.Count - 1 && parms [i + 1].IsArray)))
if (p.IsCount && ((i > 0 && parms [i - 1].IsArray) || (i < parms.Count - 1 && parms [i + 1].IsArray)))
continue;
has_cb = has_cb || p.Generatable is CallbackGen;
@ -55,6 +55,22 @@ namespace GtkSharp.Generation {
}
}
public string GetCallString (bool use_place_holders)
{
if (parms.Count == 0)
return "";
string[] result = new string [parms.Count];
int i = 0;
foreach (Parameter p in parms) {
result [i] = p.PassAs != "" ? p.PassAs + " " : "";
result [i] += use_place_holders ? "{" + i + "}" : p.Name;
i++;
}
return String.Join (", ", result);
}
public override string ToString ()
{
if (parms.Count == 0)

View file

@ -3,6 +3,7 @@
// Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2003-2004 Novell, Inc.
// Copyright (c) 2009 Christian Hoff
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the GNU General Public
@ -26,37 +27,19 @@ namespace GtkSharp.Generation {
using System.IO;
using System.Xml;
// FIXME: handle static VMs
public class VirtualMethod : MethodBase {
public abstract class VirtualMethod : MethodBase {
protected ReturnValue retval;
protected ManagedCallString call;
XmlElement elem;
ReturnValue retval;
Parameters parms;
protected string modifiers = "";
public VirtualMethod (XmlElement elem, ClassBase container_type) : base (elem, container_type)
public VirtualMethod (XmlElement elem, ObjectBase container_type) : base (elem, container_type)
{
this.elem = elem;
if (container_type.ParserVersion == 1) {
// The old pre 2.14 parser didn't drop the 1st parameter in all <signal> and <virtual_method> elements
parms = new Parameters (elem ["parameters"], true);
}
retval = new ReturnValue (elem ["return-type"]);
parms = new Parameters (elem["parameters"]);
parms.HideData = true;
}
public bool IsGetter {
get {
return HasGetterName && ((!retval.IsVoid && parms.Count == 1) || (retval.IsVoid && parms.Count == 2 && parms [1].PassAs == "out"));
}
}
public bool IsSetter {
get {
if (!HasSetterName || !retval.IsVoid)
return false;
if (parms.Count == 2 || (parms.Count == 4 && parms [1].Scope == "notified"))
return true;
else
return false;
}
}
public string MarshalReturnType {
@ -65,47 +48,71 @@ namespace GtkSharp.Generation {
}
}
public void GenerateCallback (StreamWriter sw)
protected abstract string CallString {
get;
}
VMSignature signature;
protected VMSignature Signature {
get {
if (signature == null)
signature = new VMSignature (parms);
return signature;
}
}
/* Creates a callback method which invokes the corresponding virtual method
* @implementor is the class that implements the virtual method(e.g. the class that derives from an interface) or NULL if containing and declaring type are equal
*/
public void GenerateCallback (StreamWriter sw, ClassBase implementor)
{
if (!Validate ())
return;
ManagedCallString call = new ManagedCallString (parms, true);
string type = parms [0].CSType + "Implementor";
string name = parms [0].Name;
string call_string = "__obj." + Name + " (" + call + ")";
if (IsGetter)
call_string = "__obj." + (Name.StartsWith ("Get") ? Name.Substring (3) : Name);
else if (IsSetter)
call_string = "__obj." + Name.Substring (3) + " = " + call;
string native_signature = "";
if (!IsStatic) {
native_signature += "IntPtr inst";
if (parms.Count > 0)
native_signature += ", ";
}
if (parms.Count > 0)
native_signature += parms.ImportSignature;
sw.WriteLine ("\t\t[GLib.CDeclCallback]");
sw.WriteLine ("\t\tdelegate " + MarshalReturnType + " " + Name + "Delegate (" + parms.ImportSignature + ");");
sw.WriteLine ("\t\tdelegate {0} {1}NativeDelegate ({2});", MarshalReturnType, this.Name, native_signature);
sw.WriteLine ();
sw.WriteLine ("\t\tstatic " + MarshalReturnType + " " + Name + "Callback (" + parms.ImportSignature + ")");
sw.WriteLine ("\t\tstatic {0} {1}_cb ({2})", MarshalReturnType, this.Name, native_signature);
sw.WriteLine ("\t\t{");
string unconditional = call.Unconditional ("\t\t\t");
if (unconditional.Length > 0)
sw.WriteLine (unconditional);
sw.WriteLine ("\t\t\ttry {");
sw.WriteLine ("\t\t\t\t" + type + " __obj = GLib.Object.GetObject (" + name + ", false) as " + type + ";");
if (!this.IsStatic) {
string type;
if (implementor != null)
type = implementor.QualifiedName;
else if (this.container_type is InterfaceGen)
type = this.container_type.Name + "Implementor"; // We are in an interface/adaptor, invoke the method in the implementor class
else
type = this.container_type.Name;
sw.WriteLine ("\t\t\t\t{0} __obj = GLib.Object.GetObject (inst, false) as {0};", type);
}
sw.Write (call.Setup ("\t\t\t\t"));
if (retval.IsVoid) {
if (IsGetter) {
Parameter p = parms [1];
string out_name = p.Name;
if (p.MarshalType != p.CSType)
out_name = "my" + out_name;
sw.WriteLine ("\t\t\t\t" + out_name + " = " + call_string + ";");
} else
sw.WriteLine ("\t\t\t\t" + call_string + ";");
} else
sw.WriteLine ("\t\t\t\t" + retval.CSType + " __result = " + call_string + ";");
bool fatal = parms.HasOutParam || !retval.IsVoid;
sw.Write ("\t\t\t\t");
if (!retval.IsVoid)
sw.Write (retval.CSType + " __result = ");
if (!this.IsStatic)
sw.Write ("__obj.");
sw.WriteLine (this.CallString + ";");
sw.Write (call.Finish ("\t\t\t\t"));
if (!retval.IsVoid)
sw.WriteLine ("\t\t\t\treturn " + retval.ToNative ("__result") + ";");
bool fatal = parms.HasOutParam || !retval.IsVoid;
sw.WriteLine ("\t\t\t} catch (Exception e) {");
sw.WriteLine ("\t\t\t\tGLib.ExceptionManager.RaiseUnhandledException (e, " + (fatal ? "true" : "false") + ");");
if (fatal) {
@ -114,25 +121,13 @@ namespace GtkSharp.Generation {
}
sw.WriteLine ("\t\t\t}");
sw.WriteLine ("\t\t}");
sw.WriteLine ();
}
public void GenerateDeclaration (StreamWriter sw, VirtualMethod complement)
{
VMSignature vmsig = new VMSignature (parms);
if (IsGetter) {
string name = Name.StartsWith ("Get") ? Name.Substring (3) : Name;
string type = retval.IsVoid ? parms [1].CSType : retval.CSType;
if (complement != null && complement.parms [1].CSType == type)
sw.WriteLine ("\t\t" + type + " " + name + " { get; set; }");
else {
sw.WriteLine ("\t\t" + type + " " + name + " { get; }");
if (complement != null)
sw.WriteLine ("\t\t" + complement.retval.CSType + " " + complement.Name + " (" + (new VMSignature (complement.parms)) + ");");
}
} else if (IsSetter)
sw.WriteLine ("\t\t" + parms[1].CSType + " " + Name.Substring (3) + " { set; }");
else
sw.WriteLine ("\t\t" + retval.CSType + " " + Name + " (" + vmsig + ");");
public bool IsValid {
get {
return Validate ();
}
}
enum ValidState {
@ -143,25 +138,24 @@ namespace GtkSharp.Generation {
ValidState vstate = ValidState.Unvalidated;
public bool IsValid {
get {
if (vstate == ValidState.Unvalidated)
return Validate ();
else
return vstate == ValidState.Valid;
}
}
public override bool Validate ()
{
if (!parms.Validate () || !retval.Validate ()) {
Console.Write ("in virtual method " + Name + " ");
vstate = ValidState.Invalid;
return false;
}
if (vstate != ValidState.Unvalidated)
return vstate == ValidState.Valid;
vstate = ValidState.Valid;
return true;
if (!parms.Validate () || !retval.Validate ()) {
vstate = ValidState.Invalid;
}
if (vstate == ValidState.Invalid) {
Console.WriteLine ("(in virtual method " + container_type.QualifiedName + "." + Name + ")");
return false;
} else {
// The call string has to be created *after* the params have been validated since the Parameters class contains no elements before validation
call = new ManagedCallString (parms);
return true;
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<api parser_version="1">
<api parser_version="2">
<!--
This file was automatically generated.
@ -66,12 +66,15 @@
</parameters>
</callback>
<object name="XML" cname="GladeXML" parent="GObject">
<class_struct cname="GladeXMLClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method vm="lookup_type" />
</class_struct>
<field name="Filename" cname="filename" type="char*" />
<field name="Priv" cname="priv" type="GladeXMLPrivate*" />
<virtual_method name="LookupType" cname="lookup_type">
<return-type type="GType" />
<parameters>
<parameter type="GladeXML*self" name="arg1" />
<parameter type="const-char*" name="gtypename" />
</parameters>
</virtual_method>

View file

@ -255,7 +255,7 @@ namespace GLib {
return Marshaller.Utf8PtrToString (g_type_name (val));
}
internal IntPtr ClassPtr {
public IntPtr ClassPtr {
get {
IntPtr klass = g_type_class_peek (val);
if (klass == IntPtr.Zero)
@ -264,6 +264,34 @@ namespace GLib {
}
}
public GType BaseType {
get {
IntPtr parent = g_type_parent (this.Val);
if (parent == IntPtr.Zero)
return GType.None;
else
return new GType (parent);
}
}
public GType ThresholdType {
get {
GLib.GType curr_type = this;
while (curr_type.ToString ().StartsWith ("__gtksharp_")) {
curr_type = curr_type.BaseType;
}
return curr_type;
}
}
public uint ClassSize {
get {
GTypeQuery query;
g_type_query (this.Val, out query);
return query.class_size;
}
}
internal void EnsureClass ()
{
if (g_type_class_peek (val) == IntPtr.Zero)
@ -359,6 +387,9 @@ namespace GLib {
[DllImport("libgobject-2.0-0.dll")]
static extern IntPtr g_type_name (IntPtr raw);
[DllImport("libgobject-2.0-0.dll")]
static extern IntPtr g_type_parent (IntPtr type);
[DllImport("libgobject-2.0-0.dll")]
static extern void g_type_query (IntPtr type, out GTypeQuery query);

View file

@ -141,7 +141,7 @@ namespace GLib {
foreach (object attr in baseinfo.GetCustomAttributes (typeof (DefaultSignalHandlerAttribute), false)) {
DefaultSignalHandlerAttribute sigattr = attr as DefaultSignalHandlerAttribute;
MethodInfo connector = sigattr.Type.GetMethod (sigattr.ConnectionMethod, BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo connector = sigattr.Type.GetMethod (sigattr.ConnectionMethod, BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof (GType) }, new ParameterModifier [0]);
object[] parms = new object [1];
parms [0] = gtype;
connector.Invoke (null, parms);

View file

@ -24,19 +24,83 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[DllImport ("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_cell_renderer_start_editing (IntPtr handle, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle bg_area, ref Gdk.Rectangle cell_area, int flags);
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_base_get_size (IntPtr handle, IntPtr widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height);
public CellEditable StartEditing (Widget widget, Gdk.Event evnt, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
{
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
IntPtr raw_ret = gtk_cell_renderer_start_editing (Handle, evnt.Handle, widget.Handle, native, ref background_area, ref cell_area, (int) flags);
GLib.Marshaller.Free (native);
Gtk.CellEditable ret = (Gtk.CellEditable) GLib.Object.GetObject(raw_ret);
return ret;
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_override_get_size (IntPtr gtype, GetSizeDelegate cb);
[DllImport("libgtk-win32-2.0-0.dll")]
static extern void gtk_cell_renderer_render (IntPtr handle, IntPtr drawable, IntPtr widget, ref Gdk.Rectangle bg_area, ref Gdk.Rectangle cell_area, ref Gdk.Rectangle expose_area, int flags);
public void Render (Widget widget, Gdk.Drawable window, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState flags)
{
gtk_cell_renderer_render (Handle, window == null ? IntPtr.Zero : window.Handle, widget == null ? IntPtr.Zero : widget.Handle, ref background_area, ref cell_area, ref expose_area, (int) flags);
}
// We have to implement this VM manually because x_offset, y_offset, width and height params may be NULL and therefore cannot be treated as "out int"
// TODO: Implement "nullable" attribute for value type parameters in GAPI
[GLib.CDeclCallback]
delegate void GetSizeDelegate (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height);
delegate void OnGetSizeDelegate (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height);
static GetSizeDelegate GetSizeCallback;
static void OnGetSize_cb (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height)
{
try {
CellRenderer obj = GLib.Object.GetObject (item, false) as CellRenderer;
Gtk.Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
Gdk.Rectangle cell_area = Gdk.Rectangle.New (cell_area_ptr);
int a, b, c, d;
static void GetSize_cb (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height)
obj.OnGetSize (widg, ref cell_area, out a, out b, out c, out d);
if (x_offset != IntPtr.Zero)
Marshal.WriteInt32 (x_offset, a);
if (y_offset != IntPtr.Zero)
Marshal.WriteInt32 (y_offset, b);
if (width != IntPtr.Zero)
Marshal.WriteInt32 (width, c);
if (height != IntPtr.Zero)
Marshal.WriteInt32 (height, d);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_override_get_size (IntPtr gtype, OnGetSizeDelegate cb);
static OnGetSizeDelegate OnGetSizeCallback;
static void OverrideOnGetSize (GLib.GType gtype)
{
if (OnGetSizeCallback == null)
OnGetSizeCallback = new OnGetSizeDelegate (OnGetSize_cb);
gtksharp_cellrenderer_override_get_size (gtype.Val, OnGetSizeCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideOnGetSize")]
protected virtual void OnGetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
InternalOnGetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_base_get_size (IntPtr cell, IntPtr widget, IntPtr cell_area, out int x_offset, out int y_offset, out int width, out int height);
private void InternalOnGetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
IntPtr native_cell_area = GLib.Marshaller.StructureToPtrAlloc (cell_area);
gtksharp_cellrenderer_base_get_size (Handle, widget == null ? IntPtr.Zero : widget.Handle, native_cell_area, out x_offset, out y_offset, out width, out height);
cell_area = Gdk.Rectangle.New (native_cell_area);
Marshal.FreeHGlobal (native_cell_area);
}
// Compatibility code for old GetSize(..) virtual method
static void ObsoleteGetSize_cb (IntPtr item, IntPtr widget, IntPtr cell_area_ptr, IntPtr x_offset, IntPtr y_offset, IntPtr width, IntPtr height)
{
try {
CellRenderer obj = GLib.Object.GetObject (item, false) as CellRenderer;
@ -58,123 +122,70 @@
}
}
static void OverrideGetSize (GLib.GType gtype)
static void OverrideObsoleteGetSize (GLib.GType gtype)
{
if (GetSizeCallback == null)
GetSizeCallback = new GetSizeDelegate (GetSize_cb);
gtksharp_cellrenderer_override_get_size (gtype.Val, GetSizeCallback);
if (OnGetSizeCallback == null)
OnGetSizeCallback = new OnGetSizeDelegate (ObsoleteGetSize_cb);
gtksharp_cellrenderer_override_get_size (gtype.Val, OnGetSizeCallback);
}
[GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideGetSize")]
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
[GLib.DefaultSignalHandler(Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideObsoleteGetSize")]
public virtual void GetSize(Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
gtksharp_cellrenderer_base_get_size(Handle, widget.Handle, ref cell_area, out x_offset, out y_offset, out width, out height);
InternalOnGetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_invoke_get_size (IntPtr gtype, IntPtr handle, IntPtr widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height);
internal static void InternalGetSize (GLib.GType gtype, Gtk.CellRenderer cell, Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
gtksharp_cellrenderer_invoke_get_size (gtype.Val, cell.Handle, widget.Handle, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_base_render (IntPtr handle, IntPtr window, IntPtr widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags);
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_override_render (IntPtr gtype, RenderDelegate cb);
[GLib.CDeclCallback]
delegate void RenderDelegate (IntPtr item, IntPtr window, IntPtr widget, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, ref Gdk.Rectangle expose_area, Gtk.CellRendererState flags);
static RenderDelegate RenderCallback;
static void Render_cb (IntPtr item, IntPtr window, IntPtr widget, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, ref Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
// Compatibility code for old Render(..) virtual method
static void ObsoleteRender_cb (IntPtr cell, IntPtr window, IntPtr widget, IntPtr background_area, IntPtr cell_area, IntPtr expose_area, int flags)
{
try {
CellRenderer obj = GLib.Object.GetObject (item, false) as CellRenderer;
Gdk.Drawable wind = GLib.Object.GetObject (window, false) as Gdk.Drawable;
Gtk.Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
obj.Render (wind, widg, background_area, cell_area, expose_area, flags);
Gtk.CellRenderer __obj = GLib.Object.GetObject (cell, false) as Gtk.CellRenderer;
__obj.Render (GLib.Object.GetObject(window) as Gdk.Drawable, GLib.Object.GetObject(widget) as Gtk.Widget, Gdk.Rectangle.New (background_area), Gdk.Rectangle.New (cell_area), Gdk.Rectangle.New (expose_area), (Gtk.CellRendererState) flags);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
static void OverrideRender (GLib.GType gtype)
static RenderNativeDelegate ObsoleteRenderVMCallback;
static void OverrideObsoleteRender (GLib.GType gtype)
{
if (RenderCallback == null)
RenderCallback = new RenderDelegate (Render_cb);
gtksharp_cellrenderer_override_render (gtype.Val, RenderCallback);
if (ObsoleteRenderVMCallback == null)
ObsoleteRenderVMCallback = new RenderNativeDelegate (ObsoleteRender_cb);
OverrideRender (gtype, ObsoleteRenderVMCallback); // -> autogenerated method
}
[GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideRender")]
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
[GLib.DefaultSignalHandler(Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideObsoleteRender")]
protected virtual void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
gtksharp_cellrenderer_base_render (Handle, window.Handle, widget.Handle, background_area, cell_area, expose_area, flags);
InternalRender (window, widget, background_area, cell_area, expose_area, flags);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_invoke_render (IntPtr gtype, IntPtr handle, IntPtr window, IntPtr widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags);
internal static void InternalRender (GLib.GType gtype, Gtk.CellRenderer cell, Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
gtksharp_cellrenderer_invoke_render (gtype.Val, cell.Handle, window.Handle, widget.Handle, background_area, cell_area, expose_area, flags);
}
[DllImport("gtksharpglue-2")]
static extern void gtksharp_cellrenderer_override_start_editing (IntPtr gtype, StartEditingDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr StartEditingDelegate (IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags);
static StartEditingDelegate StartEditingCallback;
static IntPtr StartEditing_cb (IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
// Compatibility code for old StartEditing(..) virtual method
static IntPtr ObsoleteStartEditing_cb (IntPtr cell, IntPtr evnt, IntPtr widget, IntPtr path, IntPtr background_area, IntPtr cell_area, int flags)
{
try {
CellRenderer obj = GLib.Object.GetObject (raw, false) as CellRenderer;
Gdk.Event _event = new Gdk.Event (evnt);
Widget widg = GLib.Object.GetObject (widget, false) as Gtk.Widget;
CellEditable retval = obj.StartEditing (_event, widg, GLib.Marshaller.Utf8PtrToString (path), background_area, cell_area, flags);
if (retval == null)
return IntPtr.Zero;
return retval.Handle;
Gtk.CellRenderer __obj = GLib.Object.GetObject (cell, false) as Gtk.CellRenderer;
Gtk.CellEditable __result = __obj.StartEditing (Gdk.Event.GetEvent (evnt), GLib.Object.GetObject(widget) as Gtk.Widget, GLib.Marshaller.Utf8PtrToString (path), Gdk.Rectangle.New (background_area), Gdk.Rectangle.New (cell_area), (Gtk.CellRendererState) flags);
return __result == null ? IntPtr.Zero : __result.Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
return IntPtr.Zero;
}
static void OverrideStartEditing (GLib.GType gtype)
static StartEditingNativeDelegate ObsoleteStartEditingVMCallback;
static void OverrideObsoleteStartEditing (GLib.GType gtype)
{
if (StartEditingCallback == null)
StartEditingCallback = new StartEditingDelegate (StartEditing_cb);
gtksharp_cellrenderer_override_start_editing (gtype.Val, StartEditingCallback);
if (ObsoleteStartEditingVMCallback == null)
ObsoleteStartEditingVMCallback = new StartEditingNativeDelegate (ObsoleteStartEditing_cb);
OverrideStartEditing (gtype, ObsoleteStartEditingVMCallback);
}
[DllImport("gtksharpglue-2")]
static extern IntPtr gtksharp_cellrenderer_base_start_editing(IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, int flags);
[GLib.DefaultSignalHandler (Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideStartEditing")]
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
[GLib.DefaultSignalHandler(Type=typeof(Gtk.CellRenderer), ConnectionMethod="OverrideObsoleteStartEditing")]
public virtual Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
IntPtr raw_ret = gtksharp_cellrenderer_base_start_editing(Handle, evnt.Handle, widget.Handle, native, ref background_area, ref cell_area, (int) flags);
GLib.Marshaller.Free (native);
Gtk.CellEditable ret = (Gtk.CellEditable) GLib.Object.GetObject(raw_ret);
return ret;
}
[DllImport("gtksharpglue-2")]
static extern IntPtr gtksharp_cellrenderer_invoke_start_editing(IntPtr gtype, IntPtr raw, IntPtr evnt, IntPtr widget, IntPtr path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, int flags);
internal static Gtk.CellEditable InternalStartEditing(GLib.GType gtype, Gtk.CellRenderer cell, Gdk.Event evnt, Gtk.Widget widget, string path, ref Gdk.Rectangle background_area, ref Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
IntPtr native = GLib.Marshaller.StringToPtrGStrdup (path);
IntPtr raw_ret = gtksharp_cellrenderer_invoke_start_editing(gtype.Val, cell.Handle, evnt.Handle, widget.Handle, native, ref background_area, ref cell_area, (int) flags);
GLib.Marshaller.Free (native);
Gtk.CellEditable ret = GLib.Object.GetObject(raw_ret) as Gtk.CellEditable;
return ret;
return InternalStartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererAccel.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererAccel.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererAccel.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererCombo.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererCombo.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererCombo.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererPixbuf.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererPixbuf.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererPixbuf.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererProgress.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererProgress.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererProgress.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererSpin.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererSpin.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererSpin.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererText.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererText.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererText.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -22,17 +22,20 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
[Obsolete ("Replaced by OnGetSize for implementations and GetSize(..., out Gdk.Rectangle bounds) for callers.")]
public override void GetSize (Gtk.Widget widget, ref Gdk.Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
CellRenderer.InternalGetSize (Gtk.CellRendererToggle.GType, this, widget, ref cell_area, out x_offset, out y_offset, out width, out height);
base.GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
}
[Obsolete ("Replaced by OnRender for subclass overrides and Render (Widget ...) for callers.")]
protected override void Render (Gdk.Drawable window, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, Gtk.CellRendererState flags)
{
CellRenderer.InternalRender (Gtk.CellRendererToggle.GType, this, window, widget, background_area, cell_area, expose_area, flags);
base.Render (window, widget, background_area, cell_area, expose_area, flags);
}
[Obsolete ("Replaced by OnStartEditing for subclass overrides and StartEditing (Gtk.Widget ...) for callers.")]
public override Gtk.CellEditable StartEditing(Gdk.Event evnt, Gtk.Widget widget, string path, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags)
{
return Gtk.CellRenderer.InternalStartEditing (Gtk.CellRendererToggle.GType, this, evnt, widget, path, ref background_area, ref cell_area, flags);
return base.StartEditing (evnt, widget, path, background_area, cell_area, flags);
}

View file

@ -179,18 +179,8 @@ protected virtual void ForAll (bool include_internals, Gtk.Callback callback)
gtksharp_container_base_forall (Handle, include_internals, invoker.Callback, invoker.Data);
}
[DllImport("libgtk-win32-2.0-0.dll")]
static extern IntPtr gtk_container_child_type(IntPtr raw);
[DllImport("gtksharpglue-2")]
static extern void gtksharp_container_override_child_type (IntPtr type, ChildTypeDelegate cb);
[GLib.CDeclCallback]
delegate IntPtr ChildTypeDelegate (IntPtr raw);
static ChildTypeDelegate ChildTypeCallback;
static IntPtr ChildType_cb (IntPtr raw)
// Compatibility code for old ChildType() virtual method
static IntPtr ObsoleteChildType_cb (IntPtr raw)
{
try {
Container obj = GLib.Object.GetObject (raw, false) as Container;
@ -203,18 +193,19 @@ static IntPtr ChildType_cb (IntPtr raw)
return GLib.GType.Invalid.Val;
}
static void OverrideChildType (GLib.GType gtype)
static ChildTypeNativeDelegate ObsoleteChildTypeVMCallback;
static void OverrideObsoleteChildType (GLib.GType gtype)
{
if (ChildTypeCallback == null)
ChildTypeCallback = new ChildTypeDelegate (ChildType_cb);
gtksharp_container_override_child_type (gtype.Val, ChildTypeCallback);
if (ObsoleteChildTypeVMCallback == null)
ObsoleteChildTypeVMCallback = new ChildTypeNativeDelegate (ObsoleteChildType_cb);
OverrideChildType (gtype, ObsoleteChildTypeVMCallback); // -> autogenerated method
}
[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideChildType")]
[Obsolete ("Replaced by OnChildType for implementations and SupportedChildType for callers.")]
[GLib.DefaultSignalHandler (Type=typeof(Gtk.Container), ConnectionMethod="OverrideObsoleteChildType")]
public virtual GLib.GType ChildType() {
IntPtr raw_ret = gtk_container_child_type(Handle);
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
return InternalChildType (); // -> autogenerated method
}
public class ContainerChild {

View file

@ -218,14 +218,12 @@
<attr path="/api/namespace/object[@cname='GtkAction']/method[@name='GetAccelClosure']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkAction']/method[@name='GetProxies']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkAccelGroup']/method[@name='Find']/*/*[@name='find_func']" name="scope">call</attr>
<attr path="/api/namespace/object[@cname='GtkAccelGroup']/signal[@name='AccelActivate']/*/*[@name='inst']" name="name">accel_group</attr>
<attr path="/api/namespace/object[@cname='GtkAccelGroup']/signal[@name='AccelActivate']/*/*[@name='p0']" name="name">acceleratable</attr>
<attr path="/api/namespace/object[@cname='GtkAccelGroup']/signal[@name='AccelActivate']/*/*[@name='p1']" name="name">keyval</attr>
<attr path="/api/namespace/object[@cname='GtkAccelGroup']/signal[@name='AccelActivate']/*/*[@name='p2']" name="name">modifier</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/method[@name='Foreach']/*/*[@name='foreach_func']" name="scope">call</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/method[@name='ForeachUnfiltered']/*/*[@name='foreach_func']" name="scope">call</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/signal[@name='Changed']" name="name">MapChanged</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/signal[@name='MapChanged']/*/*[@name='inst']" name="name">map</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/signal[@name='MapChanged']/*/*[@name='p0']" name="name">accel_path</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/signal[@name='MapChanged']/*/*[@name='p1']" name="name">accel_key</attr>
<attr path="/api/namespace/object[@cname='GtkAccelMap']/signal[@name='MapChanged']/*/*[@name='p2']" name="name">accel_mods</attr>
@ -239,15 +237,11 @@
<attr path="/api/namespace/object[@cname='GtkActionGroup']/method[@name='AddToggleActionsFull']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/method[@name='ListActions']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/method[@name='RemoveAction']" name="name">Remove</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='ConnectProxy']/*/*[@name='inst']" name="name">action_group</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='ConnectProxy']/*/*[@name='p0']" name="name">action</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='ConnectProxy']/*/*[@name='p1']" name="name">proxy</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='DisconnectProxy']/*/*[@name='inst']" name="name">action_group</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='DisconnectProxy']/*/*[@name='p0']" name="name">action</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='DisconnectProxy']/*/*[@name='p1']" name="name">proxy</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='PreActivate']/*/*[@name='inst']" name="name">action_group</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='PreActivate']/*/*[@name='p0']" name="name">action</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='PostActivate']/*/*[@name='inst']" name="name">action_group</attr>
<attr path="/api/namespace/object[@cname='GtkActionGroup']/signal[@name='PostActivate']/*/*[@name='p0']" name="name">action</attr>
<attr path="/api/namespace/object[@cname='GtkAdjustment']/constructor[@cname='gtk_adjustment_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkAdjustment']/method[@name='Changed']" name="name">Change</attr>
@ -281,6 +275,8 @@
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='EditingCanceled']" name="name">CancelEditing</attr>
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='StartEditing']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='GetSize']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/virtual_method[@cname='get_size']/*/*[@name='cell_area']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/virtual_method[@cname='get_size']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkCellRendererPixbuf']/property[@cname='gicon']" name="name">Icon</attr>
<attr path="/api/namespace/object[@cname='GtkCellRendererProgress']/property[@name='TextXalign']" name="name">TextXAlign</attr>
<attr path="/api/namespace/object[@cname='GtkCellRendererProgress']/property[@name='TextYalign']" name="name">TextYAlign</attr>
@ -297,7 +293,7 @@
<attr path="/api/namespace/object[@cname='GtkClipboard']/method[@name='WaitForContents']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/method[@name='WaitForRichText']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/method[@name='RequestRichText']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/signal" name="field_name"></attr>
<attr path="/api/namespace/object[@cname='GtkClipboard']/signal" name="block_glue">1</attr>
<attr path="/api/namespace/object[@cname='GtkColorButton']/method[@name='GetColor']/*/*[@name='color']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='GetColor']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkColorSelection']/method[@name='GetCurrentColor']/*/*[@name='color']" name="pass_as">out</attr>
@ -342,7 +338,8 @@
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='CheckResize']" name="name">ResizeChecked</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='Remove']" name="name">Removed</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/signal[@name='SetFocusChild']" name="name">FocusChildSet</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/method[@cname='gtk_container_child_type']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/method[@cname='gtk_container_child_type']" name="name">SupportedChildType</attr>
<attr path="/api/namespace/object[@cname='GtkContainer']/virtual_method[@cname='forall']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/constructor[@cname='gtk_dialog_new_with_buttons']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/field[@name='ActionArea']" name="type">GtkHButtonBox*</attr>
<attr path="/api/namespace/object[@cname='GtkDialog']/field[@name='Vbox']" name="name">VBox</attr>
@ -410,7 +407,6 @@
<attr path="/api/namespace/object[@cname='GtkHandleBox']/property[@name='ShadowType']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkHandleBox']/method[@name='GetChildDetached']" name="name">IsChildDetached</attr>
<attr path="/api/namespace/object[@cname='GtkHScale']/constructor[@cname='gtk_hscale_new_with_range']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkHSV']/signal" name="field_name"></attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='ChooseIcon']/*/*[@name='icon_names']" name="null_term_array">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='GetIconSizes']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkIconTheme']/method[@name='GetSearchPath']" name="hidden">1</attr>
@ -546,8 +542,8 @@
<attr path="/api/namespace/object[@cname='GtkPrinter']/method[@name='ListPapers']/return-type" name="element_type">GtkPageSetup*</attr>
<attr path="/api/namespace/object[@cname='GtkPrinter']/method[@name='ListPapers']/return-type" name="owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkPrinter']/method[@name='ListPapers']/return-type" name="elements_owned">true</attr>
<attr path="/api/namespace/object[@cname='GtkPrinter']/signal" name="field_name"></attr>
<attr path="/api/namespace/object[@cname='GtkPrintJob']/signal" name="field_name"></attr>
<attr path="/api/namespace/object[@cname='GtkPrinter']/signal" name="block_glue">1</attr>
<attr path="/api/namespace/object[@cname='GtkPrintJob']/signal" name="block_glue">1</attr>
<attr path="/api/namespace/object[@cname='GtkPrintSettings']/constructor[@cname='gtk_print_settings_new_from_file']/*/*[@name='file_name']" name="type">const-gfilename*</attr>
<attr path="/api/namespace/object[@cname='GtkPrintSettings']/method[@name='Foreach']/*/*[@name='func']" name="scope">call</attr>
<attr path="/api/namespace/object[@cname='GtkPrintSettings']/method[@name='ToFile']/*/*[@name='file_name']" name="type">const-gfilename*</attr>
@ -691,6 +687,7 @@
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='GetVisibleRect']/*/*[@type='GdkRectangle*']" name="pass_as">out</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/method[@name='MoveVisually']/*/*[@type='GtkTextIter*']" name="pass_as">ref</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/signal[@name='SetScrollAdjustments']" name="name">ScrollAdjustmentsSet</attr>
<attr path="/api/namespace/object[@cname='GtkTextView']/virtual_method[@cname='move_focus']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkToggleAction']/method[@name='Toggled']" name="name">Toggle</attr>
<attr path="/api/namespace/object[@cname='GtkToggleButton']/constructor[@cname='gtk_toggle_button_new_with_mnemonic']" name="preferred">1</attr>
<attr path="/api/namespace/object[@cname='GtkToggleButton']/method[@name='Toggled']" name="name">Toggle</attr>
@ -825,7 +822,6 @@
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='DragFailed']/*/*[@name='p0']" name="name">drag_context</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='DragFailed']/*/*[@name='p1']" name="name">drag_result</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='Event']" name="name">WidgetEvent</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='EventAfter']/*/*[@name='inst']" name="name">widget</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='EventAfter']/*/*[@name='p0']" name="name">event</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='EventAfter']" name="name">WidgetEventAfter</attr>
<attr path="/api/namespace/object[@cname='GtkWidget']/signal[@name='Focus']" name="name">Focused</attr>
@ -858,6 +854,7 @@
<attr path="/api/namespace/object[@cname='GtkWindow']/property[@name='Screen']" name="new_flag">1</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/signal[@name='ActivateDefault']" name="name">DefaultActivated</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/signal[@name='ActivateFocus']" name="name">FocusActivated</attr>
<attr path="/api/namespace/object[@cname='GtkWindow']/virtual_method[@cname='move_focus']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkBindingArg']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkBindingEntry']" name="hidden">1</attr>
<attr path="/api/namespace/struct[@cname='GtkBindingSet']" name="hidden">1</attr>

View file

@ -23,13 +23,18 @@
#include <gtk/gtkcellrenderer.h>
void gtksharp_cellrenderer_invoke_get_size (GType gtype, GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height);
const gchar *__gtype_prefix = "__gtksharp_";
#define HAS_PREFIX(a) (*((guint64 *)(a)) == *((guint64 *) __gtype_prefix))
void
gtksharp_cellrenderer_invoke_get_size (GType type, GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height)
static GObjectClass *
get_threshold_class (GObject *obj)
{
GtkCellRendererClass *klass = g_type_class_peek (type);
klass->get_size (cell, widget, cell_area, x_offset, y_offset, width, height);
GType gtype = G_TYPE_FROM_INSTANCE (obj);
while (HAS_PREFIX (g_type_name (gtype)))
gtype = g_type_parent (gtype);
GObjectClass *klass = g_type_class_peek (gtype);
if (klass == NULL) klass = g_type_class_ref (gtype);
return klass;
}
void gtksharp_cellrenderer_base_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height);
@ -37,80 +42,17 @@ void gtksharp_cellrenderer_base_get_size (GtkCellRenderer *cell, GtkWidget *widg
void
gtksharp_cellrenderer_base_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area, gint *x_offset, gint *y_offset, gint *width, gint *height)
{
GtkCellRendererClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (cell));
if (parent->get_size)
(*parent->get_size) (cell, widget, cell_area, x_offset, y_offset, width, height);
GtkCellRendererClass *klass = (GtkCellRendererClass *) get_threshold_class (G_OBJECT (cell));
if (klass->get_size)
(* klass->get_size) (cell, widget, cell_area, x_offset, y_offset, width, height);
}
void gtksharp_cellrenderer_override_get_size (GType gtype, gpointer cb);
void
gtksharp_cellrenderer_override_get_size (GType gtype, gpointer cb)
{
GtkCellRendererClass *klass = g_type_class_peek (gtype);
if (!klass)
GObjectClass *klass = g_type_class_peek (gtype);
if (klass == NULL)
klass = g_type_class_ref (gtype);
((GtkCellRendererClass *) klass)->get_size = cb;
}
void gtksharp_cellrenderer_invoke_render (GType type, GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags);
void
gtksharp_cellrenderer_invoke_render (GType type, GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
{
GtkCellRendererClass *klass = g_type_class_peek (type);
klass->render (cell, window, widget, background_area, cell_area, expose_area, flags);
}
void gtksharp_cellrenderer_base_render (GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags);
void
gtksharp_cellrenderer_base_render (GtkCellRenderer *cell, GdkDrawable *window, GtkWidget *widget, GdkRectangle *background_area, GdkRectangle *cell_area, GdkRectangle *expose_area, GtkCellRendererState flags)
{
GtkCellRendererClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (cell));
if (parent->render)
(*parent->render) (cell, window, widget, background_area, cell_area, expose_area, flags);
}
void gtksharp_cellrenderer_override_render (GType gtype, gpointer cb);
void
gtksharp_cellrenderer_override_render (GType gtype, gpointer cb)
{
GtkCellRendererClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((GtkCellRendererClass *) klass)->render = cb;
}
GtkCellEditable * gtksharp_cellrenderer_invoke_start_editing (GType type, GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags);
GtkCellEditable *
gtksharp_cellrenderer_invoke_start_editing (GType type, GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
{
GtkCellRendererClass *klass = g_type_class_peek (type);
return klass->start_editing (cell, event, widget, path, background_area, cell_area, flags);
}
GtkCellEditable * gtksharp_cellrenderer_base_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags);
GtkCellEditable *
gtksharp_cellrenderer_base_start_editing (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, GdkRectangle *background_area, GdkRectangle *cell_area, GtkCellRendererState flags)
{
GtkCellRendererClass *parent = g_type_class_peek_parent (G_OBJECT_GET_CLASS (cell));
if (parent->start_editing)
return (*parent->start_editing) (cell, event, widget, path, background_area, cell_area, flags);
return NULL;
}
void gtksharp_cellrenderer_override_start_editing (GType gtype, gpointer cb);
void
gtksharp_cellrenderer_override_start_editing (GType gtype, gpointer cb)
{
GtkCellRendererClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((GtkCellRendererClass *) klass)->start_editing = cb;
}

View file

@ -50,17 +50,6 @@ gtksharp_container_invoke_gtk_callback (GtkCallback cb, GtkWidget *widget, gpoin
cb (widget, data);
}
void gtksharp_container_override_child_type (GType gtype, gpointer cb);
void
gtksharp_container_override_child_type (GType gtype, gpointer cb)
{
GtkContainerClass *klass = g_type_class_peek (gtype);
if (!klass)
klass = g_type_class_ref (gtype);
((GtkContainerClass *) klass)->child_type = cb;
}
void gtksharp_container_child_get_property (GtkContainer *container, GtkWidget *child,
const gchar* property, GValue *value);

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<api parser_version="1">
<api parser_version="2">
<!--
This file was automatically generated.
@ -309,6 +309,9 @@
</method>
</object>
<object name="Context" cname="PangoContext" parent="GObject">
<class_struct cname="PangoContextClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<method name="GetBaseDir" cname="pango_context_get_base_dir">
<return-type type="PangoDirection" />
</method>
@ -576,6 +579,9 @@
</method>
</object>
<object name="Layout" cname="PangoLayout" parent="GObject">
<class_struct cname="PangoLayoutClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
</class_struct>
<method name="ContextChanged" cname="pango_layout_context_changed">
<return-type type="void" />
</method>
@ -853,6 +859,23 @@
</method>
</object>
<object name="Renderer" cname="PangoRenderer" parent="GObject">
<class_struct cname="PangoRendererClass">
<field name="ParentClass" cname="parent_class" type="GObjectClass" />
<method vm="draw_glyphs" />
<method vm="draw_rectangle" />
<method vm="draw_error_underline" />
<method vm="draw_shape" />
<method vm="draw_trapezoid" />
<method vm="draw_glyph" />
<method vm="part_changed" />
<method vm="begin" />
<method vm="end" />
<method vm="prepare_run" />
<method vm="draw_glyph_item" />
<method vm="_pango_reserved2" />
<method vm="_pango_reserved3" />
<method vm="_pango_reserved4" />
</class_struct>
<field name="Underline" cname="underline" type="PangoUnderline" />
<field name="Strikethrough" cname="strikethrough" type="gboolean" />
<field name="ActiveCount" cname="active_count" type="int" />
@ -861,7 +884,6 @@
<virtual_method name="DrawGlyphs" cname="draw_glyphs">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoFont*" name="font" />
<parameter type="PangoGlyphString*" name="glyphs" />
<parameter type="int" name="x" />
@ -871,7 +893,6 @@
<virtual_method name="DrawRectangle" cname="draw_rectangle">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoRenderPart" name="part" />
<parameter type="int" name="x" />
<parameter type="int" name="y" />
@ -882,7 +903,6 @@
<virtual_method name="DrawErrorUnderline" cname="draw_error_underline">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="int" name="x" />
<parameter type="int" name="y" />
<parameter type="int" name="width" />
@ -892,7 +912,6 @@
<virtual_method name="DrawShape" cname="draw_shape">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoAttrShape*" name="attr" />
<parameter type="int" name="x" />
<parameter type="int" name="y" />
@ -901,7 +920,6 @@
<virtual_method name="DrawTrapezoid" cname="draw_trapezoid">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoRenderPart" name="part" />
<parameter type="double" name="y1_" />
<parameter type="double" name="x11" />
@ -914,7 +932,6 @@
<virtual_method name="DrawGlyph" cname="draw_glyph">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoFont*" name="font" />
<parameter type="PangoGlyph" name="glyph" />
<parameter type="double" name="x" />
@ -924,39 +941,41 @@
<virtual_method name="PartChanged" cname="part_changed">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoRenderPart" name="part" />
</parameters>
</virtual_method>
<virtual_method name="Begin" cname="begin">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="End" cname="end">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
</parameters>
<parameters />
</virtual_method>
<virtual_method name="PrepareRun" cname="prepare_run">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="PangoLayoutRun*" name="run" />
</parameters>
</virtual_method>
<virtual_method name="DrawGlyphItem" cname="draw_glyph_item">
<return-type type="void" />
<parameters>
<parameter type="PangoRenderer*" name="renderer" />
<parameter type="const-char*" name="text" />
<parameter type="PangoGlyphItem*" name="glyph_item" />
<parameter type="int" name="x" />
<parameter type="int" name="y" />
</parameters>
</virtual_method>
<virtual_method name="PangoReserved2" cname="_pango_reserved2" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="PangoReserved3" cname="_pango_reserved3" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<virtual_method name="PangoReserved4" cname="_pango_reserved4" shared="true" padding="true">
<return-type type="void" />
</virtual_method>
<method name="Activate" cname="pango_renderer_activate">
<return-type type="void" />
</method>

View file

@ -5,7 +5,7 @@
# Author: Mike Kestner <mkestner@speakeasy.net>
#
# Copyright (c) 2001-2003 Mike Kestner
# Copyright (c) 2003-2004 Novell, Inc.
# Copyright (c) 2003-2009 Novell, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@ -22,7 +22,7 @@
# Boston, MA 02111-1307, USA.
##############################################################
$parser_version = 1;
$parser_version = 2;
$debug=$ENV{'GAPI_DEBUG'};
use XML::LibXML;
@ -34,6 +34,10 @@ if (!$ARGV[2]) {
$ns = $ARGV[0];
$libname = $ARGV[2];
# Used by name mangling sub
%num2txt = ('1', "One", '2', "Two", '3', "Three", '4', "Four", '5', "Five",
'6', "Six", '7', "Seven", '8', "Eight", '9', "Nine", '0', "Zero");
##############################################################
# Check if the filename provided exists. We parse existing files into
# a tree and append the namespace to the root node. If the file doesn't
@ -319,12 +323,15 @@ foreach $type (sort(keys(%ifaces))) {
$elem_table{lc($inst)} = $iface_el;
$classdef = $sdefs{$1} if ($ifacetype =~ /struct\s+(\w+)/);
my @signal_vms;
if ($initfunc) {
parseInitFunc($iface_el, $initfunc, $classdef);
@signal_vms = parseInitFunc($iface_el, $initfunc, $classdef);
} else {
warn "Don't have an init func for $inst.\n" if $debug;
addVirtualMethods ($classdef, $classdef, $iface_el);
# my @signal_vms;
}
addClassElem ($iface_el, $classdef, @signal_vms) if ($classdef);
}
@ -375,11 +382,13 @@ foreach $type (sort(keys(%objects))) {
# Get the props from the class_init func.
if ($initfunc) {
parseInitFunc($obj_el, $initfunc, $classdef);
@signal_vms = parseInitFunc($obj_el, $initfunc, $classdef);
} else {
warn "Don't have an init func for $inst.\n" if $debug;
}
addClassElem ($obj_el, $classdef, @signal_vms) if ($classdef);
# Get the interfaces from the class_init func.
if ($typefunc) {
if ($typefunc =~ /G_DEFINE_TYPE_WITH_CODE/) {
@ -495,6 +504,81 @@ print "structs: $scnt enums: $ecnt callbacks: $cbcnt\n";
print "funcs: $fcnt types: $tcnt classes: $classcnt\n";
print "props: $propcnt childprops: $childpropcnt signals: $sigcnt\n\n";
sub addClassElem
{
my ($obj_el, $classdef, @signal_vms) = @_;
my %is_signal_vm;
for (@signal_vms) {
$is_signal_vm{$_} = 1;
}
if ($classdef =~ /struct\s+_?(\w+)\s*{(.*)};/) {
my $elem = $doc->createElement('class_struct');
$elem->setAttribute('cname', $1);
$obj_el->insertBefore($elem, $obj_el->firstChild);
$fields = $2;
$fields =~ s!/\*.*?\*/!!g; # Remove comments
foreach $field (split (/;/, $fields)) {
if ($field =~ /\s*(G_CONST_RETURN\s+)?(\S+\s*\**)\s*\(\s*\*\s*(\w+)\)\s*(\((.*?)\))?/) {
$ret = $1 . $2; $cname = $3; $parms = $5;
$class_elem = $doc->createElement('method');
$elem->appendChild($class_elem);
if ($is_signal_vm{$cname}) {
$class_elem->setAttribute('signal_vm', $cname);
} else {
$class_elem->setAttribute('vm', $cname);
$vm_elem = $doc->createElement('virtual_method');
$obj_el->appendChild($vm_elem);
$vm_elem->setAttribute('name', StudlyCaps($cname));
$vm_elem->setAttribute('cname', $cname);
addReturnElem($vm_elem, $ret);
if ($parms && ($parms ne "void")) { # if there are any parameters
@parm_arr = split(/,/, $parms);
$parms =~ /\s*(\w+)/; # Get type of first parameter
if ($1 ne $obj_el->getAttribute ('cname')) {
$vm_elem->setAttribute('shared', 'true'); # First parameter is not of the type of the declaring class -> static vm
} else {
($dump, @parm_arr) = @parm_arr;
}
addParamsElem($vm_elem, @parm_arr);
} else {
$vm_elem->setAttribute('shared', 'true');
}
if ($cname =~ /reserved[0-9]+$/ || $cname =~ /padding[0-9]+$/ || $cname =~ /recent[0-9]+$/) {
$vm_elem->setAttribute('padding', 'true');
}
}
} elsif ($field =~ /(unsigned\s+)?(\S+)\s+(.+)/) {
my $type = $1 . $2; $symb = $3;
foreach $tok (split (/,\s*/, $symb)) { # multiple field defs may occur in one line; like int xrange, yrange;
$tok =~ /(\*)?(\w+)\s*(.*)/;
my $field_type = $type . $1; my $cname = $2; my $modifiers = $3;
$fld_elem = addNameElem($elem, 'field', $cname, "");
$fld_elem->setAttribute('type', "$field_type");
if ($modifiers =~ /\[(.*)\]/) {
$fld_elem->setAttribute('array_len', "$1");
} elsif ($modifiers =~ /\:\s*(\d+)/) {
$fld_elem->setAttribute('bits', "$1");
}
}
} elsif ($field =~ /\S+/) {
print "***** Unmatched class struct field $field\n";
}
}
} else {
print "***** Unmatched $classdef\n";
}
}
sub addFieldElems
{
my ($parent, $defaultaccess, @fields) = @_;
@ -830,6 +914,9 @@ sub addParamsElem
}elsif ($parm =~ /(unsigned )?(\S+)\s+(\S+)/) {
$parm_elem->setAttribute('type', $1 . $2);
$name = $3;
} elsif ($parm =~ /(\w+\*)(\w+)/) {
$parm_elem->setAttribute('type', $1);
$name = $2;
} elsif ($parm =~ /(\S+)/) {
$parm_elem->setAttribute('type', $1);
$name = "arg" . $parm_num;
@ -950,11 +1037,22 @@ sub addSignalElem
}
$sig_elem->setAttribute('when', $1) if ($spec =~ /_RUN_(\w+)/);
my $method = "";
$sig_elem->setAttribute('manual', 'true') if ($spec =~ /G_TYPE_POINTER/);
if ($spec =~ /_OFFSET\s*\(\w+,\s*(\w+)\)/) {
$method = $1;
$sig_elem->setAttribute('field_name', $1);
my $method = $1;
$sig_elem->setAttribute('field_name', $method);
if ($class =~ /;\s*(\/\*< (public|protected|private) >\s*\*\/)?(G_CONST_RETURN\s+)?(\w+\s*\**)\s*\(\s*\*\s*$method\)\s*\((.*?)\);/) {
$ret = $4; $parms = $5;
addReturnElem($sig_elem, $ret);
if ($parms && ($parms ne "void")) {
my ($dump, @parm_arr) = split (/,/, $parms);
addParamsElem($sig_elem, @parm_arr);
}
return $method;
} else {
die "ERROR: Failed to parse method $method from class definition:\n$class";
}
} else {
@args = split(/,/, $spec);
my $rettype = parseTypeToken ($args[7]);
@ -963,10 +1061,7 @@ sub addSignalElem
$parmcnt =~ s/.*(\d+).*/\1/;
$parms_elem = $doc->createElement('parameters');
$sig_elem->appendChild($parms_elem);
$parm_elem = $doc->createElement('parameter');
$parms_elem->appendChild($parm_elem);
$parm_elem->setAttribute('name', "inst");
$parm_elem->setAttribute('type', "$inst*");
for (my $idx = 0; $idx < $parmcnt; $idx++) {
my $argtype = parseTypeToken ($args[9+$idx]);
$parm_elem = $doc->createElement('parameter');
@ -974,60 +1069,9 @@ sub addSignalElem
$parm_elem->setAttribute('name', "p$idx");
$parm_elem->setAttribute('type', $argtype);
}
return $class;
return "";
}
if ($class =~ /;\s*(\/\*< (public|protected|private) >\s*\*\/)?(G_CONST_RETURN\s+)?(\w+\s*\**)\s*\(\s*\*\s*$method\)\s*\((.*?)\);/) {
$ret = $4; $parms = $5;
addReturnElem($sig_elem, $ret);
if ($parms && ($parms ne "void")) {
addParamsElem($sig_elem, split(/,/, $parms));
}
$class =~ s/;\s*(\/\*< (public|protected|private) >\s*\*\/)?(G_CONST_RETURN\s+)?\w+\s*\**\s*\(\s*\*\s*$method\)\s*\(.*?\);/;/;
} else {
die "ERROR: Failed to parse method $method from class definition:\n$class";
}
return $class;
}
sub addVirtualMethods
{
my ($class, $orig_class, $node) = @_;
$class =~ s/\n\s*//g;
$class =~ s/\/\*.*?\*\///g;
my $idx = 0;
my $ins_sibling = $node->firstChild;
while ($ins_sibling && ($ins_sibling->nodeName eq "field" || $ins_sibling->nodeName eq "property")) {
$ins_sibling = $ins_sibling->nextSibling ();
}
while ($class =~ /;\s*(G_CONST_RETURN\s+)?(\S+\s*\**)\s*\(\s*\*\s*(\w+)\)\s*\((.*?)\);/) {
$ret = $1 . $2; $cname = $3; $parms = $4;
$orig_class =~ /;\s*(G_CONST_RETURN\s+)?(\S+\s*\**)\s*\(\s*\*\s*(\w+)\)\s*\((.*?)\);/;
while ($ins_sibling && $3 ne $cname) {
$ins_sibling = $ins_sibling->nextSibling ();
$orig_class =~ s/;(.*?\));/;/;
$orig_class =~ /;\s*(G_CONST_RETURN\s+)?(\S+\s*\**)\s*\(\s*\*\s*(\w+)\)\s*\((.*?)\);/;
}
if ($cname !~ /reserved/) {
$vm_elem = $doc->createElement('virtual_method');
if ($ins_sibling) {
$node->insertBefore($vm_elem, $ins_sibling);
} else {
$node->appendChild($vm_elem);
}
$vm_elem->setAttribute('name', StudlyCaps($cname));
$vm_elem->setAttribute('cname', $cname);
addReturnElem($vm_elem, $ret);
if ($parms && ($parms ne "void")) {
addParamsElem($vm_elem, split(/,/, $parms));
}
}
$class =~ s/;\s*(G_CONST_RETURN\s+)?\S+\s*\**\s*\(\s*\*\s*\w+\)\s*\(.*?\);/;/;
$orig_class =~ s/;.*?\);/;/;
}
}
sub addImplementsElem
{
@ -1045,9 +1089,9 @@ sub addImplementsElem
sub parseInitFunc
{
my ($obj_el, $initfunc, $classdef) = @_;
my $orig_classdef = $classdef;
my @init_lines = split (/\n/, $initfunc);
my @signal_vms = ();
my $linenum = 0;
while ($linenum < @init_lines) {
@ -1075,13 +1119,13 @@ sub parseInitFunc
do {
$sig .= $init_lines[++$linenum];
} until ($init_lines[$linenum] =~ /;/);
$classdef = addSignalElem ($sig, $classdef, $obj_el);
$signal_vm = addSignalElem ($sig, $classdef, $obj_el);
push (@signal_vms, $signal_vm) if $signal_vm;
$sigcnt++;
}
$linenum++;
}
addVirtualMethods ($classdef, $orig_classdef, $obj_el);
return @signal_vms;
}
sub parseTypeFuncMacro
@ -1139,9 +1183,6 @@ sub parseTypeFunc
# Converts a dash or underscore separated name to StudlyCaps.
##############################################################
%num2txt = ('1', "One", '2', "Two", '3', "Three", '4', "Four", '5', "Five",
'6', "Six", '7', "Seven", '8', "Eight", '9', "Nine", '0', "Zero");
sub StudlyCaps
{
my ($symb) = @_;

View file

@ -26,7 +26,7 @@ public class CustomCellRenderer : CellRenderer
}
}
public override void GetSize (Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
protected override void OnGetSize (Widget widget, ref Rectangle cell_area, out int x_offset, out int y_offset, out int width, out int height)
{
int calc_width = (int) this.Xpad * 2 + 100;
int calc_height = (int) this.Ypad * 2 + 10;
@ -45,11 +45,11 @@ public class CustomCellRenderer : CellRenderer
}
}
protected override void Render (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
protected override void OnRender (Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
{
int width = 0, height = 0, x_offset = 0, y_offset = 0;
StateType state;
GetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
OnGetSize (widget, ref cell_area, out x_offset, out y_offset, out width, out height);
if (widget.HasFocus)
state = StateType.Active;