forked from AuroraMiddleware/gtk
Convert GailPaned to GtkPanedAccessible
This commit is contained in:
parent
7f58482d4e
commit
c750139c85
@ -29,7 +29,7 @@ gail_c_sources = \
|
||||
gailmenuitem.c \
|
||||
gailnotebook.c \
|
||||
gailnotebookpage.c \
|
||||
gailpaned.c \
|
||||
gtkpanedaccessible.c \
|
||||
gtkprogressbaraccessible.c \
|
||||
gailradiobutton.c \
|
||||
gailradiomenuitem.c \
|
||||
@ -81,7 +81,7 @@ gail_private_h_sources = \
|
||||
gailmenuitem.h \
|
||||
gailnotebook.h \
|
||||
gailnotebookpage.h \
|
||||
gailpaned.h \
|
||||
gtkpanedaccessible.h \
|
||||
gtkprogressbaraccessible.h \
|
||||
gailradiobutton.h \
|
||||
gailradiomenuitem.h \
|
||||
|
@ -37,11 +37,9 @@
|
||||
#include "gailmenushell.h"
|
||||
#include "gailmenuitem.h"
|
||||
#include "gailnotebook.h"
|
||||
#include "gailpaned.h"
|
||||
#include "gailradiobutton.h"
|
||||
#include "gailradiomenuitem.h"
|
||||
#include "gailrenderercell.h"
|
||||
#include "gailrange.h"
|
||||
#include "gailscalebutton.h"
|
||||
#include "gailscrolledwindow.h"
|
||||
#include "gailstatusbar.h"
|
||||
@ -108,14 +106,12 @@ GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_COMBO_BOX, GailComboBox, gail_combo_box, GTK_T
|
||||
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)
|
||||
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_RANGE, GailRange, gail_range, GTK_TYPE_RANGE)
|
||||
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_SCALE_BUTTON, GailScaleButton, gail_scale_button, GTK_TYPE_SCALE_BUTTON)
|
||||
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_STATUSBAR, GailStatusbar, gail_statusbar, GTK_TYPE_STATUSBAR)
|
||||
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_NOTEBOOK, GailNotebook, gail_notebook, GTK_TYPE_NOTEBOOK)
|
||||
GAIL_IMPLEMENT_FACTORY (GAIL_TYPE_TREE_VIEW, GailTreeView, gail_tree_view, GTK_TYPE_TREE_VIEW)
|
||||
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_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)
|
||||
@ -872,7 +868,6 @@ gail_accessibility_module_init (void)
|
||||
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);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_RANGE, gail_range);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCALE_BUTTON, gail_scale_button);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
|
||||
@ -883,7 +878,6 @@ gail_accessibility_module_init (void)
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER, gail_renderer_cell);
|
||||
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_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);
|
||||
|
@ -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_PANED_H__
|
||||
#define __GAIL_PANED_H__
|
||||
|
||||
#include "gailcontainer.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GAIL_TYPE_PANED (gail_paned_get_type ())
|
||||
#define GAIL_PANED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_PANED, GailPaned))
|
||||
#define GAIL_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_PANED, GailPanedClass))
|
||||
#define GAIL_IS_PANED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_PANED))
|
||||
#define GAIL_IS_PANED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_PANED))
|
||||
#define GAIL_PANED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_PANED, GailPanedClass))
|
||||
|
||||
typedef struct _GailPaned GailPaned;
|
||||
typedef struct _GailPanedClass GailPanedClass;
|
||||
|
||||
struct _GailPaned
|
||||
{
|
||||
GailContainer parent;
|
||||
};
|
||||
|
||||
GType gail_paned_get_type (void);
|
||||
|
||||
struct _GailPanedClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GAIL_PANED_H__ */
|
@ -21,85 +21,58 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailpaned.h"
|
||||
#include "gtkpanedaccessible.h"
|
||||
|
||||
static void gail_paned_class_init (GailPanedClass *klass);
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
static void gail_paned_init (GailPaned *paned);
|
||||
|
||||
static void gail_paned_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
static void gail_paned_size_allocate_gtk (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
static void gail_paned_get_current_value (AtkValue *obj,
|
||||
GValue *value);
|
||||
static void gail_paned_get_maximum_value (AtkValue *obj,
|
||||
GValue *value);
|
||||
static void gail_paned_get_minimum_value (AtkValue *obj,
|
||||
GValue *value);
|
||||
static gboolean gail_paned_set_current_value (AtkValue *obj,
|
||||
const GValue *value);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GailPaned, gail_paned, GAIL_TYPE_CONTAINER,
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GAIL_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
gail_paned_class_init (GailPanedClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gail_paned_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_paned_init (GailPaned *paned)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gail_paned_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gail_paned_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (data,
|
||||
"size_allocate",
|
||||
G_CALLBACK (gail_paned_size_allocate_gtk),
|
||||
NULL);
|
||||
|
||||
obj->role = ATK_ROLE_SPLIT_PANE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_paned_size_allocate_gtk (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
gtk_paned_accessible_size_allocate_gtk (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
AtkObject *obj = gtk_widget_get_accessible (widget);
|
||||
|
||||
g_object_notify (G_OBJECT (obj), "accessible-value");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
gtk_paned_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
iface->get_current_value = gail_paned_get_current_value;
|
||||
iface->get_maximum_value = gail_paned_get_maximum_value;
|
||||
iface->get_minimum_value = gail_paned_get_minimum_value;
|
||||
iface->set_current_value = gail_paned_set_current_value;
|
||||
ATK_OBJECT_CLASS (gtk_paned_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (data,
|
||||
"size_allocate",
|
||||
G_CALLBACK (gtk_paned_accessible_size_allocate_gtk),
|
||||
NULL);
|
||||
|
||||
obj->role = ATK_ROLE_SPLIT_PANE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_paned_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
gtk_paned_accessible_class_init (GtkPanedAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gtk_paned_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_init (GtkPanedAccessible *paned)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
gint current_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return;
|
||||
|
||||
current_value = gtk_paned_get_position (GTK_PANED (widget));
|
||||
@ -109,15 +82,14 @@ gail_paned_get_current_value (AtkValue *obj,
|
||||
}
|
||||
|
||||
static void
|
||||
gail_paned_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
gtk_paned_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
gint maximum_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return;
|
||||
|
||||
g_object_get (GTK_PANED (widget),
|
||||
@ -129,15 +101,14 @@ gail_paned_get_maximum_value (AtkValue *obj,
|
||||
}
|
||||
|
||||
static void
|
||||
gail_paned_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
gtk_paned_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
gint minimum_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return;
|
||||
|
||||
g_object_get (GTK_PANED (widget),
|
||||
@ -149,22 +120,21 @@ gail_paned_get_minimum_value (AtkValue *obj,
|
||||
}
|
||||
|
||||
/*
|
||||
* Calling atk_value_set_current_value() is no guarantee that the value is
|
||||
* acceptable; it is necessary to listen for accessible-value signals
|
||||
* and check whether the current value has been changed or check what the
|
||||
* Calling atk_value_set_current_value() is no guarantee that the value
|
||||
* is acceptable; it is necessary to listen for accessible-value signals
|
||||
* and check whether the current value has been changed or check what the
|
||||
* maximum and minimum values are.
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
gail_paned_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
gtk_paned_accessible_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
gint new_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return FALSE;
|
||||
|
||||
if (G_VALUE_HOLDS_INT (value))
|
||||
@ -177,3 +147,12 @@ gail_paned_set_current_value (AtkValue *obj,
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_paned_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_paned_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_paned_accessible_get_minimum_value;
|
||||
iface->set_current_value = gtk_paned_accessible_set_current_value;
|
||||
}
|
51
gtk/a11y/gtkpanedaccessible.h
Normal file
51
gtk/a11y/gtkpanedaccessible.h
Normal 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_PANED_ACCESSIBLE_H__
|
||||
#define __GTK_PANED_ACCESSIBLE_H__
|
||||
|
||||
#include "gailcontainer.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PANED_ACCESSIBLE (gtk_paned_accessible_get_type ())
|
||||
#define GTK_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessible))
|
||||
#define GTK_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass))
|
||||
#define GTK_IS_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PANED_ACCESSIBLE))
|
||||
#define GTK_IS_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PANED_ACCESSIBLE))
|
||||
#define GTK_PANED_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass))
|
||||
|
||||
typedef struct _GtkPanedAccessible GtkPanedAccessible;
|
||||
typedef struct _GtkPanedAccessibleClass GtkPanedAccessibleClass;
|
||||
|
||||
struct _GtkPanedAccessible
|
||||
{
|
||||
GailContainer parent;
|
||||
};
|
||||
|
||||
struct _GtkPanedAccessibleClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_paned_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PANED_ACCESSIBLE_H__ */
|
@ -36,7 +36,7 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#include "a11y/gtkpanedaccessible.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkpaned
|
||||
@ -653,6 +653,7 @@ gtk_paned_class_init (GtkPanedClass *class)
|
||||
add_move_binding (binding_set, GDK_KEY_KP_End, 0, GTK_SCROLL_END);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkPanedPrivate));
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_PANED_ACCESSIBLE);
|
||||
}
|
||||
|
||||
static GType
|
||||
|
Loading…
Reference in New Issue
Block a user