widget: Add _gtk_widget_peek_accessible()

This function returns the accessible if it already exists. This way we
can call functions on the accessible from the widget itself instead of
having to rely on signals.
This commit is contained in:
Benjamin Otte 2011-11-12 03:38:40 +01:00
parent 24e4a03af2
commit 0b716e77ea
2 changed files with 21 additions and 0 deletions

View File

@ -11289,6 +11289,25 @@ gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class,
priv->accessible_role = role;
}
/**
* _gtk_widget_peek_accessible:
* @widget: a #GtkWidget
*
* Gets the accessible for @widget, if it has been created yet.
* Otherwise, this function returns %NULL. If the @widget's implementation
* does not use the default way to create accessibles, %NULL will always be
* returned.
*
* Returns: the accessible for @widget or %NULL if none has been
* created yet.
**/
AtkObject *
_gtk_widget_peek_accessible (GtkWidget *widget)
{
return g_object_get_qdata (G_OBJECT (widget),
quark_accessible_object);
}
/**
* gtk_widget_get_accessible:
* @widget: a #GtkWidget

View File

@ -118,6 +118,8 @@ void _gtk_widget_free_cached_sizes (GtkWidget *widget);
const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
gboolean *locked);
AtkObject * _gtk_widget_peek_accessible (GtkWidget *widget);
GdkEventExpose * _gtk_cairo_get_event (cairo_t *cr);
void _gtk_widget_draw_internal (GtkWidget *widget,