a11y: Add private GtkContainerAccessible functions to add/remove a child
This may be useful in container implementations, or for internal children that trigger no signal emission. https://bugzilla.gnome.org/show_bug.cgi?id=725864
This commit is contained in:
@ -115,6 +115,7 @@ gtka11y_private_h_sources = \
|
||||
gtkaccessibilityutil.h \
|
||||
gtkcellaccessibleprivate.h \
|
||||
gtkcolorswatchaccessibleprivate.h \
|
||||
gtkcontaineraccessibleprivate.h \
|
||||
gtkiconviewaccessibleprivate.h \
|
||||
gtklabelaccessibleprivate.h \
|
||||
gtkflowboxaccessibleprivate.h \
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcontaineraccessible.h"
|
||||
#include "gtkcontaineraccessibleprivate.h"
|
||||
|
||||
struct _GtkContainerAccessiblePrivate
|
||||
{
|
||||
@ -118,11 +119,10 @@ gtk_container_accessible_real_add_gtk (GtkContainer *container,
|
||||
atk_child = gtk_widget_get_accessible (widget);
|
||||
accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent);
|
||||
|
||||
g_object_notify (G_OBJECT (atk_child), "accessible-parent");
|
||||
g_list_free (accessible->priv->children);
|
||||
accessible->priv->children = gtk_container_get_children (container);
|
||||
index = g_list_index (accessible->priv->children, widget);
|
||||
g_signal_emit_by_name (atk_parent, "children-changed::add", index, atk_child, NULL);
|
||||
_gtk_container_accessible_add_child (accessible, atk_child, index);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -143,12 +143,11 @@ gtk_container_accessible_real_remove_gtk (GtkContainer *container,
|
||||
return 1;
|
||||
accessible = GTK_CONTAINER_ACCESSIBLE (atk_parent);
|
||||
|
||||
g_object_notify (G_OBJECT (atk_child), "accessible-parent");
|
||||
index = g_list_index (accessible->priv->children, widget);
|
||||
g_list_free (accessible->priv->children);
|
||||
accessible->priv->children = gtk_container_get_children (container);
|
||||
if (index >= 0 && index <= g_list_length (accessible->priv->children))
|
||||
g_signal_emit_by_name (atk_parent, "children-changed::remove", index, atk_child, NULL);
|
||||
if (index >= 0)
|
||||
_gtk_container_accessible_remove_child (accessible, atk_child, index);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -200,3 +199,21 @@ gtk_container_accessible_init (GtkContainerAccessible *container)
|
||||
{
|
||||
container->priv = gtk_container_accessible_get_instance_private (container);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_container_accessible_add_child (GtkContainerAccessible *accessible,
|
||||
AtkObject *child,
|
||||
gint index)
|
||||
{
|
||||
g_object_notify (G_OBJECT (child), "accessible-parent");
|
||||
g_signal_emit_by_name (accessible, "children-changed::add", index, child, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_container_accessible_remove_child (GtkContainerAccessible *accessible,
|
||||
AtkObject *child,
|
||||
gint index)
|
||||
{
|
||||
g_object_notify (G_OBJECT (child), "accessible-parent");
|
||||
g_signal_emit_by_name (accessible, "children-changed::remove", index, child, NULL);
|
||||
}
|
||||
|
||||
33
gtk/a11y/gtkcontaineraccessibleprivate.h
Normal file
33
gtk/a11y/gtkcontaineraccessibleprivate.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2001 Sun Microsystems Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkcontaineraccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_container_accessible_add_child (GtkContainerAccessible *accessible,
|
||||
AtkObject *child,
|
||||
gint index);
|
||||
void _gtk_container_accessible_remove_child (GtkContainerAccessible *accessible,
|
||||
AtkObject *child,
|
||||
gint index);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CONTAINER_ACCESSIBLE_PRIVATE_H__ */
|
||||
Reference in New Issue
Block a user