GtkWidgetAccessible: add a private struct

Move instance fields to a private struct, in preparation
for installing a11y headers.
This also required removing access to GtkWidgetAccessible innards
from several accessible implementations.
This commit is contained in:
Matthias Clasen 2012-10-15 06:04:11 -04:00
parent 19fc090354
commit d83294d313
5 changed files with 29 additions and 8 deletions

View File

@ -31,7 +31,7 @@ gtk_menu_accessible_initialize (AtkObject *obj,
obj->role = ATK_ROLE_MENU;
GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_POPUP;
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP);
}
static AtkObject *

View File

@ -72,7 +72,7 @@ gtk_menu_item_accessible_initialize (AtkObject *obj,
atk_object_set_parent (obj, gtk_widget_get_accessible (parent_widget));
}
GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_POPUP;
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_POPUP);
obj->role = ATK_ROLE_MENU_ITEM;

View File

@ -24,6 +24,11 @@
#include "gtkwidgetaccessible.h"
#include "gtknotebookpageaccessible.h"
struct _GtkWidgetAccessiblePrivate
{
AtkLayer layer;
};
#define TOOLTIP_KEY "tooltip"
extern GtkWidget *_focus_widget;
@ -133,7 +138,7 @@ gtk_widget_accessible_initialize (AtkObject *obj,
g_signal_connect (widget, "map", G_CALLBACK (map_cb), NULL);
g_signal_connect (widget, "unmap", G_CALLBACK (map_cb), NULL);
GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WIDGET;
GTK_WIDGET_ACCESSIBLE (obj)->priv->layer = ATK_LAYER_WIDGET;
obj->role = ATK_ROLE_UNKNOWN;
gtk_widget_accessible_update_tooltip (GTK_WIDGET_ACCESSIBLE (obj), widget);
@ -534,11 +539,16 @@ _gtk_widget_accessible_class_init (GtkWidgetAccessibleClass *klass)
class->initialize = gtk_widget_accessible_initialize;
class->get_attributes = gtk_widget_accessible_get_attributes;
class->focus_event = gtk_widget_accessible_focus_event;
g_type_class_add_private (klass, sizeof (GtkWidgetAccessiblePrivate));
}
static void
_gtk_widget_accessible_init (GtkWidgetAccessible *accessible)
{
accessible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accessible,
GTK_TYPE_WIDGET_ACCESSIBLE,
GtkWidgetAccessiblePrivate);
}
static void
@ -615,7 +625,7 @@ gtk_widget_accessible_get_layer (AtkComponent *component)
{
GtkWidgetAccessible *accessible = GTK_WIDGET_ACCESSIBLE (component);
return accessible->layer;
return accessible->priv->layer;
}
static gboolean
@ -833,3 +843,10 @@ gtk_widget_accessible_all_parents_visible (GtkWidget *widget)
return result;
}
void
_gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible,
AtkLayer layer)
{
accessible->priv->layer = layer;
}

View File

@ -30,14 +30,15 @@ G_BEGIN_DECLS
#define GTK_IS_WIDGET_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET_ACCESSIBLE))
#define GTK_WIDGET_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET_ACCESSIBLE, GtkWidgetAccessibleClass))
typedef struct _GtkWidgetAccessible GtkWidgetAccessible;
typedef struct _GtkWidgetAccessibleClass GtkWidgetAccessibleClass;
typedef struct _GtkWidgetAccessible GtkWidgetAccessible;
typedef struct _GtkWidgetAccessibleClass GtkWidgetAccessibleClass;
typedef struct _GtkWidgetAccessiblePrivate GtkWidgetAccessiblePrivate;
struct _GtkWidgetAccessible
{
GtkAccessible parent;
AtkLayer layer;
GtkWidgetAccessiblePrivate *priv;
};
struct _GtkWidgetAccessibleClass
@ -54,6 +55,9 @@ struct _GtkWidgetAccessibleClass
GType _gtk_widget_accessible_get_type (void);
void _gtk_widget_accessible_set_layer (GtkWidgetAccessible *accessible,
AtkLayer layer);
G_END_DECLS
#endif /* __GTK_WIDGET_ACCESSIBLE_H__ */

View File

@ -93,7 +93,7 @@ gtk_window_accessible_initialize (AtkObject *obj,
ATK_OBJECT_CLASS (_gtk_window_accessible_parent_class)->initialize (obj, data);
g_signal_connect (data, "window-state-event", G_CALLBACK (window_state_event_cb), NULL);
GTK_WIDGET_ACCESSIBLE (obj)->layer = ATK_LAYER_WINDOW;
_gtk_widget_accessible_set_layer (GTK_WIDGET_ACCESSIBLE (obj), ATK_LAYER_WINDOW);
name = gtk_widget_get_name (widget);