Convert GailCellParent to GtkCellAccessibleParent

This commit is contained in:
Matthias Clasen 2011-07-09 23:56:42 -04:00
parent 4e5629bed1
commit ddfa756ac7
8 changed files with 142 additions and 142 deletions

View File

@ -9,7 +9,7 @@ gail_c_sources = \
gtkboxaccessible.c \ gtkboxaccessible.c \
gtkbuttonaccessible.c \ gtkbuttonaccessible.c \
gtkcellaccessible.c \ gtkcellaccessible.c \
gailcellparent.c \ gtkcellaccessibleparent.c \
gtkcheckmenuitemaccessible.c \ gtkcheckmenuitemaccessible.c \
gtkchecksubmenuitemaccessible.c \ gtkchecksubmenuitemaccessible.c \
gtkcomboboxaccessible.c \ gtkcomboboxaccessible.c \
@ -61,7 +61,7 @@ gail_private_h_sources = \
gtkboxaccessible.h \ gtkboxaccessible.h \
gtkbuttonaccessible.h \ gtkbuttonaccessible.h \
gtkcellaccessible.h \ gtkcellaccessible.h \
gailcellparent.h \ gtkcellaccessibleparent.h \
gtkcheckmenuitemaccessible.h \ gtkcheckmenuitemaccessible.h \
gtkchecksubmenuitemaccessible.h \ gtkchecksubmenuitemaccessible.h \
gtkcomboboxaccessible.h \ gtkcomboboxaccessible.h \

View File

@ -1,84 +0,0 @@
/* GAIL - The GNOME Accessibility Implementation Library
*
* 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GAIL_CELL_PARENT_H__
#define __GAIL_CELL_PARENT_H__
#include <atk/atk.h>
#include "gtkcellaccessible.h"
G_BEGIN_DECLS
/*
* The GailCellParent interface should be supported by any object which
* contains children which are flyweights, i.e. do not have corresponding
* widgets and the children need help from their parent to provide
* functionality. One example is GailTreeView where the children GailCell
* need help from the GailTreeView in order to implement
* atk_component_get_extents
*/
#define GAIL_TYPE_CELL_PARENT (gail_cell_parent_get_type ())
#define GAIL_IS_CELL_PARENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CELL_PARENT)
#define GAIL_CELL_PARENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CELL_PARENT, GailCellParent)
#define GAIL_CELL_PARENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAIL_TYPE_CELL_PARENT, GailCellParentIface))
#ifndef _TYPEDEF_GAIL_CELL_PARENT_
#define _TYPEDEF_GAIL_CELL_PARENT_
typedef struct _GailCellParent GailCellParent;
#endif
typedef struct _GailCellParentIface GailCellParentIface;
struct _GailCellParentIface
{
GTypeInterface parent;
void ( *get_cell_extents) (GailCellParent *parent,
GtkCellAccessible *cell,
gint *x,
gint *y,
gint *width,
gint *height,
AtkCoordType coord_type);
void ( *get_cell_area) (GailCellParent *parent,
GtkCellAccessible *cell,
GdkRectangle *cell_rect);
gboolean ( *grab_focus) (GailCellParent *parent,
GtkCellAccessible *cell);
};
GType gail_cell_parent_get_type (void);
void gail_cell_parent_get_cell_extents (GailCellParent *parent,
GtkCellAccessible *cell,
gint *x,
gint *y,
gint *width,
gint *height,
AtkCoordType coord_type
);
void gail_cell_parent_get_cell_area (GailCellParent *parent,
GtkCellAccessible *cell,
GdkRectangle *cell_rect);
gboolean gail_cell_parent_grab_focus (GailCellParent *parent,
GtkCellAccessible *cell);
G_END_DECLS
#endif /* __GAIL_CELL_PARENT_H__ */

View File

