Commit 3459dc48 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Convert Gail(Sub)MenuItem to GtkAccessible classes

This is along the same lines as the previous commit,
with the same caveat.
parent 209a2d1b
......@@ -25,7 +25,7 @@ gail_c_sources = \
gailmisc.c \
gailmenu.c \
gailmenushell.c \
gailmenuitem.c \
gtkmenuitemaccessible.c \
gtknotebookaccessible.c \
gtknotebookpageaccessible.c \
gtkpanedaccessible.c \
......@@ -40,7 +40,7 @@ gail_c_sources = \
gtkscrollbaraccessible.c \
gtkscrolledwindowaccessible.c \
gtkspinbuttonaccessible.c \
gailsubmenuitem.c \
gtksubmenuitemaccessible.c \
gtkstatusbaraccessible.c \
gailtextcell.c \
gailtextutil.c \
......@@ -77,7 +77,7 @@ gail_private_h_sources = \
gailmisc.h \
gailmenu.h \
gailmenushell.h \
gailmenuitem.h \
gtkmenuitemaccessible.h \
gtknotebookaccessible.h \
gtknotebookpageaccessible.h \
gtkpanedaccessible.h \
......@@ -92,7 +92,7 @@ gail_private_h_sources = \
gtkscrollbaraccessible.h \
gtkscrolledwindowaccessible.h \
gtkspinbuttonaccessible.h \
gailsubmenuitem.h \
gtksubmenuitemaccessible.h \
gtkstatusbaraccessible.h \
gailtextcell.h \
gailtextutil.h \
......
......@@ -31,7 +31,6 @@
#include "gailimagecell.h"
#include "gailmenu.h"
#include "gailmenushell.h"
#include "gailmenuitem.h"
#include "gailrenderercell.h"
#include "gailtextcell.h"
#include "gailtoplevel.h"
......@@ -86,7 +85,6 @@ static GQuark quark_focus_object = 0;
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WIDGET, GailWidget, gail_widget, GTK_TYPE_WIDGET)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_CONTAINER, GailContainer, gail_container, GTK_TYPE_CONTAINER)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_BUTTON, GailButton, gail_button, GTK_TYPE_BUTTON)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_MENU_ITEM, GailMenuItem, gail_menu_item, gail_menu_item_new)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU_SHELL, GailMenuShell, gail_menu_shell, GTK_TYPE_MENU_SHELL)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_MENU, GailMenu, gail_menu, GTK_TYPE_MENU)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_WINDOW, GailWindow, gail_window, GTK_TYPE_BIN)
......@@ -837,7 +835,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WIDGET, gail_widget);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CONTAINER, gail_container);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BUTTON, gail_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_ITEM, gail_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_BAR, gail_menu_shell);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU, gail_menu);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_WINDOW, gail_window);
......
......@@ -38,10 +38,7 @@ struct _GailContainer
{
GailWidget parent;
/*
* Cached list of children
*/
GList *children;
GList *children;
};
GType gail_container_get_type (void);
......
......@@ -23,7 +23,7 @@
#include "gtkcheckmenuitemaccessible.h"
G_DEFINE_TYPE (GtkCheckMenuItemAccessible, gtk_check_menu_item_accessible, GAIL_TYPE_MENU_ITEM)
G_DEFINE_TYPE (GtkCheckMenuItemAccessible, gtk_check_menu_item_accessible, GTK_TYPE_MENU_ITEM_ACCESSIBLE)
static void
toggled_cb (GtkWidget *widget)
......
......@@ -20,7 +20,7 @@
#ifndef __GTK_CHECK_MENU_ITEM_ACCESSIBLE_H__
#define __GTK_CHECK_MENU_ITEM_ACCESSIBLE_H__
#include "gailmenuitem.h"
#include "gtkmenuitemaccessible.h"
G_BEGIN_DECLS
......@@ -36,12 +36,12 @@ typedef struct _GtkCheckMenuItemAccessibleClass GtkCheckMenuItemAccessibleClass;
struct _GtkCheckMenuItemAccessible
{
GailMenuItem parent;
GtkMenuItemAccessible parent;
};
struct _GtkCheckMenuItemAccessibleClass
{
GailMenuItemClass parent_class;
GtkMenuItemAccessibleClass parent_class;
};
GType gtk_check_menu_item_accessible_get_type (void);
......
......@@ -24,7 +24,7 @@
#include "gtkchecksubmenuitemaccessible.h"
G_DEFINE_TYPE (GtkCheckSubmenuItemAccessible, gtk_check_submenu_item_accessible, GAIL_TYPE_SUB_MENU_ITEM)
G_DEFINE_TYPE (GtkCheckSubmenuItemAccessible, gtk_check_submenu_item_accessible, GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE)
static void
toggled_cb (GtkWidget *widget)
......
......@@ -20,7 +20,7 @@
#ifndef __GTK_CHECK_SUBMENU_ITEM_ACCESSIBLE_H__
#define __GTK_CHECK_SUBMENU_ITEM_ACCESSIBLE_H__
#include "gailsubmenuitem.h"
#include "gtksubmenuitemaccessible.h"
G_BEGIN_DECLS
......@@ -36,12 +36,12 @@ typedef struct _GtkCheckSubmenuItemAccessibleClass GtkCheckSubmenuItemAccessible
struct _GtkCheckSubmenuItemAccessible
{
GailSubMenuItem parent;
GtkSubmenuItemAccessible parent;
};
struct _GtkCheckSubmenuItemAccessibleClass
{
GailSubMenuItemClass parent_class;
GtkSubmenuItemAccessibleClass parent_class;
};
GType gtk_check_submenu_item_accessible_get_type (void);
......
......@@ -243,7 +243,6 @@ static const gchar *
gtk_expander_accessible_get_keybinding (AtkAction *action,
gint i)
{
GtkExpanderAccessible *expander;
gchar *return_value = NULL;
GtkWidget *widget;
GtkWidget *label;
......@@ -255,8 +254,6 @@ gtk_expander_accessible_get_keybinding (AtkAction *action,
if (i != 0)
return NULL;
expander = GTK_EXPANDER_ACCESSIBLE (action);
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
if (GTK_IS_LABEL (label))
{
......
......@@ -17,44 +17,37 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GAIL_MENU_ITEM_H__
#define __GAIL_MENU_ITEM_H__
#ifndef __GTK_MENU_ITEM_ACCESSIBLE_H__
#define __GTK_MENU_ITEM_ACCESSIBLE_H__
#include "gailcontainer.h"
#include "gailtextutil.h"
G_BEGIN_DECLS
#define GAIL_TYPE_MENU_ITEM (gail_menu_item_get_type ())
#define GAIL_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_MENU_ITEM, GailMenuItem))
#define GAIL_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_MENU_ITEM, GailMenuItemClass))
#define GAIL_IS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_MENU_ITEM))
#define GAIL_IS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_MENU_ITEM))
#define GAIL_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_MENU_ITEM, GailMenuItemClass))
#define GTK_TYPE_MENU_ITEM_ACCESSIBLE (gtk_menu_item_accessible_get_type ())
#define GTK_MENU_ITEM_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_ITEM_ACCESSIBLE, GtkMenuItemAccessible))
#define GTK_MENU_ITEM_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_ITEM_ACCESSIBLE, GtkMenuItemAccessibleClass))
#define GTK_IS_MENU_ITEM_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_ITEM_ACCESSIBLE))
#define GTK_IS_MENU_ITEM_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_ITEM_ACCESSIBLE))
#define GTK_MENU_ITEM_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_ITEM_ACCESSIBLE, GtkMenuItemAccessibleClass))
typedef struct _GailMenuItem GailMenuItem;
typedef struct _GailMenuItemClass GailMenuItemClass;
typedef struct _GtkMenuItemAccessible GtkMenuItemAccessible;
typedef struct _GtkMenuItemAccessibleClass GtkMenuItemAccessibleClass;
struct _GailMenuItem
struct _GtkMenuItemAccessible
{
GailContainer parent;
GailTextUtil *textutil;
gchar *text;
gchar *click_keybinding;
};
GType gail_menu_item_get_type (void);
struct _GailMenuItemClass
struct _GtkMenuItemAccessibleClass
{
GailContainerClass parent_class;
};
AtkObject* gail_menu_item_new (GtkWidget *widget);
GType gtk_menu_item_accessible_get_type (void);
G_END_DECLS
#endif /* __GAIL_MENU_ITEM_H__ */
#endif /* __GTK_MENU_ITEM_ACCESSIBLE_H__ */
......@@ -20,104 +20,51 @@
#include "config.h"
#include <gtk/gtk.h>
#include "gailsubmenuitem.h"
static void gail_sub_menu_item_class_init (GailSubMenuItemClass *klass);
static void gail_sub_menu_item_init (GailSubMenuItem *item);
static void gail_sub_menu_item_real_initialize (AtkObject *obj,
gpointer data);
static void atk_selection_interface_init (AtkSelectionIface *iface);
static gboolean gail_sub_menu_item_add_selection (AtkSelection *selection,
gint i);
static gboolean gail_sub_menu_item_clear_selection (AtkSelection *selection);
static AtkObject* gail_sub_menu_item_ref_selection (AtkSelection *selection,
gint i);
static gint gail_sub_menu_item_get_selection_count
(AtkSelection *selection);
static gboolean gail_sub_menu_item_is_child_selected
(AtkSelection *selection,
gint i);
static gboolean gail_sub_menu_item_remove_selection (AtkSelection *selection,
gint i);
static gint menu_item_add_gtk (GtkContainer *container,
GtkWidget *widget);
static gint menu_item_remove_gtk (GtkContainer *container,
GtkWidget *widget);
G_DEFINE_TYPE_WITH_CODE (GailSubMenuItem, gail_sub_menu_item, GAIL_TYPE_MENU_ITEM,
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
#include "gtksubmenuitemaccessible.h"
static void
gail_sub_menu_item_class_init (GailSubMenuItemClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
static gint menu_item_add_gtk (GtkContainer *container,
GtkWidget *widget);
static gint menu_item_remove_gtk (GtkContainer *container,
GtkWidget *widget);
class->initialize = gail_sub_menu_item_real_initialize;
}
static void atk_selection_interface_init (AtkSelectionIface *iface);
static void
gail_sub_menu_item_init (GailSubMenuItem *item)
{
}
G_DEFINE_TYPE_WITH_CODE (GtkSubmenuItemAccessible, gtk_submenu_item_accessible, GTK_TYPE_MENU_ITEM_ACCESSIBLE,
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
static void
gail_sub_menu_item_real_initialize (AtkObject *obj,
gpointer data)
gtk_submenu_item_accessible_initialize (AtkObject *obj,
gpointer data)
{
GtkWidget *submenu;
ATK_OBJECT_CLASS (gail_sub_menu_item_parent_class)->initialize (obj, data);
ATK_OBJECT_CLASS (gtk_submenu_item_accessible_parent_class)->initialize (obj, data);
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (data));
g_return_if_fail (submenu);
g_signal_connect (submenu,
"add",
G_CALLBACK (menu_item_add_gtk),
NULL);
g_signal_connect (submenu,
"remove",
G_CALLBACK (menu_item_remove_gtk),
NULL);
g_signal_connect (submenu, "add", G_CALLBACK (menu_item_add_gtk), NULL);
g_signal_connect (submenu, "remove", G_CALLBACK (menu_item_remove_gtk), NULL);
obj->role = ATK_ROLE_MENU;
}
AtkObject*
gail_sub_menu_item_new (GtkWidget *widget)
static void
gtk_submenu_item_accessible_class_init (GtkSubmenuItemAccessibleClass *klass)
{
GObject *object;
AtkObject *accessible;
g_return_val_if_fail (GTK_IS_MENU_ITEM (widget), NULL);
object = g_object_new (GAIL_TYPE_SUB_MENU_ITEM, NULL);
accessible = ATK_OBJECT (object);
atk_object_initialize (accessible, widget);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
return accessible;
class->initialize = gtk_submenu_item_accessible_initialize;
}
static void
atk_selection_interface_init (AtkSelectionIface *iface)
gtk_submenu_item_accessible_init (GtkSubmenuItemAccessible *item)
{
iface->add_selection = gail_sub_menu_item_add_selection;
iface->clear_selection = gail_sub_menu_item_clear_selection;
iface->ref_selection = gail_sub_menu_item_ref_selection;
iface->get_selection_count = gail_sub_menu_item_get_selection_count;
iface->is_child_selected = gail_sub_menu_item_is_child_selected;
iface->remove_selection = gail_sub_menu_item_remove_selection;
/*
* select_all_selection does not make sense for a submenu of a menu item
* so no implementation is provided.
*/
}
static gboolean
gail_sub_menu_item_add_selection (AtkSelection *selection,
gint i)
gtk_submenu_item_accessible_add_selection (AtkSelection *selection,
gint i)
{
GtkMenuShell *shell;
GList *kids;
......@@ -128,7 +75,6 @@ gail_sub_menu_item_add_selection (AtkSelection *selection,
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
/* State is defunct */
return FALSE;
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
......@@ -150,7 +96,7 @@ gail_sub_menu_item_add_selection (AtkSelection *selection,
}
static gboolean
gail_sub_menu_item_clear_selection (AtkSelection *selection)
gtk_submenu_item_accessible_clear_selection (AtkSelection *selection)
{
GtkMenuShell *shell;
GtkWidget *widget;
......@@ -158,7 +104,6 @@ gail_sub_menu_item_clear_selection (AtkSelection *selection)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
/* State is defunct */
return FALSE;
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
......@@ -169,9 +114,9 @@ gail_sub_menu_item_clear_selection (AtkSelection *selection)
return TRUE;
}
static AtkObject*
gail_sub_menu_item_ref_selection (AtkSelection *selection,
gint i)
static AtkObject *
gtk_submenu_item_accessible_ref_selection (AtkSelection *selection,
gint i)
{
GtkMenuShell *shell;
AtkObject *obj;
......@@ -184,7 +129,6 @@ gail_sub_menu_item_ref_selection (AtkSelection *selection,
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
/* State is defunct */
return NULL;
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
......@@ -198,14 +142,12 @@ gail_sub_menu_item_ref_selection (AtkSelection *selection,
g_object_ref (obj);
return obj;
}
else
{
return NULL;
}
return NULL;
}
static gint
gail_sub_menu_item_get_selection_count (AtkSelection *selection)
gtk_submenu_item_accessible_get_selection_count (AtkSelection *selection)
{
GtkMenuShell *shell;
GtkWidget *widget;
......@@ -213,25 +155,21 @@ gail_sub_menu_item_get_selection_count (AtkSelection *selection)
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
/* State is defunct */
return 0;
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
g_return_val_if_fail (GTK_IS_MENU_SHELL (submenu), FALSE);
g_return_val_if_fail (GTK_IS_MENU_SHELL (submenu), 0);
shell = GTK_MENU_SHELL (submenu);
/*
* Identifies the currently selected menu item
*/
if (gtk_menu_shell_get_selected_item (shell) == NULL)
return 0;
else
if (gtk_menu_shell_get_selected_item (shell) != NULL)
return 1;
return 0;
}
static gboolean
gail_sub_menu_item_is_child_selected (AtkSelection *selection,
gint i)
gtk_submenu_item_accessible_is_child_selected (AtkSelection *selection,
gint i)
{
GtkMenuShell *shell;
gint j;
......@@ -242,7 +180,6 @@ gail_sub_menu_item_is_child_selected (AtkSelection *selection,
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
/* State is defunct */
return FALSE;
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
......@@ -257,12 +194,12 @@ gail_sub_menu_item_is_child_selected (AtkSelection *selection,
j = g_list_index (kids, item);
g_list_free (kids);
return (j==i);
return j==i;
}
static gboolean
gail_sub_menu_item_remove_selection (AtkSelection *selection,
gint i)
gtk_submenu_item_accessible_remove_selection (AtkSelection *selection,
gint i)
{
GtkMenuShell *shell;
GtkWidget *widget;
......@@ -274,7 +211,6 @@ gail_sub_menu_item_remove_selection (AtkSelection *selection,
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
/* State is defunct */
return FALSE;
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
......@@ -283,19 +219,25 @@ gail_sub_menu_item_remove_selection (AtkSelection *selection,
item = gtk_menu_shell_get_selected_item (shell);
if (item && gtk_menu_item_get_submenu (GTK_MENU_ITEM (item)))
{
/*
* Menu item contains a menu and it is the selected menu item
* so deselect it.
*/
gtk_menu_shell_deselect (shell);
}
gtk_menu_shell_deselect (shell);
return TRUE;
}
static void
atk_selection_interface_init (AtkSelectionIface *iface)
{
iface->add_selection = gtk_submenu_item_accessible_add_selection;
iface->clear_selection = gtk_submenu_item_accessible_clear_selection;
iface->ref_selection = gtk_submenu_item_accessible_ref_selection;
iface->get_selection_count = gtk_submenu_item_accessible_get_selection_count;
iface->is_child_selected = gtk_submenu_item_accessible_is_child_selected;
iface->remove_selection = gtk_submenu_item_accessible_remove_selection;
}
static gint
menu_item_add_gtk (GtkContainer *container,
GtkWidget *widget)
GtkWidget *widget)
{
GtkWidget *parent_widget;
AtkObject *atk_parent;
......@@ -311,9 +253,8 @@ menu_item_add_gtk (GtkContainer *container,
atk_parent = gtk_widget_get_accessible (parent_widget);
atk_child = gtk_widget_get_accessible (widget);
g_object_notify (G_OBJECT (atk_child), "accessible-parent");
gail_container = GAIL_CONTAINER (atk_parent);
g_object_notify (G_OBJECT (atk_child), "accessible_parent");
g_list_free (gail_container->children);
gail_container->children = gtk_container_get_children (container);
index = g_list_index (gail_container->children, widget);
......@@ -325,13 +266,12 @@ menu_item_add_gtk (GtkContainer *container,
static gint
menu_item_remove_gtk (GtkContainer *container,
GtkWidget *widget)
GtkWidget *widget)
{
GtkWidget *parent_widget;
AtkObject *atk_parent;
AtkObject *atk_child;
GailContainer *gail_container;
AtkPropertyValues values = { NULL };
gint index;
gint list_length;
......@@ -343,13 +283,9 @@ menu_item_remove_gtk (GtkContainer *container,
atk_parent = gtk_widget_get_accessible (parent_widget);
atk_child = gtk_widget_get_accessible (widget);
gail_container = GAIL_CONTAINER (atk_parent);
g_value_init (&values.old_value, G_TYPE_POINTER);
g_value_set_pointer (&values.old_value, atk_parent);
values.property_name = "accessible-parent";
g_signal_emit_by_name (atk_child,
"property_change::accessible-parent", &values, NULL);
g_object_notify (G_OBJECT (atk_child), "accessible-parent");
gail_container = GAIL_CONTAINER (atk_parent);
index = g_list_index (gail_container->children, widget);
list_length = g_list_length (gail_container->children);
g_list_free (gail_container->children);
......
......@@ -17,38 +17,35 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef __GAIL_SUB_MENU_ITEM_H__
#define __GAIL_SUB_MENU_ITEM_H__
#ifndef __GTK_SUBMENU_ITEM_ACCESSIBLE_H__
#define __GTK_SUBMENU_ITEM_ACCESSIBLE_H__
#include "gailmenuitem.h"
#include "gtkmenuitemaccessible.h"
G_BEGIN_DECLS
#define GAIL_TYPE_SUB_MENU_ITEM (gail_sub_menu_item_get_type ())
#define GAIL_SUB_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_SUB_MENU_ITEM, GailSubMenuItem))
#define GAIL_SUB_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_SUB_MENU_ITEM, GailSubMenuItemClass))
#define GAIL_IS_SUB_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_SUB_MENU_ITEM))
#define GAIL_IS_SUB_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_SUB_MENU_ITEM))
#define GAIL_SUB_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_SUB_MENU_ITEM, GailSubMenuItemClass))
#define GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE (gtk_submenu_item_accessible_get_type ())
#define GTK_SUBMENU_ITEM_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE, GtkSubmenuItemAccessible))
#define GTK_SUBMENU_ITEM_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE, GtkSubmenuItemAccessibleClass))
#define GTK_IS_SUBMENU_ITEM_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE))
#define GTK_IS_SUBMENU_ITEM_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE))
#define GTK_SUBMENU_ITEM_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE, GtkSubmenuItemAccessibleClass))
typedef struct _GailSubMenuItem GailSubMenuItem;
typedef struct _GailSubMenuItemClass GailSubMenuItemClass;
typedef struct _GtkSubmenuItemAccessible GtkSubmenuItemAccessible;
typedef struct _GtkSubmenuItemAccessibleClass GtkSubmenuItemAccessibleClass;
struct _GailSubMenuItem
struct _GtkSubmenuItemAccessible
{
GailMenuItem parent;
GtkMenuItemAccessible parent;
};
GType gail_sub_menu_item_get_type (void);
struct _GailSubMenuItemClass
struct _GtkSubmenuItemAccessibleClass
{
GailMenuItemClass parent_class;
GtkMenuItemAccessibleClass parent_class;
};
AtkObject* gail_sub_menu_item_new (GtkWidget *widget);
GType gtk_submenu_item_accessible_get_type (void);
G_END_DECLS
#endif /* __GAIL_SUB_MENU_ITEM_H__ */
#endif /* __GTK_SUBMENU_ITEM_ACCESSIBLE_H__ */
......@@ -43,6 +43,8 @@
#include "gtkwidgetprivate.h"
#include "gtkintl.h"
#include "gtktypebuiltins.h"
#include "a11y/gtkmenuitemaccessible.h"
#include "a11y/gtksubmenuitemaccessible.h"
/**
......@@ -207,6 +209,23 @@ G_DEFINE_TYPE_WITH_CODE (GtkMenuItem, gtk_menu_item, GTK_TYPE_BIN,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTIVATABLE,
gtk_menu_item_activatable_interface_init))
static AtkObject *
gtk_menu_item_get_accessible (GtkWidget *widget)
{
GObject *object;
AtkObject *accessible;
/* FIXME this is not really right, submenus can come and go */
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
object = g_object_new (GTK_TYPE_SUBMENU_ITEM_ACCESSIBLE, NULL);
else
object = g_object_new (GTK_TYPE_MENU_ITEM_ACCESSIBLE, NULL);