2007-12-18 13:51:12 +00:00
|
|
|
/* 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 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
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2007-12-23 12:27:33 +00:00
|
|
|
|
2007-12-18 13:51:12 +00:00
|
|
|
#include <gtk/gtk.h>
|
2011-06-27 02:32:34 +00:00
|
|
|
#include "gtkscrollbaraccessible.h"
|
2007-12-18 13:51:12 +00:00
|
|
|
|
|
|
|
|
2011-07-09 20:32:40 +00:00
|
|
|
G_DEFINE_TYPE (GtkScrollbarAccessible, _gtk_scrollbar_accessible, GTK_TYPE_RANGE_ACCESSIBLE)
|
2007-12-18 13:51:12 +00:00
|
|
|
|
2007-12-23 12:24:59 +00:00
|
|
|
static void
|
2011-07-09 20:32:40 +00:00
|
|
|
_gtk_scrollbar_accessible_init (GtkScrollbarAccessible *accessible)
|
2007-12-23 12:24:59 +00:00
|
|
|
{
|
2007-12-18 13:51:12 +00:00
|
|
|
}
|
|
|
|
|
2007-12-25 09:29:46 +00:00
|
|
|
static void
|
2011-06-27 02:32:34 +00:00
|
|
|
gtk_scrollbar_accessible_initialize (AtkObject *accessible,
|
2011-07-09 20:32:40 +00:00
|
|
|
gpointer data)
|
2007-12-18 13:51:12 +00:00
|
|
|
{
|
2011-07-09 20:32:40 +00:00
|
|
|
ATK_OBJECT_CLASS (_gtk_scrollbar_accessible_parent_class)->initialize (accessible, data);
|
2007-12-18 13:51:12 +00:00
|
|
|
|
|
|
|
accessible->role = ATK_ROLE_SCROLL_BAR;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2011-06-27 02:32:34 +00:00
|
|
|
gtk_scrollbar_accessible_get_index_in_parent (AtkObject *accessible)
|
2007-12-18 13:51:12 +00:00
|
|
|
{
|
|
|
|
GtkWidget *widget;
|
2010-08-15 17:45:13 +00:00
|
|
|
GtkWidget *parent;
|
2011-06-09 04:16:23 +00:00
|
|
|
GtkWidget *child;
|
2007-12-18 13:51:12 +00:00
|
|
|
GtkScrolledWindow *scrolled_window;
|
2011-06-09 04:16:23 +00:00
|
|
|
gint id;
|
2007-12-18 13:51:12 +00:00
|
|
|
|
2010-05-22 23:55:33 +00:00
|
|
|
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
2007-12-18 13:51:12 +00:00
|
|
|
if (widget == NULL)
|
|
|
|
return -1;
|
|
|
|
|
2010-08-15 17:45:13 +00:00
|
|
|
parent = gtk_widget_get_parent (widget);
|
|
|
|
if (!GTK_IS_SCROLLED_WINDOW (parent))
|
2011-07-09 20:32:40 +00:00
|
|
|
return ATK_OBJECT_CLASS (_gtk_scrollbar_accessible_parent_class)->get_index_in_parent (accessible);
|
2007-12-18 13:51:12 +00:00
|
|
|
|
2010-08-15 17:45:13 +00:00
|
|
|
scrolled_window = GTK_SCROLLED_WINDOW (parent);
|
2011-06-09 04:16:23 +00:00
|
|
|
id = 0;
|
|
|
|
child = gtk_bin_get_child (GTK_BIN (scrolled_window));
|
|
|
|
if (child)
|
2007-12-18 13:51:12 +00:00
|
|
|
{
|
2011-06-09 04:16:23 +00:00
|
|
|
if (widget == child)
|
|
|
|
return id;
|
|
|
|
id++;
|
2007-12-18 13:51:12 +00:00
|
|
|
}
|
2011-06-09 04:16:23 +00:00
|
|
|
|
|
|
|
child = gtk_scrolled_window_get_hscrollbar (scrolled_window);
|
|
|
|
if (child)
|
2007-12-18 13:51:12 +00:00
|
|
|
{
|
2011-06-09 04:16:23 +00:00
|
|
|
if (widget == child)
|
|
|
|
return id;
|
|
|
|
id++;
|
2007-12-18 13:51:12 +00:00
|
|
|
}
|
2011-06-09 04:16:23 +00:00
|
|
|
child = gtk_scrolled_window_get_vscrollbar (scrolled_window);
|
|
|
|
if (child)
|
2007-12-18 13:51:12 +00:00
|
|
|
{
|
2011-06-09 04:16:23 +00:00
|
|
|
if (widget == child)
|
|
|
|
return id;
|
2007-12-18 13:51:12 +00:00
|
|
|
}
|
2011-06-09 04:16:23 +00:00
|
|
|
|
|
|
|
return -1;
|
2011-06-27 02:32:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-07-09 20:32:40 +00:00
|
|
|
_gtk_scrollbar_accessible_class_init (GtkScrollbarAccessibleClass *klass)
|
2011-06-27 02:32:34 +00:00
|
|
|
{
|
|
|
|
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
class->initialize = gtk_scrollbar_accessible_initialize;
|
|
|
|
class->get_index_in_parent = gtk_scrollbar_accessible_get_index_in_parent;
|
|
|
|
}
|