@ -22,7 +22,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "gtkcontainercellaccessible.h" #include "gtkcontainercellaccessible.h"
#include "gtkcellaccessible.h" #include "gtkcellaccessible.h"
#include "gailcellparent.h" #include "gtkcellaccessibleparent.h"
typedef struct _ActionInfo ActionInfo; typedef struct _ActionInfo ActionInfo;
struct _ActionInfo { struct _ActionInfo {
@ -399,8 +399,9 @@ gtk_cell_accessible_get_extents (AtkComponent *component,
cell = GTK_CELL_ACCESSIBLE (component); cell = GTK_CELL_ACCESSIBLE (component);
parent = gtk_widget_get_accessible (cell->widget); parent = gtk_widget_get_accessible (cell->widget);
gail_cell_parent_get_cell_extents (GAIL_CELL_PARENT (parent), _gtk_cell_accessible_parent_get_cell_extents (GTK_CELL_ACCESSIBLE_PARENT (parent),
cell, x, y, width, height, coord_type); cell,
x, y, width, height, coord_type);
} }
static gboolean static gboolean
@ -412,7 +413,7 @@ gtk_cell_accessible_grab_focus (AtkComponent *component)
cell = GTK_CELL_ACCESSIBLE (component); cell = GTK_CELL_ACCESSIBLE (component);
parent = gtk_widget_get_accessible (cell->widget); parent = gtk_widget_get_accessible (cell->widget);
return gail_cell_parent_grab_focus (GAIL_CELL_PARENT (parent), cell); return _gtk_cell_accessible_parent_grab_focus (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
} }
static void static void

View File

@ -21,10 +21,10 @@
#include "config.h" #include "config.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "gailcellparent.h" #include "gtkcellaccessibleparent.h"
GType GType
gail_cell_parent_get_type (void) _gtk_cell_accessible_parent_get_type (void)
{ {
static volatile gsize g_define_type_id__volatile = 0; static volatile gsize g_define_type_id__volatile = 0;
@ -32,8 +32,8 @@ gail_cell_parent_get_type (void)
{ {
GType g_define_type_id = GType g_define_type_id =
g_type_register_static_simple (G_TYPE_INTERFACE, g_type_register_static_simple (G_TYPE_INTERFACE,
"GailCellParent", "GtkCellAccessibleParent",
sizeof (GailCellParentIface), sizeof (GtkCellAccessibleParentIface),
NULL, NULL,
0, 0,
NULL, NULL,
@ -46,49 +46,49 @@ gail_cell_parent_get_type (void)
} }
void void
gail_cell_parent_get_cell_extents (GailCellParent *parent, _gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell, GtkCellAccessible *cell,
gint *x, gint *x,
gint *y, gint *y,
gint *width, gint *width,
gint *height, gint *height,
AtkCoordType coord_type) AtkCoordType coord_type)
{ {
GailCellParentIface *iface; GtkCellAccessibleParentIface *iface;
g_return_if_fail (GAIL_IS_CELL_PARENT (parent)); g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
iface = GAIL_CELL_PARENT_GET_IFACE (parent); iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->get_cell_extents) if (iface->get_cell_extents)
(iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type); (iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type);
} }
void void
gail_cell_parent_get_cell_area (GailCellParent *parent, _gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell, GtkCellAccessible *cell,
GdkRectangle *cell_rect) GdkRectangle *cell_rect)
{ {
GailCellParentIface *iface; GtkCellAccessibleParentIface *iface;
g_return_if_fail (GAIL_IS_CELL_PARENT (parent)); g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
g_return_if_fail (cell_rect); g_return_if_fail (cell_rect);
iface = GAIL_CELL_PARENT_GET_IFACE (parent); iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->get_cell_area) if (iface->get_cell_area)
(iface->get_cell_area) (parent, cell, cell_rect); (iface->get_cell_area) (parent, cell, cell_rect);
} }
gboolean gboolean
gail_cell_parent_grab_focus (GailCellParent *parent, _gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell) GtkCellAccessible *cell)
{ {
GailCellParentIface *iface; GtkCellAccessibleParentIface *iface;
g_return_val_if_fail (GAIL_IS_CELL_PARENT (parent), FALSE); g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
iface = GAIL_CELL_PARENT_GET_IFACE (parent); iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
if (iface->grab_focus) if (iface->grab_focus)
return (iface->grab_focus) (parent, cell); return (iface->grab_focus) (parent, cell);

View File

@ -0,0 +1,80 @@
/* GAIL - The GNOME Accessibility Implementation Library
*
* 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, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_CELL_ACCESSIBLE_PARENT_H__
#define __GTK_CELL_ACCESSIBLE_PARENT_H__
#include <atk/atk.h>
#include "gtkcellaccessible.h"
G_BEGIN_DECLS
/*
* The GtkCellAccessibleParent interface should be supported by any object
* which contains children which are flyweights, i.e. do not have corresponding
* widgets and the children need help from their parent to provide
* functionality. One example is GtkTreeViewAccessible where the children
* GtkCellAccessible need help from the GtkTreeViewAccessible in order to
* implement atk_component_get_extents().
*/
#define GTK_TYPE_CELL_ACCESSIBLE_PARENT (_gtk_cell_accessible_parent_get_type ())
#define GTK_IS_CELL_ACCESSIBLE_PARENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT)
#define GTK_CELL_ACCESSIBLE_PARENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT, GtkCellAccessibleParent)
#define GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT, GtkCellAccessibleParentIface))
typedef struct _GtkCellAccessibleParent GtkCellAccessibleParent;
typedef struct _GtkCellAccessibleParentIface GtkCellAccessibleParentIface;
struct _GtkCellAccessibleParentIface
{
GTypeInterface parent;
void ( *get_cell_extents) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gint *x,
gint *y,
gint *width,
gint *height,
AtkCoordType coord_type);
void ( *get_cell_area) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
GdkRectangle *cell_rect);
gboolean ( *grab_focus) (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
};
GType _gtk_cell_accessible_parent_get_type (void);
void _gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
gint *x,
gint *y,
gint *width,
gint *height,
AtkCoordType coord_type);
void _gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell,
GdkRectangle *cell_rect);
gboolean _gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell);
G_END_DECLS
#endif /* __GTK_CELL_ACCESSIBLE_PARENT_H__ */

