Support GetIndexInParent.
svn path=/trunk/gtk-sharp/; revision=112901
This commit is contained in:
parent
324929ee4b
commit
cbf6068edf
3 changed files with 47 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
2008-09-12 Mike Gorse <mgorse@novell.com>
|
||||
|
||||
* atk/Object.custom, atk/glue/object.c: Support GetIndexInParent.
|
||||
|
||||
2008-09-09 Mike Kestner <mkestner@novell.com>
|
||||
|
||||
* generator/ReturnValue.cs: warning cleanup.
|
||||
|
|
|
@ -150,4 +150,36 @@
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ 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_get_n_children (GType gtype, gpointer cb)
|
||||
|
@ -67,3 +68,13 @@ atksharp_object_base_ref_state_set (AtkObject *atk_obj)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue