Convert GailScrollbar to GtkScrollbarAccessible

This commit is contained in:
Matthias Clasen 2011-06-26 22:32:34 -04:00
parent eebf34dd5f
commit 87195bc3cd
7 changed files with 76 additions and 88 deletions

View File

@ -38,7 +38,7 @@ gail_c_sources = \
gailrenderercell.c \
gtkscaleaccessible.c \
gailscalebutton.c \
gailscrollbar.c \
gtkscrollbaraccessible.c \
gailscrolledwindow.c \
gtkspinbuttonaccessible.c \
gailsubmenuitem.c \
@ -90,7 +90,7 @@ gail_private_h_sources = \
gailrenderercell.h \
gtkscaleaccessible.h \
gailscalebutton.h \
gailscrollbar.h \
gtkscrollbaraccessible.h \
gailscrolledwindow.h \
gtkspinbuttonaccessible.h \
gailsubmenuitem.h \

View File

@ -46,7 +46,6 @@
#include "gailrenderercell.h"
#include "gailrange.h"
#include "gailscalebutton.h"
#include "gailscrollbar.h"
#include "gailscrolledwindow.h"
#include "gailstatusbar.h"
#include "gailtextcell.h"
@ -123,7 +122,6 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_T
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RADIO_BUTTON, GailRadioButton, gail_radio_button, GTK_TYPE_RADIO_BUTTON)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, GailScrolledWindow, gail_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_PANED, GailPaned, gail_paned, GTK_TYPE_PANED)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCROLLBAR, GailScrollbar, gail_scrollbar, GTK_TYPE_SCROLLBAR)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItem, gail_check_menu_item, gail_check_menu_item_new)
GAIL_IMPLEMENT_FACTORY_WITH_FUNC (GAIL_TYPE_RADIO_MENU_ITEM, GailRadioMenuItem, gail_radio_menu_item, gail_radio_menu_item_new)
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_EXPANDER, GailExpander, gail_expander, GTK_TYPE_EXPANDER)
@ -895,7 +893,6 @@ gail_accessibility_module_init (void)
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_BUTTON, gail_radio_button);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLED_WINDOW, gail_scrolled_window);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PANED, gail_paned);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLBAR, gail_scrollbar);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CHECK_MENU_ITEM, gail_check_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item);
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_EXPANDER, gail_expander);

View File

@ -1,51 +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_SCROLLBAR_H__
#define __GAIL_SCROLLBAR_H__
#include "gailrange.h"
G_BEGIN_DECLS
#define GAIL_TYPE_SCROLLBAR (gail_scrollbar_get_type ())
#define GAIL_SCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_SCROLLBAR, GailScrollbar))
#define GAIL_SCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_SCROLLBAR, GailScrollbarClass))
#define GAIL_IS_SCROLLBAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_SCROLLBAR))
#define GAIL_IS_SCROLLBAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_SCROLLBAR))
#define GAIL_SCROLLBAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_SCROLLBAR, GailScrollbarClass))
typedef struct _GailScrollbar GailScrollbar;
typedef struct _GailScrollbarClass GailScrollbarClass;
struct _GailScrollbar
{
GailRange parent;
};
GType gail_scrollbar_get_type (void);
struct _GailScrollbarClass
{
GailRangeClass parent_class;
};
G_END_DECLS
#endif /* __GAIL_SCROLLBAR_H__ */

View File