View File

@ -23,7 +23,7 @@
#include "../gtkpango.h" #include "../gtkpango.h"
#include "gtktextcellaccessible.h" #include "gtktextcellaccessible.h"
#include "gtkcontainercellaccessible.h" #include "gtkcontainercellaccessible.h"
#include "gailcellparent.h" #include "gtkcellaccessibleparent.h"
static const gchar* gtk_text_cell_accessible_get_name (AtkObject *atk_obj); static const gchar* gtk_text_cell_accessible_get_name (AtkObject *atk_obj);
@ -611,9 +611,10 @@ gtk_text_cell_accessible_get_character_extents (AtkText *text,
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent)) if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (parent))
parent = atk_object_get_parent (parent); parent = atk_object_get_parent (parent);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
g_return_if_fail (GAIL_IS_CELL_PARENT (parent)); g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
gail_cell_parent_get_cell_area (GAIL_CELL_PARENT (parent), GTK_CELL_ACCESSIBLE (text), _gtk_cell_accessible_parent_get_cell_area (GTK_CELL_ACCESSIBLE_PARENT (parent),
&rendered_rect); GTK_CELL_ACCESSIBLE (text),
&rendered_rect);
gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer), gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer),
widget, widget,
@ -696,9 +697,10 @@ gtk_text_cell_accessible_get_offset_at_point (AtkText *text,
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent)); widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (parent));
g_return_val_if_fail (GAIL_IS_CELL_PARENT (parent), -1); g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), -1);
gail_cell_parent_get_cell_area (GAIL_CELL_PARENT (parent), GTK_CELL_ACCESSIBLE (text), _gtk_cell_accessible_parent_get_cell_area (GTK_CELL_ACCESSIBLE_PARENT (parent),
&rendered_rect); GTK_CELL_ACCESSIBLE (text),
&rendered_rect);
gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer), gtk_cell_renderer_get_preferred_size (GTK_CELL_RENDERER (gtk_renderer),
widget, widget,

View File

@ -25,7 +25,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GTK_TYPE_TEXT_CELL_ACCESSIBLE (gtk_text_cell_accessible_get_type ()) #define GTK_TYPE_TEXT_CELL_ACCESSIBLE (_gtk_text_cell_accessible_get_type ())
#define GTK_TEXT_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessible)) #define GTK_TEXT_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessible))
#define GTK_TEXT_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessibleClass)) #define GTK_TEXT_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TEXT_CELL_ACCESSIBLE, GtkTextCellAccessibleClass))
#define GTK_IS_TEXT_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE)) #define GTK_IS_TEXT_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_CELL_ACCESSIBLE))

View File

@ -30,7 +30,7 @@
#include "gtkimagecellaccessible.h" #include "gtkimagecellaccessible.h"
#include "gtkcontainercellaccessible.h" #include "gtkcontainercellaccessible.h"
#include "gtktextcellaccessible.h" #include "gtktextcellaccessible.h"
#include "gailcellparent.h" #include "gtkcellaccessibleparent.h"
typedef struct _GtkTreeViewAccessibleCellInfo GtkTreeViewAccessibleCellInfo; typedef struct _GtkTreeViewAccessibleCellInfo GtkTreeViewAccessibleCellInfo;
struct _GtkTreeViewAccessibleCellInfo struct _GtkTreeViewAccessibleCellInfo
@ -156,16 +156,16 @@ static AtkObject * get_header_from_column (GtkTreeViewColumn
static gboolean idle_garbage_collect_cell_data (gpointer data); static gboolean idle_garbage_collect_cell_data (gpointer data);
static void atk_table_interface_init (AtkTableIface *iface); static void atk_table_interface_init (AtkTableIface *iface);
static void atk_selection_interface_init (AtkSelectionIface *iface); static void atk_selection_interface_init (AtkSelectionIface *iface);
static void atk_component_interface_init (AtkComponentIface *iface); static void atk_component_interface_init (AtkComponentIface *iface);
static void gail_cell_parent_interface_init (GailCellParentIface *iface); static void gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, _gtk_tree_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE, G_DEFINE_TYPE_WITH_CODE (GtkTreeViewAccessible, _gtk_tree_view_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE, atk_table_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE, atk_table_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init)
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init) G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
G_IMPLEMENT_INTERFACE (GAIL_TYPE_CELL_PARENT, gail_cell_parent_interface_init)) G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_ACCESSIBLE_PARENT, gtk_cell_accessible_parent_interface_init))
static void static void
@ -1332,9 +1332,9 @@ static void atk_selection_interface_init (AtkSelectionIface *iface)
#define EXTRA_EXPANDER_PADDING 4 #define EXTRA_EXPANDER_PADDING 4
static void static void
gtk_tree_view_accessible_get_cell_area (GailCellParent *parent, gtk_tree_view_accessible_get_cell_area (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell, GtkCellAccessible *cell,
GdkRectangle *cell_rect) GdkRectangle *cell_rect)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkTreeView *tree_view; GtkTreeView *tree_view;
@ -1413,13 +1413,13 @@ gtk_tree_view_accessible_get_cell_area (GailCellParent *parent,
} }
static void static void
gtk_tree_view_accessible_get_cell_extents (GailCellParent *parent, gtk_tree_view_accessible_get_cell_extents (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell, GtkCellAccessible *cell,
gint *x, gint *x,
gint *y, gint *y,
gint *width, gint *width,
gint *height, gint *height,
AtkCoordType coord_type) AtkCoordType coord_type)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkTreeView *tree_view; GtkTreeView *tree_view;
@ -1463,8 +1463,8 @@ gtk_tree_view_accessible_get_cell_extents (GailCellParent *parent,
} }
static gboolean static gboolean
gtk_tree_view_accessible_grab_cell_focus (GailCellParent *parent, gtk_tree_view_accessible_grab_cell_focus (GtkCellAccessibleParent *parent,
GtkCellAccessible *cell) GtkCellAccessible *cell)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkTreeView *tree_view; GtkTreeView *tree_view;
@ -1532,7 +1532,8 @@ gtk_tree_view_accessible_grab_cell_focus (GailCellParent *parent,
return FALSE; return FALSE;
} }
static void gail_cell_parent_interface_init (GailCellParentIface *iface) static void
gtk_cell_accessible_parent_interface_init (GtkCellAccessibleParentIface *iface)
{ {
iface->get_cell_extents = gtk_tree_view_accessible_get_cell_extents; iface->get_cell_extents = gtk_tree_view_accessible_get_cell_extents;
iface->get_cell_area = gtk_tree_view_accessible_get_cell_area; iface->get_cell_area = gtk_tree_view_accessible_get_cell_area;