* atk/Object.custom:

* atk/glue/object.c: Implement virtual method OnRefStateSet().

svn path=/trunk/gtk-sharp/; revision=105160
This commit is contained in:
Andrés G. Aragoneses 2008-06-06 14:56:01 +00:00
parent be458c5034
commit 15cf27b0dd
3 changed files with 70 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2008-06-06 Andres G. Aragoneses <aaragoneses@novell.com>
* atk/Object.custom:
* atk/glue/object.c: Implement virtual method OnRefStateSet().
2008-05-30 Mike Kestner <mkestner@novell.com>
* gdk/Pixbuf.custom: don't use the autogenerated PixbufDestroyNative

View file

@ -33,7 +33,7 @@
{
try {
Atk.Object obj = GLib.Object.GetObject (raw, false) as Atk.Object;
return obj.OnGetNChildren();
return obj.OnGetNChildren ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
@ -88,7 +88,7 @@
}
[GLib.DefaultSignalHandler (Type=typeof(Atk.Object), ConnectionMethod="OverrideRefChild")]
protected virtual Atk.Object OnRefChild(int i) {
protected virtual Atk.Object OnRefChild (int i) {
return null;
}
@ -104,4 +104,44 @@
Add,
Remove
}
[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 (Atk.StateSet) GLib.Object.GetObject(raw, true);
}

View file

@ -26,6 +26,11 @@ 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_n_children (GType gtype, gpointer cb)
{
@ -43,3 +48,21 @@ atksharp_object_override_ref_child (GType gtype, gpointer cb)
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_parent (G_OBJECT_GET_CLASS (atk_obj));
if (parent->ref_state_set)
return (*parent->ref_state_set) (atk_obj);
return NULL;
}