@ -20,42 +20,27 @@
#include "config.h"
#include <gtk/gtk.h>
#include "gailscrollbar.h"
#include "gtkscrollbaraccessible.h"
static void gail_scrollbar_class_init (GailScrollbarClass *klass);
static void gail_scrollbar_init (GailScrollbar *accessible);
static void gail_scrollbar_initialize (AtkObject *accessible,
gpointer data);
static gint gail_scrollbar_get_index_in_parent (AtkObject *accessible);
G_DEFINE_TYPE (GailScrollbar, gail_scrollbar, GAIL_TYPE_RANGE)
static void
gail_scrollbar_class_init (GailScrollbarClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = gail_scrollbar_initialize;
class->get_index_in_parent = gail_scrollbar_get_index_in_parent;
}
G_DEFINE_TYPE (GtkScrollbarAccessible, gtk_scrollbar_accessible, GAIL_TYPE_RANGE)
static void
gail_scrollbar_init (GailScrollbar *accessible)
gtk_scrollbar_accessible_init (GtkScrollbarAccessible *accessible)
{
}
static void
gail_scrollbar_initialize (AtkObject *accessible,
gtk_scrollbar_accessible_initialize (AtkObject *accessible,
gpointer data)
{
ATK_OBJECT_CLASS (gail_scrollbar_parent_class)->initialize (accessible, data);
ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->initialize (accessible, data);
accessible->role = ATK_ROLE_SCROLL_BAR;
}
static gint
gail_scrollbar_get_index_in_parent (AtkObject *accessible)
gtk_scrollbar_accessible_get_index_in_parent (AtkObject *accessible)
{
GtkWidget *widget;
GtkWidget *parent;
@ -64,19 +49,12 @@ gail_scrollbar_get_index_in_parent (AtkObject *accessible)
gint id;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
if (widget == NULL)
{
/*
* State is defunct
*/
return -1;
}
g_return_val_if_fail (GTK_IS_SCROLLBAR (widget), -1);
parent = gtk_widget_get_parent (widget);
if (!GTK_IS_SCROLLED_WINDOW (parent))
return ATK_OBJECT_CLASS (gail_scrollbar_parent_class)->get_index_in_parent (accessible);
return ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->get_index_in_parent (accessible);
scrolled_window = GTK_SCROLLED_WINDOW (parent);
id = 0;
@ -103,4 +81,13 @@ gail_scrollbar_get_index_in_parent (AtkObject *accessible)
}
return -1;
}
}
static void
gtk_scrollbar_accessible_class_init (GtkScrollbarAccessibleClass *klass)
{
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
class->initialize = gtk_scrollbar_accessible_initialize;
class->get_index_in_parent = gtk_scrollbar_accessible_get_index_in_parent;
}

View File

@ -0,0 +1,51 @@
/* 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_SCROLLBAR_ACCESSIBLE_H__
#define __GTK_SCROLLBAR_ACCESSIBLE_H__
#include "gailrange.h"
G_BEGIN_DECLS
#define GTK_TYPE_SCROLLBAR_ACCESSIBLE (gtk_scrollbar_accessible_get_type ())
#define GTK_SCROLLBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessible))
#define GTK_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass))
#define GTK_IS_SCROLLBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE))
#define GTK_IS_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE))
#define GTK_SCROLLBAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass))
typedef struct _GtkScrollbarAccessible GtkScrollbarAccessible;
typedef struct _GtkScrollbarAccessibleClass GtkScrollbarAccessibleClass;
struct _GtkScrollbarAccessible
{
GailRange parent;
};
struct _GtkScrollbarAccessibleClass
{
GailRangeClass parent_class;
};
GType gtk_scrollbar_accessible_get_type (void);
G_END_DECLS
#endif /* __GTK_SCROLLBAR_ACCESSIBLE_H__ */

View File

@ -31,6 +31,8 @@
#include "gtkintl.h"
#include "gtkprivate.h"
#include "a11y/gtkscrollbaraccessible.h"
/**
* SECTION:gtkscrollbar
@ -108,6 +110,8 @@ gtk_scrollbar_class_init (GtkScrollbarClass *class)
P_("Display a second forward arrow button on the opposite end of the scrollbar"),
FALSE,
GTK_PARAM_READABLE));
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_SCROLLBAR_ACCESSIBLE);
}
static void

View File

@ -396,7 +396,7 @@ Click "Show other applications", for more options, or "Find applications online"
<AtkAction>
action 0 name: activate
action 0 description: activate the cell
unnamed-GailScrollbar-8
unnamed-GtkScrollbarAccessible-8
"scroll bar"
parent: unnamed-GailScrolledWindow-4
index: 1
@ -412,7 +412,7 @@ Click "Show other applications", for more options, or "Find applications online"
maximum value: 0.000000
current value: 0.000000
minimum increment: 39.800000
unnamed-GailScrollbar-9
unnamed-GtkScrollbarAccessible-9
"scroll bar"
parent: unnamed-GailScrolledWindow-4
index: 2