Integrate gail into gtk+. Bug #169488.
* configure.in: * docs/reference/Makefile.am: * docs/reference/libgail-util/*: * gail-uninstalled.pc.in: * gail.pc.in: * modules/Makefile.am: * modules/other/Makefile.am: * modules/other/gail/*: * modules/other/gail/libgail-util/*: * po/POTFILES.skip: Integrate gail into gtk+. Bug #169488. svn path=/trunk/; revision=19196
This commit is contained in:
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2007-12-18 Christian Persch <chpe@gnome.org>
|
||||
|
||||
* configure.in:
|
||||
* docs/reference/Makefile.am:
|
||||
* docs/reference/libgail-util/*:
|
||||
* gail-uninstalled.pc.in:
|
||||
* gail.pc.in:
|
||||
* modules/Makefile.am:
|
||||
* modules/other/Makefile.am:
|
||||
* modules/other/gail/*:
|
||||
* modules/other/gail/libgail-util/*:
|
||||
* po/POTFILES.skip: Integrate gail into gtk+. Bug #169488.
|
||||
|
||||
2007-12-17 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtksettings.c: Add a gtk-im-module GTK setting
|
||||
|
||||
40
configure.in
40
configure.in
@ -33,7 +33,7 @@ m4_define([gtk_binary_version], [2.10.0])
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.15.0])
|
||||
m4_define([pango_required_version], [1.17.3])
|
||||
m4_define([atk_required_version], [1.9.0])
|
||||
m4_define([atk_required_version], [1.13.0])
|
||||
m4_define([cairo_required_version], [1.2.0])
|
||||
|
||||
|
||||
@ -1559,6 +1559,36 @@ AC_SUBST(CAIRO_PREFIX)
|
||||
AC_SUBST(GTK_DEBUG_FLAGS)
|
||||
AC_SUBST(GTK_XIM_FLAGS)
|
||||
|
||||
########################
|
||||
# Checks needed for gail
|
||||
########################
|
||||
|
||||
old_LIBS="$LIBS"
|
||||
dnl Checks for inet libraries:
|
||||
AC_SEARCH_LIBS(gethostent, nsl)
|
||||
AC_SEARCH_LIBS(setsockopt, socket)
|
||||
AC_SEARCH_LIBS(connect, inet)
|
||||
|
||||
dnl check for the sockaddr_un.sun_len member
|
||||
AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
|
||||
[struct_sockaddr_un_sun_len=true],
|
||||
[struct_sockaddr_un_suin_len=false],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/un.h>]
|
||||
)
|
||||
case $struct_sockaddr_un_sun_len in
|
||||
true)
|
||||
AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_UN_SUN_LEN, 1, Have the sockaddr_un.sun_len member.)
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
GAIL_INET_LIBS="$LIBS"
|
||||
AC_SUBST([GAIL_INET_LIBS])
|
||||
|
||||
LIBS="$old_LIBS"
|
||||
|
||||
################################################################
|
||||
# Printing system checks
|
||||
################################################################
|
||||
@ -1760,9 +1790,11 @@ gdk-pixbuf-2.0.pc
|
||||
gdk-2.0.pc
|
||||
gtk+-2.0.pc
|
||||
gtk+-unix-print-2.0.pc
|
||||
gail.pc
|
||||
gdk-pixbuf-2.0-uninstalled.pc
|
||||
gdk-2.0-uninstalled.pc
|
||||
gtk+-2.0-uninstalled.pc
|
||||
gail-uninstalled.pc
|
||||
m4macros/Makefile
|
||||
po/Makefile.in
|
||||
po-properties/Makefile.in
|
||||
@ -1778,6 +1810,7 @@ docs/reference/gdk/Makefile
|
||||
docs/reference/gdk/version.xml
|
||||
docs/reference/gtk/Makefile
|
||||
docs/reference/gtk/version.xml
|
||||
docs/reference/libgail-util/Makefile
|
||||
docs/faq/Makefile
|
||||
docs/tools/Makefile
|
||||
docs/tutorial/Makefile
|
||||
@ -1800,12 +1833,15 @@ gtk/theme-bits/Makefile
|
||||
gtk/tests/Makefile
|
||||
gtk/xdgmime/Makefile
|
||||
modules/Makefile
|
||||
modules/input/Makefile
|
||||
modules/other/Makefile
|
||||
modules/other/gail/Makefile
|
||||
modules/other/gail/libgail-util/Makefile
|
||||
modules/engines/Makefile
|
||||
modules/engines/pixbuf/Makefile
|
||||
modules/engines/ms-windows/Makefile
|
||||
modules/engines/ms-windows/Theme/Makefile
|
||||
modules/engines/ms-windows/Theme/gtk-2.0/Makefile
|
||||
modules/input/Makefile
|
||||
modules/printbackends/Makefile
|
||||
modules/printbackends/cups/Makefile
|
||||
modules/printbackends/lpr/Makefile
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = gdk-pixbuf gdk gtk
|
||||
SUBDIRS = gdk-pixbuf gdk gtk libgail-util
|
||||
|
||||
|
||||
33
docs/reference/libgail-util/Makefile.am
Normal file
33
docs/reference/libgail-util/Makefile.am
Normal file
@ -0,0 +1,33 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.7
|
||||
|
||||
# The name of the module.
|
||||
DOC_MODULE=gail-libgail-util
|
||||
|
||||
# The top-level SGML file.
|
||||
DOC_MAIN_SGML_FILE=gail-libgail-util-docs.sgml
|
||||
|
||||
# The directory containing the source code (if it contains documentation).
|
||||
DOC_SOURCE_DIR=../../../modules/other/gail/libgail-util
|
||||
|
||||
# Used for dependencies
|
||||
HFILE_GLOB = $(top_srcdir)/modules/other/gail/libgail-util/*.h
|
||||
CFILE_GLOB = $(top_srcdir)/modules/other/gail/libgail-util/*.c
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling scan program. Only needed
|
||||
# if $(DOC_MODULE).types is non-empty.
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_builddir) \
|
||||
$(DEP_CFLAGS)
|
||||
|
||||
GTKDOC_LIBS = $(top_builddir)/modules/other/gail/libgail-util/libgailutil.la
|
||||
|
||||
# gtkdoc-mkdb related varaibles
|
||||
MKDB_OPTIONS =
|
||||
content_files =
|
||||
|
||||
HTML_IMAGES =
|
||||
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
17
docs/reference/libgail-util/gail-libgail-util-docs.sgml
Normal file
17
docs/reference/libgail-util/gail-libgail-util-docs.sgml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
|
||||
<!ENTITY gail-libgail-util-gailtextutil SYSTEM "xml/gailtextutil.xml">
|
||||
<!ENTITY gail-libgail-util-gailmisc SYSTEM "xml/gailmisc.xml">
|
||||
]>
|
||||
|
||||
<book>
|
||||
<bookinfo>
|
||||
<title>GAIL Reference Manual</title>
|
||||
</bookinfo>
|
||||
<chapter id="libgail-util-main">
|
||||
<title>GAIL libgail-util Library</title>
|
||||
&gail-libgail-util-gailtextutil;
|
||||
&gail-libgail-util-gailmisc;
|
||||
</chapter>
|
||||
</book>
|
||||
34
docs/reference/libgail-util/gail-libgail-util-sections.txt
Normal file
34
docs/reference/libgail-util/gail-libgail-util-sections.txt
Normal file
@ -0,0 +1,34 @@
|
||||
<SECTION>
|
||||
<FILE>gailtextutil</FILE>
|
||||
<TITLE>GailTextUtil</TITLE>
|
||||
GailTextUtil
|
||||
GailOffsetType
|
||||
gail_text_util_new
|
||||
gail_text_util_text_setup
|
||||
gail_text_util_buffer_setup
|
||||
gail_text_util_get_text
|
||||
gail_text_util_get_substring
|
||||
<SUBSECTION Standard>
|
||||
GailTextUtilClass
|
||||
GAIL_TEXT_UTIL
|
||||
GAIL_IS_TEXT_UTIL
|
||||
GAIL_TYPE_TEXT_UTIL
|
||||
GAIL_TEXT_UTIL_CLASS
|
||||
GAIL_IS_TEXT_UTIL_CLASS
|
||||
GAIL_TEXT_UTIL_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gail_text_util_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gailmisc</FILE>
|
||||
<TITLE>GailMisc</TITLE>
|
||||
gail_misc_add_attribute
|
||||
gail_misc_layout_get_run_attributes
|
||||
gail_misc_get_default_attributes
|
||||
gail_misc_get_extents_from_pango_rectangle
|
||||
gail_misc_get_index_at_point_in_layout
|
||||
gail_misc_get_origins
|
||||
gail_misc_add_to_attr_set
|
||||
gail_misc_buffer_get_run_attributes
|
||||
</SECTION>
|
||||
0
docs/reference/libgail-util/gail-libgail-util.types
Normal file
0
docs/reference/libgail-util/gail-libgail-util.types
Normal file
122
docs/reference/libgail-util/tmpl/gailmisc.sgml
Normal file
122
docs/reference/libgail-util/tmpl/gailmisc.sgml
Normal file
@ -0,0 +1,122 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GailMisc
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
GailMisc is a set of utility functions which may be useful to implementors of
|
||||
Atk interfaces for custom widgets.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GailMisc is a set of utility function which are used in the implemementation
|
||||
of Atk interfaces for Gtk widgets. They may be useful to implementors of
|
||||
Atk interfaces for custom widgets.
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_add_attribute ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@attrib_set:
|
||||
@attr:
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_layout_get_run_attributes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@attrib_set:
|
||||
@layout:
|
||||
@text:
|
||||
@offset:
|
||||
@start_offset:
|
||||
@end_offset:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_get_default_attributes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@attrib_set:
|
||||
@layout:
|
||||
@widget:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_get_extents_from_pango_rectangle ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@char_rect:
|
||||
@x_layout:
|
||||
@y_layout:
|
||||
@x:
|
||||
@y:
|
||||
@width:
|
||||
@height:
|
||||
@coords:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_get_index_at_point_in_layout ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@layout:
|
||||
@x_layout:
|
||||
@y_layout:
|
||||
@x:
|
||||
@y:
|
||||
@coords:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_get_origins ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@widget:
|
||||
@x_window:
|
||||
@y_window:
|
||||
@x_toplevel:
|
||||
@y_toplevel:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_add_to_attr_set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@attrib_set:
|
||||
@attrs:
|
||||
@attr:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_misc_buffer_get_run_attributes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@offset:
|
||||
@start_offset:
|
||||
@end_offset:
|
||||
@Returns:
|
||||
|
||||
|
||||
92
docs/reference/libgail-util/tmpl/gailtextutil.sgml
Normal file
92
docs/reference/libgail-util/tmpl/gailtextutil.sgml
Normal file
@ -0,0 +1,92 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GailTextUtil
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
GailTextUtil is a utility class which can be used to implement some of
|
||||
the AtkText functions for accessible objects which implement AtkText.
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GailTextUtil is a utility class which can be used to implement the
|
||||
AtkText functions which get text for accessible objects which implement
|
||||
AtkText.
|
||||
|
||||
In GAIL it is used by the accsesible objects for GnomeCanvasText, GtkEntry,
|
||||
GtkLabel, GtkCellRendererText and GtkTextview.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### STRUCT GailTextUtil ##### -->
|
||||
<para>
|
||||
The GailTextCell structure should not be accessed directly.
|
||||
|
||||
</para>
|
||||
|
||||
@parent:
|
||||
@buffer:
|
||||
|
||||
<!-- ##### ENUM GailOffsetType ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GAIL_BEFORE_OFFSET:
|
||||
@GAIL_AT_OFFSET:
|
||||
@GAIL_AFTER_OFFSET:
|
||||
|
||||
<!-- ##### FUNCTION gail_text_util_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_text_util_text_setup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@textutil:
|
||||
@text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_text_util_buffer_setup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@textutil:
|
||||
@buffer:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_text_util_get_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@textutil:
|
||||
@layout:
|
||||
@function:
|
||||
@boundary_type:
|
||||
@offset:
|
||||
@start_offset:
|
||||
@end_offset:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gail_text_util_get_substring ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@textutil:
|
||||
@start_pos:
|
||||
@end_pos:
|
||||
@Returns:
|
||||
|
||||
|
||||
11
gail-uninstalled.pc.in
Normal file
11
gail-uninstalled.pc.in
Normal file
@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Gail
|
||||
Description: GNOME Accessibility Implementation Library
|
||||
Version: @VERSION@
|
||||
Requires: atk gtk+-2.0
|
||||
Libs: ${pc_top_builddir}/${pcfiledir}/gail/libgail.la
|
||||
Cflags: -I${pc_top_builddir}/${pcfiledir}
|
||||
11
gail.pc.in
Normal file
11
gail.pc.in
Normal file
@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Gail
|
||||
Description: GNOME Accessibility Implementation Library
|
||||
Version: @VERSION@
|
||||
Requires: atk gtk+-2.0
|
||||
Libs: -L${libdir} -lgailutil
|
||||
Cflags: -I${includedir}/gail-1.0
|
||||
@ -1,8 +1,7 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
if OS_UNIX
|
||||
PRINTBACKENDS_SUBDIR=printbackends
|
||||
endif
|
||||
SUBDIRS = input engines other
|
||||
|
||||
SUBDIRS=input engines $(PRINTBACKENDS_SUBDIR)
|
||||
DIST_SUBDIRS=input engines printbackends
|
||||
if OS_UNIX
|
||||
SUBDIRS += printbackends
|
||||
endif
|
||||
|
||||
1
modules/other/Makefile.am
Normal file
1
modules/other/Makefile.am
Normal file
@ -0,0 +1 @@
|
||||
SUBDIRS = gail
|
||||
173
modules/other/gail/Makefile.am
Normal file
173
modules/other/gail/Makefile.am
Normal file
@ -0,0 +1,173 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = libgail-util
|
||||
|
||||
if OS_WIN32
|
||||
no_undefined = -no-undefined
|
||||
endif
|
||||
|
||||
moduledir = $(libdir)/gtk-2.0/$(GTK_BINARY_VERSION)/other
|
||||
module_LTLIBRARIES = libgail.la
|
||||
|
||||
gail_c_sources = \
|
||||
gail-private-macros.h \
|
||||
gail.c \
|
||||
gailadjustment.c \
|
||||
gailarrow.c \
|
||||
gailbooleancell.c \
|
||||
gailbooleancellfactory.c \
|
||||
gailbox.c \
|
||||
gailbutton.c \
|
||||
gailcalendar.c \
|
||||
gailcell.c \
|
||||
gailcellparent.c \
|
||||
gailcheckmenuitem.c \
|
||||
gailchecksubmenuitem.c \
|
||||
gailclist.c \
|
||||
gailclistcell.c \
|
||||
gailcombo.c \
|
||||
gailcombobox.c \
|
||||
gailcontainer.c \
|
||||
gailcontainercell.c \
|
||||
gailentry.c \
|
||||
gailexpander.c \
|
||||
gailframe.c \
|
||||
gailimage.c \
|
||||
gailimagecell.c \
|
||||
gailimagecellfactory.c \
|
||||
gailitem.c \
|
||||
gaillabel.c \
|
||||
gaillist.c \
|
||||
gailmenu.c \
|
||||
gailmenushell.c \
|
||||
gailmenuitem.c \
|
||||
gailnotebook.c \
|
||||
gailnotebookpage.c \
|
||||
gailobject.c \
|
||||
gailobjectfactory.c \
|
||||
gailoptionmenu.c \
|
||||
gailpaned.c \
|
||||
gailpixmap.c \
|
||||
gailprogressbar.c \
|
||||
gailradiobutton.c \
|
||||
gailradiomenuitem.c \
|
||||
gailradiosubmenuitem.c \
|
||||
gailrange.c \
|
||||
gailrenderercell.c \
|
||||
gailrenderercellfactory.c \
|
||||
gailscale.c \
|
||||
gailscrollbar.c \
|
||||
gailscrolledwindow.c \
|
||||
gailseparator.c \
|
||||
gailspinbutton.c \
|
||||
gailsubmenuitem.c \
|
||||
gailstatusbar.c \
|
||||
gailtextcell.c \
|
||||
gailtextcellfactory.c \
|
||||
gailtextview.c \
|
||||
gailtogglebutton.c \
|
||||
gailtoplevel.c \
|
||||
gailtreeview.c \
|
||||
gailutil.c \
|
||||
gailwidget.c \
|
||||
gailwindow.c
|
||||
|
||||
libgailincludedir=$(includedir)/gail-1.0/gail
|
||||
|
||||
gail_private_h_sources = \
|
||||
gail.h \
|
||||
gailadjustment.h \
|
||||
gailarrow.h \
|
||||
gailbooleancell.h \
|
||||
gailbooleancellfactory.h \
|
||||
gailbox.h \
|
||||
gailbutton.h \
|
||||
gailcalendar.h \
|
||||
gailcell.h \
|
||||
gailcellparent.h \
|
||||
gailcheckmenuitem.h \
|
||||
gailchecksubmenuitem.h \
|
||||
gailclist.h \
|
||||
gailclistcell.h \
|
||||
gailcombo.h \
|
||||
gailcombobox.h \
|
||||
gailcontainercell.h \
|
||||
gailcontainer.h \
|
||||
gailentry.h \
|
||||
gailexpander.h \
|
||||
gailfactory.h \
|
||||
gailframe.h \
|
||||
gailimage.h \
|
||||
gailimagecell.h \
|
||||
gailimagecellfactory.h \
|
||||
gailintl.h \
|
||||
gailitem.h \
|
||||
gaillabel.h \
|
||||
gaillist.h \
|
||||
gailmenu.h \
|
||||
gailmenushell.h \
|
||||
gailmenuitem.h \
|
||||
gailnotebook.h \
|
||||
gailnotebookpage.h \
|
||||
gailobject.h \
|
||||
gailobjectfactory.h \
|
||||
gailoptionmenu.h \
|
||||
gailpaned.h \
|
||||
gailpixmap.h \
|
||||
gailprogressbar.h \
|
||||
gailradiobutton.h \
|
||||
gailradiomenuitem.h \
|
||||
gailradiosubmenuitem.h \
|
||||
gailrange.h \
|
||||
gailrenderercell.h \
|
||||
gailrenderercellfactory.h \
|
||||
gailscale.h \
|
||||
gailscrollbar.h \
|
||||
gailscrolledwindow.h \
|
||||
gailseparator.h \
|
||||
gailspinbutton.h \
|
||||
gailsubmenuitem.h \
|
||||
gailstatusbar.h \
|
||||
gailtextcell.h \
|
||||
gailtextcellfactory.h \
|
||||
gailtextview.h \
|
||||
gailtogglebutton.h \
|
||||
gailtoplevel.h \
|
||||
gailtreeview.h \
|
||||
gailutil.h \
|
||||
gailwindow.h
|
||||
|
||||
gail_public_h_sources = \
|
||||
gailwidget.h
|
||||
|
||||
libgail_la_SOURCES = \
|
||||
$(gail_c_sources) \
|
||||
$(gail_public_h_sources) \
|
||||
$(gail_private_h_sources)
|
||||
|
||||
libgailinclude_HEADERS = \
|
||||
$(gail_public_h_sources)
|
||||
|
||||
libgail_la_CPPFLAGS = \
|
||||
-I$(top_srcdir)/modules/other \
|
||||
-I$(top_srcdir)/gdk \
|
||||
-I$(top_builddir)/gdk \
|
||||
-I$(top_srcdir)/gtk \
|
||||
-I$(top_builddir)/gtk \
|
||||
-DGTK_VERSION=\"$(GTK_VERSION)\" \
|
||||
$(AM_CPPFLAGS)
|
||||
|
||||
libgail_la_CFLAGS = \
|
||||
$(GTK_DEP_CFLAGS) \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(AM_CFLAGS)
|
||||
|
||||
libgail_la_LIBADD = \
|
||||
$(GTK_DEP_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
libgail_la_LDFLAGS = \
|
||||
$(top_builddir)/modules/other/gail/libgail-util/libgailutil.la \
|
||||
-rpath $(moduledir) -module -avoid-version \
|
||||
$(no_undefined) \
|
||||
$(LDFLAGS)
|
||||
38
modules/other/gail/gail-private-macros.h
Normal file
38
modules/other/gail/gail-private-macros.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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_PRIVATE_MACROS_H__
|
||||
#define __GAIL_PRIVATE_MACROS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Note: these macros are logic macros, not intended to warn on failure. */
|
||||
|
||||
#define gail_return_val_if_fail(a, b) if (!(a)) return (b)
|
||||
#define gail_return_if_fail(a) if (!(a)) return
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_PRIVATE_MACROS_H__ */
|
||||
982
modules/other/gail/gail.c
Normal file
982
modules/other/gail/gail.c
Normal file
@ -0,0 +1,982 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gail.h"
|
||||
#include "gailfactory.h"
|
||||
|
||||
#define GNOME_ACCESSIBILITY_ENV "GNOME_ACCESSIBILITY"
|
||||
|
||||
static gboolean gail_focus_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data);
|
||||
static gboolean gail_select_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data);
|
||||
static gboolean gail_deselect_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data);
|
||||
static gboolean gail_switch_page_watcher(GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data);
|
||||
static AtkObject* gail_get_accessible_for_widget (GtkWidget *widget,
|
||||
gboolean *transient);
|
||||
static void gail_finish_select (GtkWidget *widget);
|
||||
static void gail_map_cb (GtkWidget *widget);
|
||||
static void gail_map_submenu_cb (GtkWidget *widget);
|
||||
static gint gail_focus_idle_handler (gpointer data);
|
||||
static void gail_focus_notify (GtkWidget *widget);
|
||||
static void gail_focus_notify_when_idle (GtkWidget *widget);
|
||||
|
||||
static void gail_focus_tracker_init (void);
|
||||
static void gail_focus_object_destroyed (gpointer data);
|
||||
static void gail_focus_tracker (AtkObject *object);
|
||||
static void gail_set_focus_widget (GtkWidget *focus_widget,
|
||||
GtkWidget *widget);
|
||||
static void gail_set_focus_object (AtkObject *focus_obj,
|
||||
AtkObject *obj);
|
||||
|
||||
GtkWidget* focus_widget = NULL;
|
||||
static GtkWidget* next_focus_widget = NULL;
|
||||
static gboolean was_deselect = FALSE;
|
||||
static GtkWidget* subsequent_focus_widget = NULL;
|
||||
static GtkWidget* focus_before_menu = NULL;
|
||||
static guint focus_notify_handler = 0;
|
||||
static guint focus_tracker_id = 0;
|
||||
static GQuark quark_focus_object = 0;
|
||||
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_WIDGET, gail_widget, gail_widget_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_CONTAINER, gail_container, gail_container_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_BUTTON, gail_button, gail_button_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_ITEM, gail_item, gail_item_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_MENU_ITEM, gail_menu_item, gail_menu_item_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_TOGGLE_BUTTON, gail_toggle_button, gail_toggle_button_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_IMAGE, gail_image, gail_image_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_TEXT_VIEW, gail_text_view, gail_text_view_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_COMBO, gail_combo, gail_combo_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_COMBO_BOX, gail_combo_box, gail_combo_box_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_ENTRY, gail_entry, gail_entry_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_MENU_SHELL, gail_menu_shell, gail_menu_shell_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_MENU, gail_menu, gail_menu_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_WINDOW, gail_window, gail_window_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_RANGE, gail_range, gail_range_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_SCALE, gail_scale, gail_scale_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_CLIST, gail_clist, gail_clist_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_LABEL, gail_label, gail_label_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_STATUSBAR, gail_statusbar, gail_statusbar_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_NOTEBOOK, gail_notebook, gail_notebook_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_CALENDAR, gail_calendar, gail_calendar_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_PROGRESS_BAR, gail_progress_bar, gail_progress_bar_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_SPIN_BUTTON, gail_spin_button, gail_spin_button_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_TREE_VIEW, gail_tree_view, gail_tree_view_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_FRAME, gail_frame, gail_frame_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_RADIO_BUTTON, gail_radio_button, gail_radio_button_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_ARROW, gail_arrow, gail_arrow_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_PIXMAP, gail_pixmap, gail_pixmap_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_SEPARATOR, gail_separator, gail_separator_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_BOX, gail_box, gail_box_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_SCROLLED_WINDOW, gail_scrolled_window, gail_scrolled_window_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_LIST, gail_list, gail_list_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_PANED, gail_paned, gail_paned_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_SCROLLBAR, gail_scrollbar, gail_scrollbar_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_OPTION_MENU, gail_option_menu, gail_option_menu_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_CHECK_MENU_ITEM, gail_check_menu_item, gail_check_menu_item_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_RADIO_MENU_ITEM, gail_radio_menu_item, gail_radio_menu_item_new)
|
||||
GAIL_ACCESSIBLE_FACTORY (GAIL_TYPE_EXPANDER, gail_expander, gail_expander_new)
|
||||
|
||||
static AtkObject*
|
||||
gail_get_accessible_for_widget (GtkWidget *widget,
|
||||
gboolean *transient)
|
||||
{
|
||||
AtkObject *obj = NULL;
|
||||
GType gnome_canvas;
|
||||
|
||||
gnome_canvas = g_type_from_name ("GnomeCanvas");
|
||||
|
||||
*transient = FALSE;
|
||||
if (!widget)
|
||||
return NULL;
|
||||
|
||||
if (GTK_IS_ENTRY (widget))
|
||||
{
|
||||
GtkWidget *other_widget = widget->parent;
|
||||
if (GTK_IS_COMBO (other_widget))
|
||||
{
|
||||
gail_set_focus_widget (other_widget, widget);
|
||||
widget = other_widget;
|
||||
}
|
||||
}
|
||||
else if (GTK_IS_NOTEBOOK (widget))
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
gint page_num = -1;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
/*
|
||||
* Report the currently focused tab rather than the currently selected tab
|
||||
*/
|
||||
if (notebook->focus_tab)
|
||||
{
|
||||
page_num = g_list_index (notebook->children, notebook->focus_tab->data);
|
||||
}
|
||||
if (page_num != -1)
|
||||
{
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
obj = atk_object_ref_accessible_child (obj, page_num);
|
||||
g_object_unref (obj);
|
||||
}
|
||||
}
|
||||
else if (GTK_CHECK_TYPE ((widget), gnome_canvas))
|
||||
{
|
||||
GObject *focused_item;
|
||||
GValue value = {0, };
|
||||
|
||||
g_value_init (&value, G_TYPE_OBJECT);
|
||||
g_object_get_property (G_OBJECT (widget), "focused_item", &value);
|
||||
focused_item = g_value_get_object (&value);
|
||||
|
||||
if (focused_item)
|
||||
{
|
||||
AtkObject *tmp;
|
||||
|
||||
obj = atk_gobject_accessible_for_object (G_OBJECT (focused_item));
|
||||
tmp = g_object_get_qdata (G_OBJECT (obj), quark_focus_object);
|
||||
if (tmp != NULL)
|
||||
obj = tmp;
|
||||
}
|
||||
}
|
||||
else if (GTK_IS_TOGGLE_BUTTON (widget))
|
||||
{
|
||||
GtkWidget *other_widget = widget->parent;
|
||||
if (GTK_IS_COMBO_BOX (other_widget))
|
||||
{
|
||||
gail_set_focus_widget (other_widget, widget);
|
||||
widget = other_widget;
|
||||
}
|
||||
}
|
||||
if (obj == NULL)
|
||||
{
|
||||
AtkObject *focus_object;
|
||||
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
focus_object = g_object_get_qdata (G_OBJECT (obj), quark_focus_object);
|
||||
/*
|
||||
* We check whether the object for this focus_object has been deleted.
|
||||
* This can happen when navigating to an empty directory in nautilus.
|
||||
* See bug #141907.
|
||||
*/
|
||||
if (ATK_IS_GOBJECT_ACCESSIBLE (focus_object))
|
||||
{
|
||||
if (!atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (focus_object)))
|
||||
focus_object = NULL;
|
||||
}
|
||||
if (focus_object)
|
||||
obj = focus_object;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_focus_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data)
|
||||
{
|
||||
GObject *object;
|
||||
GtkWidget *widget;
|
||||
GdkEvent *event;
|
||||
|
||||
object = g_value_get_object (param_values + 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET(object), FALSE);
|
||||
|
||||
event = g_value_get_boxed (param_values + 1);
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
if (event->type == GDK_FOCUS_CHANGE)
|
||||
{
|
||||
if (event->focus_change.in)
|
||||
{
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
{
|
||||
GtkWindow *window;
|
||||
|
||||
window = GTK_WINDOW (widget);
|
||||
if (window->focus_widget)
|
||||
{
|
||||
/*
|
||||
* If we already have a potential focus widget set this
|
||||
* windows's focus widget to focus_before_menu so that
|
||||
* it will be reported when menu item is unset.
|
||||
*/
|
||||
if (next_focus_widget)
|
||||
{
|
||||
if (GTK_IS_MENU_ITEM (next_focus_widget) &&
|
||||
!focus_before_menu)
|
||||
{
|
||||
void *vp_focus_before_menu = &focus_before_menu;
|
||||
focus_before_menu = window->focus_widget;
|
||||
g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
widget = window->focus_widget;
|
||||
}
|
||||
else if (window->type == GTK_WINDOW_POPUP)
|
||||
{
|
||||
if (GTK_IS_BIN (widget))
|
||||
{
|
||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
|
||||
if (GTK_IS_WIDGET (child) && GTK_WIDGET_HAS_GRAB (child))
|
||||
{
|
||||
if (GTK_IS_MENU_SHELL (child))
|
||||
{
|
||||
if (GTK_MENU_SHELL (child)->active_menu_item)
|
||||
{
|
||||
/*
|
||||
* We have a menu which has a menu item selected
|
||||
* so we do not report focus on the menu.
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
widget = child;
|
||||
}
|
||||
}
|
||||
else /* popup window has no children; this edge case occurs in some custom code (OOo for instance) */
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else /* Widget is a non-popup toplevel with no focus children;
|
||||
don't emit for this case either, as it's useless */
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (next_focus_widget)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (next_focus_widget);
|
||||
if (toplevel == widget)
|
||||
next_focus_widget = NULL;
|
||||
}
|
||||
/* focus out */
|
||||
widget = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (event->type == GDK_MOTION_NOTIFY && GTK_WIDGET_HAS_FOCUS (widget))
|
||||
{
|
||||
if (widget == focus_widget)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If the focus widget is a GtkSocket without a plug
|
||||
* then ignore the focus notification as the embedded
|
||||
* plug will report a focus notification.
|
||||
*/
|
||||
if (GTK_IS_SOCKET (widget) &&
|
||||
GTK_SOCKET (widget)->plug_widget == NULL)
|
||||
return TRUE;
|
||||
/*
|
||||
* The widget may not yet be visible on the screen so we wait until it is.
|
||||
*/
|
||||
gail_focus_notify_when_idle (widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_select_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data)
|
||||
{
|
||||
GObject *object;
|
||||
GtkWidget *widget;
|
||||
|
||||
object = g_value_get_object (param_values + 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET(object), FALSE);
|
||||
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
if (!GTK_WIDGET_MAPPED (widget))
|
||||
{
|
||||
g_signal_connect (widget, "map",
|
||||
G_CALLBACK (gail_map_cb),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
gail_finish_select (widget);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_finish_select (GtkWidget *widget)
|
||||
{
|
||||
if (GTK_IS_MENU_ITEM (widget))
|
||||
{
|
||||
GtkMenuItem* menu_item;
|
||||
|
||||
menu_item = GTK_MENU_ITEM (widget);
|
||||
if (menu_item->submenu &&
|
||||
!GTK_WIDGET_MAPPED (menu_item->submenu))
|
||||
{
|
||||
/*
|
||||
* If the submenu is not visble, wait until it is before
|
||||
* reporting focus on the menu item.
|
||||
*/
|
||||
gulong handler_id;
|
||||
|
||||
handler_id = g_signal_handler_find (menu_item->submenu,
|
||||
G_SIGNAL_MATCH_FUNC,
|
||||
g_signal_lookup ("map",
|
||||
GTK_TYPE_WINDOW),
|
||||
0,
|
||||
NULL,
|
||||
(gpointer) gail_map_submenu_cb,
|
||||
NULL);
|
||||
if (!handler_id)
|
||||
g_signal_connect (menu_item->submenu, "map",
|
||||
G_CALLBACK (gail_map_submenu_cb),
|
||||
NULL);
|
||||
return;
|
||||
|
||||
}
|
||||
/*
|
||||
* If we are waiting to report focus on a menubar or a menu item
|
||||
* because of a previous deselect, cancel it.
|
||||
*/
|
||||
if (was_deselect &&
|
||||
focus_notify_handler &&
|
||||
next_focus_widget &&
|
||||
(GTK_IS_MENU_BAR (next_focus_widget) ||
|
||||
GTK_IS_MENU_ITEM (next_focus_widget)))
|
||||
{
|
||||
void *vp_next_focus_widget = &next_focus_widget;
|
||||
g_source_remove (focus_notify_handler);
|
||||
g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
|
||||
next_focus_widget = NULL;
|
||||
focus_notify_handler = 0;
|
||||
was_deselect = FALSE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If previously focused widget is not a GtkMenuItem or a GtkMenu,
|
||||
* keep track of it so we can return to it after menubar is deactivated
|
||||
*/
|
||||
if (focus_widget &&
|
||||
!GTK_IS_MENU_ITEM (focus_widget) &&
|
||||
!GTK_IS_MENU (focus_widget))
|
||||
{
|
||||
void *vp_focus_before_menu = &focus_before_menu;
|
||||
focus_before_menu = focus_widget;
|
||||
g_object_add_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
|
||||
|
||||
}
|
||||
gail_focus_notify_when_idle (widget);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_map_cb (GtkWidget *widget)
|
||||
{
|
||||
gail_finish_select (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_map_submenu_cb (GtkWidget *widget)
|
||||
{
|
||||
if (GTK_IS_MENU (widget))
|
||||
{
|
||||
if (GTK_MENU (widget)->parent_menu_item)
|
||||
gail_finish_select (GTK_MENU (widget)->parent_menu_item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gail_deselect_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data)
|
||||
{
|
||||
GObject *object;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *menu_shell;
|
||||
|
||||
object = g_value_get_object (param_values + 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET(object), FALSE);
|
||||
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
if (!GTK_IS_MENU_ITEM (widget))
|
||||
return TRUE;
|
||||
|
||||
if (subsequent_focus_widget == widget)
|
||||
subsequent_focus_widget = NULL;
|
||||
|
||||
menu_shell = gtk_widget_get_parent (widget);
|
||||
if (GTK_IS_MENU_SHELL (menu_shell))
|
||||
{
|
||||
GtkWidget *parent_menu_shell;
|
||||
|
||||
parent_menu_shell = GTK_MENU_SHELL (menu_shell)->parent_menu_shell;
|
||||
if (parent_menu_shell)
|
||||
{
|
||||
GtkWidget *active_menu_item;
|
||||
|
||||
active_menu_item = GTK_MENU_SHELL (parent_menu_shell)->active_menu_item;
|
||||
if (active_menu_item)
|
||||
{
|
||||
gail_focus_notify_when_idle (active_menu_item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GTK_IS_MENU_BAR (menu_shell))
|
||||
{
|
||||
gail_focus_notify_when_idle (menu_shell);
|
||||
}
|
||||
}
|
||||
}
|
||||
was_deselect = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_switch_page_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data)
|
||||
{
|
||||
GObject *object;
|
||||
GtkWidget *widget;
|
||||
GtkNotebook *notebook;
|
||||
|
||||
object = g_value_get_object (param_values + 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET(object), FALSE);
|
||||
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
if (!GTK_IS_NOTEBOOK (widget))
|
||||
return TRUE;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
if (!notebook->focus_tab)
|
||||
return TRUE;
|
||||
|
||||
gail_focus_notify_when_idle (widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
gail_focus_idle_handler (gpointer data)
|
||||
{
|
||||
GDK_THREADS_ENTER();
|
||||
|
||||
focus_notify_handler = 0;
|
||||
/*
|
||||
* The widget which was to receive focus may have been removed
|
||||
*/
|
||||
if (!next_focus_widget)
|
||||
{
|
||||
if (next_focus_widget != data)
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
void *vp_next_focus_widget = &next_focus_widget;
|
||||
g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
|
||||
next_focus_widget = NULL;
|
||||
}
|
||||
|
||||
gail_focus_notify (data);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_focus_notify (GtkWidget *widget)
|
||||
{
|
||||
AtkObject *atk_obj;
|
||||
gboolean transient;
|
||||
|
||||
if (widget != focus_widget)
|
||||
{
|
||||
if (focus_widget)
|
||||
{
|
||||
void *vp_focus_widget = &focus_widget;
|
||||
g_object_remove_weak_pointer (G_OBJECT (focus_widget), vp_focus_widget);
|
||||
}
|
||||
focus_widget = widget;
|
||||
if (focus_widget)
|
||||
{
|
||||
void *vp_focus_widget = &focus_widget;
|
||||
g_object_add_weak_pointer (G_OBJECT (focus_widget), vp_focus_widget);
|
||||
/*
|
||||
* The UI may not have been updated yet; e.g. in gtkhtml2
|
||||
* html_view_layout() is called in a idle handler
|
||||
*/
|
||||
if (focus_widget == focus_before_menu)
|
||||
{
|
||||
void *vp_focus_before_menu = &focus_before_menu;
|
||||
g_object_remove_weak_pointer (G_OBJECT (focus_before_menu), vp_focus_before_menu);
|
||||
focus_before_menu = NULL;
|
||||
}
|
||||
}
|
||||
gail_focus_notify_when_idle (focus_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (focus_widget)
|
||||
atk_obj = gail_get_accessible_for_widget (focus_widget, &transient);
|
||||
else
|
||||
atk_obj = NULL;
|
||||
/*
|
||||
* Do not report focus on redundant object
|
||||
*/
|
||||
if (atk_obj &&
|
||||
(atk_object_get_role(atk_obj) != ATK_ROLE_REDUNDANT_OBJECT))
|
||||
atk_focus_tracker_notify (atk_obj);
|
||||
if (atk_obj && transient)
|
||||
g_object_unref (atk_obj);
|
||||
if (subsequent_focus_widget)
|
||||
{
|
||||
GtkWidget *tmp_widget = subsequent_focus_widget;
|
||||
subsequent_focus_widget = NULL;
|
||||
gail_focus_notify_when_idle (tmp_widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gail_focus_notify_when_idle (GtkWidget *widget)
|
||||
{
|
||||
if (focus_notify_handler)
|
||||
{
|
||||
if (widget)
|
||||
{
|
||||
/*
|
||||
* Ignore focus request when menu item is going to be focused.
|
||||
* See bug #124232.
|
||||
*/
|
||||
if (GTK_IS_MENU_ITEM (next_focus_widget) && !GTK_IS_MENU_ITEM (widget))
|
||||
return;
|
||||
|
||||
if (next_focus_widget)
|
||||
{
|
||||
if (GTK_IS_MENU_ITEM (next_focus_widget) && GTK_IS_MENU_ITEM (widget))
|
||||
{
|
||||
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (next_focus_widget)) == gtk_widget_get_parent (widget))
|
||||
{
|
||||
if (subsequent_focus_widget)
|
||||
g_assert_not_reached ();
|
||||
subsequent_focus_widget = widget;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_source_remove (focus_notify_handler);
|
||||
if (next_focus_widget)
|
||||
{
|
||||
void *vp_next_focus_widget = &next_focus_widget;
|
||||
g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
|
||||
next_focus_widget = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
/*
|
||||
* Ignore if focus is being set to NULL and we are waiting to set focus
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
if (widget)
|
||||
{
|
||||
void *vp_next_focus_widget = &next_focus_widget;
|
||||
next_focus_widget = widget;
|
||||
g_object_add_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We are about to report focus as NULL so remove the weak pointer
|
||||
* for the widget we were waiting to report focus on.
|
||||
*/
|
||||
if (next_focus_widget)
|
||||
{
|
||||
void *vp_next_focus_widget = &next_focus_widget;
|
||||
g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
|
||||
next_focus_widget = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
focus_notify_handler = g_idle_add (gail_focus_idle_handler, widget);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_deactivate_watcher (GSignalInvocationHint *ihint,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer data)
|
||||
{
|
||||
GObject *object;
|
||||
GtkWidget *widget;
|
||||
GtkMenuShell *shell;
|
||||
GtkWidget *focus = NULL;
|
||||
|
||||
object = g_value_get_object (param_values + 0);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET(object), FALSE);
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_MENU_SHELL(widget), TRUE);
|
||||
shell = GTK_MENU_SHELL(widget);
|
||||
if (!shell->parent_menu_shell)
|
||||
focus = focus_before_menu;
|
||||
|
||||
/*
|
||||
* If we are waiting to report focus on a menubar or a menu item
|
||||
* because of a previous deselect, cancel it.
|
||||
*/
|
||||
if (was_deselect &&
|
||||
focus_notify_handler &&
|
||||
next_focus_widget &&
|
||||
(GTK_IS_MENU_BAR (next_focus_widget) ||
|
||||
GTK_IS_MENU_ITEM (next_focus_widget)))
|
||||
{
|
||||
void *vp_next_focus_widget = &next_focus_widget;
|
||||
g_source_remove (focus_notify_handler);
|
||||
g_object_remove_weak_pointer (G_OBJECT (next_focus_widget), vp_next_focus_widget);
|
||||
next_focus_widget = NULL;
|
||||
focus_notify_handler = 0;
|
||||
was_deselect = FALSE;
|
||||
}
|
||||
gail_focus_notify_when_idle (focus);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_focus_tracker_init (void)
|
||||
{
|
||||
static gboolean emission_hooks_added = FALSE;
|
||||
|
||||
if (!emission_hooks_added)
|
||||
{
|
||||
/*
|
||||
* We cannot be sure that the classes exist so we make sure that they do.
|
||||
*/
|
||||
gtk_type_class (GTK_TYPE_WIDGET);
|
||||
gtk_type_class (GTK_TYPE_ITEM);
|
||||
gtk_type_class (GTK_TYPE_MENU_SHELL);
|
||||
gtk_type_class (GTK_TYPE_NOTEBOOK);
|
||||
|
||||
/*
|
||||
* We listen for event_after signal and then check that the
|
||||
* event was a focus in event so we get called after the event.
|
||||
*/
|
||||
g_signal_add_emission_hook (
|
||||
g_signal_lookup ("event-after", GTK_TYPE_WIDGET), 0,
|
||||
gail_focus_watcher, NULL, (GDestroyNotify) NULL);
|
||||
/*
|
||||
* A "select" signal is emitted when arrow key is used to
|
||||
* move to a list item in the popup window of a GtkCombo or
|
||||
* a menu item in a menu.
|
||||
*/
|
||||
g_signal_add_emission_hook (
|
||||
g_signal_lookup ("select", GTK_TYPE_ITEM), 0,
|
||||
gail_select_watcher, NULL, (GDestroyNotify) NULL);
|
||||
|
||||
/*
|
||||
* A "deselect" signal is emitted when arrow key is used to
|
||||
* move from a menu item in a menu to the parent menu.
|
||||
*/
|
||||
g_signal_add_emission_hook (
|
||||
g_signal_lookup ("deselect", GTK_TYPE_ITEM), 0,
|
||||
gail_deselect_watcher, NULL, (GDestroyNotify) NULL);
|
||||
|
||||
/*
|
||||
* We listen for deactivate signals on menushells to determine
|
||||
* when the "focus" has left the menus.
|
||||
*/
|
||||
g_signal_add_emission_hook (
|
||||
g_signal_lookup ("deactivate", GTK_TYPE_MENU_SHELL), 0,
|
||||
gail_deactivate_watcher, NULL, (GDestroyNotify) NULL);
|
||||
|
||||
/*
|
||||
* We listen for "switch-page" signal on a GtkNotebook to notify
|
||||
* when page has changed because of clicking on a notebook tab.
|
||||
*/
|
||||
g_signal_add_emission_hook (
|
||||
g_signal_lookup ("switch-page", GTK_TYPE_NOTEBOOK), 0,
|
||||
gail_switch_page_watcher, NULL, (GDestroyNotify) NULL);
|
||||
emission_hooks_added = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gail_focus_object_destroyed (gpointer data)
|
||||
{
|
||||
GObject *obj;
|
||||
|
||||
obj = G_OBJECT (data);
|
||||
g_object_set_qdata (obj, quark_focus_object, NULL);
|
||||
g_object_unref (obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_focus_tracker (AtkObject *focus_object)
|
||||
{
|
||||
/*
|
||||
* Do not report focus on redundant object
|
||||
*/
|
||||
if (focus_object &&
|
||||
(atk_object_get_role(focus_object) != ATK_ROLE_REDUNDANT_OBJECT))
|
||||
{
|
||||
AtkObject *old_focus_object;
|
||||
|
||||
if (!GTK_IS_ACCESSIBLE (focus_object))
|
||||
{
|
||||
AtkObject *parent;
|
||||
|
||||
parent = focus_object;
|
||||
while (1)
|
||||
{
|
||||
parent = atk_object_get_parent (parent);
|
||||
if (parent == NULL)
|
||||
break;
|
||||
if (GTK_IS_ACCESSIBLE (parent))
|
||||
break;
|
||||
}
|
||||
|
||||
if (parent)
|
||||
{
|
||||
gail_set_focus_object (focus_object, parent);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
old_focus_object = g_object_get_qdata (G_OBJECT (focus_object), quark_focus_object);
|
||||
if (old_focus_object)
|
||||
{
|
||||
g_object_weak_unref (G_OBJECT (old_focus_object),
|
||||
(GWeakNotify) gail_focus_object_destroyed,
|
||||
focus_object);
|
||||
g_object_set_qdata (G_OBJECT (focus_object), quark_focus_object, NULL);
|
||||
g_object_unref (G_OBJECT (focus_object));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gail_set_focus_widget (GtkWidget *focus_widget,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
AtkObject *focus_obj;
|
||||
AtkObject *obj;
|
||||
|
||||
focus_obj = gtk_widget_get_accessible (focus_widget);
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
gail_set_focus_object (focus_obj, obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_set_focus_object (AtkObject *focus_obj,
|
||||
AtkObject *obj)
|
||||
{
|
||||
AtkObject *old_focus_obj;
|
||||
|
||||
old_focus_obj = g_object_get_qdata (G_OBJECT (obj), quark_focus_object);
|
||||
if (old_focus_obj != obj)
|
||||
{
|
||||
if (old_focus_obj)
|
||||
g_object_weak_unref (G_OBJECT (old_focus_obj),
|
||||
(GWeakNotify) gail_focus_object_destroyed,
|
||||
obj);
|
||||
else
|
||||
/*
|
||||
* We call g_object_ref as if obj is destroyed
|
||||
* while the weak reference exists then destroying the
|
||||
* focus_obj would cause gail_focus_object_destroyed to be
|
||||
* called when obj is not a valid GObject.
|
||||
*/
|
||||
g_object_ref (obj);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (focus_obj),
|
||||
(GWeakNotify) gail_focus_object_destroyed,
|
||||
obj);
|
||||
g_object_set_qdata (G_OBJECT (obj), quark_focus_object, focus_obj);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* These exported symbols are hooked by gnome-program
|
||||
* to provide automatic module initialization and shutdown.
|
||||
*/
|
||||
extern void gnome_accessibility_module_init (void);
|
||||
extern void gnome_accessibility_module_shutdown (void);
|
||||
|
||||
static int gail_initialized = FALSE;
|
||||
|
||||
static void
|
||||
gail_accessibility_module_init (void)
|
||||
{
|
||||
const char *env_a_t_support;
|
||||
gboolean a_t_support = FALSE;
|
||||
|
||||
if (gail_initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
gail_initialized = TRUE;
|
||||
quark_focus_object = g_quark_from_static_string ("gail-focus-object");
|
||||
|
||||
env_a_t_support = g_getenv (GNOME_ACCESSIBILITY_ENV);
|
||||
|
||||
if (env_a_t_support)
|
||||
a_t_support = atoi (env_a_t_support);
|
||||
if (a_t_support)
|
||||
fprintf (stderr, "GTK Accessibility Module initialized\n");
|
||||
|
||||
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_ITEM, gail_item);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_MENU_ITEM, gail_menu_item);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TOGGLE_BUTTON, gail_toggle_button);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_IMAGE, gail_image);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TEXT_VIEW, gail_text_view);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_COMBO, gail_combo);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_COMBO_BOX, gail_combo_box);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_ENTRY, gail_entry);
|
||||
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, gail_scale);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CLIST, gail_clist);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LABEL, gail_label);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_STATUSBAR, gail_statusbar);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_NOTEBOOK, gail_notebook);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CALENDAR, gail_calendar);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PROGRESS_BAR, gail_progress_bar);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SPIN_BUTTON, gail_spin_button);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_TREE_VIEW, gail_tree_view);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_FRAME, gail_frame);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TEXT, gail_text_cell);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_TOGGLE, gail_boolean_cell);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_CELL_RENDERER_PIXBUF, gail_image_cell);
|
||||
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_ARROW, gail_arrow);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PIXMAP, gail_pixmap);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SEPARATOR, gail_separator);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_BOX, gail_box);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLED_WINDOW, gail_scrolled_window);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_LIST, gail_list);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_PANED, gail_paned);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_SCROLLBAR, gail_scrollbar);
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_OPTION_MENU, gail_option_menu);
|
||||
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);
|
||||
|
||||
/* LIBGNOMECANVAS SUPPORT */
|
||||
GAIL_WIDGET_SET_FACTORY (GTK_TYPE_OBJECT, gail_object);
|
||||
|
||||
atk_focus_tracker_init (gail_focus_tracker_init);
|
||||
focus_tracker_id = atk_add_focus_tracker (gail_focus_tracker);
|
||||
|
||||
/* Initialize the GailUtility class */
|
||||
g_type_class_unref (g_type_class_ref (GAIL_TYPE_UTIL));
|
||||
g_type_class_unref (g_type_class_ref (GAIL_TYPE_MISC));
|
||||
}
|
||||
|
||||
/**
|
||||
* gnome_accessibility_module_init:
|
||||
* @void:
|
||||
*
|
||||
* This method is invoked by name from libgnome's
|
||||
* gnome-program.c to activate accessibility support.
|
||||
**/
|
||||
void
|
||||
gnome_accessibility_module_init (void)
|
||||
{
|
||||
gail_accessibility_module_init ();
|
||||
}
|
||||
|
||||
/**
|
||||
* gnome_accessibility_module_shutdown:
|
||||
* @void:
|
||||
*
|
||||
* This method is invoked by name from libgnome's
|
||||
* gnome-program.c to de-activate accessibility support.
|
||||
**/
|
||||
void
|
||||
gnome_accessibility_module_shutdown (void)
|
||||
{
|
||||
if (!gail_initialized)
|
||||
{
|
||||
return;
|
||||
}
|
||||
gail_initialized = FALSE;
|
||||
atk_remove_focus_tracker (focus_tracker_id);
|
||||
|
||||
fprintf (stderr, "GTK Accessibility Module shutdown\n");
|
||||
|
||||
/* FIXME: de-register the factory types so we can unload ? */
|
||||
}
|
||||
|
||||
int
|
||||
gtk_module_init (gint *argc, char** argv[])
|
||||
{
|
||||
gail_accessibility_module_init ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
54
modules/other/gail/gail.h
Normal file
54
modules/other/gail/gail.h
Normal file
@ -0,0 +1,54 @@
|
||||
#include <gail/gailadjustment.h>
|
||||
#include <gail/gailarrow.h>
|
||||
#include <gail/gailbooleancell.h>
|
||||
#include <gail/gailbooleancellfactory.h>
|
||||
#include <gail/gailbox.h>
|
||||
#include <gail/gailbutton.h>
|
||||
#include <gail/gailcalendar.h>
|
||||
#include <gail/gailcell.h>
|
||||
#include <gail/gailcheckmenuitem.h>
|
||||
#include <gail/gailclist.h>
|
||||
#include <gail/gailclistcell.h>
|
||||
#include <gail/gailcombo.h>
|
||||
#include <gail/gailcombobox.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
#include <gail/gailcontainercell.h>
|
||||
#include <gail/gailentry.h>
|
||||
#include <gail/gailexpander.h>
|
||||
#include <gail/gailframe.h>
|
||||
#include <gail/gailimage.h>
|
||||
#include <gail/gailimagecell.h>
|
||||
#include <gail/gailimagecellfactory.h>
|
||||
#include <gail/gailitem.h>
|
||||
#include <gail/gaillabel.h>
|
||||
#include <gail/gaillist.h>
|
||||
#include <gail/gailmenu.h>
|
||||
#include <gail/gailmenushell.h>
|
||||
#include <gail/gailmenuitem.h>
|
||||
#include <gail/gailnotebook.h>
|
||||
#include <gail/gailobject.h>
|
||||
#include <gail/gailobjectfactory.h>
|
||||
#include <gail/gailoptionmenu.h>
|
||||
#include <gail/gailpaned.h>
|
||||
#include <gail/gailpixmap.h>
|
||||
#include <gail/gailprogressbar.h>
|
||||
#include <gail/gailradiobutton.h>
|
||||
#include <gail/gailradiomenuitem.h>
|
||||
#include <gail/gailrenderercell.h>
|
||||
#include <gail/gailrenderercellfactory.h>
|
||||
#include <gail/gailrange.h>
|
||||
#include <gail/gailscale.h>
|
||||
#include <gail/gailscrollbar.h>
|
||||
#include <gail/gailscrolledwindow.h>
|
||||
#include <gail/gailseparator.h>
|
||||
#include <gail/gailspinbutton.h>
|
||||
#include <gail/gailstatusbar.h>
|
||||
#include <gail/gailtextcell.h>
|
||||
#include <gail/gailtextcellfactory.h>
|
||||
#include <gail/gailtextview.h>
|
||||
#include <gail/gailtogglebutton.h>
|
||||
#include <gail/gailtoplevel.h>
|
||||
#include <gail/gailtreeview.h>
|
||||
#include <gail/gailutil.h>
|
||||
#include <gail/gailwidget.h>
|
||||
#include <gail/gailwindow.h>
|
||||
234
modules/other/gail/gailadjustment.c
Normal file
234
modules/other/gail/gailadjustment.c
Normal file
@ -0,0 +1,234 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2001, 2002, 2003 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailadjustment.h"
|
||||
|
||||
static void gail_adjustment_class_init (GailAdjustmentClass *klass);
|
||||
|
||||
static void gail_adjustment_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
static void gail_adjustment_get_current_value (AtkValue *obj,
|
||||
GValue *value);
|
||||
static void gail_adjustment_get_maximum_value (AtkValue *obj,
|
||||
GValue *value);
|
||||
static void gail_adjustment_get_minimum_value (AtkValue *obj,
|
||||
GValue *value);
|
||||
static gboolean gail_adjustment_set_current_value (AtkValue *obj,
|
||||
const GValue *value);
|
||||
|
||||
static void gail_adjustment_destroyed (GtkAdjustment *adjustment,
|
||||
GailAdjustment *gail_adjustment);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_adjustment_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailAdjustmentClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_adjustment_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailAdjustment), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo atk_value_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_value_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
type = g_type_register_static (ATK_TYPE_OBJECT,
|
||||
"GailAdjustment", &tinfo, 0);
|
||||
|
||||
g_type_add_interface_static (type, ATK_TYPE_VALUE,
|
||||
&atk_value_info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_adjustment_class_init (GailAdjustmentClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->initialize = gail_adjustment_real_initialize;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_adjustment_new (GtkAdjustment *adjustment)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *atk_object;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_ADJUSTMENT, NULL);
|
||||
|
||||
g_return_val_if_fail (object != NULL, NULL);
|
||||
|
||||
atk_object = ATK_OBJECT (object);
|
||||
atk_object_initialize (atk_object, adjustment);
|
||||
|
||||
return atk_object;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_adjustment_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (data);
|
||||
|
||||
obj->role = ATK_ROLE_UNKNOWN;
|
||||
GAIL_ADJUSTMENT (obj)->adjustment = adjustment;
|
||||
|
||||
g_signal_connect_object (G_OBJECT (adjustment),
|
||||
"destroy",
|
||||
G_CALLBACK (gail_adjustment_destroyed),
|
||||
obj, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->get_current_value = gail_adjustment_get_current_value;
|
||||
iface->get_maximum_value = gail_adjustment_get_maximum_value;
|
||||
iface->get_minimum_value = gail_adjustment_get_minimum_value;
|
||||
iface->set_current_value = gail_adjustment_set_current_value;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gail_adjustment_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkAdjustment* adjustment;
|
||||
gdouble current_value;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
{
|
||||
/* State is defunct */
|
||||
return;
|
||||
}
|
||||
|
||||
current_value = adjustment->value;
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value,current_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_adjustment_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkAdjustment* adjustment;
|
||||
gdouble maximum_value;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
{
|
||||
/* State is defunct */
|
||||
return;
|
||||
}
|
||||
|
||||
maximum_value = adjustment->upper;
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, maximum_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_adjustment_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkAdjustment* adjustment;
|
||||
gdouble minimum_value;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
{
|
||||
/* State is defunct */
|
||||
return;
|
||||
}
|
||||
|
||||
minimum_value = adjustment->lower;
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, minimum_value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_adjustment_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
if (G_VALUE_HOLDS_DOUBLE (value))
|
||||
{
|
||||
GtkAdjustment* adjustment;
|
||||
gdouble new_value;
|
||||
|
||||
adjustment = GAIL_ADJUSTMENT (obj)->adjustment;
|
||||
if (adjustment == NULL)
|
||||
{
|
||||
/* State is defunct */
|
||||
return FALSE;
|
||||
}
|
||||
new_value = g_value_get_double (value);
|
||||
gtk_adjustment_set_value (adjustment, new_value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_adjustment_destroyed (GtkAdjustment *adjustment,
|
||||
GailAdjustment *gail_adjustment)
|
||||
{
|
||||
/*
|
||||
* This is the signal handler for the "destroy" signal for the
|
||||
* GtkAdjustment. We set the pointer location to NULL;
|
||||
*/
|
||||
gail_adjustment->adjustment = NULL;
|
||||
}
|
||||
61
modules/other/gail/gailadjustment.h
Normal file
61
modules/other/gail/gailadjustment.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* 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_ADJUSTMENT_H__
|
||||
#define __GAIL_ADJUSTMENT_H__
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_ADJUSTMENT (gail_adjustment_get_type ())
|
||||
#define GAIL_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_ADJUSTMENT, GailAdjustment))
|
||||
#define GAIL_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_ADJUSTMENT, GailAdjustmentClass))
|
||||
#define GAIL_IS_ADJUSTMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_ADJUSTMENT))
|
||||
#define GAIL_IS_ADJUSTMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_ADJUSTMENT))
|
||||
#define GAIL_ADJUSTMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_ADJUSTMENT, GailAdjustmentClass))
|
||||
|
||||
typedef struct _GailAdjustment GailAdjustment;
|
||||
typedef struct _GailAdjustmentClass GailAdjustmentClass;
|
||||
|
||||
struct _GailAdjustment
|
||||
{
|
||||
AtkObject parent;
|
||||
|
||||
GtkAdjustment *adjustment;
|
||||
};
|
||||
|
||||
GType gail_adjustment_get_type (void);
|
||||
|
||||
struct _GailAdjustmentClass
|
||||
{
|
||||
AtkObjectClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject *gail_adjustment_new (GtkAdjustment *adjustment);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_ADJUSTMENT_H__ */
|
||||
164
modules/other/gail/gailarrow.c
Normal file
164
modules/other/gail/gailarrow.c
Normal file
@ -0,0 +1,164 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailarrow.h"
|
||||
|
||||
static void gail_arrow_class_init (GailArrowClass *klass);
|
||||
static void gail_arrow_object_init (GailArrow *arrow);
|
||||
|
||||
/* AtkImage */
|
||||
static void atk_image_interface_init (AtkImageIface *iface);
|
||||
static G_CONST_RETURN gchar* gail_arrow_get_image_description
|
||||
(AtkImage *obj);
|
||||
static gboolean gail_arrow_set_image_description
|
||||
(AtkImage *obj,
|
||||
const gchar *description);
|
||||
static void gail_arrow_finalize (GObject *object);
|
||||
|
||||
static GailWidgetClass* parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_arrow_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailArrowClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_arrow_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailArrow), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) gail_arrow_object_init, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo atk_image_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_image_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_WIDGET,
|
||||
"GailArrow", &tinfo, 0);
|
||||
|
||||
g_type_add_interface_static (type, ATK_TYPE_IMAGE,
|
||||
&atk_image_info);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_arrow_class_init (GailArrowClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gail_arrow_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_arrow_object_init (GailArrow *arrow)
|
||||
{
|
||||
arrow->image_description = NULL;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_arrow_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_ARROW (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_ARROW, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
accessible->role = ATK_ROLE_ICON;
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_image_interface_init (AtkImageIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->get_image_description = gail_arrow_get_image_description;
|
||||
iface->set_image_description = gail_arrow_set_image_description;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_arrow_get_image_description (AtkImage *obj)
|
||||
{
|
||||
GailArrow* arrow;
|
||||
|
||||
g_return_val_if_fail(GAIL_IS_ARROW(obj), NULL);
|
||||
|
||||
arrow = GAIL_ARROW (obj);
|
||||
|
||||
return arrow->image_description;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gail_arrow_set_image_description (AtkImage *obj,
|
||||
const gchar *description)
|
||||
{
|
||||
GailArrow* arrow;
|
||||
|
||||
g_return_val_if_fail(GAIL_IS_ARROW(obj), FALSE);
|
||||
|
||||
arrow = GAIL_ARROW (obj);
|
||||
g_free (arrow->image_description);
|
||||
|
||||
arrow->image_description = g_strdup (description);
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* static void
|
||||
* gail_arrow_get_image_size (AtkImage *obj,
|
||||
* gint *height,
|
||||
* gint *width)
|
||||
*
|
||||
* We dont implement this function for GailArrow as gtk hardcodes the size
|
||||
* of the arrow to be 7x5 and it is not possible to query this.
|
||||
*/
|
||||
|
||||
static void
|
||||
gail_arrow_finalize (GObject *object)
|
||||
{
|
||||
GailArrow *arrow = GAIL_ARROW (object);
|
||||
|
||||
g_free (arrow->image_description);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
61
modules/other/gail/gailarrow.h
Normal file
61
modules/other/gail/gailarrow.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* 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_ARROW_H__
|
||||
#define __GAIL_ARROW_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailwidget.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_ARROW (gail_arrow_get_type ())
|
||||
#define GAIL_ARROW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_ARROW, GailArrow))
|
||||
#define GAIL_ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_ARROW, GailArrowClass))
|
||||
#define GAIL_IS_ARROW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_ARROW))
|
||||
#define GAIL_IS_ARROW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_ARROW))
|
||||
#define GAIL_ARROW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_ARROW, GailArrowClass))
|
||||
|
||||
typedef struct _GailArrow GailArrow;
|
||||
typedef struct _GailArrowClass GailArrowClass;
|
||||
|
||||
struct _GailArrow
|
||||
{
|
||||
GailWidget parent;
|
||||
|
||||
gchar* image_description;
|
||||
};
|
||||
|
||||
GType gail_arrow_get_type (void);
|
||||
|
||||
struct _GailArrowClass
|
||||
{
|
||||
GailWidgetClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_arrow_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_ARROW_H__ */
|
||||
122
modules/other/gail/gailbooleancell.c
Normal file
122
modules/other/gail/gailbooleancell.c
Normal file
@ -0,0 +1,122 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailbooleancell.h"
|
||||
|
||||
static void gail_boolean_cell_class_init (GailBooleanCellClass *klass);
|
||||
|
||||
/* Misc */
|
||||
|
||||
static gboolean gail_boolean_cell_update_cache (GailRendererCell *cell,
|
||||
gboolean emit_change_signal);
|
||||
|
||||
gchar *gail_boolean_cell_property_list[] = {
|
||||
"active",
|
||||
"radio",
|
||||
NULL
|
||||
};
|
||||
|
||||
GType
|
||||
gail_boolean_cell_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailBooleanCellClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_boolean_cell_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailBooleanCell), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_RENDERER_CELL,
|
||||
"GailBooleanCell", &tinfo, 0);
|
||||
gail_cell_type_add_action_interface (type);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_boolean_cell_class_init (GailBooleanCellClass *klass)
|
||||
{
|
||||
GailRendererCellClass *renderer_cell_class = GAIL_RENDERER_CELL_CLASS (klass);
|
||||
|
||||
renderer_cell_class->update_cache = gail_boolean_cell_update_cache;
|
||||
renderer_cell_class->property_list = gail_boolean_cell_property_list;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_boolean_cell_new (void)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *atk_object;
|
||||
GailRendererCell *cell;
|
||||
GailBooleanCell *boolean_cell;
|
||||
|
||||
object = g_object_new (GAIL_TYPE_BOOLEAN_CELL, NULL);
|
||||
|
||||
g_return_val_if_fail (object != NULL, NULL);
|
||||
|
||||
atk_object = ATK_OBJECT (object);
|
||||
atk_object->role = ATK_ROLE_TABLE_CELL;
|
||||
|
||||
cell = GAIL_RENDERER_CELL(object);
|
||||
boolean_cell = GAIL_BOOLEAN_CELL(object);
|
||||
|
||||
cell->renderer = gtk_cell_renderer_toggle_new ();
|
||||
g_object_ref (cell->renderer);
|
||||
gtk_object_sink (GTK_OBJECT (cell->renderer));
|
||||
boolean_cell->cell_value = FALSE;
|
||||
return atk_object;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_boolean_cell_update_cache (GailRendererCell *cell,
|
||||
gboolean emit_change_signal)
|
||||
{
|
||||
GailBooleanCell *boolean_cell = GAIL_BOOLEAN_CELL (cell);
|
||||
gboolean rv = FALSE;
|
||||
gboolean new_boolean;
|
||||
|
||||
g_object_get (G_OBJECT(cell->renderer), "active", &new_boolean, NULL);
|
||||
|
||||
if (boolean_cell->cell_value != new_boolean)
|
||||
{
|
||||
rv = TRUE;
|
||||
boolean_cell->cell_value = !(boolean_cell->cell_value);
|
||||
|
||||
/* Update cell's state */
|
||||
|
||||
if (new_boolean)
|
||||
gail_cell_add_state (GAIL_CELL (cell), ATK_STATE_CHECKED, emit_change_signal);
|
||||
else
|
||||
gail_cell_remove_state (GAIL_CELL (cell), ATK_STATE_CHECKED, emit_change_signal);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
60
modules/other/gail/gailbooleancell.h
Normal file
60
modules/other/gail/gailbooleancell.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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_BOOLEAN_CELL_H__
|
||||
#define __GAIL_BOOLEAN_CELL_H__
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gail/gailrenderercell.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_BOOLEAN_CELL (gail_boolean_cell_get_type ())
|
||||
#define GAIL_BOOLEAN_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_BOOLEAN_CELL, GailBooleanCell))
|
||||
#define GAIL_BOOLEAN_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_BOOLEAN_CELL, GailBooleanCellClass))
|
||||
#define GAIL_IS_BOOLEAN_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_BOOLEAN_CELL))
|
||||
#define GAIL_IS_BOOLEAN_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_BOOLEAN_CELL))
|
||||
#define GAIL_BOOLEAN_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_BOOLEAN_CELL, GailBooleanCellClass))
|
||||
|
||||
typedef struct _GailBooleanCell GailBooleanCell;
|
||||
typedef struct _GailBooleanCellClass GailBooleanCellClass;
|
||||
|
||||
struct _GailBooleanCell
|
||||
{
|
||||
GailRendererCell parent;
|
||||
gboolean cell_value;
|
||||
};
|
||||
|
||||
GType gail_boolean_cell_get_type (void);
|
||||
|
||||
struct _GailBooleanCellClass
|
||||
{
|
||||
GailRendererCellClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject *gail_boolean_cell_new (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_TREE_VIEW_BOOLEAN_CELL_H__ */
|
||||
78
modules/other/gail/gailbooleancellfactory.c
Normal file
78
modules/other/gail/gailbooleancellfactory.c
Normal file
@ -0,0 +1,78 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtkcellrenderertoggle.h>
|
||||
#include "gailbooleancellfactory.h"
|
||||
#include "gailbooleancell.h"
|
||||
|
||||
static void gail_boolean_cell_factory_class_init (GailBooleanCellFactoryClass *klass);
|
||||
|
||||
static AtkObject* gail_boolean_cell_factory_create_accessible (
|
||||
GObject *obj);
|
||||
static GType gail_boolean_cell_factory_get_accessible_type (void);
|
||||
|
||||
GType
|
||||
gail_boolean_cell_factory_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailBooleanCellFactoryClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_boolean_cell_factory_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailBooleanCellFactory), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
type = g_type_register_static (ATK_TYPE_OBJECT_FACTORY,
|
||||
"GailBooleanCellFactory" , &tinfo, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_boolean_cell_factory_class_init (GailBooleanCellFactoryClass *klass)
|
||||
{
|
||||
AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS (klass);
|
||||
|
||||
class->create_accessible = gail_boolean_cell_factory_create_accessible;
|
||||
class->get_accessible_type = gail_boolean_cell_factory_get_accessible_type;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_boolean_cell_factory_create_accessible (GObject *obj)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER_TOGGLE (obj), NULL);
|
||||
|
||||
return gail_boolean_cell_new ();
|
||||
}
|
||||
|
||||
static GType
|
||||
gail_boolean_cell_factory_get_accessible_type (void)
|
||||
{
|
||||
return GAIL_TYPE_BOOLEAN_CELL;
|
||||
}
|
||||
56
modules/other/gail/gailbooleancellfactory.h
Normal file
56
modules/other/gail/gailbooleancellfactory.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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_BOOLEAN_CELL_FACTORY_H__
|
||||
#define __GAIL_BOOLEAN_CELL_FACTORY_H__
|
||||
|
||||
#include <atk/atkobjectfactory.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_BOOLEAN_CELL_FACTORY (gail_boolean_cell_factory_get_type ())
|
||||
#define GAIL_BOOLEAN_CELL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_BOOLEAN_CELL_FACTORY, GailBooleanCellFactory))
|
||||
#define GAIL_BOOLEAN_CELL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AGTK_TYPE_BOOLEAN_CELL_FACTORY, GailBooleanCellFactoryClass))
|
||||
#define GAIL_IS_BOOLEAN_CELL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_BOOLEAN_CELL_FACTORY))
|
||||
#define GAIL_IS_BOOLEAN_CELL_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_BOOLEAN_CELL_FACTORY))
|
||||
#define GAIL_BOOLEAN_CELL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_BOOLEAN_CELL_FACTORY, GailBooleanCellFactoryClass))
|
||||
|
||||
typedef struct _GailBooleanCellFactory GailBooleanCellFactory;
|
||||
typedef struct _GailBooleanCellFactoryClass GailBooleanCellFactoryClass;
|
||||
|
||||
struct _GailBooleanCellFactory
|
||||
{
|
||||
AtkObjectFactory parent;
|
||||
};
|
||||
|
||||
struct _GailBooleanCellFactoryClass
|
||||
{
|
||||
AtkObjectFactoryClass parent_class;
|
||||
};
|
||||
|
||||
GType gail_boolean_cell_factory_get_type(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_BOOLEAN_CELL_FACTORY_H__ */
|
||||
101
modules/other/gail/gailbox.c
Normal file
101
modules/other/gail/gailbox.c
Normal file
@ -0,0 +1,101 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailbox.h"
|
||||
|
||||
static void gail_box_class_init (GailBoxClass *klass);
|
||||
static AtkStateSet* gail_box_ref_state_set (AtkObject *accessible);
|
||||
|
||||
static GailContainerClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_box_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailBoxClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_box_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailBox), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CONTAINER,
|
||||
"GailBox", &tinfo, 0);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_box_class_init (GailBoxClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->ref_state_set = gail_box_ref_state_set;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_box_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_BOX (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_BOX, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
accessible->role = ATK_ROLE_FILLER;
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gail_box_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
|
||||
widget = GTK_ACCESSIBLE (accessible)->widget;
|
||||
|
||||
if (widget == NULL)
|
||||
return state_set;
|
||||
|
||||
if (GTK_IS_VBOX (widget) || GTK_IS_VBUTTON_BOX (widget))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_VERTICAL);
|
||||
else if (GTK_IS_HBOX (widget) || GTK_IS_HBUTTON_BOX (widget))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_HORIZONTAL);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
59
modules/other/gail/gailbox.h
Normal file
59
modules/other/gail/gailbox.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* 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_BOX_H__
|
||||
#define __GAIL_BOX_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_BOX (gail_box_get_type ())
|
||||
#define GAIL_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_BOX, GailBox))
|
||||
#define GAIL_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_BOX, GailBoxClass))
|
||||
#define GAIL_IS_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_BOX))
|
||||
#define GAIL_IS_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_BOX))
|
||||
#define GAIL_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_BOX, GailBoxClass))
|
||||
|
||||
typedef struct _GailBox GailBox;
|
||||
typedef struct _GailBoxClass GailBoxClass;
|
||||
|
||||
struct _GailBox
|
||||
{
|
||||
GailContainer parent;
|
||||
};
|
||||
|
||||
GType gail_box_get_type (void);
|
||||
|
||||
struct _GailBoxClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_box_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_BOX_H__ */
|
||||
1720
modules/other/gail/gailbutton.c
Normal file
1720
modules/other/gail/gailbutton.c
Normal file
File diff suppressed because it is too large
Load Diff
77
modules/other/gail/gailbutton.h
Normal file
77
modules/other/gail/gailbutton.h
Normal file
@ -0,0 +1,77 @@
|
||||
/* 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_BUTTON_H__
|
||||
#define __GAIL_BUTTON_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
#include <libgail-util/gailtextutil.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_BUTTON (gail_button_get_type ())
|
||||
#define GAIL_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_BUTTON, GailButton))
|
||||
#define GAIL_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_BUTTON, GailButtonClass))
|
||||
#define GAIL_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_BUTTON))
|
||||
#define GAIL_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_BUTTON))
|
||||
#define GAIL_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_BUTTON, GailButtonClass))
|
||||
|
||||
typedef struct _GailButton GailButton;
|
||||
typedef struct _GailButtonClass GailButtonClass;
|
||||
|
||||
struct _GailButton
|
||||
{
|
||||
GailContainer parent;
|
||||
|
||||
/*
|
||||
* Cache the widget state so we know the previous state when it changed
|
||||
*/
|
||||
gint8 state;
|
||||
|
||||
gchar *click_description;
|
||||
gchar *press_description;
|
||||
gchar *release_description;
|
||||
gchar *click_keybinding;
|
||||
guint action_idle_handler;
|
||||
GQueue *action_queue;
|
||||
|
||||
GailTextUtil *textutil;
|
||||
|
||||
gboolean default_is_press;
|
||||
};
|
||||
|
||||
GType gail_button_get_type (void);
|
||||
|
||||
struct _GailButtonClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_button_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_BUTTON_H__ */
|
||||
73
modules/other/gail/gailcalendar.c
Normal file
73
modules/other/gail/gailcalendar.c
Normal file
@ -0,0 +1,73 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailcalendar.h"
|
||||
|
||||
static void gail_calendar_class_init (GailCalendarClass *klass);
|
||||
|
||||
GType
|
||||
gail_calendar_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailCalendarClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_calendar_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailCalendar), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_WIDGET,
|
||||
"GailCalendar", &tinfo, 0);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_calendar_class_init (GailCalendarClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_calendar_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CALENDAR (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_CALENDAR, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
accessible->role = ATK_ROLE_CALENDAR;
|
||||
|
||||
return accessible;
|
||||
}
|
||||
59
modules/other/gail/gailcalendar.h
Normal file
59
modules/other/gail/gailcalendar.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* 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_CALENDAR_H__
|
||||
#define __GAIL_CALENDAR_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CALENDAR (gail_calendar_get_type ())
|
||||
#define GAIL_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CALENDAR, GailCalendar))
|
||||
#define GAIL_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CALENDAR, GailCalendarClass))
|
||||
#define GAIL_IS_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CALENDAR))
|
||||
#define GAIL_IS_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CALENDAR))
|
||||
#define GAIL_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CALENDAR, GailCalendarClass))
|
||||
|
||||
typedef struct _GailCalendar GailCalendar;
|
||||
typedef struct _GailCalendarClass GailCalendarClass;
|
||||
|
||||
struct _GailCalendar
|
||||
{
|
||||
GailWidget parent;
|
||||
};
|
||||
|
||||
GType gail_calendar_get_type (void);
|
||||
|
||||
struct _GailCalendarClass
|
||||
{
|
||||
GailWidgetClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_calendar_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CALENDAR_H__ */
|
||||
577
modules/other/gail/gailcell.c
Normal file
577
modules/other/gail/gailcell.c
Normal file
@ -0,0 +1,577 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailcontainercell.h"
|
||||
#include "gailcell.h"
|
||||
#include "gailcellparent.h"
|
||||
|
||||
static void gail_cell_class_init (GailCellClass *klass);
|
||||
static void gail_cell_destroyed (GtkWidget *widget,
|
||||
GailCell *cell);
|
||||
|
||||
static void gail_cell_object_init (GailCell *cell);
|
||||
static void gail_cell_object_finalize (GObject *cell);
|
||||
static AtkStateSet* gail_cell_ref_state_set (AtkObject *obj);
|
||||
static gint gail_cell_get_index_in_parent (AtkObject *obj);
|
||||
|
||||
/* AtkAction */
|
||||
|
||||
static void gail_cell_atk_action_interface_init
|
||||
(AtkActionIface *iface);
|
||||
static ActionInfo * _gail_cell_get_action_info (GailCell *cell,
|
||||
gint index);
|
||||
static void _gail_cell_destroy_action_info
|
||||
(gpointer data,
|
||||
gpointer user_data);
|
||||
|
||||
static gint gail_cell_action_get_n_actions
|
||||
(AtkAction *action);
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_cell_action_get_name (AtkAction *action,
|
||||
gint index);
|
||||
static G_CONST_RETURN gchar *
|
||||
gail_cell_action_get_description
|
||||
(AtkAction *action,
|
||||
gint index);
|
||||
static gboolean gail_cell_action_set_description
|
||||
(AtkAction *action,
|
||||
gint index,
|
||||
const gchar *desc);
|
||||
static G_CONST_RETURN gchar *
|
||||
gail_cell_action_get_keybinding
|
||||
(AtkAction *action,
|
||||
gint index);
|
||||
static gboolean gail_cell_action_do_action (AtkAction *action,
|
||||
gint index);
|
||||
static gboolean idle_do_action (gpointer data);
|
||||
|
||||
static void atk_component_interface_init (AtkComponentIface *iface);
|
||||
static void gail_cell_get_extents (AtkComponent *component,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coord_type);
|
||||
static gboolean gail_cell_grab_focus (AtkComponent *component);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_cell_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailCellClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_cell_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailCell), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) gail_cell_object_init, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo atk_component_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_component_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
type = g_type_register_static (ATK_TYPE_OBJECT,
|
||||
"GailCell", &tinfo, 0);
|
||||
g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
|
||||
&atk_component_info);
|
||||
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_cell_class_init (GailCellClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
g_object_class->finalize = gail_cell_object_finalize;
|
||||
|
||||
class->get_index_in_parent = gail_cell_get_index_in_parent;
|
||||
class->ref_state_set = gail_cell_ref_state_set;
|
||||
}
|
||||
|
||||
void
|
||||
gail_cell_init (GailCell *cell,
|
||||
GtkWidget *widget,
|
||||
AtkObject *parent,
|
||||
gint index)
|
||||
{
|
||||
g_return_if_fail (GAIL_IS_CELL (cell));
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
cell->widget = widget;
|
||||
atk_object_set_parent (ATK_OBJECT (cell), parent);
|
||||
cell->index = index;
|
||||
|
||||
g_signal_connect_object (G_OBJECT (widget),
|
||||
"destroy",
|
||||
G_CALLBACK (gail_cell_destroyed ),
|
||||
cell, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_cell_destroyed (GtkWidget *widget,
|
||||
GailCell *cell)
|
||||
{
|
||||
/*
|
||||
* This is the signal handler for the "destroy" signal for the
|
||||
* GtkWidget. We set the pointer location to NULL;
|
||||
*/
|
||||
cell->widget = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_cell_object_init (GailCell *cell)
|
||||
{
|
||||
cell->state_set = atk_state_set_new ();
|
||||
cell->widget = NULL;
|
||||
cell->action_list = NULL;
|
||||
cell->index = 0;
|
||||
atk_state_set_add_state (cell->state_set, ATK_STATE_TRANSIENT);
|
||||
atk_state_set_add_state (cell->state_set, ATK_STATE_ENABLED);
|
||||
atk_state_set_add_state (cell->state_set, ATK_STATE_SENSITIVE);
|
||||
atk_state_set_add_state (cell->state_set, ATK_STATE_SELECTABLE);
|
||||
cell->refresh_index = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_cell_object_finalize (GObject *obj)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL (obj);
|
||||
AtkRelationSet *relation_set;
|
||||
AtkRelation *relation;
|
||||
GPtrArray *target;
|
||||
gpointer target_object;
|
||||
gint i;
|
||||
|
||||
if (cell->state_set)
|
||||
g_object_unref (cell->state_set);
|
||||
g_list_free (cell->action_list);
|
||||
if (cell->action_idle_handler)
|
||||
{
|
||||
g_source_remove (cell->action_idle_handler);
|
||||
cell->action_idle_handler = 0;
|
||||
}
|
||||
relation_set = atk_object_ref_relation_set (ATK_OBJECT (obj));
|
||||
if (ATK_IS_RELATION_SET (relation_set))
|
||||
{
|
||||
relation = atk_relation_set_get_relation_by_type (relation_set,
|
||||
ATK_RELATION_NODE_CHILD_OF);
|
||||
if (relation)
|
||||
{
|
||||
target = atk_relation_get_target (relation);
|
||||
for (i = 0; i < target->len; i++)
|
||||
{
|
||||
target_object = g_ptr_array_index (target, i);
|
||||
if (GAIL_IS_CELL (target_object))
|
||||
{
|
||||
g_object_unref (target_object);
|
||||
}
|
||||
}
|
||||
}
|
||||
g_object_unref (relation_set);
|
||||
}
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gail_cell_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL (obj);
|
||||
g_assert (cell->state_set);
|
||||
|
||||
g_object_ref(cell->state_set);
|
||||
return cell->state_set;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gail_cell_add_state (GailCell *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
if (!atk_state_set_contains_state (cell->state_set, state_type))
|
||||
{
|
||||
gboolean rc;
|
||||
AtkObject *parent;
|
||||
|
||||
rc = atk_state_set_add_state (cell->state_set, state_type);
|
||||
/*
|
||||
* The signal should only be generated if the value changed,
|
||||
* not when the cell is set up. So states that are set
|
||||
* initially should pass FALSE as the emit_signal argument.
|
||||
*/
|
||||
|
||||
if (emit_signal)
|
||||
{
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), state_type, TRUE);
|
||||
/* If state_type is ATK_STATE_VISIBLE, additional notification */
|
||||
if (state_type == ATK_STATE_VISIBLE)
|
||||
g_signal_emit_by_name (cell, "visible_data_changed");
|
||||
}
|
||||
|
||||
/*
|
||||
* If the parent is a flyweight container cell, propagate the state
|
||||
* change to it also
|
||||
*/
|
||||
|
||||
parent = atk_object_get_parent (ATK_OBJECT (cell));
|
||||
if (GAIL_IS_CONTAINER_CELL (parent))
|
||||
gail_cell_add_state (GAIL_CELL (parent), state_type, emit_signal);
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gail_cell_remove_state (GailCell *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
if (atk_state_set_contains_state (cell->state_set, state_type))
|
||||
{
|
||||
gboolean rc;
|
||||
AtkObject *parent;
|
||||
|
||||
parent = atk_object_get_parent (ATK_OBJECT (cell));
|
||||
|
||||
rc = atk_state_set_remove_state (cell->state_set, state_type);
|
||||
/*
|
||||
* The signal should only be generated if the value changed,
|
||||
* not when the cell is set up. So states that are set
|
||||
* initially should pass FALSE as the emit_signal argument.
|
||||
*/
|
||||
|
||||
if (emit_signal)
|
||||
{
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), state_type, FALSE);
|
||||
/* If state_type is ATK_STATE_VISIBLE, additional notification */
|
||||
if (state_type == ATK_STATE_VISIBLE)
|
||||
g_signal_emit_by_name (cell, "visible_data_changed");
|
||||
}
|
||||
|
||||
/*
|
||||
* If the parent is a flyweight container cell, propagate the state
|
||||
* change to it also
|
||||
*/
|
||||
|
||||
if (GAIL_IS_CONTAINER_CELL (parent))
|
||||
gail_cell_remove_state (GAIL_CELL (parent), state_type, emit_signal);
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_cell_get_index_in_parent (AtkObject *obj)
|
||||
{
|
||||
GailCell *cell;
|
||||
|
||||
g_assert (GAIL_IS_CELL (obj));
|
||||
|
||||
cell = GAIL_CELL (obj);
|
||||
if (atk_state_set_contains_state (cell->state_set, ATK_STATE_STALE))
|
||||
if (cell->refresh_index)
|
||||
{
|
||||
cell->refresh_index (cell);
|
||||
atk_state_set_remove_state (cell->state_set, ATK_STATE_STALE);
|
||||
}
|
||||
return cell->index;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_cell_atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
g_assert (iface != NULL);
|
||||
|
||||
iface->get_n_actions = gail_cell_action_get_n_actions;
|
||||
iface->do_action = gail_cell_action_do_action;
|
||||
iface->get_name = gail_cell_action_get_name;
|
||||
iface->get_description = gail_cell_action_get_description;
|
||||
iface->set_description = gail_cell_action_set_description;
|
||||
iface->get_keybinding = gail_cell_action_get_keybinding;
|
||||
}
|
||||
|
||||
void
|
||||
gail_cell_type_add_action_interface (GType type)
|
||||
{
|
||||
static const GInterfaceInfo atk_action_info =
|
||||
{
|
||||
(GInterfaceInitFunc) gail_cell_atk_action_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
g_type_add_interface_static (type, ATK_TYPE_ACTION,
|
||||
&atk_action_info);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gail_cell_add_action (GailCell *cell,
|
||||
const gchar *action_name,
|
||||
const gchar *action_description,
|
||||
const gchar *action_keybinding,
|
||||
ACTION_FUNC action_func)
|
||||
{
|
||||
ActionInfo *info;
|
||||
g_return_val_if_fail (GAIL_IS_CELL (cell), FALSE);
|
||||
info = g_new (ActionInfo, 1);
|
||||
|
||||
if (action_name != NULL)
|
||||
info->name = g_strdup (action_name);
|
||||
else
|
||||
info->name = NULL;
|
||||
if (action_description != NULL)
|
||||
info->description = g_strdup (action_description);
|
||||
else
|
||||
info->description = NULL;
|
||||
if (action_keybinding != NULL)
|
||||
info->keybinding = g_strdup (action_keybinding);
|
||||
else
|
||||
info->keybinding = NULL;
|
||||
info->do_action_func = action_func;
|
||||
|
||||
cell->action_list = g_list_append (cell->action_list, (gpointer) info);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gail_cell_remove_action (GailCell *cell,
|
||||
gint action_index)
|
||||
{
|
||||
GList *list_node;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CELL (cell), FALSE);
|
||||
list_node = g_list_nth (cell->action_list, action_index);
|
||||
if (!list_node)
|
||||
return FALSE;
|
||||
_gail_cell_destroy_action_info (list_node->data, NULL);
|
||||
cell->action_list = g_list_remove_link (cell->action_list, list_node);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
gail_cell_remove_action_by_name (GailCell *cell,
|
||||
const gchar *action_name)
|
||||
{
|
||||
GList *list_node;
|
||||
gboolean action_found= FALSE;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CELL (cell), FALSE);
|
||||
for (list_node = cell->action_list; list_node && !action_found;
|
||||
list_node = list_node->next)
|
||||
{
|
||||
if (!g_strcasecmp (((ActionInfo *)(list_node->data))->name, action_name))
|
||||
{
|
||||
action_found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!action_found)
|
||||
return FALSE;
|
||||
_gail_cell_destroy_action_info (list_node->data, NULL);
|
||||
cell->action_list = g_list_remove_link (cell->action_list, list_node);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static ActionInfo *
|
||||
_gail_cell_get_action_info (GailCell *cell,
|
||||
gint index)
|
||||
{
|
||||
GList *list_node;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CELL (cell), NULL);
|
||||
if (cell->action_list == NULL)
|
||||
return NULL;
|
||||
list_node = g_list_nth (cell->action_list, index);
|
||||
if (!list_node)
|
||||
return NULL;
|
||||
return (ActionInfo *) (list_node->data);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_gail_cell_destroy_action_info (gpointer action_info,
|
||||
gpointer user_data)
|
||||
{
|
||||
ActionInfo *info = (ActionInfo *)action_info;
|
||||
g_assert (info != NULL);
|
||||
g_free (info->name);
|
||||
g_free (info->description);
|
||||
g_free (info->keybinding);
|
||||
g_free (info);
|
||||
}
|
||||
static gint
|
||||
gail_cell_action_get_n_actions (AtkAction *action)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL(action);
|
||||
if (cell->action_list != NULL)
|
||||
return g_list_length (cell->action_list);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar *
|
||||
gail_cell_action_get_name (AtkAction *action,
|
||||
gint index)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL(action);
|
||||
ActionInfo *info = _gail_cell_get_action_info (cell, index);
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
return info->name;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar *
|
||||
gail_cell_action_get_description (AtkAction *action,
|
||||
gint index)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL(action);
|
||||
ActionInfo *info = _gail_cell_get_action_info (cell, index);
|
||||
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
return info->description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_cell_action_set_description (AtkAction *action,
|
||||
gint index,
|
||||
const gchar *desc)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL(action);
|
||||
ActionInfo *info = _gail_cell_get_action_info (cell, index);
|
||||
|
||||
if (info == NULL)
|
||||
return FALSE;
|
||||
g_free (info->description);
|
||||
info->description = g_strdup (desc);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar *
|
||||
gail_cell_action_get_keybinding (AtkAction *action,
|
||||
gint index)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL(action);
|
||||
ActionInfo *info = _gail_cell_get_action_info (cell, index);
|
||||
if (info == NULL)
|
||||
return NULL;
|
||||
return info->keybinding;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_cell_action_do_action (AtkAction *action,
|
||||
gint index)
|
||||
{
|
||||
GailCell *cell = GAIL_CELL(action);
|
||||
ActionInfo *info = _gail_cell_get_action_info (cell, index);
|
||||
if (info == NULL)
|
||||
return FALSE;
|
||||
if (info->do_action_func == NULL)
|
||||
return FALSE;
|
||||
if (cell->action_idle_handler)
|
||||
return FALSE;
|
||||
cell->action_func = info->do_action_func;
|
||||
cell->action_idle_handler = g_idle_add (idle_do_action, cell);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
idle_do_action (gpointer data)
|
||||
{
|
||||
GailCell *cell;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
cell = GAIL_CELL (data);
|
||||
cell->action_idle_handler = 0;
|
||||
cell->action_func (cell);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_component_interface_init (AtkComponentIface *iface)
|
||||
{
|
||||
g_assert (iface != NULL);
|
||||
|
||||
iface->get_extents = gail_cell_get_extents;
|
||||
iface->grab_focus = gail_cell_grab_focus;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_cell_get_extents (AtkComponent *component,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
GailCell *gailcell;
|
||||
AtkObject *cell_parent;
|
||||
|
||||
g_assert (GAIL_IS_CELL (component));
|
||||
|
||||
gailcell = GAIL_CELL (component);
|
||||
|
||||
cell_parent = gtk_widget_get_accessible (gailcell->widget);
|
||||
|
||||
gail_cell_parent_get_cell_extents (GAIL_CELL_PARENT (cell_parent),
|
||||
gailcell, x, y, width, height, coord_type);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_cell_grab_focus (AtkComponent *component)
|
||||
{
|
||||
GailCell *gailcell;
|
||||
AtkObject *cell_parent;
|
||||
|
||||
g_assert (GAIL_IS_CELL (component));
|
||||
|
||||
gailcell = GAIL_CELL (component);
|
||||
|
||||
cell_parent = gtk_widget_get_accessible (gailcell->widget);
|
||||
|
||||
return gail_cell_parent_grab_focus (GAIL_CELL_PARENT (cell_parent),
|
||||
gailcell);
|
||||
}
|
||||
110
modules/other/gail/gailcell.h
Normal file
110
modules/other/gail/gailcell.h
Normal file
@ -0,0 +1,110 @@
|
||||
/* 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_CELL_H__
|
||||
#define __GAIL_CELL_H__
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CELL (gail_cell_get_type ())
|
||||
#define GAIL_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CELL, GailCell))
|
||||
#define GAIL_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CELL, GailCellClass))
|
||||
#define GAIL_IS_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CELL))
|
||||
#define GAIL_IS_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CELL))
|
||||
#define GAIL_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CELL, GailCellClass))
|
||||
|
||||
typedef struct _GailCell GailCell;
|
||||
typedef struct _GailCellClass GailCellClass;
|
||||
typedef struct _ActionInfo ActionInfo;
|
||||
typedef void (*ACTION_FUNC) (GailCell *cell);
|
||||
|
||||
struct _GailCell
|
||||
{
|
||||
AtkObject parent;
|
||||
|
||||
GtkWidget *widget;
|
||||
/*
|
||||
* This cached value is used only by atk_object_get_index_in_parent()
|
||||
* which updates the value when it is stale.
|
||||
*/
|
||||
gint index;
|
||||
AtkStateSet *state_set;
|
||||
GList *action_list;
|
||||
void (*refresh_index) (GailCell *cell);
|
||||
gint action_idle_handler;
|
||||
ACTION_FUNC action_func;
|
||||
};
|
||||
|
||||
GType gail_cell_get_type (void);
|
||||
|
||||
struct _GailCellClass
|
||||
{
|
||||
AtkObjectClass parent_class;
|
||||
};
|
||||
|
||||
struct _ActionInfo {
|
||||
gchar *name;
|
||||
gchar *description;
|
||||
gchar *keybinding;
|
||||
ACTION_FUNC do_action_func;
|
||||
};
|
||||
|
||||
|
||||
void gail_cell_init (GailCell *cell,
|
||||
GtkWidget *widget,
|
||||
AtkObject *parent,
|
||||
gint index);
|
||||
|
||||
gboolean gail_cell_add_state (GailCell *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal);
|
||||
|
||||
gboolean gail_cell_remove_state (GailCell *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal);
|
||||
|
||||
void gail_cell_type_add_action_interface
|
||||
(GType type);
|
||||
|
||||
gboolean gail_cell_add_action (GailCell *cell,
|
||||
const gchar *action_name,
|
||||
const gchar *action_description,
|
||||
const gchar *action_keybinding,
|
||||
ACTION_FUNC action_func);
|
||||
|
||||
gboolean gail_cell_remove_action (GailCell *cell,
|
||||
gint action_id);
|
||||
|
||||
gboolean gail_cell_remove_action_by_name (GailCell *cell,
|
||||
const gchar *action_name);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CELL_H__ */
|
||||
124
modules/other/gail/gailcellparent.c
Normal file
124
modules/other/gail/gailcellparent.c
Normal file
@ -0,0 +1,124 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include "gailcellparent.h"
|
||||
|
||||
GType
|
||||
gail_cell_parent_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailCellParentIface),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
|
||||
};
|
||||
|
||||
type = g_type_register_static (G_TYPE_INTERFACE, "GailCellParent", &tinfo, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gail_cell_parent_get_cell_extents:
|
||||
* @parent: a #GObject instance that implements GailCellParentIface
|
||||
* @cell: a #GailCell whose extents is required
|
||||
* @x: address of #gint to put x coordinate
|
||||
* @y: address of #gint to put y coordinate
|
||||
* @width: address of #gint to put width
|
||||
* @height: address of #gint to put height
|
||||
* @coord_type: specifies whether the coordinates are relative to the screen
|
||||
* or to the components top level window
|
||||
*
|
||||
* Gets the rectangle which gives the extent of the @cell.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gail_cell_parent_get_cell_extents (GailCellParent *parent,
|
||||
GailCell *cell,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
GailCellParentIface *iface;
|
||||
|
||||
g_return_if_fail (GAIL_IS_CELL_PARENT (parent));
|
||||
|
||||
iface = GAIL_CELL_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_cell_extents)
|
||||
(iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* gail_cell_parent_get_cell_area:
|
||||
* @parent: a #GObject instance that implements GailCellParentIface
|
||||
* @cell: a #GailCell whose area is required
|
||||
* @cell_rect: address of #GdkRectangle to put the cell area
|
||||
*
|
||||
* Gets the cell area of the @cell.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gail_cell_parent_get_cell_area (GailCellParent *parent,
|
||||
GailCell *cell,
|
||||
GdkRectangle *cell_rect)
|
||||
{
|
||||
GailCellParentIface *iface;
|
||||
|
||||
g_return_if_fail (GAIL_IS_CELL_PARENT (parent));
|
||||
g_return_if_fail (cell_rect);
|
||||
|
||||
iface = GAIL_CELL_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_cell_area)
|
||||
(iface->get_cell_area) (parent, cell, cell_rect);
|
||||
}
|
||||
/**
|
||||
* gail_cell_parent_grab_focus:
|
||||
* @parent: a #GObject instance that implements GailCellParentIface
|
||||
* @cell: a #GailCell whose area is required
|
||||
*
|
||||
* Puts focus in the specified cell.
|
||||
*
|
||||
**/
|
||||
gboolean
|
||||
gail_cell_parent_grab_focus (GailCellParent *parent,
|
||||
GailCell *cell)
|
||||
{
|
||||
GailCellParentIface *iface;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CELL_PARENT (parent), FALSE);
|
||||
|
||||
iface = GAIL_CELL_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->grab_focus)
|
||||
return (iface->grab_focus) (parent, cell);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
88
modules/other/gail/gailcellparent.h
Normal file
88
modules/other/gail/gailcellparent.h
Normal file
@ -0,0 +1,88 @@
|
||||
/* 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_CELL_PARENT_H__
|
||||
#define __GAIL_CELL_PARENT_H__
|
||||
|
||||
#include <atk/atkobject.h>
|
||||
#include <atk/atkutil.h>
|
||||
#include <gail/gailcell.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* The GailCellParent interface should be supported by any object which
|
||||
* contains children which are flyweights, i.e. do not have corresponding
|
||||
* widgets and the children need help from their parent to provide
|
||||
* functionality. One example is GailTreeView where the children GailCell
|
||||
* need help from the GailTreeView in order to implement
|
||||
* atk_component_get_extents
|
||||
*/
|
||||
|
||||
#define GAIL_TYPE_CELL_PARENT (gail_cell_parent_get_type ())
|
||||
#define GAIL_IS_CELL_PARENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CELL_PARENT)
|
||||
#define GAIL_CELL_PARENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CELL_PARENT, GailCellParent)
|
||||
#define GAIL_CELL_PARENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GAIL_TYPE_CELL_PARENT, GailCellParentIface))
|
||||
|
||||
#ifndef _TYPEDEF_GAIL_CELL_PARENT_
|
||||
#define _TYPEDEF_GAIL_CELL_PARENT_
|
||||
typedef struct _GailCellParent GailCellParent;
|
||||
#endif
|
||||
typedef struct _GailCellParentIface GailCellParentIface;
|
||||
|
||||
struct _GailCellParentIface
|
||||
{
|
||||
GTypeInterface parent;
|
||||
void ( *get_cell_extents) (GailCellParent *parent,
|
||||
GailCell *cell,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coord_type);
|
||||
void ( *get_cell_area) (GailCellParent *parent,
|
||||
GailCell *cell,
|
||||
GdkRectangle *cell_rect);
|
||||
gboolean ( *grab_focus) (GailCellParent *parent,
|
||||
GailCell *cell);
|
||||
};
|
||||
|
||||
GType gail_cell_parent_get_type (void);
|
||||
|
||||
void gail_cell_parent_get_cell_extents (GailCellParent *parent,
|
||||
GailCell *cell,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coord_type
|
||||
);
|
||||
void gail_cell_parent_get_cell_area (GailCellParent *parent,
|
||||
GailCell *cell,
|
||||
GdkRectangle *cell_rect);
|
||||
gboolean gail_cell_parent_grab_focus (GailCellParent *parent,
|
||||
GailCell *cell);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __GAIL_CELL_PARENT_H__ */
|
||||
166
modules/other/gail/gailcheckmenuitem.c
Normal file
166
modules/other/gail/gailcheckmenuitem.c
Normal file
@ -0,0 +1,166 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2002, 2003 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailcheckmenuitem.h"
|
||||
#include "gailchecksubmenuitem.h"
|
||||
|
||||
static void gail_check_menu_item_class_init (GailCheckMenuItemClass *klass);
|
||||
|
||||
static void gail_check_menu_item_toggled_gtk (GtkWidget *widget);
|
||||
|
||||
static void gail_check_menu_item_real_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gail_check_menu_item_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
static AtkStateSet* gail_check_menu_item_ref_state_set (AtkObject *accessible);
|
||||
|
||||
static GailMenuItemClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_check_menu_item_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailCheckMenuItemClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_check_menu_item_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailCheckMenuItem), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_MENU_ITEM,
|
||||
"GailCheckMenuItem", &tinfo, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_menu_item_class_init (GailCheckMenuItemClass *klass)
|
||||
{
|
||||
GailWidgetClass *widget_class;
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
widget_class = (GailWidgetClass*)klass;
|
||||
widget_class->notify_gtk = gail_check_menu_item_real_notify_gtk;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->ref_state_set = gail_check_menu_item_ref_state_set;
|
||||
class->initialize = gail_check_menu_item_real_initialize;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_check_menu_item_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (widget), NULL);
|
||||
|
||||
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget)))
|
||||
return gail_check_sub_menu_item_new (widget);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_CHECK_MENU_ITEM, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_menu_item_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (data,
|
||||
"toggled",
|
||||
G_CALLBACK (gail_check_menu_item_toggled_gtk),
|
||||
NULL);
|
||||
|
||||
obj->role = ATK_ROLE_CHECK_MENU_ITEM;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_menu_item_toggled_gtk (GtkWidget *widget)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
GtkCheckMenuItem *check_menu_item;
|
||||
|
||||
check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||
|
||||
accessible = gtk_widget_get_accessible (widget);
|
||||
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED,
|
||||
check_menu_item->active);
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gail_check_menu_item_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkCheckMenuItem *check_menu_item;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
|
||||
widget = GTK_ACCESSIBLE (accessible)->widget;
|
||||
|
||||
if (widget == NULL)
|
||||
return state_set;
|
||||
|
||||
check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||
|
||||
if (gtk_check_menu_item_get_active (check_menu_item))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
|
||||
|
||||
if (gtk_check_menu_item_get_inconsistent (check_menu_item))
|
||||
atk_state_set_remove_state (state_set, ATK_STATE_ENABLED);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_menu_item_real_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (obj);
|
||||
AtkObject *atk_obj;
|
||||
|
||||
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (check_menu_item));
|
||||
|
||||
if (strcmp (pspec->name, "inconsistent") == 0)
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED,
|
||||
!gtk_check_menu_item_get_inconsistent (check_menu_item));
|
||||
else
|
||||
GAIL_WIDGET_CLASS (parent_class)->notify_gtk (obj, pspec);
|
||||
}
|
||||
59
modules/other/gail/gailcheckmenuitem.h
Normal file
59
modules/other/gail/gailcheckmenuitem.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2002 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_CHECK_MENU_ITEM_H__
|
||||
#define __GAIL_CHECK_MENU_ITEM_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailmenuitem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CHECK_MENU_ITEM (gail_check_menu_item_get_type ())
|
||||
#define GAIL_CHECK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItem))
|
||||
#define GAIL_CHECK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItemClass))
|
||||
#define GAIL_IS_CHECK_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CHECK_MENU_ITEM))
|
||||
#define GAIL_IS_CHECK_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CHECK_MENU_ITEM))
|
||||
#define GAIL_CHECK_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CHECK_MENU_ITEM, GailCheckMenuItemClass))
|
||||
|
||||
typedef struct _GailCheckMenuItem GailCheckMenuItem;
|
||||
typedef struct _GailCheckMenuItemClass GailCheckMenuItemClass;
|
||||
|
||||
struct _GailCheckMenuItem
|
||||
{
|
||||
GailMenuItem parent;
|
||||
};
|
||||
|
||||
GType gail_check_menu_item_get_type (void);
|
||||
|
||||
struct _GailCheckMenuItemClass
|
||||
{
|
||||
GailMenuItemClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_check_menu_item_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CHECK_MENU_ITEM_H__ */
|
||||
162
modules/other/gail/gailchecksubmenuitem.c
Normal file
162
modules/other/gail/gailchecksubmenuitem.c
Normal file
@ -0,0 +1,162 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2002 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailchecksubmenuitem.h"
|
||||
|
||||
static void gail_check_sub_menu_item_class_init (GailCheckSubMenuItemClass *klass);
|
||||
|
||||
static void gail_check_sub_menu_item_toggled_gtk (GtkWidget *widget);
|
||||
|
||||
static void gail_check_sub_menu_item_real_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gail_check_sub_menu_item_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
static AtkStateSet* gail_check_sub_menu_item_ref_state_set (AtkObject *accessible);
|
||||
|
||||
static GailSubMenuItemClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_check_sub_menu_item_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailCheckSubMenuItemClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_check_sub_menu_item_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailCheckSubMenuItem), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_SUB_MENU_ITEM,
|
||||
"GailCheckSubMenuItem", &tinfo, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_sub_menu_item_class_init (GailCheckSubMenuItemClass *klass)
|
||||
{
|
||||
GailWidgetClass *widget_class;
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
widget_class = (GailWidgetClass*)klass;
|
||||
widget_class->notify_gtk = gail_check_sub_menu_item_real_notify_gtk;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->ref_state_set = gail_check_sub_menu_item_ref_state_set;
|
||||
class->initialize = gail_check_sub_menu_item_real_initialize;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_check_sub_menu_item_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CHECK_MENU_ITEM (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_CHECK_SUB_MENU_ITEM, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_sub_menu_item_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (data,
|
||||
"toggled",
|
||||
G_CALLBACK (gail_check_sub_menu_item_toggled_gtk),
|
||||
NULL);
|
||||
|
||||
obj->role = ATK_ROLE_CHECK_MENU_ITEM;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_sub_menu_item_toggled_gtk (GtkWidget *widget)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
GtkCheckMenuItem *check_menu_item;
|
||||
|
||||
check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||
|
||||
accessible = gtk_widget_get_accessible (widget);
|
||||
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED,
|
||||
check_menu_item->active);
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gail_check_sub_menu_item_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkCheckMenuItem *check_menu_item;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (accessible);
|
||||
widget = GTK_ACCESSIBLE (accessible)->widget;
|
||||
|
||||
if (widget == NULL)
|
||||
return state_set;
|
||||
|
||||
check_menu_item = GTK_CHECK_MENU_ITEM (widget);
|
||||
|
||||
if (gtk_check_menu_item_get_active (check_menu_item))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
|
||||
|
||||
if (gtk_check_menu_item_get_inconsistent (check_menu_item))
|
||||
atk_state_set_remove_state (state_set, ATK_STATE_ENABLED);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_check_sub_menu_item_real_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (obj);
|
||||
AtkObject *atk_obj;
|
||||
|
||||
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (check_menu_item));
|
||||
|
||||
if (strcmp (pspec->name, "inconsistent") == 0)
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_ENABLED,
|
||||
!gtk_check_menu_item_get_inconsistent (check_menu_item));
|
||||
else
|
||||
GAIL_WIDGET_CLASS (parent_class)->notify_gtk (obj, pspec);
|
||||
}
|
||||
59
modules/other/gail/gailchecksubmenuitem.h
Normal file
59
modules/other/gail/gailchecksubmenuitem.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2002 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_CHECK_SUB_MENU_ITEM_H__
|
||||
#define __GAIL_CHECK_SUB_MENU_ITEM_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailsubmenuitem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CHECK_SUB_MENU_ITEM (gail_check_sub_menu_item_get_type ())
|
||||
#define GAIL_CHECK_SUB_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CHECK_SUB_MENU_ITEM, GailCheckSubMenuItem))
|
||||
#define GAIL_CHECK_SUB_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CHECK_SUB_MENU_ITEM, GailCheckSubMenuItemClass))
|
||||
#define GAIL_IS_CHECK_SUB_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CHECK_SUB_MENU_ITEM))
|
||||
#define GAIL_IS_CHECK_SUB_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CHECK_SUB_MENU_ITEM))
|
||||
#define GAIL_CHECK_SUB_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CHECK_SUB_MENU_ITEM, GailCheckSubMenuItemClass))
|
||||
|
||||
typedef struct _GailCheckSubMenuItem GailCheckSubMenuItem;
|
||||
typedef struct _GailCheckSubMenuItemClass GailCheckSubMenuItemClass;
|
||||
|
||||
struct _GailCheckSubMenuItem
|
||||
{
|
||||
GailSubMenuItem parent;
|
||||
};
|
||||
|
||||
GType gail_check_sub_menu_item_get_type (void);
|
||||
|
||||
struct _GailCheckSubMenuItemClass
|
||||
{
|
||||
GailSubMenuItemClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_check_sub_menu_item_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CHECK_SUB_MENU_ITEM_H__ */
|
||||
1670
modules/other/gail/gailclist.c
Normal file
1670
modules/other/gail/gailclist.c
Normal file
File diff suppressed because it is too large
Load Diff
72
modules/other/gail/gailclist.h
Normal file
72
modules/other/gail/gailclist.h
Normal file
@ -0,0 +1,72 @@
|
||||
/* 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_CLIST_H__
|
||||
#define __GAIL_CLIST_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CLIST (gail_clist_get_type ())
|
||||
#define GAIL_CLIST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CLIST, GailCList))
|
||||
#define GAIL_CLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CLIST, GailCListClass))
|
||||
#define GAIL_IS_CLIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CLIST))
|
||||
#define GAIL_IS_CLIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CLIST))
|
||||
#define GAIL_CLIST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CLIST, GailCListClass))
|
||||
|
||||
typedef struct _GailCList GailCList;
|
||||
typedef struct _GailCListClass GailCListClass;
|
||||
|
||||
typedef struct _GailCListColumn GailCListColumn;
|
||||
|
||||
struct _GailCList
|
||||
{
|
||||
GailContainer parent;
|
||||
|
||||
AtkObject* caption;
|
||||
AtkObject* summary;
|
||||
|
||||
/* dynamically allocated array of column structures */
|
||||
GailCListColumn *columns;
|
||||
/* private */
|
||||
gint n_cols;
|
||||
GArray *row_data;
|
||||
GList *cell_data;
|
||||
AtkObject *previous_selected_cell;
|
||||
};
|
||||
|
||||
GType gail_clist_get_type (void);
|
||||
|
||||
struct _GailCListClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_clist_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CLIST_H__ */
|
||||
121
modules/other/gail/gailclistcell.c
Normal file
121
modules/other/gail/gailclistcell.c
Normal file
@ -0,0 +1,121 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailclistcell.h"
|
||||
|
||||
static void gail_clist_cell_class_init (GailCListCellClass *klass);
|
||||
|
||||
static G_CONST_RETURN gchar* gail_clist_cell_get_name (AtkObject *accessible);
|
||||
|
||||
GType
|
||||
gail_clist_cell_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailCListCellClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_clist_cell_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailCListCell), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CELL,
|
||||
"GailCListCell", &tinfo, 0);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_clist_cell_class_init (GailCListCellClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_name = gail_clist_cell_get_name;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_clist_cell_new (void)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *atk_object;
|
||||
|
||||
object = g_object_new (GAIL_TYPE_CLIST_CELL, NULL);
|
||||
|
||||
g_return_val_if_fail (object != NULL, NULL);
|
||||
|
||||
atk_object = ATK_OBJECT (object);
|
||||
atk_object->role = ATK_ROLE_TABLE_CELL;
|
||||
|
||||
g_return_val_if_fail (!ATK_IS_TEXT (atk_object), NULL);
|
||||
|
||||
return atk_object;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_clist_cell_get_name (AtkObject *accessible)
|
||||
{
|
||||
if (accessible->name)
|
||||
return accessible->name;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Get the cell's text if it exists
|
||||
*/
|
||||
GailCell *cell = GAIL_CELL (accessible);
|
||||
GtkWidget* widget = cell->widget;
|
||||
GtkCellType cell_type;
|
||||
GtkCList *clist;
|
||||
gchar *text = NULL;
|
||||
gint row, column;
|
||||
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
clist = GTK_CLIST (widget);
|
||||
g_return_val_if_fail (clist->columns, NULL);
|
||||
row = cell->index / clist->columns;
|
||||
column = cell->index % clist->columns;
|
||||
cell_type = gtk_clist_get_cell_type (clist, row, column);
|
||||
switch (cell_type)
|
||||
{
|
||||
case GTK_CELL_TEXT:
|
||||
gtk_clist_get_text (clist, row, column, &text);
|
||||
break;
|
||||
case GTK_CELL_PIXTEXT:
|
||||
gtk_clist_get_pixtext (clist, row, column, &text, NULL, NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
59
modules/other/gail/gailclistcell.h
Normal file
59
modules/other/gail/gailclistcell.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* 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_CLIST_CELL_H__
|
||||
#define __GAIL_CLIST_CELL_H__
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gail/gailcell.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CLIST_CELL (gail_clist_cell_get_type ())
|
||||
#define GAIL_CLIST_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CLIST_CELL, GailCListCell))
|
||||
#define GAIL_CLIST_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CLIST_CELL, GailCListCellClass))
|
||||
#define GAIL_IS_CLIST_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CLIST_CELL))
|
||||
#define GAIL_IS_CLIST_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CLIST_CELL))
|
||||
#define GAIL_CLIST_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CLIST_CELL, GailCListCellClass))
|
||||
|
||||
typedef struct _GailCListCell GailCListCell;
|
||||
typedef struct _GailCListCellClass GailCListCellClass;
|
||||
|
||||
struct _GailCListCell
|
||||
{
|
||||
GailCell parent;
|
||||
};
|
||||
|
||||
GType gail_clist_cell_get_type (void);
|
||||
|
||||
struct _GailCListCellClass
|
||||
{
|
||||
GailCellClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject *gail_clist_cell_new (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CLIST_CELL_H__ */
|
||||
714
modules/other/gail/gailcombo.c
Normal file
714
modules/other/gail/gailcombo.c
Normal file
@ -0,0 +1,714 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2001, 2002, 2003 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailcombo.h"
|
||||
|
||||
static void gail_combo_class_init (GailComboClass *klass);
|
||||
static void gail_combo_object_init (GailCombo *combo);
|
||||
static void gail_combo_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
static void gail_combo_selection_changed_gtk (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static gint gail_combo_get_n_children (AtkObject *obj);
|
||||
static AtkObject* gail_combo_ref_child (AtkObject *obj,
|
||||
gint i);
|
||||
static void gail_combo_finalize (GObject *object);
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
static gboolean gail_combo_do_action (AtkAction *action,
|
||||
gint i);
|
||||
static gboolean idle_do_action (gpointer data);
|
||||
static gint gail_combo_get_n_actions (AtkAction *action)
|
||||
;
|
||||
static G_CONST_RETURN gchar* gail_combo_get_description(AtkAction *action,
|
||||
gint i);
|
||||
static G_CONST_RETURN gchar* gail_combo_get_name (AtkAction *action,
|
||||
gint i);
|
||||
static gboolean gail_combo_set_description(AtkAction *action,
|
||||
gint i,
|
||||
const gchar *desc);
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
static gboolean gail_combo_add_selection (AtkSelection *selection,
|
||||
gint i);
|
||||
static gboolean gail_combo_clear_selection (AtkSelection *selection);
|
||||
static AtkObject* gail_combo_ref_selection (AtkSelection *selection,
|
||||
gint i);
|
||||
static gint gail_combo_get_selection_count (AtkSelection *selection);
|
||||
static gboolean gail_combo_is_child_selected (AtkSelection *selection,
|
||||
gint i);
|
||||
static gboolean gail_combo_remove_selection (AtkSelection *selection,
|
||||
gint i);
|
||||
|
||||
static gint _gail_combo_button_release (gpointer data);
|
||||
static gint _gail_combo_popup_release (gpointer data);
|
||||
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_combo_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailComboClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_combo_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailCombo), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) gail_combo_object_init, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo atk_action_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_action_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
static const GInterfaceInfo atk_selection_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_selection_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CONTAINER,
|
||||
"GailCombo", &tinfo, 0);
|
||||
|
||||
g_type_add_interface_static (type, ATK_TYPE_ACTION,
|
||||
&atk_action_info);
|
||||
g_type_add_interface_static (type, ATK_TYPE_SELECTION,
|
||||
&atk_selection_info);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_class_init (GailComboClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gail_combo_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->get_n_children = gail_combo_get_n_children;
|
||||
class->ref_child = gail_combo_ref_child;
|
||||
class->initialize = gail_combo_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_object_init (GailCombo *combo)
|
||||
{
|
||||
combo->press_description = NULL;
|
||||
combo->old_selection = NULL;
|
||||
combo->deselect_idle_handler = 0;
|
||||
combo->select_idle_handler = 0;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_combo_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_COMBO (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_COMBO, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkList *list;
|
||||
GList *slist;
|
||||
GailCombo *gail_combo;
|
||||
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
combo = GTK_COMBO (data);
|
||||
|
||||
list = GTK_LIST (combo->list);
|
||||
slist = list->selection;
|
||||
|
||||
gail_combo = GAIL_COMBO (obj);
|
||||
if (slist && slist->data)
|
||||
{
|
||||
gail_combo->old_selection = slist->data;
|
||||
}
|
||||
g_signal_connect (combo->list,
|
||||
"selection_changed",
|
||||
G_CALLBACK (gail_combo_selection_changed_gtk),
|
||||
data);
|
||||
atk_object_set_parent (gtk_widget_get_accessible (combo->entry), obj);
|
||||
atk_object_set_parent (gtk_widget_get_accessible (combo->popup), obj);
|
||||
|
||||
obj->role = ATK_ROLE_COMBO_BOX;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
notify_deselect (gpointer data)
|
||||
{
|
||||
GailCombo *combo;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
combo = GAIL_COMBO (data);
|
||||
|
||||
combo->old_selection = NULL;
|
||||
combo->deselect_idle_handler = 0;
|
||||
g_signal_emit_by_name (data, "selection_changed");
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
notify_select (gpointer data)
|
||||
{
|
||||
GailCombo *combo;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
combo = GAIL_COMBO (data);
|
||||
|
||||
combo->select_idle_handler = 0;
|
||||
g_signal_emit_by_name (data, "selection_changed");
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_selection_changed_gtk (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkList *list;
|
||||
GList *slist;
|
||||
AtkObject *obj;
|
||||
GailCombo *gail_combo;
|
||||
|
||||
combo = GTK_COMBO (data);
|
||||
list = GTK_LIST (combo->list);
|
||||
|
||||
slist = list->selection;
|
||||
|
||||
obj = gtk_widget_get_accessible (GTK_WIDGET (data));
|
||||
gail_combo = GAIL_COMBO (obj);
|
||||
if (slist && slist->data)
|
||||
{
|
||||
if (slist->data != gail_combo->old_selection)
|
||||
{
|
||||
gail_combo->old_selection = slist->data;
|
||||
if (gail_combo->select_idle_handler == 0)
|
||||
gail_combo->select_idle_handler = g_idle_add (notify_select, gail_combo);
|
||||
}
|
||||
if (gail_combo->deselect_idle_handler)
|
||||
{
|
||||
g_source_remove (gail_combo->deselect_idle_handler);
|
||||
gail_combo->deselect_idle_handler = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gail_combo->deselect_idle_handler == 0)
|
||||
gail_combo->deselect_idle_handler = g_idle_add (notify_deselect, gail_combo);
|
||||
if (gail_combo->select_idle_handler)
|
||||
{
|
||||
g_source_remove (gail_combo->select_idle_handler);
|
||||
gail_combo->select_idle_handler = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The children of a GailCombo are the list of items and the entry field
|
||||
*/
|
||||
static gint
|
||||
gail_combo_get_n_children (AtkObject* obj)
|
||||
{
|
||||
gint n_children = 2;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_COMBO (obj), 0);
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return 0;
|
||||
|
||||
return n_children;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_combo_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_COMBO (obj), NULL);
|
||||
|
||||
if (i < 0 || i > 1)
|
||||
return NULL;
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
if (i == 0)
|
||||
accessible = gtk_widget_get_accessible (GTK_COMBO (widget)->popup);
|
||||
else
|
||||
accessible = gtk_widget_get_accessible (GTK_COMBO (widget)->entry);
|
||||
|
||||
g_object_ref (accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->do_action = gail_combo_do_action;
|
||||
iface->get_n_actions = gail_combo_get_n_actions;
|
||||
iface->get_description = gail_combo_get_description;
|
||||
iface->get_name = gail_combo_get_name;
|
||||
iface->set_description = gail_combo_set_description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_do_action (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
GailCombo *combo;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (action)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
if (!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
|
||||
return FALSE;
|
||||
|
||||
combo = GAIL_COMBO (action);
|
||||
if (i == 0)
|
||||
{
|
||||
if (combo->action_idle_handler)
|
||||
return FALSE;
|
||||
|
||||
combo->action_idle_handler = g_idle_add (idle_do_action, combo);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* This action is the pressing of the button on the combo box.
|
||||
* The behavior is different depending on whether the list is being
|
||||
* displayed or removed.
|
||||
*
|
||||
* A button press event is simulated on the appropriate widget and
|
||||
* a button release event is simulated in an idle function.
|
||||
*/
|
||||
static gboolean
|
||||
idle_do_action (gpointer data)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkWidget *action_widget;
|
||||
GtkWidget *widget;
|
||||
GailCombo *gail_combo;
|
||||
gboolean do_popup;
|
||||
GdkEvent tmp_event;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
gail_combo = GAIL_COMBO (data);
|
||||
gail_combo->action_idle_handler = 0;
|
||||
widget = GTK_ACCESSIBLE (gail_combo)->widget;
|
||||
if (widget == NULL /* State is defunct */ ||
|
||||
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
combo = GTK_COMBO (widget);
|
||||
|
||||
do_popup = !GTK_WIDGET_MAPPED (combo->popwin);
|
||||
|
||||
tmp_event.button.type = GDK_BUTTON_PRESS;
|
||||
tmp_event.button.window = widget->window;
|
||||
tmp_event.button.button = 1;
|
||||
tmp_event.button.send_event = TRUE;
|
||||
tmp_event.button.time = GDK_CURRENT_TIME;
|
||||
tmp_event.button.axes = NULL;
|
||||
|
||||
if (do_popup)
|
||||
{
|
||||
/* Pop up list */
|
||||
action_widget = combo->button;
|
||||
|
||||
gtk_widget_event (action_widget, &tmp_event);
|
||||
|
||||
g_idle_add (_gail_combo_button_release, combo);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Pop down list */
|
||||
tmp_event.button.window = combo->list->window;
|
||||
gdk_window_set_user_data (combo->list->window, combo->button);
|
||||
action_widget = combo->popwin;
|
||||
|
||||
gtk_widget_event (action_widget, &tmp_event);
|
||||
g_idle_add (_gail_combo_popup_release, combo);
|
||||
}
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_combo_get_n_actions (AtkAction *action)
|
||||
{
|
||||
/*
|
||||
* The default behavior of a combo box is to have one action -
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_combo_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
GailCombo *combo;
|
||||
|
||||
combo = GAIL_COMBO (action);
|
||||
return combo->press_description;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_combo_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "press";
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_selection_interface_init (AtkSelectionIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->add_selection = gail_combo_add_selection;
|
||||
iface->clear_selection = gail_combo_clear_selection;
|
||||
iface->ref_selection = gail_combo_ref_selection;
|
||||
iface->get_selection_count = gail_combo_get_selection_count;
|
||||
iface->is_child_selected = gail_combo_is_child_selected;
|
||||
iface->remove_selection = gail_combo_remove_selection;
|
||||
/*
|
||||
* select_all_selection does not make sense for a combo box
|
||||
* so no implementation is provided.
|
||||
*/
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_add_selection (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
combo = GTK_COMBO (widget);
|
||||
|
||||
gtk_list_select_item (GTK_LIST (combo->list), i);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_clear_selection (AtkSelection *selection)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
combo = GTK_COMBO (widget);
|
||||
|
||||
gtk_list_unselect_all (GTK_LIST (combo->list));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_combo_ref_selection (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GList * list;
|
||||
GtkWidget *item;
|
||||
AtkObject *obj;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
combo = GTK_COMBO (widget);
|
||||
|
||||
/*
|
||||
* A combo box can have only one selection.
|
||||
*/
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
list = GTK_LIST (combo->list)->selection;
|
||||
|
||||
if (list == NULL)
|
||||
return NULL;
|
||||
|
||||
item = GTK_WIDGET (list->data);
|
||||
|
||||
obj = gtk_widget_get_accessible (item);
|
||||
g_object_ref (obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_combo_get_selection_count (AtkSelection *selection)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GList * list;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return 0;
|
||||
|
||||
combo = GTK_COMBO (widget);
|
||||
|
||||
/*
|
||||
* The number of children currently selected is either 1 or 0 so we
|
||||
* do not bother to count the elements of the selected list.
|
||||
*/
|
||||
list = GTK_LIST (combo->list)->selection;
|
||||
|
||||
if (list == NULL)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_is_child_selected (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GList * list;
|
||||
GtkWidget *item;
|
||||
gint j;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
combo = GTK_COMBO (widget);
|
||||
|
||||
list = GTK_LIST (combo->list)->selection;
|
||||
|
||||
if (list == NULL)
|
||||
return FALSE;
|
||||
|
||||
item = GTK_WIDGET (list->data);
|
||||
|
||||
j = g_list_index (GTK_LIST (combo->list)->children, item);
|
||||
|
||||
return (j == i);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_remove_selection (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
if (atk_selection_is_child_selected (selection, i))
|
||||
atk_selection_clear_selection (selection);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
_gail_combo_popup_release (gpointer data)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkWidget *action_widget;
|
||||
GdkEvent tmp_event;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
combo = GTK_COMBO (data);
|
||||
if (combo->current_button == 0)
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tmp_event.button.type = GDK_BUTTON_RELEASE;
|
||||
tmp_event.button.button = 1;
|
||||
tmp_event.button.time = GDK_CURRENT_TIME;
|
||||
action_widget = combo->button;
|
||||
|
||||
gtk_widget_event (action_widget, &tmp_event);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
_gail_combo_button_release (gpointer data)
|
||||
{
|
||||
GtkCombo *combo;
|
||||
GtkWidget *action_widget;
|
||||
GdkEvent tmp_event;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
combo = GTK_COMBO (data);
|
||||
if (combo->current_button == 0)
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tmp_event.button.type = GDK_BUTTON_RELEASE;
|
||||
tmp_event.button.button = 1;
|
||||
tmp_event.button.window = combo->list->window;
|
||||
tmp_event.button.time = GDK_CURRENT_TIME;
|
||||
gdk_window_set_user_data (combo->list->window, combo->button);
|
||||
action_widget = combo->list;
|
||||
|
||||
gtk_widget_event (action_widget, &tmp_event);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_set_description (AtkAction *action,
|
||||
gint i,
|
||||
const gchar *desc)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
GailCombo *combo;
|
||||
|
||||
combo = GAIL_COMBO (action);
|
||||
g_free (combo->press_description);
|
||||
combo->press_description = g_strdup (desc);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_finalize (GObject *object)
|
||||
{
|
||||
GailCombo *combo = GAIL_COMBO (object);
|
||||
|
||||
g_free (combo->press_description);
|
||||
if (combo->action_idle_handler)
|
||||
{
|
||||
g_source_remove (combo->action_idle_handler);
|
||||
combo->action_idle_handler = 0;
|
||||
}
|
||||
if (combo->deselect_idle_handler)
|
||||
{
|
||||
g_source_remove (combo->deselect_idle_handler);
|
||||
combo->deselect_idle_handler = 0;
|
||||
}
|
||||
if (combo->select_idle_handler)
|
||||
{
|
||||
g_source_remove (combo->select_idle_handler);
|
||||
combo->select_idle_handler = 0;
|
||||
}
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
67
modules/other/gail/gailcombo.h
Normal file
67
modules/other/gail/gailcombo.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* 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_COMBO_H__
|
||||
#define __GAIL_COMBO_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_COMBO (gail_combo_get_type ())
|
||||
#define GAIL_COMBO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_COMBO, GailCombo))
|
||||
#define GAIL_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_COMBO, GailComboClass))
|
||||
#define GAIL_IS_COMBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_COMBO))
|
||||
#define GAIL_IS_COMBO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_COMBO))
|
||||
#define GAIL_COMBO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_COMBO, GailComboClass))
|
||||
|
||||
typedef struct _GailCombo GailCombo;
|
||||
typedef struct _GailComboClass GailComboClass;
|
||||
|
||||
struct _GailCombo
|
||||
{
|
||||
GailContainer parent;
|
||||
|
||||
gchar *press_description;
|
||||
guint action_idle_handler;
|
||||
|
||||
gpointer old_selection;
|
||||
guint select_idle_handler;
|
||||
guint deselect_idle_handler;
|
||||
};
|
||||
|
||||
GType gail_combo_get_type (void);
|
||||
|
||||
struct _GailComboClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_combo_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_COMBO_H__ */
|
||||
686
modules/other/gail/gailcombobox.c
Normal file
686
modules/other/gail/gailcombobox.c
Normal file
@ -0,0 +1,686 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2004 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gailcombobox.h"
|
||||
|
||||
#if GTK_MINOR_VERSION > 4
|
||||
#define GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
#endif
|
||||
|
||||
static void gail_combo_box_class_init (GailComboBoxClass *klass);
|
||||
static void gail_combo_box_object_init (GailComboBox *combo_box);
|
||||
static void gail_combo_box_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
static void gail_combo_box_changed_gtk (GtkWidget *widget);
|
||||
|
||||
static G_CONST_RETURN gchar* gail_combo_box_get_name (AtkObject *obj);
|
||||
static gint gail_combo_box_get_n_children (AtkObject *obj);
|
||||
static AtkObject* gail_combo_box_ref_child (AtkObject *obj,
|
||||
gint i);
|
||||
static void gail_combo_box_finalize (GObject *object);
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
static gboolean gail_combo_box_do_action (AtkAction *action,
|
||||
gint i);
|
||||
static gboolean idle_do_action (gpointer data);
|
||||
static gint gail_combo_box_get_n_actions (AtkAction *action)
|
||||
;
|
||||
static G_CONST_RETURN gchar* gail_combo_box_get_description(AtkAction *action,
|
||||
gint i);
|
||||
static G_CONST_RETURN gchar* gail_combo_box_get_keybinding (AtkAction *action,
|
||||
gint i);
|
||||
static G_CONST_RETURN gchar* gail_combo_box_action_get_name(AtkAction *action,
|
||||
gint i);
|
||||
static gboolean gail_combo_box_set_description(AtkAction *action,
|
||||
gint i,
|
||||
const gchar *desc);
|
||||
#endif
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
static gboolean gail_combo_box_add_selection (AtkSelection *selection,
|
||||
gint i);
|
||||
static gboolean gail_combo_box_clear_selection (AtkSelection *selection);
|
||||
static AtkObject* gail_combo_box_ref_selection (AtkSelection *selection,
|
||||
gint i);
|
||||
static gint gail_combo_box_get_selection_count (AtkSelection *selection);
|
||||
static gboolean gail_combo_box_is_child_selected (AtkSelection *selection,
|
||||
gint i);
|
||||
static gboolean gail_combo_box_remove_selection (AtkSelection *selection,
|
||||
gint i);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_combo_box_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailComboBoxClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_combo_box_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailComboBox), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) gail_combo_box_object_init, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
static const GInterfaceInfo atk_action_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_action_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
static const GInterfaceInfo atk_selection_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_selection_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CONTAINER,
|
||||
"GailComboBox", &tinfo, 0);
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
g_type_add_interface_static (type, ATK_TYPE_ACTION,
|
||||
&atk_action_info);
|
||||
#endif
|
||||
g_type_add_interface_static (type, ATK_TYPE_SELECTION,
|
||||
&atk_selection_info);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_box_class_init (GailComboBoxClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gail_combo_box_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->get_name = gail_combo_box_get_name;
|
||||
class->get_n_children = gail_combo_box_get_n_children;
|
||||
class->ref_child = gail_combo_box_ref_child;
|
||||
class->initialize = gail_combo_box_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_box_object_init (GailComboBox *combo_box)
|
||||
{
|
||||
combo_box->press_description = NULL;
|
||||
combo_box->press_keybinding = NULL;
|
||||
combo_box->old_selection = -1;
|
||||
combo_box->name = NULL;
|
||||
combo_box->popup_set = FALSE;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_combo_box_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_COMBO_BOX (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_COMBO_BOX, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_box_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GailComboBox *gail_combo_box;
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
AtkObject *popup;
|
||||
#endif
|
||||
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
combo_box = GTK_COMBO_BOX (data);
|
||||
|
||||
gail_combo_box = GAIL_COMBO_BOX (obj);
|
||||
|
||||
g_signal_connect (combo_box,
|
||||
"changed",
|
||||
G_CALLBACK (gail_combo_box_changed_gtk),
|
||||
NULL);
|
||||
gail_combo_box->old_selection = gtk_combo_box_get_active (combo_box);
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
popup = gtk_combo_box_get_popup_accessible (combo_box);
|
||||
if (popup)
|
||||
{
|
||||
atk_object_set_parent (popup, obj);
|
||||
gail_combo_box->popup_set = TRUE;
|
||||
}
|
||||
if (GTK_IS_COMBO_BOX_ENTRY (combo_box))
|
||||
atk_object_set_parent (gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (combo_box))), obj);
|
||||
#endif
|
||||
|
||||
obj->role = ATK_ROLE_COMBO_BOX;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_box_changed_gtk (GtkWidget *widget)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
AtkObject *obj;
|
||||
GailComboBox *gail_combo_box;
|
||||
gint index;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
index = gtk_combo_box_get_active (combo_box);
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
gail_combo_box = GAIL_COMBO_BOX (obj);
|
||||
if (gail_combo_box->old_selection != index)
|
||||
{
|
||||
gail_combo_box->old_selection = index;
|
||||
g_signal_emit_by_name (obj, "selection_changed");
|
||||
}
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_combo_box_get_name (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkComboBox *combo_box;
|
||||
GailComboBox *gail_combo_box;
|
||||
GtkTreeIter iter;
|
||||
G_CONST_RETURN gchar *name;
|
||||
GtkTreeModel *model;
|
||||
gint n_columns;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_COMBO_BOX (obj), NULL);
|
||||
|
||||
name = ATK_OBJECT_CLASS (parent_class)->get_name (obj);
|
||||
if (name)
|
||||
return name;
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
gail_combo_box = GAIL_COMBO_BOX (obj);
|
||||
if (gtk_combo_box_get_active_iter (combo_box, &iter))
|
||||
{
|
||||
model = gtk_combo_box_get_model (combo_box);
|
||||
n_columns = gtk_tree_model_get_n_columns (model);
|
||||
for (i = 0; i < n_columns; i++)
|
||||
{
|
||||
GValue value = { 0, };
|
||||
|
||||
gtk_tree_model_get_value (model, &iter, i, &value);
|
||||
if (G_VALUE_HOLDS_STRING (&value))
|
||||
{
|
||||
if (gail_combo_box->name) g_free (gail_combo_box->name);
|
||||
gail_combo_box->name = g_strdup ((gchar *)
|
||||
g_value_get_string (&value));
|
||||
g_value_unset (&value);
|
||||
break;
|
||||
}
|
||||
else
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
return gail_combo_box->name;
|
||||
}
|
||||
|
||||
/*
|
||||
* The children of a GailComboBox are the list of items and the entry field
|
||||
* if it is editable.
|
||||
*/
|
||||
static gint
|
||||
gail_combo_box_get_n_children (AtkObject* obj)
|
||||
{
|
||||
gint n_children = 0;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_COMBO_BOX (obj), 0);
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return 0;
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
n_children++;
|
||||
if (GTK_IS_COMBO_BOX_ENTRY (widget))
|
||||
n_children ++;
|
||||
#endif
|
||||
|
||||
return n_children;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_combo_box_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
AtkObject *child;
|
||||
GailComboBox *box;
|
||||
#endif
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_COMBO_BOX (obj), NULL);
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
if (i == 0)
|
||||
{
|
||||
child = gtk_combo_box_get_popup_accessible (GTK_COMBO_BOX (widget));
|
||||
box = GAIL_COMBO_BOX (obj);
|
||||
if (box->popup_set == FALSE)
|
||||
{
|
||||
atk_object_set_parent (child, obj);
|
||||
box->popup_set = TRUE;
|
||||
}
|
||||
}
|
||||
else if (i == 1 && GTK_IS_COMBO_BOX_ENTRY (widget))
|
||||
{
|
||||
child = gtk_widget_get_accessible (gtk_bin_get_child (GTK_BIN (widget)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return g_object_ref (child);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->do_action = gail_combo_box_do_action;
|
||||
iface->get_n_actions = gail_combo_box_get_n_actions;
|
||||
iface->get_description = gail_combo_box_get_description;
|
||||
iface->get_keybinding = gail_combo_box_get_keybinding;
|
||||
iface->get_name = gail_combo_box_action_get_name;
|
||||
iface->set_description = gail_combo_box_set_description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_box_do_action (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
GailComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (action)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
if (!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
|
||||
return FALSE;
|
||||
|
||||
combo_box = GAIL_COMBO_BOX (action);
|
||||
if (i == 0)
|
||||
{
|
||||
if (combo_box->action_idle_handler)
|
||||
return FALSE;
|
||||
|
||||
combo_box->action_idle_handler = g_idle_add (idle_do_action, combo_box);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
idle_do_action (gpointer data)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
GailComboBox *gail_combo_box;
|
||||
AtkObject *popup;
|
||||
gboolean do_popup;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
gail_combo_box = GAIL_COMBO_BOX (data);
|
||||
gail_combo_box->action_idle_handler = 0;
|
||||
widget = GTK_ACCESSIBLE (gail_combo_box)->widget;
|
||||
if (widget == NULL || /* State is defunct */
|
||||
!GTK_WIDGET_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
popup = gtk_combo_box_get_popup_accessible (combo_box);
|
||||
do_popup = !GTK_WIDGET_MAPPED (GTK_ACCESSIBLE (popup)->widget);
|
||||
if (do_popup)
|
||||
gtk_combo_box_popup (combo_box);
|
||||
else
|
||||
gtk_combo_box_popdown (combo_box);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_combo_box_get_n_actions (AtkAction *action)
|
||||
{
|
||||
/*
|
||||
* The default behavior of a combo_box box is to have one action -
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_combo_box_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
GailComboBox *combo_box;
|
||||
|
||||
combo_box = GAIL_COMBO_BOX (action);
|
||||
return combo_box->press_description;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_combo_box_get_keybinding (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
GailComboBox *combo_box;
|
||||
gchar *return_value = NULL;
|
||||
combo_box = GAIL_COMBO_BOX (action);
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
AtkRelationSet *set;
|
||||
AtkRelation *relation;
|
||||
GPtrArray *target;
|
||||
gpointer target_object;
|
||||
guint key_val;
|
||||
|
||||
combo_box = GAIL_COMBO_BOX (action);
|
||||
widget = GTK_ACCESSIBLE (combo_box)->widget;
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
set = atk_object_ref_relation_set (ATK_OBJECT (action));
|
||||
if (!set)
|
||||
return NULL;
|
||||
label = NULL;
|
||||
relation = atk_relation_set_get_relation_by_type (set, ATK_RELATION_LABELLED_BY);
|
||||
if (relation)
|
||||
{
|
||||
target = atk_relation_get_target (relation);
|
||||
target_object = g_ptr_array_index (target, 0);
|
||||
if (GTK_IS_ACCESSIBLE (target_object))
|
||||
{
|
||||
label = GTK_ACCESSIBLE (target_object)->widget;
|
||||
}
|
||||
}
|
||||
g_object_unref (set);
|
||||
if (GTK_IS_LABEL (label))
|
||||
{
|
||||
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
|
||||
if (key_val != GDK_VoidSymbol)
|
||||
return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK);
|
||||
}
|
||||
g_free (combo_box->press_keybinding);
|
||||
combo_box->press_keybinding = return_value;
|
||||
break; }
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_combo_box_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "press";
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_box_set_description (AtkAction *action,
|
||||
gint i,
|
||||
const gchar *desc)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
GailComboBox *combo_box;
|
||||
|
||||
combo_box = GAIL_COMBO_BOX (action);
|
||||
g_free (combo_box->press_description);
|
||||
combo_box->press_description = g_strdup (desc);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
atk_selection_interface_init (AtkSelectionIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->add_selection = gail_combo_box_add_selection;
|
||||
iface->clear_selection = gail_combo_box_clear_selection;
|
||||
iface->ref_selection = gail_combo_box_ref_selection;
|
||||
iface->get_selection_count = gail_combo_box_get_selection_count;
|
||||
iface->is_child_selected = gail_combo_box_is_child_selected;
|
||||
iface->remove_selection = gail_combo_box_remove_selection;
|
||||
/*
|
||||
* select_all_selection does not make sense for a combo_box
|
||||
* so no implementation is provided.
|
||||
*/
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_box_add_selection (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
gtk_combo_box_set_active (combo_box, i);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_box_clear_selection (AtkSelection *selection)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
gtk_combo_box_set_active (combo_box, -1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_combo_box_ref_selection (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
AtkObject *obj;
|
||||
gint index;
|
||||
#endif
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
/*
|
||||
* A combo_box box can have only one selection.
|
||||
*/
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
#ifdef GAIL_COMBOX_BOX_A11y_COMPLETE
|
||||
obj = gtk_combo_box_get_popup_accessible (combo_box);
|
||||
index = gtk_combo_box_get_active (combo_box);
|
||||
return atk_object_ref_accessible_child (obj, index);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_combo_box_get_selection_count (AtkSelection *selection)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return 0;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
return (gtk_combo_box_get_active (combo_box) == -1) ? 0 : 1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_box_is_child_selected (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
gint j;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (selection)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
j = gtk_combo_box_get_active (combo_box);
|
||||
|
||||
return (j == i);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_combo_box_remove_selection (AtkSelection *selection,
|
||||
gint i)
|
||||
{
|
||||
if (atk_selection_is_child_selected (selection, i))
|
||||
atk_selection_clear_selection (selection);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_combo_box_finalize (GObject *object)
|
||||
{
|
||||
GailComboBox *combo_box = GAIL_COMBO_BOX (object);
|
||||
|
||||
g_free (combo_box->press_description);
|
||||
g_free (combo_box->press_keybinding);
|
||||
g_free (combo_box->name);
|
||||
if (combo_box->action_idle_handler)
|
||||
{
|
||||
g_source_remove (combo_box->action_idle_handler);
|
||||
combo_box->action_idle_handler = 0;
|
||||
}
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
68
modules/other/gail/gailcombobox.h
Normal file
68
modules/other/gail/gailcombobox.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2004 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_COMBO_BOX_H__
|
||||
#define __GAIL_COMBO_BOX_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_COMBO_BOX (gail_combo_box_get_type ())
|
||||
#define GAIL_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_COMBO_BOX, GailComboBox))
|
||||
#define GAIL_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_COMBO_BOX, GailComboBoxClass))
|
||||
#define GAIL_IS_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_COMBO_BOX))
|
||||
#define GAIL_IS_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_COMBO_BOX))
|
||||
#define GAIL_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_COMBO_BOX, GailComboBoxClass))
|
||||
|
||||
typedef struct _GailComboBox GailComboBox;
|
||||
typedef struct _GailComboBoxClass GailComboBoxClass;
|
||||
|
||||
struct _GailComboBox
|
||||
{
|
||||
GailContainer parent;
|
||||
|
||||
gchar *press_keybinding;
|
||||
gchar *press_description;
|
||||
guint action_idle_handler;
|
||||
|
||||
gchar *name;
|
||||
gint old_selection;
|
||||
gboolean popup_set;
|
||||
};
|
||||
|
||||
GType gail_combo_box_get_type (void);
|
||||
|
||||
struct _GailComboBoxClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_combo_box_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_COMBO_BOX_H__ */
|
||||
298
modules/other/gail/gailcontainer.c
Normal file
298
modules/other/gail/gailcontainer.c
Normal file
@ -0,0 +1,298 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2001, 2002, 2003 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailcontainer.h"
|
||||
|
||||
static void gail_container_class_init (GailContainerClass *klass);
|
||||
static void gail_container_object_init (GailContainer *container);
|
||||
|
||||
static gint gail_container_get_n_children (AtkObject *obj);
|
||||
static AtkObject* gail_container_ref_child (AtkObject *obj,
|
||||
gint i);
|
||||
static gint gail_container_add_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint gail_container_remove_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint gail_container_real_add_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
static gint gail_container_real_remove_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void gail_container_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
|
||||
static void gail_container_finalize (GObject *object);
|
||||
|
||||
static GailWidgetClass *parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_container_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailContainerClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_container_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailContainer), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) gail_container_object_init, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_WIDGET,
|
||||
"GailContainer", &tinfo, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_container_class_init (GailContainerClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gobject_class->finalize = gail_container_finalize;
|
||||
|
||||
class->get_n_children = gail_container_get_n_children;
|
||||
class->ref_child = gail_container_ref_child;
|
||||
class->initialize = gail_container_real_initialize;
|
||||
|
||||
klass->add_gtk = gail_container_real_add_gtk;
|
||||
klass->remove_gtk = gail_container_real_remove_gtk;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_container_object_init (GailContainer *container)
|
||||
{
|
||||
container->children = NULL;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_container_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_CONTAINER, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_container_get_n_children (AtkObject* obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GList *children;
|
||||
gint count = 0;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CONTAINER (obj), count);
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER(widget));
|
||||
count = g_list_length (children);
|
||||
g_list_free (children);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_container_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
{
|
||||
GList *children, *tmp_list;
|
||||
AtkObject *accessible;
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CONTAINER (obj), NULL);
|
||||
g_return_val_if_fail ((i >= 0), NULL);
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (widget));
|
||||
tmp_list = g_list_nth (children, i);
|
||||
if (!tmp_list)
|
||||
{
|
||||
g_list_free (children);
|
||||
return NULL;
|
||||
}
|
||||
accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));
|
||||
|
||||
g_list_free (children);
|
||||
g_object_ref (accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_container_add_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GailContainer *gail_container = GAIL_CONTAINER (data);
|
||||
GailContainerClass *klass;
|
||||
|
||||
klass = GAIL_CONTAINER_GET_CLASS (gail_container);
|
||||
|
||||
if (klass->add_gtk)
|
||||
return klass->add_gtk (container, widget, data);
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_container_remove_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GailContainer *gail_container = GAIL_CONTAINER (data);
|
||||
GailContainerClass *klass;
|
||||
|
||||
klass = GAIL_CONTAINER_GET_CLASS (gail_container);
|
||||
|
||||
if (klass->remove_gtk)
|
||||
return klass->remove_gtk (container, widget, data);
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_container_real_add_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
AtkObject* atk_parent = ATK_OBJECT (data);
|
||||
AtkObject* atk_child = gtk_widget_get_accessible (widget);
|
||||
GailContainer *gail_container = GAIL_CONTAINER (atk_parent);
|
||||
gint index;
|
||||
|
||||
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);
|
||||
g_signal_emit_by_name (atk_parent, "children_changed::add",
|
||||
index, atk_child, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_container_real_remove_gtk (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
AtkPropertyValues values = { NULL };
|
||||
AtkObject* atk_parent;
|
||||
AtkObject *atk_child;
|
||||
GailContainer *gail_container;
|
||||
gint index;
|
||||
|
||||
atk_parent = ATK_OBJECT (data);
|
||||
atk_child = gtk_widget_get_accessible (widget);
|
||||
|
||||
if (atk_child)
|
||||
{
|
||||
g_value_init (&values.old_value, G_TYPE_POINTER);
|
||||
g_value_set_pointer (&values.old_value, atk_parent);
|
||||
|
||||
values.property_name = "accessible-parent";
|
||||
|
||||
g_object_ref (atk_child);
|
||||
g_signal_emit_by_name (atk_child,
|
||||
"property_change::accessible-parent", &values, NULL);
|
||||
g_object_unref (atk_child);
|
||||
}
|
||||
gail_container = GAIL_CONTAINER (atk_parent);
|
||||
index = g_list_index (gail_container->children, widget);
|
||||
g_list_free (gail_container->children);
|
||||
gail_container->children = gtk_container_get_children (container);
|
||||
if (index >= 0 && index <= g_list_length (gail_container->children))
|
||||
g_signal_emit_by_name (atk_parent, "children_changed::remove",
|
||||
index, atk_child, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_container_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GailContainer *container = GAIL_CONTAINER (obj);
|
||||
guint handler_id;
|
||||
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
container->children = gtk_container_get_children (GTK_CONTAINER (data));
|
||||
|
||||
/*
|
||||
* We store the handler ids for these signals in case some objects
|
||||
* need to remove these handlers.
|
||||
*/
|
||||
handler_id = g_signal_connect (data,
|
||||
"add",
|
||||
G_CALLBACK (gail_container_add_gtk),
|
||||
obj);
|
||||
g_object_set_data (G_OBJECT (obj), "gail-add-handler-id",
|
||||
GUINT_TO_POINTER (handler_id));
|
||||
handler_id = g_signal_connect (data,
|
||||
"remove",
|
||||
G_CALLBACK (gail_container_remove_gtk),
|
||||
obj);
|
||||
g_object_set_data (G_OBJECT (obj), "gail-remove-handler-id",
|
||||
GUINT_TO_POINTER (handler_id));
|
||||
|
||||
if (GTK_IS_TOOLBAR (data))
|
||||
obj->role = ATK_ROLE_TOOL_BAR;
|
||||
else if (GTK_IS_VIEWPORT (data))
|
||||
obj->role = ATK_ROLE_VIEWPORT;
|
||||
else
|
||||
obj->role = ATK_ROLE_PANEL;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_container_finalize (GObject *object)
|
||||
{
|
||||
GailContainer *container = GAIL_CONTAINER (object);
|
||||
|
||||
g_list_free (container->children);
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
72
modules/other/gail/gailcontainer.h
Normal file
72
modules/other/gail/gailcontainer.h
Normal file
@ -0,0 +1,72 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2001, 2002, 2003 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_CONTAINER_H__
|
||||
#define __GAIL_CONTAINER_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailwidget.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CONTAINER (gail_container_get_type ())
|
||||
#define GAIL_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CONTAINER, GailContainer))
|
||||
#define GAIL_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CONTAINER, GailContainerClass))
|
||||
#define GAIL_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CONTAINER))
|
||||
#define GAIL_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CONTAINER))
|
||||
#define GAIL_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CONTAINER, GailContainerClass))
|
||||
|
||||
typedef struct _GailContainer GailContainer;
|
||||
typedef struct _GailContainerClass GailContainerClass;
|
||||
|
||||
struct _GailContainer
|
||||
{
|
||||
GailWidget parent;
|
||||
|
||||
/*
|
||||
* Cached list of children
|
||||
*/
|
||||
GList *children;
|
||||
};
|
||||
|
||||
GType gail_container_get_type (void);
|
||||
|
||||
struct _GailContainerClass
|
||||
{
|
||||
GailWidgetClass parent_class;
|
||||
|
||||
gint (*add_gtk) (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
gint (*remove_gtk) (GtkContainer *container,
|
||||
GtkWidget *widget,
|
||||
gpointer data);
|
||||
};
|
||||
|
||||
AtkObject* gail_container_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_CONTAINER_H__ */
|
||||
202
modules/other/gail/gailcontainercell.c
Normal file
202
modules/other/gail/gailcontainercell.c
Normal file
@ -0,0 +1,202 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailcontainercell.h"
|
||||
|
||||
static void gail_container_cell_class_init (GailContainerCellClass *klass);
|
||||
static void gail_container_cell_finalize (GObject *obj);
|
||||
|
||||
|
||||
static void _gail_container_cell_recompute_child_indices
|
||||
(GailContainerCell *container);
|
||||
|
||||
static void gail_container_cell_refresh_child_index (GailCell *cell);
|
||||
|
||||
static gint gail_container_cell_get_n_children (AtkObject *obj);
|
||||
|
||||
static AtkObject* gail_container_cell_ref_child (AtkObject *obj,
|
||||
gint child);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_container_cell_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailContainerCellClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_container_cell_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailContainerCell), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CELL,
|
||||
"GailContainerCell", &tinfo, 0);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_container_cell_class_init (GailContainerCellClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS(klass);
|
||||
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
g_object_class->finalize = gail_container_cell_finalize;
|
||||
|
||||
class->get_n_children = gail_container_cell_get_n_children;
|
||||
class->ref_child = gail_container_cell_ref_child;
|
||||
}
|
||||
|
||||
|
||||
GailContainerCell *
|
||||
gail_container_cell_new (void)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *atk_object;
|
||||
GailContainerCell *container;
|
||||
|
||||
object = g_object_new (GAIL_TYPE_CONTAINER_CELL, NULL);
|
||||
|
||||
g_return_val_if_fail (object != NULL, NULL);
|
||||
|
||||
atk_object = ATK_OBJECT (object);
|
||||
atk_object->role = ATK_ROLE_TABLE_CELL;
|
||||
|
||||
container = GAIL_CONTAINER_CELL(object);
|
||||
container->children = NULL;
|
||||
container->NChildren = 0;
|
||||
return container;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_container_cell_finalize (GObject *obj)
|
||||
{
|
||||
GailContainerCell *container = GAIL_CONTAINER_CELL (obj);
|
||||
GList *list;
|
||||
|
||||
list = container->children;
|
||||
while (list)
|
||||
{
|
||||
g_object_unref (list->data);
|
||||
list = list->next;
|
||||
}
|
||||
g_list_free (container->children);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gail_container_cell_add_child (GailContainerCell *container,
|
||||
GailCell *child)
|
||||
{
|
||||
gint child_index;
|
||||
|
||||
g_return_if_fail (GAIL_IS_CONTAINER_CELL(container));
|
||||
g_return_if_fail (GAIL_IS_CELL(child));
|
||||
|
||||
child_index = container->NChildren++;
|
||||
container->children = g_list_append (container->children, (gpointer) child);
|
||||
child->index = child_index;
|
||||
atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container));
|
||||
child->refresh_index = gail_container_cell_refresh_child_index;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gail_container_cell_remove_child (GailContainerCell *container,
|
||||
GailCell *child)
|
||||
{
|
||||
g_return_if_fail (GAIL_IS_CONTAINER_CELL(container));
|
||||
g_return_if_fail (GAIL_IS_CELL(child));
|
||||
g_return_if_fail (container->NChildren > 0);
|
||||
|
||||
g_list_remove (container->children, (gpointer) child);
|
||||
_gail_container_cell_recompute_child_indices (container);
|
||||
container->NChildren--;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_gail_container_cell_recompute_child_indices (GailContainerCell *container)
|
||||
{
|
||||
gint cur_index = 0;
|
||||
GList *temp_list;
|
||||
|
||||
g_return_if_fail (GAIL_IS_CONTAINER_CELL(container));
|
||||
|
||||
for (temp_list = container->children; temp_list; temp_list = temp_list->next)
|
||||
{
|
||||
GAIL_CELL(temp_list->data)->index = cur_index;
|
||||
cur_index++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gail_container_cell_refresh_child_index (GailCell *cell)
|
||||
{
|
||||
GailContainerCell *container;
|
||||
g_return_if_fail (GAIL_IS_CELL(cell));
|
||||
container = GAIL_CONTAINER_CELL (atk_object_get_parent (ATK_OBJECT(cell)));
|
||||
g_return_if_fail (GAIL_IS_CONTAINER_CELL (container));
|
||||
_gail_container_cell_recompute_child_indices (container);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static gint
|
||||
gail_container_cell_get_n_children (AtkObject *obj)
|
||||
{
|
||||
GailContainerCell *cell;
|
||||
g_return_val_if_fail (GAIL_IS_CONTAINER_CELL(obj), 0);
|
||||
cell = GAIL_CONTAINER_CELL(obj);
|
||||
return cell->NChildren;
|
||||
}
|
||||
|
||||
|
||||
static AtkObject *
|
||||
gail_container_cell_ref_child (AtkObject *obj,
|
||||
gint child)
|
||||
{
|
||||
GailContainerCell *cell;
|
||||
GList *list_node;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CONTAINER_CELL(obj), NULL);
|
||||
cell = GAIL_CONTAINER_CELL(obj);
|
||||
|
||||
list_node = g_list_nth (cell->children, child);
|
||||
if (!list_node)
|
||||
return NULL;
|
||||
|
||||
return g_object_ref (ATK_OBJECT (list_node->data));
|
||||
}
|
||||
71
modules/other/gail/gailcontainercell.h
Normal file
71
modules/other/gail/gailcontainercell.h
Normal file
@ -0,0 +1,71 @@
|
||||
/* GAIL - The GNOME Accessibility Enabling 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_CONTAINER_CELL_H__
|
||||
#define __GAIL_CONTAINER_CELL_H__
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gail/gailcell.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_CONTAINER_CELL (gail_container_cell_get_type ())
|
||||
#define GAIL_CONTAINER_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_CONTAINER_CELL, GailContainerCell))
|
||||
#define GAIL_CONTAINER_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_CONTAINER_CELL, GailContainerCellClass))
|
||||
#define GAIL_IS_CONTAINER_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_CONTAINER_CELL))
|
||||
#define GAIL_IS_CONTAINER_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_CONTAINER_CELL))
|
||||
#define GAIL_CONTAINER_CELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_CONTAINER_CELL, GailContainerCellClass))
|
||||
|
||||
typedef struct _GailContainerCell GailContainerCell;
|
||||
typedef struct _GailContainerCellClass GailContainerCellClass;
|
||||
|
||||
struct _GailContainerCell
|
||||
{
|
||||
GailCell parent;
|
||||
GList *children;
|
||||
gint NChildren;
|
||||
};
|
||||
|
||||
GType gail_container_cell_get_type (void);
|
||||
|
||||
struct _GailContainerCellClass
|
||||
{
|
||||
GailCellClass parent_class;
|
||||
};
|
||||
|
||||
GailContainerCell *
|
||||
gail_container_cell_new (void);
|
||||
|
||||
void
|
||||
gail_container_cell_add_child (GailContainerCell *container,
|
||||
GailCell *child);
|
||||
|
||||
void
|
||||
gail_container_cell_remove_child (GailContainerCell *container,
|
||||
GailCell *child);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_TREE_VIEW_TEXT_CELL_H__ */
|
||||
1449
modules/other/gail/gailentry.c
Normal file
1449
modules/other/gail/gailentry.c
Normal file
File diff suppressed because it is too large
Load Diff
78
modules/other/gail/gailentry.h
Normal file
78
modules/other/gail/gailentry.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* 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_ENTRY_H__
|
||||
#define __GAIL_ENTRY_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailwidget.h>
|
||||
#include <libgail-util/gailtextutil.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_ENTRY (gail_entry_get_type ())
|
||||
#define GAIL_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_ENTRY, GailEntry))
|
||||
#define GAIL_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_ENTRY, GailEntryClass))
|
||||
#define GAIL_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_ENTRY))
|
||||
#define GAIL_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_ENTRY))
|
||||
#define GAIL_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_ENTRY, GailEntryClass))
|
||||
|
||||
typedef struct _GailEntry GailEntry;
|
||||
typedef struct _GailEntryClass GailEntryClass;
|
||||
|
||||
struct _GailEntry
|
||||
{
|
||||
GailWidget parent;
|
||||
|
||||
GailTextUtil *textutil;
|
||||
/*
|
||||
* These fields store information about text changed
|
||||
*/
|
||||
gchar *signal_name_insert;
|
||||
gchar *signal_name_delete;
|
||||
gint position_insert;
|
||||
gint position_delete;
|
||||
gint length_insert;
|
||||
gint length_delete;
|
||||
gint cursor_position;
|
||||
gint selection_bound;
|
||||
|
||||
gchar *activate_description;
|
||||
gchar *activate_keybinding;
|
||||
guint action_idle_handler;
|
||||
guint insert_idle_handler;
|
||||
};
|
||||
|
||||
GType gail_entry_get_type (void);
|
||||
|
||||
struct _GailEntryClass
|
||||
{
|
||||
GailWidgetClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_entry_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_ENTRY_H__ */
|
||||
950
modules/other/gail/gailexpander.c
Normal file
950
modules/other/gail/gailexpander.c
Normal file
@ -0,0 +1,950 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2003 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include "gailexpander.h"
|
||||
#include <libgail-util/gailmisc.h>
|
||||
|
||||
static void gail_expander_class_init (GailExpanderClass *klass);
|
||||
static void gail_expander_object_init (GailExpander *expander);
|
||||
|
||||
static G_CONST_RETURN gchar* gail_expander_get_name (AtkObject *obj);
|
||||
static gint gail_expander_get_n_children (AtkObject *obj)
|
||||
;
|
||||
static AtkObject* gail_expander_ref_child (AtkObject *obj,
|
||||
gint i);
|
||||
|
||||
static AtkStateSet* gail_expander_ref_state_set (AtkObject *obj);
|
||||
static void gail_expander_real_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec);
|
||||
static void gail_expander_map_gtk (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void gail_expander_real_initialize (AtkObject *obj,
|
||||
gpointer data);
|
||||
static void gail_expander_finalize (GObject *object);
|
||||
static void gail_expander_init_textutil (GailExpander *expander,
|
||||
GtkExpander *widget);
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
static gboolean gail_expander_do_action (AtkAction *action,
|
||||
gint i);
|
||||
static gboolean idle_do_action (gpointer data);
|
||||
static gint gail_expander_get_n_actions(AtkAction *action);
|
||||
static G_CONST_RETURN gchar* gail_expander_get_description
|
||||
(AtkAction *action,
|
||||
gint i);
|
||||
static G_CONST_RETURN gchar* gail_expander_get_keybinding
|
||||
(AtkAction *action,
|
||||
gint i);
|
||||
static G_CONST_RETURN gchar* gail_expander_action_get_name
|
||||
(AtkAction *action,
|
||||
gint i);
|
||||
static gboolean gail_expander_set_description
|
||||
(AtkAction *action,
|
||||
gint i,
|
||||
const gchar *desc);
|
||||
|
||||
/* atktext.h */
|
||||
static void atk_text_interface_init (AtkTextIface *iface);
|
||||
|
||||
static gchar* gail_expander_get_text (AtkText *text,
|
||||
gint start_pos,
|
||||
gint end_pos);
|
||||
static gunichar gail_expander_get_character_at_offset
|
||||
(AtkText *text,
|
||||
gint offset);
|
||||
static gchar* gail_expander_get_text_before_offset
|
||||
(AtkText *text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset);
|
||||
static gchar* gail_expander_get_text_at_offset (AtkText *text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset);
|
||||
static gchar* gail_expander_get_text_after_offset
|
||||
(AtkText *text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset);
|
||||
static gint gail_expander_get_character_count(AtkText *text);
|
||||
static void gail_expander_get_character_extents (AtkText *text,
|
||||
gint offset,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coords);
|
||||
static gint gail_expander_get_offset_at_point (AtkText *text,
|
||||
gint x,
|
||||
gint y,
|
||||
AtkCoordType coords);
|
||||
static AtkAttributeSet* gail_expander_get_run_attributes
|
||||
(AtkText *text,
|
||||
gint offset,
|
||||
gint *start_offset,
|
||||
gint *end_offset);
|
||||
static AtkAttributeSet* gail_expander_get_default_attributes
|
||||
(AtkText *text);
|
||||
|
||||
static GailContainer* parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_expander_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailExpanderClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_expander_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailExpander), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) gail_expander_object_init, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
static const GInterfaceInfo atk_action_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_action_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const GInterfaceInfo atk_text_info =
|
||||
{
|
||||
(GInterfaceInitFunc) atk_text_interface_init,
|
||||
(GInterfaceFinalizeFunc) NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CONTAINER,
|
||||
"GailExpander", &tinfo, 0);
|
||||
|
||||
g_type_add_interface_static (type, ATK_TYPE_ACTION,
|
||||
&atk_action_info);
|
||||
g_type_add_interface_static (type, ATK_TYPE_TEXT,
|
||||
&atk_text_info);
|
||||
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_class_init (GailExpanderClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
GailWidgetClass *widget_class;
|
||||
|
||||
widget_class = (GailWidgetClass*)klass;
|
||||
widget_class->notify_gtk = gail_expander_real_notify_gtk;
|
||||
|
||||
gobject_class->finalize = gail_expander_finalize;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
class->get_name = gail_expander_get_name;
|
||||
class->get_n_children = gail_expander_get_n_children;
|
||||
class->ref_child = gail_expander_ref_child;
|
||||
class->ref_state_set = gail_expander_ref_state_set;
|
||||
|
||||
class->initialize = gail_expander_real_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_object_init (GailExpander *expander)
|
||||
{
|
||||
expander->activate_description = NULL;
|
||||
expander->activate_keybinding = NULL;
|
||||
expander->action_idle_handler = 0;
|
||||
expander->textutil = NULL;
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_expander_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_EXPANDER, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_expander_get_name (AtkObject *obj)
|
||||
{
|
||||
G_CONST_RETURN gchar *name;
|
||||
g_return_val_if_fail (GAIL_IS_EXPANDER (obj), NULL);
|
||||
|
||||
name = ATK_OBJECT_CLASS (parent_class)->get_name (obj);
|
||||
if (name != NULL)
|
||||
return name;
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Get the text on the label
|
||||
*/
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL);
|
||||
|
||||
return gtk_expander_get_label (GTK_EXPANDER (widget));
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_expander_get_n_children (AtkObject* obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GList *children;
|
||||
gint count = 0;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CONTAINER (obj), count);
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER(widget));
|
||||
count = g_list_length (children);
|
||||
g_list_free (children);
|
||||
|
||||
/* See if there is a label - if there is, reduce our count by 1
|
||||
* since we don't want the label included with the children.
|
||||
*/
|
||||
if (gtk_expander_get_label_widget (widget))
|
||||
count -= 1;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gail_expander_ref_child (AtkObject *obj,
|
||||
gint i)
|
||||
{
|
||||
GList *children, *tmp_list;
|
||||
AtkObject *accessible;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
gint index;
|
||||
gint count;
|
||||
|
||||
g_return_val_if_fail (GAIL_IS_CONTAINER (obj), NULL);
|
||||
g_return_val_if_fail ((i >= 0), NULL);
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (widget));
|
||||
|
||||
/* See if there is a label - if there is, we need to skip it
|
||||
* since we don't want the label included with the children.
|
||||
*/
|
||||
label = gtk_expander_get_label_widget (widget);
|
||||
if (label) {
|
||||
count = g_list_length (children);
|
||||
for (index = 0; index <= i; index++) {
|
||||
tmp_list = g_list_nth (children, index);
|
||||
if (label == GTK_WIDGET (tmp_list->data)) {
|
||||
i += 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tmp_list = g_list_nth (children, i);
|
||||
if (!tmp_list)
|
||||
{
|
||||
g_list_free (children);
|
||||
return NULL;
|
||||
}
|
||||
accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));
|
||||
|
||||
g_list_free (children);
|
||||
g_object_ref (accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_real_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GailExpander *gail_expander = GAIL_EXPANDER (obj);
|
||||
GtkWidget *expander;
|
||||
|
||||
ATK_OBJECT_CLASS (parent_class)->initialize (obj, data);
|
||||
|
||||
expander = GTK_WIDGET (data);
|
||||
if (GTK_WIDGET_MAPPED (expander))
|
||||
gail_expander_init_textutil (gail_expander, GTK_EXPANDER (expander));
|
||||
else
|
||||
g_signal_connect (expander,
|
||||
"map",
|
||||
G_CALLBACK (gail_expander_map_gtk),
|
||||
gail_expander);
|
||||
|
||||
obj->role = ATK_ROLE_TOGGLE_BUTTON;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_map_gtk (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GailExpander *expander;
|
||||
|
||||
expander = GAIL_EXPANDER (data);
|
||||
gail_expander_init_textutil (expander, GTK_EXPANDER (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_real_notify_gtk (GObject *obj,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
AtkObject* atk_obj;
|
||||
GtkExpander *expander;
|
||||
GailExpander *gail_expander;
|
||||
|
||||
expander = GTK_EXPANDER (obj);
|
||||
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (expander));
|
||||
;
|
||||
if (strcmp (pspec->name, "label") == 0)
|
||||
{
|
||||
const gchar* label_text;
|
||||
|
||||
|
||||
label_text = gtk_expander_get_label (expander);
|
||||
|
||||
gail_expander = GAIL_EXPANDER (atk_obj);
|
||||
if (gail_expander->textutil)
|
||||
gail_text_util_text_setup (gail_expander->textutil, label_text);
|
||||
|
||||
if (atk_obj->name == NULL)
|
||||
{
|
||||
/*
|
||||
* The label has changed so notify a change in accessible-name
|
||||
*/
|
||||
g_object_notify (G_OBJECT (atk_obj), "accessible-name");
|
||||
}
|
||||
/*
|
||||
* The label is the only property which can be changed
|
||||
*/
|
||||
g_signal_emit_by_name (atk_obj, "visible_data_changed");
|
||||
}
|
||||
else if (strcmp (pspec->name, "expanded") == 0)
|
||||
{
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED,
|
||||
gtk_expander_get_expanded (expander));
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_EXPANDED,
|
||||
gtk_expander_get_expanded (expander));
|
||||
g_signal_emit_by_name (atk_obj, "visible_data_changed");
|
||||
}
|
||||
else
|
||||
GAIL_WIDGET_CLASS (parent_class)->notify_gtk (obj, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_init_textutil (GailExpander *expander,
|
||||
GtkExpander *widget)
|
||||
{
|
||||
const gchar *label_text;
|
||||
|
||||
expander->textutil = gail_text_util_new ();
|
||||
label_text = gtk_expander_get_label (widget);
|
||||
gail_text_util_text_setup (expander->textutil, label_text);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
|
||||
iface->do_action = gail_expander_do_action;
|
||||
iface->get_n_actions = gail_expander_get_n_actions;
|
||||
iface->get_description = gail_expander_get_description;
|
||||
iface->get_keybinding = gail_expander_get_keybinding;
|
||||
iface->get_name = gail_expander_action_get_name;
|
||||
iface->set_description = gail_expander_set_description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_expander_do_action (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GailExpander *expander;
|
||||
gboolean return_value = TRUE;
|
||||
|
||||
widget = GTK_ACCESSIBLE (action)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return FALSE;
|
||||
|
||||
if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
|
||||
return FALSE;
|
||||
|
||||
expander = GAIL_EXPANDER (action);
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
if (expander->action_idle_handler)
|
||||
return_value = FALSE;
|
||||
else
|
||||
expander->action_idle_handler = g_idle_add (idle_do_action, expander);
|
||||
break;
|
||||
default:
|
||||
return_value = FALSE;
|
||||
break;
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
idle_do_action (gpointer data)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GailExpander *gail_expander;
|
||||
|
||||
GDK_THREADS_ENTER ();
|
||||
|
||||
gail_expander = GAIL_EXPANDER (data);
|
||||
gail_expander->action_idle_handler = 0;
|
||||
|
||||
widget = GTK_ACCESSIBLE (gail_expander)->widget;
|
||||
if (widget == NULL /* State is defunct */ ||
|
||||
!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
|
||||
{
|
||||
GDK_THREADS_LEAVE ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_widget_activate (widget);
|
||||
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_expander_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_expander_get_description (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
GailExpander *expander;
|
||||
G_CONST_RETURN gchar *return_value;
|
||||
|
||||
expander = GAIL_EXPANDER (action);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return_value = expander->activate_description;
|
||||
break;
|
||||
default:
|
||||
return_value = NULL;
|
||||
break;
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_expander_get_keybinding (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
GailExpander *expander;
|
||||
gchar *return_value = NULL;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
/*
|
||||
* We look for a mnemonic on the label
|
||||
*/
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
|
||||
expander = GAIL_EXPANDER (action);
|
||||
widget = GTK_ACCESSIBLE (expander)->widget;
|
||||
if (widget == NULL)
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (widget), NULL);
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
if (GTK_IS_LABEL (label))
|
||||
{
|
||||
guint key_val;
|
||||
|
||||
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
|
||||
if (key_val != GDK_VoidSymbol)
|
||||
return_value = gtk_accelerator_name (key_val, GDK_MOD1_MASK);
|
||||
g_free (expander->activate_keybinding);
|
||||
expander->activate_keybinding = return_value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_expander_action_get_name (AtkAction *action,
|
||||
gint i)
|
||||
{
|
||||
G_CONST_RETURN gchar *return_value;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return_value = "activate";
|
||||
break;
|
||||
default:
|
||||
return_value = NULL;
|
||||
break;
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gail_expander_set_description (AtkAction *action,
|
||||
gint i,
|
||||
const gchar *desc)
|
||||
{
|
||||
GailExpander *expander;
|
||||
gchar **value;
|
||||
|
||||
expander = GAIL_EXPANDER (action);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
value = &expander->activate_description;
|
||||
break;
|
||||
default:
|
||||
value = NULL;
|
||||
break;
|
||||
}
|
||||
if (value)
|
||||
{
|
||||
g_free (*value);
|
||||
*value = g_strdup (desc);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gail_expander_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
GtkExpander *expander;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (parent_class)->ref_state_set (obj);
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
|
||||
if (widget == NULL)
|
||||
return state_set;
|
||||
|
||||
expander = GTK_EXPANDER (widget);
|
||||
|
||||
atk_state_set_add_state (state_set, ATK_STATE_EXPANDABLE);
|
||||
|
||||
if (gtk_expander_get_expanded (expander)) {
|
||||
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
|
||||
atk_state_set_add_state (state_set, ATK_STATE_EXPANDED);
|
||||
}
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
/* atktext.h */
|
||||
|
||||
static void
|
||||
atk_text_interface_init (AtkTextIface *iface)
|
||||
{
|
||||
g_return_if_fail (iface != NULL);
|
||||
iface->get_text = gail_expander_get_text;
|
||||
iface->get_character_at_offset = gail_expander_get_character_at_offset;
|
||||
iface->get_text_before_offset = gail_expander_get_text_before_offset;
|
||||
iface->get_text_at_offset = gail_expander_get_text_at_offset;
|
||||
iface->get_text_after_offset = gail_expander_get_text_after_offset;
|
||||
iface->get_character_count = gail_expander_get_character_count;
|
||||
iface->get_character_extents = gail_expander_get_character_extents;
|
||||
iface->get_offset_at_point = gail_expander_get_offset_at_point;
|
||||
iface->get_run_attributes = gail_expander_get_run_attributes;
|
||||
iface->get_default_attributes = gail_expander_get_default_attributes;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gail_expander_get_text (AtkText *text,
|
||||
gint start_pos,
|
||||
gint end_pos)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GailExpander *expander;
|
||||
const gchar *label_text;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return NULL;
|
||||
|
||||
expander = GAIL_EXPANDER (text);
|
||||
if (!expander->textutil)
|
||||
gail_expander_init_textutil (expander, GTK_EXPANDER (widget));
|
||||
|
||||
label_text = gtk_expander_get_label (GTK_EXPANDER (widget));
|
||||
|
||||
if (label_text == NULL)
|
||||
return NULL;
|
||||
else
|
||||
return gail_text_util_get_substring (expander->textutil,
|
||||
start_pos, end_pos);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gail_expander_get_text_before_offset (AtkText *text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GailExpander *expander;
|
||||
GtkWidget *label;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return NULL;
|
||||
|
||||
expander = GAIL_EXPANDER (text);
|
||||
if (!expander->textutil)
|
||||
gail_expander_init_textutil (expander, GTK_EXPANDER (widget));
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return NULL;
|
||||
return gail_text_util_get_text (expander->textutil,
|
||||
gtk_label_get_layout (GTK_LABEL (label)),
|
||||
GAIL_BEFORE_OFFSET,
|
||||
boundary_type, offset, start_offset, end_offset);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gail_expander_get_text_at_offset (AtkText *text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GailExpander *expander;
|
||||
GtkWidget *label;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return NULL;
|
||||
|
||||
expander = GAIL_EXPANDER (text);
|
||||
if (!expander->textutil)
|
||||
gail_expander_init_textutil (expander, GTK_EXPANDER (widget));
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return NULL;
|
||||
return gail_text_util_get_text (expander->textutil,
|
||||
gtk_label_get_layout (GTK_LABEL (label)),
|
||||
GAIL_AT_OFFSET,
|
||||
boundary_type, offset, start_offset, end_offset);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
gail_expander_get_text_after_offset (AtkText *text,
|
||||
gint offset,
|
||||
AtkTextBoundary boundary_type,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GailExpander *expander;
|
||||
GtkWidget *label;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return NULL;
|
||||
|
||||
expander = GAIL_EXPANDER (text);
|
||||
if (!expander->textutil)
|
||||
gail_expander_init_textutil (expander, GTK_EXPANDER (widget));
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return NULL;
|
||||
return gail_text_util_get_text (expander->textutil,
|
||||
gtk_label_get_layout (GTK_LABEL (label)),
|
||||
GAIL_AFTER_OFFSET,
|
||||
boundary_type, offset, start_offset, end_offset);
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_expander_get_character_count (AtkText *text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return 0;
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return 0;
|
||||
|
||||
return g_utf8_strlen (gtk_label_get_text (GTK_LABEL (label)), -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_get_character_extents (AtkText *text,
|
||||
gint offset,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *width,
|
||||
gint *height,
|
||||
AtkCoordType coords)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
PangoRectangle char_rect;
|
||||
gint index, x_layout, y_layout;
|
||||
const gchar *label_text;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return;
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return;
|
||||
|
||||
gtk_label_get_layout_offsets (GTK_LABEL (label), &x_layout, &y_layout);
|
||||
label_text = gtk_label_get_text (GTK_LABEL (label));
|
||||
index = g_utf8_offset_to_pointer (label_text, offset) - label_text;
|
||||
pango_layout_index_to_pos (gtk_label_get_layout (GTK_LABEL (label)), index, &char_rect);
|
||||
|
||||
gail_misc_get_extents_from_pango_rectangle (label, &char_rect,
|
||||
x_layout, y_layout, x, y, width, height, coords);
|
||||
}
|
||||
|
||||
static gint
|
||||
gail_expander_get_offset_at_point (AtkText *text,
|
||||
gint x,
|
||||
gint y,
|
||||
AtkCoordType coords)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
gint index, x_layout, y_layout;
|
||||
const gchar *label_text;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return -1;
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return -1;
|
||||
|
||||
gtk_label_get_layout_offsets (GTK_LABEL (label), &x_layout, &y_layout);
|
||||
|
||||
index = gail_misc_get_index_at_point_in_layout (label,
|
||||
gtk_label_get_layout (GTK_LABEL (label)),
|
||||
x_layout, y_layout, x, y, coords);
|
||||
label_text = gtk_label_get_text (GTK_LABEL (label));
|
||||
if (index == -1)
|
||||
{
|
||||
if (coords == ATK_XY_WINDOW || coords == ATK_XY_SCREEN)
|
||||
return g_utf8_strlen (label_text, -1);
|
||||
|
||||
return index;
|
||||
}
|
||||
else
|
||||
return g_utf8_pointer_to_offset (label_text, label_text + index);
|
||||
}
|
||||
|
||||
static AtkAttributeSet*
|
||||
gail_expander_get_run_attributes (AtkText *text,
|
||||
gint offset,
|
||||
gint *start_offset,
|
||||
gint *end_offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
AtkAttributeSet *at_set = NULL;
|
||||
GtkJustification justify;
|
||||
GtkTextDirection dir;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return NULL;
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return NULL;
|
||||
|
||||
/* Get values set for entire label, if any */
|
||||
justify = gtk_label_get_justify (GTK_LABEL (label));
|
||||
if (justify != GTK_JUSTIFY_CENTER)
|
||||
{
|
||||
at_set = gail_misc_add_attribute (at_set,
|
||||
ATK_TEXT_ATTR_JUSTIFICATION,
|
||||
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_JUSTIFICATION, justify)));
|
||||
}
|
||||
dir = gtk_widget_get_direction (label);
|
||||
if (dir == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
at_set = gail_misc_add_attribute (at_set,
|
||||
ATK_TEXT_ATTR_DIRECTION,
|
||||
g_strdup (atk_text_attribute_get_value (ATK_TEXT_ATTR_DIRECTION, dir)));
|
||||
}
|
||||
|
||||
at_set = gail_misc_layout_get_run_attributes (at_set,
|
||||
gtk_label_get_layout (GTK_LABEL (label)),
|
||||
(gchar *) gtk_label_get_text (GTK_LABEL (label)),
|
||||
offset,
|
||||
start_offset,
|
||||
end_offset);
|
||||
return at_set;
|
||||
}
|
||||
|
||||
static AtkAttributeSet*
|
||||
gail_expander_get_default_attributes (AtkText *text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
AtkAttributeSet *at_set = NULL;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return NULL;
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return NULL;
|
||||
|
||||
at_set = gail_misc_get_default_attributes (at_set,
|
||||
gtk_label_get_layout (GTK_LABEL (label)),
|
||||
widget);
|
||||
return at_set;
|
||||
}
|
||||
|
||||
static gunichar
|
||||
gail_expander_get_character_at_offset (AtkText *text,
|
||||
gint offset)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
const gchar *string;
|
||||
gchar *index;
|
||||
|
||||
widget = GTK_ACCESSIBLE (text)->widget;
|
||||
if (widget == NULL)
|
||||
/* State is defunct */
|
||||
return '\0';
|
||||
|
||||
label = gtk_expander_get_label_widget (GTK_EXPANDER (widget));
|
||||
|
||||
if (!GTK_IS_LABEL(label))
|
||||
return '\0';
|
||||
string = gtk_label_get_text (GTK_LABEL (label));
|
||||
if (offset >= g_utf8_strlen (string, -1))
|
||||
return '\0';
|
||||
index = g_utf8_offset_to_pointer (string, offset);
|
||||
|
||||
return g_utf8_get_char (index);
|
||||
}
|
||||
|
||||
static void
|
||||
gail_expander_finalize (GObject *object)
|
||||
{
|
||||
GailExpander *expander = GAIL_EXPANDER (object);
|
||||
|
||||
g_free (expander->activate_description);
|
||||
g_free (expander->activate_keybinding);
|
||||
if (expander->action_idle_handler)
|
||||
{
|
||||
g_source_remove (expander->action_idle_handler);
|
||||
expander->action_idle_handler = 0;
|
||||
}
|
||||
if (expander->textutil)
|
||||
g_object_unref (expander->textutil);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
66
modules/other/gail/gailexpander.h
Normal file
66
modules/other/gail/gailexpander.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2003 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_EXPANDER_H__
|
||||
#define __GAIL_EXPANDER_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
#include <libgail-util/gailtextutil.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_EXPANDER (gail_expander_get_type ())
|
||||
#define GAIL_EXPANDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_EXPANDER, GailExpander))
|
||||
#define GAIL_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_EXPANDER, GailExpanderClass))
|
||||
#define GAIL_IS_EXPANDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_EXPANDER))
|
||||
#define GAIL_IS_EXPANDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_EXPANDER))
|
||||
#define GAIL_EXPANDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_EXPANDER, GailExpanderClass))
|
||||
|
||||
typedef struct _GailExpander GailExpander;
|
||||
typedef struct _GailExpanderClass GailExpanderClass;
|
||||
|
||||
struct _GailExpander
|
||||
{
|
||||
GailContainer parent;
|
||||
|
||||
gchar *activate_description;
|
||||
gchar *activate_keybinding;
|
||||
guint action_idle_handler;
|
||||
|
||||
GailTextUtil *textutil;
|
||||
};
|
||||
|
||||
GType gail_expander_get_type (void);
|
||||
|
||||
struct _GailExpanderClass
|
||||
{
|
||||
GailContainerClass parent_class;
|
||||
};
|
||||
|
||||
AtkObject* gail_expander_new (GtkWidget *widget);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GAIL_EXPANDER_H__ */
|
||||
85
modules/other/gail/gailfactory.h
Normal file
85
modules/other/gail/gailfactory.h
Normal file
@ -0,0 +1,85 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2002 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_FACTORY_H__
|
||||
#define _GAIL_FACTORY_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <atk/atkobject.h>
|
||||
|
||||
#define GAIL_ACCESSIBLE_FACTORY(type, type_as_function, opt_create_accessible) \
|
||||
\
|
||||
static GType \
|
||||
type_as_function ## _factory_get_accessible_type (void) \
|
||||
{ \
|
||||
return type; \
|
||||
} \
|
||||
\
|
||||
static AtkObject* \
|
||||
type_as_function ## _factory_create_accessible (GObject *obj) \
|
||||
{ \
|
||||
GtkWidget *widget; \
|
||||
AtkObject *accessible; \
|
||||
\
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \
|
||||
\
|
||||
widget = GTK_WIDGET (obj); \
|
||||
\
|
||||
accessible = opt_create_accessible (widget); \
|
||||
\
|
||||
return accessible; \
|
||||
} \
|
||||
\
|
||||
static void \
|
||||
type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
|
||||
{ \
|
||||
klass->create_accessible = type_as_function ## _factory_create_accessible; \
|
||||
klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
|
||||
} \
|
||||
\
|
||||
static GType \
|
||||
type_as_function ## _factory_get_type (void) \
|
||||
{ \
|
||||
static GType t = 0; \
|
||||
\
|
||||
if (!t) \
|
||||
{ \
|
||||
char *name; \
|
||||
static const GTypeInfo tinfo = \
|
||||
{ \
|
||||
sizeof (AtkObjectFactoryClass), \
|
||||
NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
|
||||
NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
|
||||
}; \
|
||||
\
|
||||
name = g_strconcat (g_type_name (type), "Factory", NULL); \
|
||||
t = g_type_register_static ( \
|
||||
ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
|
||||
g_free (name); \
|
||||
} \
|
||||
\
|
||||
return t; \
|
||||
}
|
||||
|
||||
#define GAIL_WIDGET_SET_FACTORY(widget_type, type_as_function) \
|
||||
atk_registry_set_factory_type (atk_get_default_registry (), \
|
||||
widget_type, \
|
||||
type_as_function ## _factory_get_type ())
|
||||
|
||||
#endif /* _GAIL_FACTORY_H__ */
|
||||
113
modules/other/gail/gailframe.c
Normal file
113
modules/other/gail/gailframe.c
Normal file
@ -0,0 +1,113 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gailframe.h"
|
||||
|
||||
static void gail_frame_class_init (GailFrameClass *klass);
|
||||
static G_CONST_RETURN gchar* gail_frame_get_name (AtkObject *obj);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gail_frame_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type)
|
||||
{
|
||||
static const GTypeInfo tinfo =
|
||||
{
|
||||
sizeof (GailFrameClass),
|
||||
(GBaseInitFunc) NULL, /* base init */
|
||||
(GBaseFinalizeFunc) NULL, /* base finalize */
|
||||
(GClassInitFunc) gail_frame_class_init, /* class init */
|
||||
(GClassFinalizeFunc) NULL, /* class finalize */
|
||||
NULL, /* class data */
|
||||
sizeof (GailFrame), /* instance size */
|
||||
0, /* nb preallocs */
|
||||
(GInstanceInitFunc) NULL, /* instance init */
|
||||
NULL /* value table */
|
||||
};
|
||||
|
||||
type = g_type_register_static (GAIL_TYPE_CONTAINER,
|
||||
"GailFrame", &tinfo, 0);
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
gail_frame_class_init (GailFrameClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_name = gail_frame_get_name;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
}
|
||||
|
||||
AtkObject*
|
||||
gail_frame_new (GtkWidget *widget)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *accessible;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_FRAME (widget), NULL);
|
||||
|
||||
object = g_object_new (GAIL_TYPE_FRAME, NULL);
|
||||
|
||||
accessible = ATK_OBJECT (object);
|
||||
atk_object_initialize (accessible, widget);
|
||||
|
||||
accessible->role = ATK_ROLE_PANEL;
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar*
|
||||
gail_frame_get_name (AtkObject *obj)
|
||||
{
|
||||
G_CONST_RETURN gchar *name;
|
||||
g_return_val_if_fail (GAIL_IS_FRAME (obj), NULL);
|
||||
|
||||
name = ATK_OBJECT_CLASS (parent_class)->get_name (obj);
|
||||
if (name != NULL)
|
||||
{
|
||||
return name;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Get the text on the label
|
||||
*/
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_ACCESSIBLE (obj)->widget;
|
||||
if (widget == NULL)
|
||||
{
|
||||
/*
|
||||
* State is defunct
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
return gtk_frame_get_label (GTK_FRAME (widget));
|
||||
}
|
||||
}
|
||||
60
modules/other/gail/gailframe.h
Normal file
60
modules/other/gail/gailframe.h
Normal file
@ -0,0 +1,60 @@
|
||||
/* 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_FRAME_H__
|
||||
#define __GAIL_FRAME_H__
|
||||
|
||||
#include <gtk/gtkaccessible.h>
|
||||
#include <gail/gailcontainer.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define GAIL_TYPE_FRAME (gail_frame_get_type ())
|
||||
#define GAIL_FRAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAIL_TYPE_FRAME, GailFrame))
|
||||
#define GAIL_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_TYPE_FRAME, GailFrameClass))
|
||||
#define GAIL_IS_FRAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAIL_TYPE_FRAME))
|
||||
#define GAIL_IS_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAIL_TYPE_FRAME))
|
||||
#define GAIL_FRAME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAIL_TYPE_FRAME, GailFrameClass))
|
||||
|
||||