2012-10-30 14:21:44 +00:00
|
|
|
/* GTK+ - accessibility implementations
|
2011-07-09 22:30:59 +00:00
|
|
|
* Copyright 2001 Sun Microsystems Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2011-07-09 22:30:59 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-02-04 05:53:48 +00:00
|
|
|
#include <glib/gi18n-lib.h>
|
2011-07-09 22:30:59 +00:00
|
|
|
#include <gtk/gtk.h>
|
2011-07-09 22:51:27 +00:00
|
|
|
#include "gtkcontainercellaccessible.h"
|
2012-12-27 06:04:46 +00:00
|
|
|
#include "gtkcellaccessibleprivate.h"
|
2011-07-10 03:56:42 +00:00
|
|
|
#include "gtkcellaccessibleparent.h"
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2014-02-26 01:29:36 +00:00
|
|
|
struct _GtkCellAccessiblePrivate
|
|
|
|
{
|
|
|
|
AtkObject *parent;
|
|
|
|
};
|
|
|
|
|
2011-12-11 04:02:36 +00:00
|
|
|
static const struct {
|
|
|
|
AtkState atk_state;
|
|
|
|
GtkCellRendererState renderer_state;
|
|
|
|
gboolean invert;
|
|
|
|
} state_map[] = {
|
|
|
|
{ ATK_STATE_SENSITIVE, GTK_CELL_RENDERER_INSENSITIVE, TRUE },
|
|
|
|
{ ATK_STATE_ENABLED, GTK_CELL_RENDERER_INSENSITIVE, TRUE },
|
|
|
|
{ ATK_STATE_SELECTED, GTK_CELL_RENDERER_SELECTED, FALSE },
|
|
|
|
/* XXX: why do we map ACTIVE here? */
|
|
|
|
{ ATK_STATE_ACTIVE, GTK_CELL_RENDERER_FOCUSED, FALSE },
|
|
|
|
{ ATK_STATE_FOCUSED, GTK_CELL_RENDERER_FOCUSED, FALSE },
|
|
|
|
{ ATK_STATE_EXPANDABLE,GTK_CELL_RENDERER_EXPANDABLE, FALSE },
|
|
|
|
{ ATK_STATE_EXPANDED, GTK_CELL_RENDERER_EXPANDED, FALSE },
|
|
|
|
};
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
static GtkCellRendererState gtk_cell_accessible_get_state (GtkCellAccessible *cell);
|
2011-07-09 22:30:59 +00:00
|
|
|
static void atk_action_interface_init (AtkActionIface *iface);
|
|
|
|
static void atk_component_interface_init (AtkComponentIface *iface);
|
2018-12-14 19:25:27 +00:00
|
|
|
static void atk_table_cell_interface_init (AtkTableCellIface *iface);
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkCellAccessible, gtk_cell_accessible, GTK_TYPE_ACCESSIBLE,
|
2014-02-26 01:29:36 +00:00
|
|
|
G_ADD_PRIVATE (GtkCellAccessible)
|
2011-07-09 22:30:59 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
2018-12-14 19:25:27 +00:00
|
|
|
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
|
|
|
|
G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE_CELL, atk_table_cell_interface_init))
|
2011-07-09 22:30:59 +00:00
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
2011-11-10 21:07:19 +00:00
|
|
|
AtkObject *parent;
|
2011-07-09 22:30:59 +00:00
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (obj);
|
2011-11-11 00:25:09 +00:00
|
|
|
|
2014-02-26 01:29:36 +00:00
|
|
|
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent))
|
|
|
|
return g_list_index (gtk_container_cell_accessible_get_children (GTK_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)), obj);
|
2011-11-11 00:25:09 +00:00
|
|
|
|
2011-12-19 05:10:16 +00:00
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
2011-11-10 21:07:19 +00:00
|
|
|
if (parent == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2014-02-26 01:29:36 +00:00
|
|
|
return gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (cell->priv->parent), cell);
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
2014-03-24 14:51:38 +00:00
|
|
|
static AtkRelationSet *
|
|
|
|
gtk_cell_accessible_ref_relation_set (AtkObject *object)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
|
|
|
AtkRelationSet *relationset;
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
relationset = ATK_OBJECT_CLASS (gtk_cell_accessible_parent_class)->ref_relation_set (object);
|
|
|
|
if (relationset == NULL)
|
|
|
|
relationset = atk_relation_set_new ();
|
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (object);
|
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
|
|
|
|
|
|
|
gtk_cell_accessible_parent_update_relationset (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
|
|
|
cell,
|
|
|
|
relationset);
|
|
|
|
|
|
|
|
return relationset;
|
|
|
|
}
|
|
|
|
|
2011-07-09 22:30:59 +00:00
|
|
|
static AtkStateSet *
|
2011-11-24 00:59:18 +00:00
|
|
|
gtk_cell_accessible_ref_state_set (AtkObject *accessible)
|
2011-07-09 22:30:59 +00:00
|
|
|
{
|
2011-11-24 00:59:18 +00:00
|
|
|
GtkCellAccessible *cell_accessible;
|
|
|
|
AtkStateSet *state_set;
|
|
|
|
GtkCellRendererState flags;
|
2011-12-11 04:02:36 +00:00
|
|
|
guint i;
|
2011-11-24 00:59:18 +00:00
|
|
|
|
|
|
|
cell_accessible = GTK_CELL_ACCESSIBLE (accessible);
|
|
|
|
|
|
|
|
state_set = atk_state_set_new ();
|
|
|
|
|
2011-12-19 05:10:16 +00:00
|
|
|
if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible)) == NULL)
|
2011-11-24 00:59:18 +00:00
|
|
|
{
|
|
|
|
atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
|
|
|
|
return state_set;
|
|
|
|
}
|
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
flags = gtk_cell_accessible_get_state (cell_accessible);
|
2011-11-24 00:59:18 +00:00
|
|
|
|
2011-12-12 06:17:02 +00:00
|
|
|
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
|
2011-12-11 04:02:36 +00:00
|
|
|
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
|
2011-12-12 06:17:02 +00:00
|
|
|
atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT);
|
2011-12-11 04:02:36 +00:00
|
|
|
atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
|
2011-11-24 00:59:18 +00:00
|
|
|
|
2011-12-11 04:02:36 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (state_map); i++)
|
2011-11-24 00:59:18 +00:00
|
|
|
{
|
2011-12-11 04:02:36 +00:00
|
|
|
if (flags & state_map[i].renderer_state)
|
|
|
|
{
|
|
|
|
if (!state_map[i].invert)
|
|
|
|
atk_state_set_add_state (state_set, state_map[i].atk_state);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (state_map[i].invert)
|
|
|
|
atk_state_set_add_state (state_set, state_map[i].atk_state);
|
|
|
|
}
|
2011-11-24 00:59:18 +00:00
|
|
|
}
|
|
|
|
|
2011-12-19 05:10:16 +00:00
|
|
|
if (gtk_widget_get_mapped (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible))))
|
2011-11-24 00:59:18 +00:00
|
|
|
atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2011-11-24 00:59:18 +00:00
|
|
|
return state_set;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 01:29:36 +00:00
|
|
|
static AtkObject *
|
|
|
|
gtk_cell_accessible_get_parent (AtkObject *object)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (object);
|
|
|
|
|
|
|
|
return cell->priv->parent;
|
|
|
|
}
|
2011-11-24 00:59:18 +00:00
|
|
|
|
2011-07-09 22:30:59 +00:00
|
|
|
static void
|
2012-12-27 06:04:46 +00:00
|
|
|
gtk_cell_accessible_class_init (GtkCellAccessibleClass *klass)
|
2011-07-09 22:30:59 +00:00
|
|
|
{
|
|
|
|
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
class->get_index_in_parent = gtk_cell_accessible_get_index_in_parent;
|
|
|
|
class->ref_state_set = gtk_cell_accessible_ref_state_set;
|
2014-03-24 14:51:38 +00:00
|
|
|
class->ref_relation_set = gtk_cell_accessible_ref_relation_set;
|
2014-02-26 01:29:36 +00:00
|
|
|
class->get_parent = gtk_cell_accessible_get_parent;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-12-27 06:04:46 +00:00
|
|
|
gtk_cell_accessible_init (GtkCellAccessible *cell)
|
2011-07-09 22:30:59 +00:00
|
|
|
{
|
2014-02-26 01:29:36 +00:00
|
|
|
cell->priv = gtk_cell_accessible_get_instance_private (cell);
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-12-27 06:04:46 +00:00
|
|
|
_gtk_cell_accessible_initialize (GtkCellAccessible *cell,
|
2011-07-09 22:30:59 +00:00
|
|
|
GtkWidget *widget,
|
2011-11-11 02:02:31 +00:00
|
|
|
AtkObject *parent)
|
2011-07-09 22:30:59 +00:00
|
|
|
{
|
2011-12-19 05:10:16 +00:00
|
|
|
gtk_accessible_set_widget (GTK_ACCESSIBLE (cell), widget);
|
2014-02-26 01:29:36 +00:00
|
|
|
cell->priv->parent = parent;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gtk_cell_accessible_add_state (GtkCellAccessible *cell,
|
|
|
|
AtkStateType state_type,
|
|
|
|
gboolean emit_signal)
|
|
|
|
{
|
|
|
|
/* The signal should only be generated if the value changed,
|
|
|
|
* not when the cell is set up. So states that are set
|
|
|
|
* initially should pass FALSE as the emit_signal argument.
|
|
|
|
*/
|
|
|
|
if (emit_signal)
|
|
|
|
{
|
|
|
|
atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE);
|
|
|
|
/* If state_type is ATK_STATE_VISIBLE, additional notification */
|
|
|
|
if (state_type == ATK_STATE_VISIBLE)
|
2011-07-17 22:47:19 +00:00
|
|
|
g_signal_emit_by_name (cell, "visible-data-changed");
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the parent is a flyweight container cell, propagate the state
|
|
|
|
* change to it also
|
|
|
|
*/
|
2014-02-26 01:29:36 +00:00
|
|
|
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent))
|
|
|
|
_gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal);
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2011-11-24 00:59:18 +00:00
|
|
|
return TRUE;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
_gtk_cell_accessible_remove_state (GtkCellAccessible *cell,
|
|
|
|
AtkStateType state_type,
|
|
|
|
gboolean emit_signal)
|
|
|
|
{
|
|
|
|
/* The signal should only be generated if the value changed,
|
|
|
|
* not when the cell is set up. So states that are set
|
|
|
|
* initially should pass FALSE as the emit_signal argument.
|
|
|
|
*/
|
|
|
|
if (emit_signal)
|
|
|
|
{
|
|
|
|
atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE);
|
|
|
|
/* If state_type is ATK_STATE_VISIBLE, additional notification */
|
|
|
|
if (state_type == ATK_STATE_VISIBLE)
|
2011-07-17 22:47:19 +00:00
|
|
|
g_signal_emit_by_name (cell, "visible-data-changed");
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the parent is a flyweight container cell, propagate the state
|
|
|
|
* change to it also
|
|
|
|
*/
|
2014-02-26 01:29:36 +00:00
|
|
|
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent))
|
|
|
|
_gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal);
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2011-11-24 00:59:18 +00:00
|
|
|
return TRUE;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gtk_cell_accessible_action_get_n_actions (AtkAction *action)
|
|
|
|
{
|
2011-12-12 14:18:54 +00:00
|
|
|
return 3;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
gtk_cell_accessible_action_get_name (AtkAction *action,
|
|
|
|
gint index)
|
|
|
|
{
|
2011-12-12 14:18:54 +00:00
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return "expand or contract";
|
|
|
|
case 1:
|
|
|
|
return "edit";
|
|
|
|
case 2:
|
|
|
|
return "activate";
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
2013-02-04 05:53:48 +00:00
|
|
|
static const gchar *
|
|
|
|
gtk_cell_accessible_action_get_localized_name (AtkAction *action,
|
|
|
|
gint index)
|
|
|
|
{
|
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
return C_("Action name", "Expand or contract");
|
|
|
|
case 1:
|
|
|
|
return C_("Action name", "Edit");
|
|
|
|
case 2:
|
|
|
|
return C_("Action name", "Activate");
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-09 22:30:59 +00:00
|
|
|
static const gchar *
|
|
|
|
gtk_cell_accessible_action_get_description (AtkAction *action,
|
|
|
|
gint index)
|
|
|
|
{
|
2011-12-12 14:18:54 +00:00
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
2013-02-04 05:53:48 +00:00
|
|
|
return C_("Action description", "Expands or contracts the row in the tree view containing this cell");
|
2011-12-12 14:18:54 +00:00
|
|
|
case 1:
|
2013-02-04 05:53:48 +00:00
|
|
|
return C_("Action description", "Creates a widget in which the contents of the cell can be edited");
|
2011-12-12 14:18:54 +00:00
|
|
|
case 2:
|
2013-02-04 05:53:48 +00:00
|
|
|
return C_("Action description", "Activates the cell");
|
2011-12-12 14:18:54 +00:00
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
gtk_cell_accessible_action_get_keybinding (AtkAction *action,
|
|
|
|
gint index)
|
|
|
|
{
|
2011-12-12 14:18:54 +00:00
|
|
|
return NULL;
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_cell_accessible_action_do_action (AtkAction *action,
|
|
|
|
gint index)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action);
|
2011-12-12 14:18:54 +00:00
|
|
|
GtkCellAccessibleParent *parent;
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2011-12-19 05:10:16 +00:00
|
|
|
if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)) == NULL)
|
2011-07-09 22:30:59 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2011-12-19 05:10:16 +00:00
|
|
|
parent = GTK_CELL_ACCESSIBLE_PARENT (gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))));
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2011-12-12 14:18:54 +00:00
|
|
|
switch (index)
|
|
|
|
{
|
|
|
|
case 0:
|
2012-12-27 06:04:46 +00:00
|
|
|
gtk_cell_accessible_parent_expand_collapse (parent, cell);
|
2012-11-30 03:47:02 +00:00
|
|
|
break;
|
2011-12-12 14:18:54 +00:00
|
|
|
case 1:
|
2012-12-27 06:04:46 +00:00
|
|
|
gtk_cell_accessible_parent_edit (parent, cell);
|
2012-11-30 03:47:02 +00:00
|
|
|
break;
|
2011-12-12 14:18:54 +00:00
|
|
|
case 2:
|
2012-12-27 06:04:46 +00:00
|
|
|
gtk_cell_accessible_parent_activate (parent, cell);
|
2012-11-30 03:47:02 +00:00
|
|
|
break;
|
2011-12-12 14:18:54 +00:00
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
2011-07-09 22:30:59 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
atk_action_interface_init (AtkActionIface *iface)
|
|
|
|
{
|
|
|
|
iface->get_n_actions = gtk_cell_accessible_action_get_n_actions;
|
|
|
|
iface->do_action = gtk_cell_accessible_action_do_action;
|
|
|
|
iface->get_name = gtk_cell_accessible_action_get_name;
|
2013-02-04 05:53:48 +00:00
|
|
|
iface->get_localized_name = gtk_cell_accessible_action_get_localized_name;
|
2011-07-09 22:30:59 +00:00
|
|
|
iface->get_description = gtk_cell_accessible_action_get_description;
|
|
|
|
iface->get_keybinding = gtk_cell_accessible_action_get_keybinding;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_cell_accessible_get_extents (AtkComponent *component,
|
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
|
|
|
gint *height,
|
|
|
|
AtkCoordType coord_type)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (component);
|
2011-12-19 05:10:16 +00:00
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
gtk_cell_accessible_parent_get_cell_extents (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
2011-07-10 03:56:42 +00:00
|
|
|
cell,
|
|
|
|
x, y, width, height, coord_type);
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_cell_accessible_grab_focus (AtkComponent *component)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (component);
|
2011-12-19 05:10:16 +00:00
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
2011-07-09 22:30:59 +00:00
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
return gtk_cell_accessible_parent_grab_focus (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
|
2011-07-09 22:30:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
atk_component_interface_init (AtkComponentIface *iface)
|
|
|
|
{
|
|
|
|
iface->get_extents = gtk_cell_accessible_get_extents;
|
|
|
|
iface->grab_focus = gtk_cell_accessible_grab_focus;
|
|
|
|
}
|
2011-11-23 16:35:00 +00:00
|
|
|
|
2018-12-30 18:15:11 +00:00
|
|
|
static int
|
2018-12-14 19:25:27 +00:00
|
|
|
gtk_cell_accessible_get_column_span (AtkTableCell *table_cell)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GPtrArray *
|
|
|
|
gtk_cell_accessible_get_column_header_cells (AtkTableCell *table_cell)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (table_cell);
|
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
|
|
|
|
|
|
|
return gtk_cell_accessible_parent_get_column_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
|
|
|
cell);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gtk_cell_accessible_get_position (AtkTableCell *table_cell,
|
|
|
|
gint *row,
|
|
|
|
gint *column)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (table_cell);
|
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
|
|
|
|
|
|
|
gtk_cell_accessible_parent_get_cell_position (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
|
|
|
cell,
|
|
|
|
row, column);
|
|
|
|
return ((row && *row > 0) || (column && *column > 0));
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:15:11 +00:00
|
|
|
static int
|
2018-12-14 19:25:27 +00:00
|
|
|
gtk_cell_accessible_get_row_span (AtkTableCell *table_cell)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GPtrArray *
|
|
|
|
gtk_cell_accessible_get_row_header_cells (AtkTableCell *table_cell)
|
|
|
|
{
|
|
|
|
GtkCellAccessible *cell;
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
cell = GTK_CELL_ACCESSIBLE (table_cell);
|
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
|
|
|
|
|
|
|
return gtk_cell_accessible_parent_get_row_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
|
|
|
cell);
|
|
|
|
}
|
|
|
|
|
2018-12-18 00:20:36 +00:00
|
|
|
static AtkObject *
|
2018-12-14 19:25:27 +00:00
|
|
|
gtk_cell_accessible_get_table (AtkTableCell *table_cell)
|
|
|
|
{
|
|
|
|
AtkObject *obj;
|
|
|
|
|
|
|
|
obj = ATK_OBJECT (table_cell);
|
|
|
|
do
|
|
|
|
{
|
|
|
|
AtkRole role;
|
|
|
|
obj = atk_object_get_parent (obj);
|
|
|
|
role = atk_object_get_role (obj);
|
|
|
|
if (role == ATK_ROLE_TABLE || role == ATK_ROLE_TREE_TABLE)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
while (obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
atk_table_cell_interface_init (AtkTableCellIface *iface)
|
|
|
|
{
|
|
|
|
iface->get_column_span = gtk_cell_accessible_get_column_span;
|
|
|
|
iface->get_column_header_cells = gtk_cell_accessible_get_column_header_cells;
|
|
|
|
iface->get_position = gtk_cell_accessible_get_position;
|
|
|
|
iface->get_row_span = gtk_cell_accessible_get_row_span;
|
|
|
|
iface->get_row_header_cells = gtk_cell_accessible_get_row_header_cells;
|
|
|
|
iface->get_table = gtk_cell_accessible_get_table;
|
|
|
|
}
|
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
static GtkCellRendererState
|
|
|
|
gtk_cell_accessible_get_state (GtkCellAccessible *cell)
|
2011-11-24 00:55:38 +00:00
|
|
|
{
|
|
|
|
AtkObject *parent;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
|
|
|
|
|
2011-12-19 05:10:16 +00:00
|
|
|
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
2011-11-24 00:55:38 +00:00
|
|
|
if (parent == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
return gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
|
2011-11-24 00:55:38 +00:00
|
|
|
}
|
2011-12-11 05:37:05 +00:00
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
/*
|
|
|
|
* gtk_cell_accessible_state_changed:
|
2011-12-11 05:37:05 +00:00
|
|
|
* @cell: a #GtkCellAccessible
|
|
|
|
* @added: the flags that were added from @cell
|
|
|
|
* @removed: the flags that were removed from @cell
|
|
|
|
*
|
|
|
|
* Notifies @cell of state changes. Multiple states may be added
|
|
|
|
* or removed at the same time. A state that is @added may not be
|
|
|
|
* @removed at the same time.
|
|
|
|
**/
|
|
|
|
void
|
|
|
|
_gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
|
|
|
GtkCellRendererState added,
|
|
|
|
GtkCellRendererState removed)
|
|
|
|
{
|
|
|
|
AtkObject *object;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
|
|
|
g_return_if_fail ((added & removed) == 0);
|
|
|
|
|
|
|
|
object = ATK_OBJECT (cell);
|
|
|
|
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (state_map); i++)
|
|
|
|
{
|
|
|
|
if (added & state_map[i].renderer_state)
|
2012-12-27 06:04:46 +00:00
|
|
|
atk_object_notify_state_change (object,
|
2011-12-11 05:37:05 +00:00
|
|
|
state_map[i].atk_state,
|
|
|
|
!state_map[i].invert);
|
2013-02-19 22:22:48 +00:00
|
|
|
if (removed & state_map[i].renderer_state)
|
2012-12-27 06:04:46 +00:00
|
|
|
atk_object_notify_state_change (object,
|
2011-12-11 05:37:05 +00:00
|
|
|
state_map[i].atk_state,
|
|
|
|
state_map[i].invert);
|
|
|
|
}
|
|
|
|
}
|
2011-12-15 23:07:46 +00:00
|
|
|
|
2012-12-27 06:04:46 +00:00
|
|
|
/*
|
|
|
|
* gtk_cell_accessible_update_cache:
|
2011-12-15 23:07:46 +00:00
|
|
|
* @cell: the cell that is changed
|
2015-04-09 00:08:25 +00:00
|
|
|
* @emit_signal: whether or not to notify the ATK bridge
|
2011-12-15 23:07:46 +00:00
|
|
|
*
|
|
|
|
* Notifies the cell that the values in the data in the row that
|
|
|
|
* is used to feed the cell renderer with has changed. The
|
|
|
|
* cell_changed function of @cell is called to send update
|
|
|
|
* notifications for the properties it takes from its cell
|
2015-04-09 00:08:25 +00:00
|
|
|
* renderer. If @emit_signal is TRUE, also notify the ATK bridge
|
|
|
|
* of the change. The bridge should be notified when an existing
|
|
|
|
* cell changes; not when a newly-created cell is being set up.
|
2012-12-27 06:04:46 +00:00
|
|
|
*
|
2011-12-15 23:07:46 +00:00
|
|
|
* Note that there is no higher granularity available about which
|
|
|
|
* properties changed, so you will need to make do with this
|
|
|
|
* function.
|
|
|
|
**/
|
|
|
|
void
|
2015-04-09 00:08:25 +00:00
|
|
|
_gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
|
|
|
|
gboolean emit_signal)
|
2011-12-15 23:07:46 +00:00
|
|
|
{
|
|
|
|
GtkCellAccessibleClass *klass;
|
2012-12-27 06:04:46 +00:00
|
|
|
|
2011-12-15 23:07:46 +00:00
|
|
|
g_return_if_fail (GTK_CELL_ACCESSIBLE (cell));
|
|
|
|
|
|
|
|
klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell);
|
|
|
|
|
|
|
|
if (klass->update_cache)
|
2015-04-09 00:08:25 +00:00
|
|
|
klass->update_cache (cell, emit_signal);
|
2011-12-15 23:07:46 +00:00
|
|
|
}
|