forked from AuroraMiddleware/gtk
Remove ATK
To build a better world sometimes means having to tear the old one down. -- Alexander Pierce, "Captain America: The Winter Soldier" ATK served us well for nearly 20 years, but the world has changed, and GTK has changed with it. Now ATK is mostly a hindrance towards improving the accessibility stack: - it maps to a very specific implementation, AT-SPI, which is Linux and Unix specific - it requires implementing the same functionality in three different layers of the stack: AT-SPI, ATK, and GTK - only GTK uses it; every other Linux and Unix toolkit and application talks to AT-SPI directly, including assistive technologies Sadly, we cannot incrementally port GTK to a new accessibility stack; since ATK insulates us entirely from the underlying implementation, we cannot replace it piecemeal. Instead, we're going to remove everything and then incrementally build on a clean slate: - add an "accessible" interface, implemented by GTK objects directly, which describe the accessible role and state changes for every UI element - add an "assistive technology context" to proxy a native accessibility API, and assign it to every widget - implement the AT context depending on the platform For more information, see: https://gitlab.gnome.org/GNOME/gtk/-/issues/2833
This commit is contained in:
parent
ea0fc7619d
commit
c63087a563
@ -56,7 +56,6 @@ building for:
|
||||
- [Pango](https://download.gnome.org/sources/pango)
|
||||
- [Epoxy](https://github.com/anholt/libepoxy)
|
||||
- [Graphene](https://github.com/ebassi/graphene)
|
||||
- [ATK](https://download.gnome.org/sources/atk)
|
||||
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
|
||||
|
||||
If you are building the X11 backend, you will also need:
|
||||
@ -70,7 +69,6 @@ If you are building the X11 backend, you will also need:
|
||||
- xcursor
|
||||
- xdamage
|
||||
- xcomposite
|
||||
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
|
||||
|
||||
If you are building the Wayland backend, you will also need:
|
||||
|
||||
|
@ -95,9 +95,6 @@
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
<property name="modal">True</property>
|
||||
<accessibility>
|
||||
<relation target="window1" type="subwindow-of"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default-height">250</property>
|
||||
@ -113,11 +110,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar1">
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-toolbar">
|
||||
<property name="AtkObject::accessible-name">The toolbar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
@ -174,14 +166,6 @@
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="model">liststore1</property>
|
||||
<property name="tooltip-column">3</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-treeview">
|
||||
<property name="AtkObject::accessible-name">Name list</property>
|
||||
<property name="AtkObject::accessible-description">
|
||||
A list of person with name, surname and age columns
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column1">
|
||||
<property name="title">Name</property>
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "demotaggedentry.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtk-a11y.h>
|
||||
|
||||
struct _DemoTaggedEntry
|
||||
{
|
||||
@ -119,7 +118,6 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
||||
gtk_editable_install_properties (object_class, 1);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
|
||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,6 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
@ -83,9 +80,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -133,9 +127,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -149,9 +140,6 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
@ -165,9 +153,6 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -197,9 +182,6 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
|
@ -84,9 +84,6 @@
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="0">Message</property>
|
||||
<property name="wrap">1</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
|
@ -33,9 +33,6 @@
|
||||
<object class="GtkLabel" id="label_plain">
|
||||
<property name="label">Plain</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
@ -48,9 +45,6 @@
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
@ -61,9 +55,6 @@
|
||||
<object class="GtkLabel" id="label_marks">
|
||||
<property name="label">Marks</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -83,9 +74,6 @@
|
||||
<mark value="3" position="bottom"></mark>
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -96,9 +84,6 @@
|
||||
<object class="GtkLabel" id="label_discrete">
|
||||
<property name="label">Discrete</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_discrete"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -112,9 +97,6 @@
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment3</property>
|
||||
<property name="hexpand">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_discrete"/>
|
||||
</accessibility>
|
||||
<marks>
|
||||
<mark value="0" position="bottom"></mark>
|
||||
<mark value="1" position="bottom"></mark>
|
||||
|
@ -245,9 +245,6 @@
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -258,9 +255,6 @@
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -271,9 +265,6 @@
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -284,9 +275,6 @@
|
||||
<object class="GtkImage" id="image4">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label4"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -297,9 +285,6 @@
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label5"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -310,9 +295,6 @@
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label5"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -323,9 +305,6 @@
|
||||
<object class="GtkImage" id="image7">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label5"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">6</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -336,9 +315,6 @@
|
||||
<object class="GtkImage" id="image8">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label6"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">7</property>
|
||||
<property name="top-attach">1</property>
|
||||
@ -353,9 +329,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -370,9 +343,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -387,9 +357,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -404,9 +371,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image4"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -421,9 +385,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image5"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -438,9 +399,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image6"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -455,9 +413,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image7"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">6</property>
|
||||
<property name="top-attach">2</property>
|
||||
@ -472,9 +427,6 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image8"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">7</property>
|
||||
<property name="top-attach">2</property>
|
||||
|
@ -565,7 +565,6 @@ on_scale_button_value_changed (GtkScaleButton *button,
|
||||
}
|
||||
|
||||
gtk_widget_set_tooltip_text (GTK_WIDGET (button), str);
|
||||
atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (button)), str);
|
||||
|
||||
g_free (str);
|
||||
}
|
||||
|
@ -3029,9 +3029,6 @@ bad things might happen.</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -3231,9 +3228,6 @@ bad things might happen.</property>
|
||||
<object class="GtkLabel" id="title_label">
|
||||
<property name="label">Title:</property>
|
||||
<property name="xalign">1</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="open_popover_entry"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@ -3241,9 +3235,6 @@ bad things might happen.</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="label">Description:</property>
|
||||
<property name="xalign">1</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="open_popover_textview"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
@ -3259,9 +3250,6 @@ bad things might happen.</property>
|
||||
<property name="max-content-width">100</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="open_popover_textview">
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="description_label"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
@ -3274,9 +3262,6 @@ bad things might happen.</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="open_popover_entry">
|
||||
<property name="activates-default">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="title_label"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="column-span">2</property>
|
||||
@ -3357,9 +3342,6 @@ bad things might happen.</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">No updates at this time</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -3368,9 +3350,6 @@ bad things might happen.</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">You're in too deep!</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -127,7 +127,7 @@ compilation flags needed for that library along with version number
|
||||
information.)
|
||||
|
||||
Some of the libraries that GTK depends on are maintained by the
|
||||
GTK team: GLib, GdkPixbuf, Pango, ATK and GObject Introspection.
|
||||
GTK team: GLib, GdkPixbuf, Pango, and GObject Introspection.
|
||||
Other libraries are maintained separately.
|
||||
|
||||
- The GLib library provides core non-graphical functionality
|
||||
@ -139,10 +139,6 @@ Other libraries are maintained separately.
|
||||
file formats. It is available [here](ttps://download.gnome.org/sources/gdk-pixbuf/).
|
||||
- [Pango](http://www.pango.org) is a library for internationalized
|
||||
text handling. It is available [here](https://download.gnome.org/sources/pango/).
|
||||
- ATK is the Accessibility Toolkit. It provides a set of generic
|
||||
interfaces allowing accessibility technologies such as
|
||||
screen readers to interact with a graphical user interface.
|
||||
It is available [here](https://download.gnome.org/sources/atk/).
|
||||
- [GObject Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection)
|
||||
is a framework for making introspection data available to language
|
||||
bindings. It is available [here](https://download.gnome.org/sources/gobject-introspection/).
|
||||
@ -192,7 +188,7 @@ you'll have all of these installed already, or they will be easily
|
||||
accessible through your operating system package repositories.
|
||||
|
||||
Then build and install the GTK libraries in the order:
|
||||
GLib, Cairo, Pango, ATK, then GTK. For each library, follow the
|
||||
GLib, Cairo, Pango, then GTK. For each library, follow the
|
||||
instructions they provide, and make sure to share common settings
|
||||
between them and the GTK build; if you are using a separate prefix
|
||||
for GTK, for instance, you will need to use the same prefix for
|
||||
|
@ -9,9 +9,9 @@ is used (the actual output on your system may be different):
|
||||
|
||||
```
|
||||
$ pkg-config --cflags gtk4
|
||||
-pthread -I/usr/include/gtk-4.0 -I/usr/lib64/gtk-4.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
|
||||
-pthread -I/usr/include/gtk-4.0 -I/usr/lib64/gtk-4.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
|
||||
$ pkg-config --libs gtk4
|
||||
-pthread -lgtk-4 -lgdk-4 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
|
||||
-pthread -lgtk-4 -lgdk-4 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
|
||||
```
|
||||
The simplest way to compile a program is to use the "backticks"
|
||||
feature of the shell. If you enclose a command in backticks
|
||||
|
@ -61,18 +61,6 @@ other widgets that display text.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>ATK</term>
|
||||
<listitem><para>
|
||||
ATK is the Accessibility Toolkit. It provides a set of generic
|
||||
interfaces allowing accessibility technologies to interact with a
|
||||
graphical user interface. For example, a screen reader uses ATK to
|
||||
discover the text in an interface and read it to blind users. GTK
|
||||
widgets have built-in support for accessibility using the ATK
|
||||
framework.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GdkPixbuf</term>
|
||||
<listitem><para>
|
||||
|
@ -1,67 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GI_SCANNER__
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkBooleanCellAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkCellAccessibleParent, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkComboBoxAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainerCellAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkEntryAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkExpanderAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFlowBoxAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFlowBoxChildAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkFrameAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkIconViewAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkImageAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkImageCellAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLabelAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLevelBarAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLinkButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBoxAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkListBoxRowAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkLockButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkMenuButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkNotebookAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkNotebookPageAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPanedAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkPopoverAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkProgressBarAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRadioButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRangeAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRendererCellAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScaleAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScaleButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkScrolledWindowAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSpinButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSpinnerAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStatusbarAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkSwitchAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextCellAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextViewAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToggleButtonAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkToplevelAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeViewAccessible, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWindowAccessible, g_object_unref)
|
||||
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkaccessibility.h"
|
||||
#include "gtkaccessibilityutil.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <atk-bridge.h>
|
||||
#endif
|
||||
|
||||
static int initialized = FALSE;
|
||||
|
||||
void
|
||||
_gtk_accessibility_init (void)
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
initialized = TRUE;
|
||||
|
||||
_gtk_accessibility_override_atk_util ();
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
atk_bridge_adaptor_init (NULL, NULL);
|
||||
#endif
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ACCESSIBILITY_H__
|
||||
#define __GTK_ACCESSIBILITY_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include "gtk/gtkwidget.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_accessibility_init (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ACCESSIBILITY_H__ */
|
@ -1,109 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2011, F123 Consulting & Mais Diferenças
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkaccessibility.h"
|
||||
#include "gtkaccessibilityutil.h"
|
||||
#include "gtktoplevelaccessible.h"
|
||||
|
||||
static GSList *key_listener_list = NULL;
|
||||
|
||||
typedef struct {
|
||||
AtkKeySnoopFunc func;
|
||||
gpointer data;
|
||||
guint key;
|
||||
} KeyEventListener;
|
||||
|
||||
static guint
|
||||
add_key_event_listener (AtkKeySnoopFunc listener_func,
|
||||
gpointer listener_data)
|
||||
{
|
||||
static guint key = 0;
|
||||
KeyEventListener *listener;
|
||||
|
||||
key++;
|
||||
|
||||
listener = g_slice_new0 (KeyEventListener);
|
||||
listener->func = listener_func;
|
||||
listener->data = listener_data;
|
||||
listener->key = key;
|
||||
|
||||
key_listener_list = g_slist_append (key_listener_list, listener);
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_key_event_listener (guint listener_key)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
for (l = key_listener_list; l; l = l->next)
|
||||
{
|
||||
KeyEventListener *listener = l->data;
|
||||
|
||||
if (listener->key == listener_key)
|
||||
{
|
||||
g_slice_free (KeyEventListener, listener);
|
||||
key_listener_list = g_slist_delete_link (key_listener_list, l);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
get_root (void)
|
||||
{
|
||||
static AtkObject *root = NULL;
|
||||
|
||||
if (!root)
|
||||
{
|
||||
root = g_object_new (GTK_TYPE_TOPLEVEL_ACCESSIBLE, NULL);
|
||||
atk_object_initialize (root, NULL);
|
||||
}
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_toolkit_name (void)
|
||||
{
|
||||
return "gtk";
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_toolkit_version (void)
|
||||
{
|
||||
return GTK_VERSION;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_accessibility_override_atk_util (void)
|
||||
{
|
||||
AtkUtilClass *atk_class = ATK_UTIL_CLASS (g_type_class_ref (ATK_TYPE_UTIL));
|
||||
|
||||
atk_class->add_key_event_listener = add_key_event_listener;
|
||||
atk_class->remove_key_event_listener = remove_key_event_listener;
|
||||
atk_class->get_root = get_root;
|
||||
atk_class->get_toolkit_name = get_toolkit_name;
|
||||
atk_class->get_toolkit_version = get_toolkit_version;
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ACCESSIBILITY_UTIL_H__
|
||||
#define __GTK_ACCESSIBILITY_UTIL_H__
|
||||
|
||||
#include <atk/atk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_accessibility_override_atk_util (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ACCESSIBILITY_UTIL_H__ */
|
@ -1,164 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkbooleancellaccessible.h"
|
||||
|
||||
struct _GtkBooleanCellAccessiblePrivate
|
||||
{
|
||||
gboolean cell_value;
|
||||
gboolean cell_sensitive;
|
||||
};
|
||||
|
||||
static AtkActionIface *parent_action_iface;
|
||||
|
||||
static int
|
||||
gtk_boolean_cell_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return parent_action_iface->get_n_actions (action) + 1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_boolean_cell_accessible_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Toggles the cell");
|
||||
|
||||
return parent_action_iface->get_description (action, i - 1);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_boolean_cell_accessible_action_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "toggle";
|
||||
|
||||
return parent_action_iface->get_description (action, i - 1);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_boolean_cell_accessible_action_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Toggle");
|
||||
|
||||
return parent_action_iface->get_description (action, i - 1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_boolean_cell_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return parent_action_iface->do_action (action, 2);
|
||||
|
||||
return parent_action_iface->do_action (action, i - 1);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_boolean_cell_accessible_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
parent_action_iface = g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->do_action = gtk_boolean_cell_accessible_do_action;
|
||||
iface->get_n_actions = gtk_boolean_cell_accessible_get_n_actions;
|
||||
iface->get_description = gtk_boolean_cell_accessible_get_description;
|
||||
iface->get_name = gtk_boolean_cell_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_boolean_cell_accessible_action_get_localized_name;
|
||||
}
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkBooleanCellAccessible, gtk_boolean_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkBooleanCellAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, gtk_boolean_cell_accessible_action_interface_init))
|
||||
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_boolean_cell_accessible_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
GtkBooleanCellAccessible *cell = GTK_BOOLEAN_CELL_ACCESSIBLE (accessible);
|
||||
AtkStateSet *state_set;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_boolean_cell_accessible_parent_class)->ref_state_set (accessible);
|
||||
|
||||
if (cell->priv->cell_value)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
|
||||
|
||||
if (cell->priv->cell_sensitive)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
|
||||
else
|
||||
atk_state_set_remove_state (state_set, ATK_STATE_SENSITIVE);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
|
||||
gboolean active;
|
||||
gboolean sensitive;
|
||||
GtkCellRenderer *renderer;
|
||||
|
||||
g_object_get (cell, "renderer", &renderer, NULL);
|
||||
g_object_get (renderer,
|
||||
"active", &active,
|
||||
"sensitive", &sensitive,
|
||||
NULL);
|
||||
g_object_unref (renderer);
|
||||
|
||||
if (boolean_cell->priv->cell_value != active)
|
||||
{
|
||||
boolean_cell->priv->cell_value = !boolean_cell->priv->cell_value;
|
||||
|
||||
if (emit_signal)
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active);
|
||||
}
|
||||
|
||||
if (boolean_cell->priv->cell_sensitive != sensitive)
|
||||
{
|
||||
boolean_cell->priv->cell_sensitive = !boolean_cell->priv->cell_sensitive;
|
||||
|
||||
if (emit_signal)
|
||||
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_SENSITIVE, sensitive);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_boolean_cell_accessible_class_init (GtkBooleanCellAccessibleClass *klass)
|
||||
{
|
||||
GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass);
|
||||
AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
atkobject_class->ref_state_set = gtk_boolean_cell_accessible_ref_state_set;
|
||||
|
||||
cell_class->update_cache = gtk_boolean_cell_accessible_update_cache;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_boolean_cell_accessible_init (GtkBooleanCellAccessible *cell)
|
||||
{
|
||||
cell->priv = gtk_boolean_cell_accessible_get_instance_private (cell);
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_BOOLEAN_CELL_ACCESSIBLE_H__
|
||||
#define __GTK_BOOLEAN_CELL_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/a11y/gtkrenderercellaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE (gtk_boolean_cell_accessible_get_type ())
|
||||
#define GTK_BOOLEAN_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessible))
|
||||
#define GTK_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAIL_BOOLEAN_CELL, GtkBooleanCellAccessibleClass))
|
||||
#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE))
|
||||
#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE))
|
||||
#define GTK_BOOLEAN_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessibleClass))
|
||||
|
||||
typedef struct _GtkBooleanCellAccessible GtkBooleanCellAccessible;
|
||||
typedef struct _GtkBooleanCellAccessibleClass GtkBooleanCellAccessibleClass;
|
||||
typedef struct _GtkBooleanCellAccessiblePrivate GtkBooleanCellAccessiblePrivate;
|
||||
|
||||
struct _GtkBooleanCellAccessible
|
||||
{
|
||||
GtkRendererCellAccessible parent;
|
||||
|
||||
GtkBooleanCellAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkBooleanCellAccessibleClass
|
||||
{
|
||||
GtkRendererCellAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_boolean_cell_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GAIL_TREE_VIEW_BOOLEAN_CELL_H__ */
|
@ -1,436 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkbuttonaccessible.h"
|
||||
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
static void atk_image_interface_init (AtkImageIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkButtonAccessible, gtk_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
|
||||
|
||||
static void
|
||||
gtk_button_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
parent = gtk_widget_get_parent (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)));
|
||||
if (GTK_IS_TREE_VIEW (parent))
|
||||
{
|
||||
/* Even though the accessible parent of the column header will
|
||||
* be reported as the table because the parent widget of the
|
||||
* GtkTreeViewColumn's button is the GtkTreeView we set
|
||||
* the accessible parent for column header to be the table
|
||||
* to ensure that atk_object_get_index_in_parent() returns
|
||||
* the correct value; see gail_widget_get_index_in_parent().
|
||||
*/
|
||||
atk_object_set_parent (obj, gtk_widget_get_accessible (parent));
|
||||
obj->role = ATK_ROLE_TABLE_COLUMN_HEADER;
|
||||
}
|
||||
else
|
||||
obj->role = ATK_ROLE_PUSH_BUTTON;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
get_image_from_button (GtkWidget *button)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_button_get_child (GTK_BUTTON (button));
|
||||
if (GTK_IS_IMAGE (image))
|
||||
return image;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
find_label_child (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (widget))
|
||||
{
|
||||
if (GTK_IS_LABEL (child))
|
||||
return child;
|
||||
else
|
||||
{
|
||||
GtkWidget *w = find_label_child (child);
|
||||
if (w)
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
get_label_from_button (GtkWidget *button)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_button_get_child (GTK_BUTTON (button));
|
||||
|
||||
if (!GTK_IS_LABEL (child))
|
||||
child = find_label_child (child);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_button_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
const char *name = NULL;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *child;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->get_name (obj);
|
||||
if (name != NULL)
|
||||
return name;
|
||||
|
||||
child = get_label_from_button (widget);
|
||||
if (GTK_IS_LABEL (child))
|
||||
name = gtk_label_get_text (GTK_LABEL (child));
|
||||
else
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = get_image_from_button (widget);
|
||||
if (GTK_IS_IMAGE (image))
|
||||
{
|
||||
AtkObject *atk_obj;
|
||||
|
||||
atk_obj = gtk_widget_get_accessible (image);
|
||||
name = atk_object_get_name (atk_obj);
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_button_accessible_get_n_children (AtkObject* obj)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_button_accessible_ref_child (AtkObject *obj,
|
||||
int i)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_button_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_button_accessible_parent_class)->ref_state_set (obj);
|
||||
|
||||
if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_ACTIVE) != 0)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_ARMED);
|
||||
|
||||
if (!gtk_widget_get_can_focus (widget))
|
||||
atk_state_set_remove_state (state_set, ATK_STATE_SELECTABLE);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_button_accessible_update_label (GtkButtonAccessible *self)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_BUTTON_ACCESSIBLE (self));
|
||||
|
||||
/* If we don't have an overridden name, we use the label as the
|
||||
* accessible name
|
||||
*/
|
||||
if (atk_object_get_name (ATK_OBJECT (self)) == NULL)
|
||||
g_object_notify (G_OBJECT (self), "accessible-name");
|
||||
|
||||
g_signal_emit_by_name (self, "visible-data-changed");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_accessible_class_init (GtkButtonAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_name = gtk_button_accessible_get_name;
|
||||
class->get_n_children = gtk_button_accessible_get_n_children;
|
||||
class->ref_child = gtk_button_accessible_ref_child;
|
||||
class->ref_state_set = gtk_button_accessible_ref_state_set;
|
||||
class->initialize = gtk_button_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_accessible_init (GtkButtonAccessible *button)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_button_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (i != 0)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||
return FALSE;
|
||||
|
||||
g_signal_emit_by_name (widget, "clicked");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_button_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_button_accessible_get_keybinding (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
char *return_value = NULL;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
guint key_val;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
label = get_label_from_button (widget);
|
||||
if (GTK_IS_LABEL (label))
|
||||
{
|
||||
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
|
||||
if (key_val != GDK_KEY_VoidSymbol)
|
||||
return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK);
|
||||
}
|
||||
if (return_value == NULL)
|
||||
{
|
||||
/* Find labelled-by relation */
|
||||
AtkRelationSet *set;
|
||||
AtkRelation *relation;
|
||||
GPtrArray *target;
|
||||
gpointer target_object;
|
||||
|
||||
set = atk_object_ref_relation_set (ATK_OBJECT (action));
|
||||
if (set)
|
||||
{
|
||||
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);
|
||||
label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object));
|
||||
}
|
||||
g_object_unref (set);
|
||||
}
|
||||
|
||||
if (GTK_IS_LABEL (label))
|
||||
{
|
||||
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
|
||||
if (key_val != GDK_KEY_VoidSymbol)
|
||||
return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK);
|
||||
}
|
||||
}
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_button_accessible_action_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "click";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_button_accessible_action_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Click");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_button_accessible_action_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Clicks the button");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_button_accessible_do_action;
|
||||
iface->get_n_actions = gtk_button_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_button_accessible_get_keybinding;
|
||||
iface->get_name = gtk_button_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_button_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_button_accessible_action_get_description;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_button_accessible_get_image_description (AtkImage *image)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *button_image;
|
||||
AtkObject *obj;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
button_image = get_image_from_button (widget);
|
||||
if (GTK_IS_IMAGE (button_image))
|
||||
{
|
||||
obj = gtk_widget_get_accessible (button_image);
|
||||
return atk_image_get_image_description (ATK_IMAGE (obj));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_accessible_get_image_position (AtkImage *image,
|
||||
int *x,
|
||||
int *y,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *button_image;
|
||||
AtkObject *obj;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
if (widget == NULL)
|
||||
{
|
||||
*x = G_MININT;
|
||||
*y = G_MININT;
|
||||
return;
|
||||
}
|
||||
|
||||
button_image = get_image_from_button (widget);
|
||||
if (button_image != NULL)
|
||||
{
|
||||
obj = gtk_widget_get_accessible (button_image);
|
||||
atk_component_get_extents (ATK_COMPONENT (obj), x, y, NULL, NULL,
|
||||
coord_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = G_MININT;
|
||||
*y = G_MININT;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_accessible_get_image_size (AtkImage *image,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *button_image;
|
||||
AtkObject *obj;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
if (widget == NULL)
|
||||
{
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
button_image = get_image_from_button (widget);
|
||||
if (GTK_IS_IMAGE (button_image))
|
||||
{
|
||||
obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
|
||||
atk_image_get_image_size (ATK_IMAGE (obj), width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_button_accessible_set_image_description (AtkImage *image,
|
||||
const char *description)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *button_image;
|
||||
AtkObject *obj;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
button_image = get_image_from_button (widget);
|
||||
if (GTK_IMAGE (button_image))
|
||||
{
|
||||
obj = gtk_widget_get_accessible (GTK_WIDGET (button_image));
|
||||
return atk_image_set_image_description (ATK_IMAGE (obj), description);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_image_interface_init (AtkImageIface *iface)
|
||||
{
|
||||
iface->get_image_description = gtk_button_accessible_get_image_description;
|
||||
iface->get_image_position = gtk_button_accessible_get_image_position;
|
||||
iface->get_image_size = gtk_button_accessible_get_image_size;
|
||||
iface->set_image_description = gtk_button_accessible_set_image_description;
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_BUTTON_ACCESSIBLE_H__
|
||||
#define __GTK_BUTTON_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_BUTTON_ACCESSIBLE (gtk_button_accessible_get_type ())
|
||||
#define GTK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_BUTTON_ACCESSIBLE, GtkButtonAccessible))
|
||||
#define GTK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_BUTTON_ACCESSIBLE, GtkButtonAccessibleClass))
|
||||
#define GTK_IS_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_BUTTON_ACCESSIBLE))
|
||||
#define GTK_IS_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BUTTON_ACCESSIBLE))
|
||||
#define GTK_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BUTTON_ACCESSIBLE, GtkButtonAccessibleClass))
|
||||
|
||||
typedef struct _GtkButtonAccessible GtkButtonAccessible;
|
||||
typedef struct _GtkButtonAccessibleClass GtkButtonAccessibleClass;
|
||||
typedef struct _GtkButtonAccessiblePrivate GtkButtonAccessiblePrivate;
|
||||
|
||||
struct _GtkButtonAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkButtonAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkButtonAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_button_accessible_get_type (void);
|
||||
|
||||
/*< private >*/
|
||||
void gtk_button_accessible_update_label (GtkButtonAccessible *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_BUTTON_ACCESSIBLE_H__ */
|
@ -1,533 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcontainercellaccessible.h"
|
||||
#include "gtkcellaccessibleprivate.h"
|
||||
#include "gtkcellaccessibleparent.h"
|
||||
|
||||
struct _GtkCellAccessiblePrivate
|
||||
{
|
||||
AtkObject *parent;
|
||||
};
|
||||
|
||||
static const struct {
|
||||
AtkState atk_state;
|
||||
GtkCellRendererState renderer_state;
|
||||
gboolean invert;
|
||||
} state_map[] = {
|
||||
{ ATK_STATE_SENSITIVE, GTK_CELL_RENDERER_INSENSITIVE, TRUE },
|
||||
{ ATK_STATE_ENABLED, GTK_CELL_RENDERER_INSENSITIVE, TRUE },
|
||||
{ ATK_STATE_SELECTED, GTK_CELL_RENDERER_SELECTED, FALSE },
|
||||
/* XXX: why do we map ACTIVE here? */
|
||||
{ ATK_STATE_ACTIVE, GTK_CELL_RENDERER_FOCUSED, FALSE },
|
||||
{ ATK_STATE_FOCUSED, GTK_CELL_RENDERER_FOCUSED, FALSE },
|
||||
{ ATK_STATE_EXPANDABLE,GTK_CELL_RENDERER_EXPANDABLE, FALSE },
|
||||
{ ATK_STATE_EXPANDED, GTK_CELL_RENDERER_EXPANDED, FALSE },
|
||||
};
|
||||
|
||||
static GtkCellRendererState gtk_cell_accessible_get_state (GtkCellAccessible *cell);
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
static void atk_component_interface_init (AtkComponentIface *iface);
|
||||
static void atk_table_cell_interface_init (AtkTableCellIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkCellAccessible, gtk_cell_accessible, GTK_TYPE_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkCellAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_TABLE_CELL, atk_table_cell_interface_init))
|
||||
|
||||
static int
|
||||
gtk_cell_accessible_get_index_in_parent (AtkObject *obj)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkObject *parent;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (obj);
|
||||
|
||||
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent))
|
||||
return g_list_index (gtk_container_cell_accessible_get_children (GTK_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent)), obj);
|
||||
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
if (parent == NULL)
|
||||
return -1;
|
||||
|
||||
return gtk_cell_accessible_parent_get_child_index (GTK_CELL_ACCESSIBLE_PARENT (cell->priv->parent), cell);
|
||||
}
|
||||
|
||||
static AtkRelationSet *
|
||||
gtk_cell_accessible_ref_relation_set (AtkObject *object)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkRelationSet *relationset;
|
||||
AtkObject *parent;
|
||||
|
||||
relationset = ATK_OBJECT_CLASS (gtk_cell_accessible_parent_class)->ref_relation_set (object);
|
||||
if (relationset == NULL)
|
||||
relationset = atk_relation_set_new ();
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (object);
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
|
||||
gtk_cell_accessible_parent_update_relationset (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
||||
cell,
|
||||
relationset);
|
||||
|
||||
return relationset;
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_cell_accessible_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
GtkCellAccessible *cell_accessible;
|
||||
AtkStateSet *state_set;
|
||||
GtkCellRendererState flags;
|
||||
guint i;
|
||||
|
||||
cell_accessible = GTK_CELL_ACCESSIBLE (accessible);
|
||||
|
||||
state_set = atk_state_set_new ();
|
||||
|
||||
if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible)) == NULL)
|
||||
{
|
||||
atk_state_set_add_state (state_set, ATK_STATE_DEFUNCT);
|
||||
return state_set;
|
||||
}
|
||||
|
||||
flags = gtk_cell_accessible_get_state (cell_accessible);
|
||||
|
||||
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
|
||||
atk_state_set_add_state (state_set, ATK_STATE_TRANSIENT);
|
||||
atk_state_set_add_state (state_set, ATK_STATE_VISIBLE);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (state_map); i++)
|
||||
{
|
||||
if (flags & state_map[i].renderer_state)
|
||||
{
|
||||
if (!state_map[i].invert)
|
||||
atk_state_set_add_state (state_set, state_map[i].atk_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state_map[i].invert)
|
||||
atk_state_set_add_state (state_set, state_map[i].atk_state);
|
||||
}
|
||||
}
|
||||
|
||||
if (gtk_widget_get_mapped (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell_accessible))))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SHOWING);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_cell_accessible_get_parent (AtkObject *object)
|
||||
{
|
||||
GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (object);
|
||||
|
||||
return cell->priv->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_accessible_class_init (GtkCellAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_index_in_parent = gtk_cell_accessible_get_index_in_parent;
|
||||
class->ref_state_set = gtk_cell_accessible_ref_state_set;
|
||||
class->ref_relation_set = gtk_cell_accessible_ref_relation_set;
|
||||
class->get_parent = gtk_cell_accessible_get_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_accessible_init (GtkCellAccessible *cell)
|
||||
{
|
||||
cell->priv = gtk_cell_accessible_get_instance_private (cell);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_cell_accessible_initialize (GtkCellAccessible *cell,
|
||||
GtkWidget *widget,
|
||||
AtkObject *parent)
|
||||
{
|
||||
gtk_accessible_set_widget (GTK_ACCESSIBLE (cell), widget);
|
||||
cell->priv->parent = parent;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_cell_accessible_add_state (GtkCellAccessible *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
/* 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
|
||||
*/
|
||||
if (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent))
|
||||
_gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_cell_accessible_remove_state (GtkCellAccessible *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
/* 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 (GTK_IS_CONTAINER_CELL_ACCESSIBLE (cell->priv->parent))
|
||||
_gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell->priv->parent), state_type, emit_signal);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_cell_accessible_action_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_cell_accessible_action_get_name (AtkAction *action,
|
||||
int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return "expand or contract";
|
||||
case 1:
|
||||
return "edit";
|
||||
case 2:
|
||||
return "activate";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_cell_accessible_action_get_localized_name (AtkAction *action,
|
||||
int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action name", "Expand or contract");
|
||||
case 1:
|
||||
return C_("Action name", "Edit");
|
||||
case 2:
|
||||
return C_("Action name", "Activate");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_cell_accessible_action_get_description (AtkAction *action,
|
||||
int index)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action description", "Expands or contracts the row in the tree view containing this cell");
|
||||
case 1:
|
||||
return C_("Action description", "Creates a widget in which the contents of the cell can be edited");
|
||||
case 2:
|
||||
return C_("Action description", "Activates the cell");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_cell_accessible_action_get_keybinding (AtkAction *action,
|
||||
int index)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_cell_accessible_action_do_action (AtkAction *action,
|
||||
int index)
|
||||
{
|
||||
GtkCellAccessible *cell = GTK_CELL_ACCESSIBLE (action);
|
||||
GtkCellAccessibleParent *parent;
|
||||
|
||||
if (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)) == NULL)
|
||||
return FALSE;
|
||||
|
||||
parent = GTK_CELL_ACCESSIBLE_PARENT (gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell))));
|
||||
|
||||
switch (index)
|
||||
{
|
||||
case 0:
|
||||
gtk_cell_accessible_parent_expand_collapse (parent, cell);
|
||||
break;
|
||||
case 1:
|
||||
gtk_cell_accessible_parent_edit (parent, cell);
|
||||
break;
|
||||
case 2:
|
||||
gtk_cell_accessible_parent_activate (parent, cell);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->get_n_actions = gtk_cell_accessible_action_get_n_actions;
|
||||
iface->do_action = gtk_cell_accessible_action_do_action;
|
||||
iface->get_name = gtk_cell_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_cell_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_cell_accessible_action_get_description;
|
||||
iface->get_keybinding = gtk_cell_accessible_action_get_keybinding;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_accessible_get_extents (AtkComponent *component,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkObject *parent;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (component);
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
|
||||
gtk_cell_accessible_parent_get_cell_extents (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
||||
cell,
|
||||
x, y, width, height, coord_type);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_cell_accessible_grab_focus (AtkComponent *component)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkObject *parent;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (component);
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
|
||||
return gtk_cell_accessible_parent_grab_focus (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_component_interface_init (AtkComponentIface *iface)
|
||||
{
|
||||
iface->get_extents = gtk_cell_accessible_get_extents;
|
||||
iface->grab_focus = gtk_cell_accessible_grab_focus;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_cell_accessible_get_column_span (AtkTableCell *table_cell)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
gtk_cell_accessible_get_column_header_cells (AtkTableCell *table_cell)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkObject *parent;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (table_cell);
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
|
||||
return gtk_cell_accessible_parent_get_column_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
||||
cell);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_cell_accessible_get_position (AtkTableCell *table_cell,
|
||||
int *row,
|
||||
int *column)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkObject *parent;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (table_cell);
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
|
||||
gtk_cell_accessible_parent_get_cell_position (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
||||
cell,
|
||||
row, column);
|
||||
return ((row && *row > 0) || (column && *column > 0));
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_cell_accessible_get_row_span (AtkTableCell *table_cell)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static GPtrArray *
|
||||
gtk_cell_accessible_get_row_header_cells (AtkTableCell *table_cell)
|
||||
{
|
||||
GtkCellAccessible *cell;
|
||||
AtkObject *parent;
|
||||
|
||||
cell = GTK_CELL_ACCESSIBLE (table_cell);
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
|
||||
return gtk_cell_accessible_parent_get_row_header_cells (GTK_CELL_ACCESSIBLE_PARENT (parent),
|
||||
cell);
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_cell_accessible_get_table (AtkTableCell *table_cell)
|
||||
{
|
||||
AtkObject *obj;
|
||||
|
||||
obj = ATK_OBJECT (table_cell);
|
||||
do
|
||||
{
|
||||
AtkRole role;
|
||||
obj = atk_object_get_parent (obj);
|
||||
role = atk_object_get_role (obj);
|
||||
if (role == ATK_ROLE_TABLE || role == ATK_ROLE_TREE_TABLE)
|
||||
break;
|
||||
}
|
||||
while (obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_table_cell_interface_init (AtkTableCellIface *iface)
|
||||
{
|
||||
iface->get_column_span = gtk_cell_accessible_get_column_span;
|
||||
iface->get_column_header_cells = gtk_cell_accessible_get_column_header_cells;
|
||||
iface->get_position = gtk_cell_accessible_get_position;
|
||||
iface->get_row_span = gtk_cell_accessible_get_row_span;
|
||||
iface->get_row_header_cells = gtk_cell_accessible_get_row_header_cells;
|
||||
iface->get_table = gtk_cell_accessible_get_table;
|
||||
}
|
||||
|
||||
static GtkCellRendererState
|
||||
gtk_cell_accessible_get_state (GtkCellAccessible *cell)
|
||||
{
|
||||
AtkObject *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
|
||||
|
||||
parent = gtk_widget_get_accessible (gtk_accessible_get_widget (GTK_ACCESSIBLE (cell)));
|
||||
if (parent == NULL)
|
||||
return 0;
|
||||
|
||||
return gtk_cell_accessible_parent_get_renderer_state (GTK_CELL_ACCESSIBLE_PARENT (parent), cell);
|
||||
}
|
||||
|
||||
/*
|
||||
* gtk_cell_accessible_state_changed:
|
||||
* @cell: a #GtkCellAccessible
|
||||
* @added: the flags that were added from @cell
|
||||
* @removed: the flags that were removed from @cell
|
||||
*
|
||||
* Notifies @cell of state changes. Multiple states may be added
|
||||
* or removed at the same time. A state that is @added may not be
|
||||
* @removed at the same time.
|
||||
**/
|
||||
void
|
||||
_gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
||||
GtkCellRendererState added,
|
||||
GtkCellRendererState removed)
|
||||
{
|
||||
AtkObject *object;
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
||||
g_return_if_fail ((added & removed) == 0);
|
||||
|
||||
object = ATK_OBJECT (cell);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (state_map); i++)
|
||||
{
|
||||
if (added & state_map[i].renderer_state)
|
||||
atk_object_notify_state_change (object,
|
||||
state_map[i].atk_state,
|
||||
!state_map[i].invert);
|
||||
if (removed & state_map[i].renderer_state)
|
||||
atk_object_notify_state_change (object,
|
||||
state_map[i].atk_state,
|
||||
state_map[i].invert);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gtk_cell_accessible_update_cache:
|
||||
* @cell: the cell that is changed
|
||||
* @emit_signal: whether or not to notify the ATK bridge
|
||||
*
|
||||
* Notifies the cell that the values in the data in the row that
|
||||
* is used to feed the cell renderer with has changed. The
|
||||
* cell_changed function of @cell is called to send update
|
||||
* notifications for the properties it takes from its cell
|
||||
* renderer. If @emit_signal is TRUE, also notify the ATK bridge
|
||||
* of the change. The bridge should be notified when an existing
|
||||
* cell changes; not when a newly-created cell is being set up.
|
||||
*
|
||||
* Note that there is no higher granularity available about which
|
||||
* properties changed, so you will need to make do with this
|
||||
* function.
|
||||
**/
|
||||
void
|
||||
_gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
GtkCellAccessibleClass *klass;
|
||||
|
||||
g_return_if_fail (GTK_CELL_ACCESSIBLE (cell));
|
||||
|
||||
klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell);
|
||||
|
||||
if (klass->update_cache)
|
||||
klass->update_cache (cell, emit_signal);
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CELL_ACCESSIBLE_H__
|
||||
#define __GTK_CELL_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/gtkaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CELL_ACCESSIBLE (gtk_cell_accessible_get_type ())
|
||||
#define GTK_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessible))
|
||||
#define GTK_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessibleClass))
|
||||
#define GTK_IS_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_ACCESSIBLE))
|
||||
#define GTK_IS_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CELL_ACCESSIBLE))
|
||||
#define GTK_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CELL_ACCESSIBLE, GtkCellAccessibleClass))
|
||||
|
||||
typedef struct _GtkCellAccessible GtkCellAccessible;
|
||||
typedef struct _GtkCellAccessibleClass GtkCellAccessibleClass;
|
||||
typedef struct _GtkCellAccessiblePrivate GtkCellAccessiblePrivate;
|
||||
|
||||
struct _GtkCellAccessible
|
||||
{
|
||||
GtkAccessible parent;
|
||||
|
||||
GtkCellAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkCellAccessibleClass
|
||||
{
|
||||
GtkAccessibleClass parent_class;
|
||||
void (*update_cache) (GtkCellAccessible *cell,
|
||||
gboolean emit_signal);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_cell_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CELL_ACCESSIBLE_H__ */
|
@ -1,271 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcellaccessibleparent.h"
|
||||
|
||||
GType
|
||||
gtk_cell_accessible_parent_get_type (void)
|
||||
{
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
GType g_define_type_id =
|
||||
g_type_register_static_simple (G_TYPE_INTERFACE,
|
||||
g_intern_static_string ("GtkCellAccessibleParent"),
|
||||
sizeof (GtkCellAccessibleParentIface),
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
0);
|
||||
|
||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
||||
}
|
||||
|
||||
return g_define_type_id__volatile;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_accessible_parent_get_cell_extents:
|
||||
* @x: (out):
|
||||
* @y: (out):
|
||||
* @width: (out):
|
||||
* @height: (out):
|
||||
*/
|
||||
void
|
||||
gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_cell_extents)
|
||||
(iface->get_cell_extents) (parent, cell, x, y, width, height, coord_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_accessible_parent_get_cell_area:
|
||||
* @cell_rect: (out):
|
||||
*/
|
||||
void
|
||||
gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
GdkRectangle *cell_rect)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
g_return_if_fail (cell_rect);
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_cell_area)
|
||||
(iface->get_cell_area) (parent, cell, cell_rect);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->grab_focus)
|
||||
return (iface->grab_focus) (parent, cell);
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), FALSE);
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_child_index)
|
||||
return (iface->get_child_index) (parent, cell);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
GtkCellRendererState
|
||||
gtk_cell_accessible_parent_get_renderer_state (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), 0);
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), 0);
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_renderer_state)
|
||||
return (iface->get_renderer_state) (parent, cell);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_accessible_parent_expand_collapse (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->expand_collapse)
|
||||
(iface->expand_collapse) (parent, cell);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_accessible_parent_activate (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->activate)
|
||||
(iface->activate) (parent, cell);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_accessible_parent_edit (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->edit)
|
||||
(iface->edit) (parent, cell);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
AtkRelationSet *relationset)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
||||
g_return_if_fail (ATK_IS_RELATION_SET (relationset));
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->update_relationset)
|
||||
(iface->update_relationset) (parent, cell, relationset);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_accessible_parent_get_cell_position:
|
||||
* @row: (out):
|
||||
* @column: (out):
|
||||
*/
|
||||
void
|
||||
gtk_cell_accessible_parent_get_cell_position (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
int *row,
|
||||
int *column)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (cell));
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_cell_position)
|
||||
(iface->get_cell_position) (parent, cell, row, column);
|
||||
else
|
||||
{
|
||||
if (row)
|
||||
*row = -1;
|
||||
if (column)
|
||||
*column = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_accessible_parent_get_column_header_cells:
|
||||
* Returns: (transfer full) (element-type AtkObject)
|
||||
*/
|
||||
GPtrArray *
|
||||
gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL);
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_column_header_cells)
|
||||
return (iface->get_column_header_cells) (parent, cell);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_accessible_parent_get_row_header_cells:
|
||||
* Returns: (transfer full) (element-type AtkObject)
|
||||
*/
|
||||
GPtrArray *
|
||||
gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell)
|
||||
{
|
||||
GtkCellAccessibleParentIface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE_PARENT (parent), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CELL_ACCESSIBLE (cell), NULL);
|
||||
|
||||
iface = GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE (parent);
|
||||
|
||||
if (iface->get_row_header_cells)
|
||||
return (iface->get_row_header_cells) (parent, cell);
|
||||
else
|
||||
return NULL;
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CELL_ACCESSIBLE_PARENT_H__
|
||||
#define __GTK_CELL_ACCESSIBLE_PARENT_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/a11y/gtkcellaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
* The GtkCellAccessibleParent 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 GtkTreeViewAccessible where the children
|
||||
* GtkCellAccessible need help from the GtkTreeViewAccessible in order to
|
||||
* implement atk_component_get_extents().
|
||||
*/
|
||||
|
||||
#define GTK_TYPE_CELL_ACCESSIBLE_PARENT (gtk_cell_accessible_parent_get_type ())
|
||||
#define GTK_IS_CELL_ACCESSIBLE_PARENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT)
|
||||
#define GTK_CELL_ACCESSIBLE_PARENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT, GtkCellAccessibleParent)
|
||||
#define GTK_CELL_ACCESSIBLE_PARENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTK_TYPE_CELL_ACCESSIBLE_PARENT, GtkCellAccessibleParentIface))
|
||||
|
||||
typedef struct _GtkCellAccessibleParent GtkCellAccessibleParent;
|
||||
typedef struct _GtkCellAccessibleParentIface GtkCellAccessibleParentIface;
|
||||
|
||||
struct _GtkCellAccessibleParentIface
|
||||
{
|
||||
GTypeInterface parent;
|
||||
void ( *get_cell_extents) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height,
|
||||
AtkCoordType coord_type);
|
||||
void ( *get_cell_area) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
GdkRectangle *cell_rect);
|
||||
gboolean ( *grab_focus) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
int ( *get_child_index) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GtkCellRendererState
|
||||
( *get_renderer_state) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
/* actions */
|
||||
void ( *expand_collapse) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
void ( *activate) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
void ( *edit) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
/* end of actions */
|
||||
void ( *update_relationset) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
AtkRelationSet *relationset);
|
||||
void ( *get_cell_position) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
int *row,
|
||||
int *column);
|
||||
GPtrArray * ( *get_column_header_cells) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GPtrArray * ( *get_row_header_cells) (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_cell_accessible_parent_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_get_cell_extents (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height,
|
||||
AtkCoordType coord_type);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_get_cell_area (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
GdkRectangle *cell_rect);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_cell_accessible_parent_grab_focus (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gtk_cell_accessible_parent_get_child_index (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkCellRendererState
|
||||
gtk_cell_accessible_parent_get_renderer_state(GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_expand_collapse (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_activate (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_edit (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_update_relationset (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
AtkRelationSet *relationset);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_accessible_parent_get_cell_position(GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell,
|
||||
int *row,
|
||||
int *column);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GPtrArray *gtk_cell_accessible_parent_get_column_header_cells (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GPtrArray *gtk_cell_accessible_parent_get_row_header_cells (GtkCellAccessibleParent *parent,
|
||||
GtkCellAccessible *cell);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CELL_ACCESSIBLE_PARENT_H__ */
|
@ -1,42 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CELL_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_CELL_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkcellaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
||||
GtkCellRendererState added,
|
||||
GtkCellRendererState removed);
|
||||
void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal);
|
||||
void _gtk_cell_accessible_initialize (GtkCellAccessible *cell,
|
||||
GtkWidget *widget,
|
||||
AtkObject *parent);
|
||||
gboolean _gtk_cell_accessible_add_state (GtkCellAccessible *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal);
|
||||
gboolean _gtk_cell_accessible_remove_state (GtkCellAccessible *cell,
|
||||
AtkStateType state_type,
|
||||
gboolean emit_signal);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CELL_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,211 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2012 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcolorswatchaccessibleprivate.h"
|
||||
#include "gtkcolorswatchprivate.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkColorSwatchAccessible, _gtk_color_swatch_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
|
||||
|
||||
static void
|
||||
state_changed_cb (GtkWidget *widget,
|
||||
GtkStateFlags previous_flags,
|
||||
AtkObject *accessible)
|
||||
{
|
||||
GtkStateFlags flags;
|
||||
gboolean was_selected;
|
||||
gboolean selected;
|
||||
|
||||
flags = gtk_widget_get_state_flags (widget);
|
||||
|
||||
was_selected = (previous_flags & GTK_STATE_FLAG_SELECTED) != 0;
|
||||
selected = (flags & GTK_STATE_FLAG_SELECTED) != 0;
|
||||
|
||||
if (selected && !was_selected)
|
||||
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, TRUE);
|
||||
else if (!selected && was_selected)
|
||||
atk_object_notify_state_change (accessible, ATK_STATE_CHECKED, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
on_selectable_changed_cb (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
AtkObject *accessible)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (gobject);
|
||||
AtkRole role;
|
||||
|
||||
if (gtk_color_swatch_get_selectable (swatch))
|
||||
role = ATK_ROLE_RADIO_BUTTON;
|
||||
else
|
||||
role = ATK_ROLE_PUSH_BUTTON;
|
||||
|
||||
atk_object_set_role (accessible, role);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_swatch_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkColorSwatch *swatch = data;
|
||||
|
||||
ATK_OBJECT_CLASS (_gtk_color_swatch_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (data, "state-flags-changed",
|
||||
G_CALLBACK (state_changed_cb),
|
||||
obj);
|
||||
g_signal_connect (data, "notify::selectable",
|
||||
G_CALLBACK (on_selectable_changed_cb),
|
||||
obj);
|
||||
|
||||
obj->role = gtk_color_swatch_get_selectable (swatch)
|
||||
? ATK_ROLE_RADIO_BUTTON
|
||||
: ATK_ROLE_PUSH_BUTTON;
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_color_swatch_accessible_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
AtkStateSet *state_set;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (_gtk_color_swatch_accessible_parent_class)->ref_state_set (accessible);
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
if (widget != NULL)
|
||||
{
|
||||
if ((gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED) != 0)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
|
||||
}
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_color_swatch_accessible_class_init (GtkColorSwatchAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *atk_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
atk_class->initialize = gtk_color_swatch_accessible_initialize;
|
||||
atk_class->ref_state_set = gtk_color_swatch_accessible_ref_state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_color_swatch_accessible_init (GtkColorSwatchAccessible *self)
|
||||
{
|
||||
ATK_OBJECT (self)->role = ATK_ROLE_RADIO_BUTTON;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_color_swatch_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_color_swatch_accessible_get_keybinding (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_color_swatch_accessible_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return "select";
|
||||
case 1: return "activate";
|
||||
case 2: return "customize";
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_color_swatch_accessible_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return C_("Action name", "Select");
|
||||
case 1: return C_("Action name", "Activate");
|
||||
case 2: return C_("Action name", "Customize");
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_color_swatch_accessible_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return C_("Action description", "Selects the color");
|
||||
case 1: return C_("Action description", "Activates the color");
|
||||
case 2: return C_("Action description", "Customizes the color");
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_color_swatch_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
g_signal_emit_by_name (widget, "activate");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
g_signal_emit_by_name (widget, "customize");
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_color_swatch_accessible_do_action;
|
||||
iface->get_n_actions = gtk_color_swatch_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_color_swatch_accessible_get_keybinding;
|
||||
iface->get_name = gtk_color_swatch_accessible_get_name;
|
||||
iface->get_localized_name = gtk_color_swatch_accessible_get_localized_name;
|
||||
iface->get_description = gtk_color_swatch_accessible_get_description;
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2012, Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_COLOR_SWATCH_ACCESSIBLE_H__
|
||||
#define __GTK_COLOR_SWATCH_ACCESSIBLE_H__
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_COLOR_SWATCH_ACCESSIBLE (_gtk_color_swatch_accessible_get_type ())
|
||||
#define GTK_COLOR_SWATCH_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE, GtkColorSwatchAccessible))
|
||||
#define GTK_COLOR_SWATCH_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE, GtkColorSwatchAccessibleClass))
|
||||
#define GTK_IS_COLOR_SWATCH_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE))
|
||||
#define GTK_IS_COLOR_SWATCH_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE))
|
||||
#define GTK_COLOR_SWATCH_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COLOR_SWATCH_ACCESSIBLE, GtkColorSwatchAccessibleClass))
|
||||
|
||||
typedef struct _GtkColorSwatchAccessible GtkColorSwatchAccessible;
|
||||
typedef struct _GtkColorSwatchAccessibleClass GtkColorSwatchAccessibleClass;
|
||||
typedef struct _GtkColorSwatchAccessiblePrivate GtkColorSwatchAccessiblePrivate;
|
||||
|
||||
struct _GtkColorSwatchAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkColorSwatchAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkColorSwatchAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GType _gtk_color_swatch_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_COLOR_SWATCH_ACCESSIBLE_H__ */
|
@ -1,435 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcomboboxaccessible.h"
|
||||
|
||||
struct _GtkComboBoxAccessiblePrivate
|
||||
{
|
||||
char *name;
|
||||
int old_selection;
|
||||
gboolean popup_set;
|
||||
};
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkComboBoxAccessible, gtk_combo_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkComboBoxAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
|
||||
|
||||
static void
|
||||
changed_cb (GtkWidget *widget)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
AtkObject *obj;
|
||||
GtkComboBoxAccessible *accessible;
|
||||
int index;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
index = gtk_combo_box_get_active (combo_box);
|
||||
obj = gtk_widget_get_accessible (widget);
|
||||
accessible = GTK_COMBO_BOX_ACCESSIBLE (obj);
|
||||
if (accessible->priv->old_selection != index)
|
||||
{
|
||||
accessible->priv->old_selection = index;
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
g_signal_emit_by_name (obj, "selection-changed");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkComboBoxAccessible *accessible;
|
||||
AtkObject *popup;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_combo_box_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
combo_box = GTK_COMBO_BOX (data);
|
||||
accessible = GTK_COMBO_BOX_ACCESSIBLE (obj);
|
||||
|
||||
g_signal_connect (combo_box, "changed", G_CALLBACK (changed_cb), NULL);
|
||||
accessible->priv->old_selection = gtk_combo_box_get_active (combo_box);
|
||||
|
||||
popup = gtk_combo_box_get_popup_accessible (combo_box);
|
||||
if (popup)
|
||||
{
|
||||
atk_object_set_parent (popup, obj);
|
||||
accessible->priv->popup_set = TRUE;
|
||||
}
|
||||
if (gtk_combo_box_get_has_entry (combo_box))
|
||||
atk_object_set_parent (gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (combo_box))), obj);
|
||||
|
||||
obj->role = ATK_ROLE_COMBO_BOX;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkComboBoxAccessible *combo_box = GTK_COMBO_BOX_ACCESSIBLE (object);
|
||||
|
||||
g_free (combo_box->priv->name);
|
||||
|
||||
G_OBJECT_CLASS (gtk_combo_box_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_combo_box_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkComboBox *combo_box;
|
||||
GtkComboBoxAccessible *accessible;
|
||||
GtkTreeIter iter;
|
||||
const char *name;
|
||||
GtkTreeModel *model;
|
||||
int n_columns;
|
||||
int i;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_combo_box_accessible_parent_class)->get_name (obj);
|
||||
if (name)
|
||||
return name;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
accessible = GTK_COMBO_BOX_ACCESSIBLE (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 = G_VALUE_INIT;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter, i, &value);
|
||||
if (G_VALUE_HOLDS_STRING (&value))
|
||||
{
|
||||
g_free (accessible->priv->name);
|
||||
accessible->priv->name = g_strdup (g_value_get_string (&value));
|
||||
g_value_unset (&value);
|
||||
break;
|
||||
}
|
||||
else
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
return accessible->priv->name;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_combo_box_accessible_get_n_children (AtkObject* obj)
|
||||
{
|
||||
int n_children = 0;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
n_children++;
|
||||
if (gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget)))
|
||||
n_children++;
|
||||
|
||||
return n_children;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_combo_box_accessible_ref_child (AtkObject *obj,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
AtkObject *child;
|
||||
GtkComboBoxAccessible *box;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
child = gtk_combo_box_get_popup_accessible (GTK_COMBO_BOX (widget));
|
||||
box = GTK_COMBO_BOX_ACCESSIBLE (obj);
|
||||
if (!box->priv->popup_set)
|
||||
{
|
||||
atk_object_set_parent (child, obj);
|
||||
box->priv->popup_set = TRUE;
|
||||
}
|
||||
}
|
||||
else if (i == 1 && gtk_combo_box_get_has_entry (GTK_COMBO_BOX (widget)))
|
||||
{
|
||||
child = gtk_widget_get_accessible (gtk_combo_box_get_child (GTK_COMBO_BOX (widget)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_object_ref (child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_accessible_class_init (GtkComboBoxAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gtk_combo_box_accessible_finalize;
|
||||
|
||||
class->get_name = gtk_combo_box_accessible_get_name;
|
||||
class->get_n_children = gtk_combo_box_accessible_get_n_children;
|
||||
class->ref_child = gtk_combo_box_accessible_ref_child;
|
||||
class->initialize = gtk_combo_box_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_accessible_init (GtkComboBoxAccessible *combo_box)
|
||||
{
|
||||
combo_box->priv = gtk_combo_box_accessible_get_instance_private (combo_box);
|
||||
combo_box->priv->old_selection = -1;
|
||||
combo_box->priv->name = NULL;
|
||||
combo_box->priv->popup_set = FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_combo_box_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
gboolean popup_shown;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||
return FALSE;
|
||||
|
||||
if (i != 0)
|
||||
return FALSE;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
g_object_get (combo_box, "popup-shown", &popup_shown, NULL);
|
||||
if (popup_shown)
|
||||
gtk_combo_box_popdown (combo_box);
|
||||
else
|
||||
gtk_combo_box_popup (combo_box);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_combo_box_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_combo_box_accessible_get_keybinding (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkComboBoxAccessible *combo_box;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
AtkRelationSet *set;
|
||||
AtkRelation *relation;
|
||||
GPtrArray *target;
|
||||
gpointer target_object;
|
||||
guint key_val;
|
||||
char *return_value = NULL;
|
||||
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
combo_box = GTK_COMBO_BOX_ACCESSIBLE (action);
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (combo_box));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
set = atk_object_ref_relation_set (ATK_OBJECT (action));
|
||||
if (set == NULL)
|
||||
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);
|
||||
label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object));
|
||||
}
|
||||
g_object_unref (set);
|
||||
if (GTK_IS_LABEL (label))
|
||||
{
|
||||
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
|
||||
if (key_val != GDK_KEY_VoidSymbol)
|
||||
return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_combo_box_accessible_action_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "press";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_combo_box_accessible_action_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Press");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_combo_box_accessible_action_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Presses the combobox");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_combo_box_accessible_do_action;
|
||||
iface->get_n_actions = gtk_combo_box_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_combo_box_accessible_get_keybinding;
|
||||
iface->get_name = gtk_combo_box_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_combo_box_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_combo_box_accessible_action_get_description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_combo_box_accessible_add_selection (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), i);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_combo_box_accessible_clear_selection (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), -1);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_combo_box_accessible_ref_selection (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
GtkComboBox *combo_box;
|
||||
GtkWidget *widget;
|
||||
AtkObject *obj;
|
||||
int index;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_combo_box_accessible_get_selection_count (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
return (gtk_combo_box_get_active (GTK_COMBO_BOX (widget)) == -1) ? 0 : 1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_combo_box_accessible_is_child_selected (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
int j;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
j = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
||||
|
||||
return (j == i);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_combo_box_accessible_remove_selection (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
if (atk_selection_is_child_selected (selection, i))
|
||||
atk_selection_clear_selection (selection);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_selection_interface_init (AtkSelectionIface *iface)
|
||||
{
|
||||
iface->add_selection = gtk_combo_box_accessible_add_selection;
|
||||
iface->clear_selection = gtk_combo_box_accessible_clear_selection;
|
||||
iface->ref_selection = gtk_combo_box_accessible_ref_selection;
|
||||
iface->get_selection_count = gtk_combo_box_accessible_get_selection_count;
|
||||
iface->is_child_selected = gtk_combo_box_accessible_is_child_selected;
|
||||
iface->remove_selection = gtk_combo_box_accessible_remove_selection;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_COMBO_BOX_ACCESSIBLE_H__
|
||||
#define __GTK_COMBO_BOX_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_COMBO_BOX_ACCESSIBLE (gtk_combo_box_accessible_get_type ())
|
||||
#define GTK_COMBO_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMBO_BOX_ACCESSIBLE, GtkComboBoxAccessible))
|
||||
#define GTK_COMBO_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COMBO_BOX_ACCESSIBLE, GtkComboBoxAccessibleClass))
|
||||
#define GTK_IS_COMBO_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMBO_BOX_ACCESSIBLE))
|
||||
#define GTK_IS_COMBO_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COMBO_BOX_ACCESSIBLE))
|
||||
#define GTK_COMBO_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COMBO_BOX_ACCESSIBLE, GtkComboBoxAccessibleClass))
|
||||
|
||||
typedef struct _GtkComboBoxAccessible GtkComboBoxAccessible;
|
||||
typedef struct _GtkComboBoxAccessibleClass GtkComboBoxAccessibleClass;
|
||||
typedef struct _GtkComboBoxAccessiblePrivate GtkComboBoxAccessiblePrivate;
|
||||
|
||||
struct _GtkComboBoxAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkComboBoxAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkComboBoxAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_combo_box_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_COMBO_BOX_ACCESSIBLE_H__ */
|
@ -1,87 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2020 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcompositeaccessible.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkCompositeAccessible, gtk_composite_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static int
|
||||
gtk_composite_accessible_get_n_children (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *child;
|
||||
int count = 0;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget); child; child = gtk_widget_get_next_sibling (child))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_composite_accessible_ref_child (AtkObject *obj,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *child;
|
||||
int pos;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget), pos = 0; child && pos < i; child = gtk_widget_get_next_sibling (child), pos++);
|
||||
|
||||
if (child)
|
||||
return g_object_ref (gtk_widget_get_accessible (GTK_WIDGET (child)));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_composite_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_composite_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_FILLER;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_composite_accessible_class_init (GtkCompositeAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gtk_composite_accessible_initialize;
|
||||
class->get_n_children = gtk_composite_accessible_get_n_children;
|
||||
class->ref_child = gtk_composite_accessible_ref_child;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_composite_accessible_init (GtkCompositeAccessible *composite)
|
||||
{
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2020 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_COMPOSITE_ACCESSIBLE_H__
|
||||
#define __GTK_COMPOSITE_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_COMPOSITE_ACCESSIBLE (gtk_composite_accessible_get_type ())
|
||||
#define GTK_COMPOSITE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_COMPOSITE_ACCESSIBLE, GtkCompositeAccessible))
|
||||
#define GTK_COMPOSITE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_COMPOSITE_ACCESSIBLE, GtkCompositeAccessibleClass))
|
||||
#define GTK_IS_COMPOSITE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COMPOSITE_ACCESSIBLE))
|
||||
#define GTK_IS_COMPOSITE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COMPOSITE_ACCESSIBLE))
|
||||
#define GTK_COMPOSITE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_COMPOSITE_ACCESSIBLE, GtkCompositeAccessibleClass))
|
||||
|
||||
typedef struct _GtkCompositeAccessible GtkCompositeAccessible;
|
||||
typedef struct _GtkCompositeAccessibleClass GtkCompositeAccessibleClass;
|
||||
|
||||
struct _GtkCompositeAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkCompositeAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_composite_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_COMPOSITE_ACCESSIBLE_H__ */
|
@ -1,180 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkcontainercellaccessible.h"
|
||||
#include "gtkcellaccessibleprivate.h"
|
||||
|
||||
struct _GtkContainerCellAccessiblePrivate
|
||||
{
|
||||
GList *children;
|
||||
int n_children;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkContainerCellAccessible, gtk_container_cell_accessible, GTK_TYPE_CELL_ACCESSIBLE)
|
||||
|
||||
|
||||
static void
|
||||
gtk_container_cell_accessible_finalize (GObject *obj)
|
||||
{
|
||||
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
|
||||
|
||||
g_list_free_full (container->priv->children, g_object_unref);
|
||||
|
||||
G_OBJECT_CLASS (gtk_container_cell_accessible_parent_class)->finalize (obj);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
gtk_container_cell_accessible_get_n_children (AtkObject *obj)
|
||||
{
|
||||
GtkContainerCellAccessible *cell = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
|
||||
|
||||
return cell->priv->n_children;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_container_cell_accessible_ref_child (AtkObject *obj,
|
||||
int child)
|
||||
{
|
||||
GtkContainerCellAccessible *cell = GTK_CONTAINER_CELL_ACCESSIBLE (obj);
|
||||
GList *l;
|
||||
|
||||
l = g_list_nth (cell->priv->children, child);
|
||||
if (l == NULL)
|
||||
return NULL;
|
||||
|
||||
return g_object_ref (ATK_OBJECT (l->data));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_cell_accessible_update_cache (GtkCellAccessible *cell,
|
||||
gboolean emit_signal)
|
||||
{
|
||||
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (cell);
|
||||
GList *l;
|
||||
|
||||
for (l = container->priv->children; l; l = l->next)
|
||||
_gtk_cell_accessible_update_cache (l->data, emit_signal);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_cell_widget_set (GtkAccessible *accessible)
|
||||
{
|
||||
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (accessible);
|
||||
GList *l;
|
||||
|
||||
for (l = container->priv->children; l; l = l->next)
|
||||
gtk_accessible_set_widget (l->data, gtk_accessible_get_widget (accessible));
|
||||
|
||||
GTK_ACCESSIBLE_CLASS (gtk_container_cell_accessible_parent_class)->widget_set (accessible);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_cell_widget_unset (GtkAccessible *accessible)
|
||||
{
|
||||
GtkContainerCellAccessible *container = GTK_CONTAINER_CELL_ACCESSIBLE (accessible);
|
||||
GList *l;
|
||||
|
||||
for (l = container->priv->children; l; l = l->next)
|
||||
gtk_accessible_set_widget (l->data, NULL);
|
||||
|
||||
GTK_ACCESSIBLE_CLASS (gtk_container_cell_accessible_parent_class)->widget_unset (accessible);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_cell_accessible_class_init (GtkContainerCellAccessibleClass *klass)
|
||||
{
|
||||
GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass);
|
||||
GtkAccessibleClass *accessible_class = GTK_ACCESSIBLE_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_object_class->finalize = gtk_container_cell_accessible_finalize;
|
||||
|
||||
class->get_n_children = gtk_container_cell_accessible_get_n_children;
|
||||
class->ref_child = gtk_container_cell_accessible_ref_child;
|
||||
|
||||
accessible_class->widget_set = gtk_container_cell_widget_set;
|
||||
accessible_class->widget_unset = gtk_container_cell_widget_unset;
|
||||
|
||||
cell_class->update_cache = gtk_container_cell_accessible_update_cache;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_cell_accessible_init (GtkContainerCellAccessible *cell)
|
||||
{
|
||||
cell->priv = gtk_container_cell_accessible_get_instance_private (cell);
|
||||
}
|
||||
|
||||
GtkContainerCellAccessible *
|
||||
gtk_container_cell_accessible_new (void)
|
||||
{
|
||||
GObject *object;
|
||||
|
||||
object = g_object_new (GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, NULL);
|
||||
|
||||
ATK_OBJECT (object)->role = ATK_ROLE_TABLE_CELL;
|
||||
|
||||
return GTK_CONTAINER_CELL_ACCESSIBLE (object);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
|
||||
GtkCellAccessible *child)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
|
||||
|
||||
g_object_ref (child);
|
||||
|
||||
container->priv->n_children++;
|
||||
container->priv->children = g_list_append (container->priv->children, child);
|
||||
atk_object_set_parent (ATK_OBJECT (child), ATK_OBJECT (container));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *container,
|
||||
GtkCellAccessible *child)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container));
|
||||
g_return_if_fail (GTK_IS_CELL_ACCESSIBLE (child));
|
||||
g_return_if_fail (container->priv->n_children > 0);
|
||||
|
||||
container->priv->children = g_list_remove (container->priv->children, child);
|
||||
container->priv->n_children--;
|
||||
|
||||
g_object_unref (child);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_container_cell_accessible_get_children:
|
||||
* @container: the container
|
||||
*
|
||||
* Get a list of children.
|
||||
*
|
||||
* Returns: (transfer none) (element-type Gtk.CellAccessible)
|
||||
*/
|
||||
GList *
|
||||
gtk_container_cell_accessible_get_children (GtkContainerCellAccessible *container)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER_CELL_ACCESSIBLE (container), NULL);
|
||||
|
||||
return container->priv->children;
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_CONTAINER_CELL_ACCESSIBLE_H__
|
||||
#define __GTK_CONTAINER_CELL_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/a11y/gtkcellaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_CONTAINER_CELL_ACCESSIBLE (gtk_container_cell_accessible_get_type ())
|
||||
#define GTK_CONTAINER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessible))
|
||||
#define GTK_CONTAINER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessibleClass))
|
||||
#define GTK_IS_CONTAINER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE))
|
||||
#define GTK_IS_CONTAINER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE))
|
||||
#define GTK_CONTAINER_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER_CELL_ACCESSIBLE, GtkContainerCellAccessibleClass))
|
||||
|
||||
typedef struct _GtkContainerCellAccessible GtkContainerCellAccessible;
|
||||
typedef struct _GtkContainerCellAccessibleClass GtkContainerCellAccessibleClass;
|
||||
typedef struct _GtkContainerCellAccessiblePrivate GtkContainerCellAccessiblePrivate;
|
||||
|
||||
struct _GtkContainerCellAccessible
|
||||
{
|
||||
GtkCellAccessible parent;
|
||||
|
||||
GtkContainerCellAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkContainerCellAccessibleClass
|
||||
{
|
||||
GtkCellAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_container_cell_accessible_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkContainerCellAccessible *gtk_container_cell_accessible_new (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_container_cell_accessible_add_child (GtkContainerCellAccessible *container,
|
||||
GtkCellAccessible *child);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_container_cell_accessible_remove_child (GtkContainerCellAccessible *container,
|
||||
GtkCellAccessible *child);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GList *gtk_container_cell_accessible_get_children (GtkContainerCellAccessible *container);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CONTAINER_CELL_ACCESSIBLE_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -1,60 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ENTRY_ACCESSIBLE_H__
|
||||
#define __GTK_ENTRY_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_ENTRY_ACCESSIBLE (gtk_entry_accessible_get_type ())
|
||||
#define GTK_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessible))
|
||||
#define GTK_ENTRY_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessibleClass))
|
||||
#define GTK_IS_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY_ACCESSIBLE))
|
||||
#define GTK_IS_ENTRY_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY_ACCESSIBLE))
|
||||
#define GTK_ENTRY_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY_ACCESSIBLE, GtkEntryAccessibleClass))
|
||||
|
||||
typedef struct _GtkEntryAccessible GtkEntryAccessible;
|
||||
typedef struct _GtkEntryAccessibleClass GtkEntryAccessibleClass;
|
||||
typedef struct _GtkEntryAccessiblePrivate GtkEntryAccessiblePrivate;
|
||||
|
||||
struct _GtkEntryAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkEntryAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkEntryAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_entry_accessible_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_entry_icon_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ENTRY_ACCESSIBLE_H__ */
|
@ -1,251 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkexpanderaccessibleprivate.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkExpanderAccessible, gtk_expander_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
|
||||
|
||||
static const char *
|
||||
gtk_expander_accessible_get_full_text (GtkExpander *widget)
|
||||
{
|
||||
GtkWidget *label_widget;
|
||||
|
||||
label_widget = gtk_expander_get_label_widget (widget);
|
||||
|
||||
if (!GTK_IS_LABEL (label_widget))
|
||||
return NULL;
|
||||
|
||||
return gtk_label_get_text (GTK_LABEL (label_widget));
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_expander_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
const char *name;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->get_name (obj);
|
||||
if (name != NULL)
|
||||
return name;
|
||||
|
||||
return gtk_expander_accessible_get_full_text (GTK_EXPANDER (widget));
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_expander_accessible_get_n_children (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
if (gtk_expander_get_child (GTK_EXPANDER (widget)))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_expander_accessible_ref_child (AtkObject *obj,
|
||||
int i)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
widget = gtk_expander_get_child (GTK_EXPANDER (widget));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
accessible = gtk_widget_get_accessible (widget);
|
||||
g_object_ref (accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_expander_accessible_update_label (GtkExpanderAccessible *self)
|
||||
{
|
||||
AtkObject *atk_obj = ATK_OBJECT (self);
|
||||
|
||||
if (atk_obj->name == NULL)
|
||||
g_object_notify (G_OBJECT (atk_obj), "accessible-name");
|
||||
|
||||
g_signal_emit_by_name (atk_obj, "visible-data-changed");
|
||||
}
|
||||
|
||||
void
|
||||
gtk_expander_accessible_update_state (GtkExpanderAccessible *self,
|
||||
gboolean expanded)
|
||||
{
|
||||
AtkObject *atk_obj = ATK_OBJECT (self);
|
||||
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_CHECKED, expanded);
|
||||
atk_object_notify_state_change (atk_obj, ATK_STATE_EXPANDED, expanded);
|
||||
|
||||
g_signal_emit_by_name (atk_obj, "visible-data-changed");
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_expander_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
GtkExpander *expander;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_expander_accessible_parent_class)->ref_state_set (obj);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_accessible_class_init (GtkExpanderAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_name = gtk_expander_accessible_get_name;
|
||||
class->get_n_children = gtk_expander_accessible_get_n_children;
|
||||
class->ref_child = gtk_expander_accessible_ref_child;
|
||||
class->ref_state_set = gtk_expander_accessible_ref_state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_expander_accessible_init (GtkExpanderAccessible *self)
|
||||
{
|
||||
ATK_OBJECT (self)->role = ATK_ROLE_TOGGLE_BUTTON;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_expander_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||
return FALSE;
|
||||
|
||||
if (i != 0)
|
||||
return FALSE;
|
||||
|
||||
gtk_widget_activate (widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_expander_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_expander_accessible_get_keybinding (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
char *return_value = NULL;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
if (i != 0)
|
||||
return 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_KEY_VoidSymbol)
|
||||
return_value = gtk_accelerator_name (key_val, GDK_ALT_MASK);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_expander_accessible_action_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return "activate";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_expander_accessible_action_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Activate");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_expander_accessible_action_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Activates the expander");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_expander_accessible_do_action;
|
||||
iface->get_n_actions = gtk_expander_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_expander_accessible_get_keybinding;
|
||||
iface->get_name = gtk_expander_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_expander_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_expander_accessible_action_get_description;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_EXPANDER_ACCESSIBLE_H__
|
||||
#define __GTK_EXPANDER_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_EXPANDER_ACCESSIBLE (gtk_expander_accessible_get_type ())
|
||||
#define GTK_EXPANDER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_EXPANDER_ACCESSIBLE, GtkExpanderAccessible))
|
||||
#define GTK_EXPANDER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_EXPANDER_ACCESSIBLE, GtkExpanderAccessibleClass))
|
||||
#define GTK_IS_EXPANDER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_EXPANDER_ACCESSIBLE))
|
||||
#define GTK_IS_EXPANDER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_EXPANDER_ACCESSIBLE))
|
||||
#define GTK_EXPANDER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_EXPANDER_ACCESSIBLE, GtkExpanderAccessibleClass))
|
||||
|
||||
typedef struct _GtkExpanderAccessible GtkExpanderAccessible;
|
||||
typedef struct _GtkExpanderAccessibleClass GtkExpanderAccessibleClass;
|
||||
typedef struct _GtkExpanderAccessiblePrivate GtkExpanderAccessiblePrivate;
|
||||
|
||||
struct _GtkExpanderAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkExpanderAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkExpanderAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_expander_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_EXPANDER_ACCESSIBLE_H__ */
|
@ -1,31 +0,0 @@
|
||||
/* gtkexpanderaccessibleprivate.h: GtkExpanderAccessible private API
|
||||
*
|
||||
* Copyright 2020 GNOME Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtkexpanderaccessible.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_expander_accessible_update_label (GtkExpanderAccessible *self);
|
||||
void gtk_expander_accessible_update_state (GtkExpanderAccessible *self,
|
||||
gboolean expanded);
|
||||
|
||||
G_END_DECLS
|
@ -1,258 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkflowboxaccessibleprivate.h"
|
||||
|
||||
#include "gtk/gtkflowbox.h"
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFlowBoxAccessible, gtk_flow_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
|
||||
|
||||
static void
|
||||
gtk_flow_box_accessible_init (GtkFlowBoxAccessible *accessible)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_flow_box_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_flow_box_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_TABLE;
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gtk_flow_box_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_flow_box_accessible_parent_class)->ref_state_set (obj);
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
|
||||
if (widget != NULL)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_flow_box_accessible_class_init (GtkFlowBoxAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->initialize = gtk_flow_box_accessible_initialize;
|
||||
object_class->ref_state_set = gtk_flow_box_accessible_ref_state_set;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_flow_box_accessible_add_selection (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *child;
|
||||
int pos;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (child = gtk_widget_get_first_child (box), pos = 0;
|
||||
child != NULL && pos < idx;
|
||||
child = gtk_widget_get_next_sibling (child), pos++) ;
|
||||
|
||||
if (child && pos == idx)
|
||||
{
|
||||
gtk_flow_box_select_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (child));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_flow_box_accessible_remove_selection (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *child;
|
||||
int pos;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
for (child = gtk_widget_get_first_child (box), pos = 0;
|
||||
child != NULL && pos < idx;
|
||||
child = gtk_widget_get_next_sibling (child), pos++) ;
|
||||
|
||||
if (child && pos == idx)
|
||||
{
|
||||
gtk_flow_box_unselect_child (GTK_FLOW_BOX (box), GTK_FLOW_BOX_CHILD (child));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_flow_box_accessible_clear_selection (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *box;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_flow_box_unselect_all (GTK_FLOW_BOX (box));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_flow_box_accessible_select_all (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *box;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_flow_box_select_all (GTK_FLOW_BOX (box));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int idx;
|
||||
GtkWidget *child;
|
||||
} FindSelectedData;
|
||||
|
||||
static void
|
||||
find_selected_child (GtkFlowBox *box,
|
||||
GtkFlowBoxChild *child,
|
||||
gpointer data)
|
||||
{
|
||||
FindSelectedData *d = data;
|
||||
|
||||
if (d->idx == 0)
|
||||
{
|
||||
if (d->child == NULL)
|
||||
d->child = GTK_WIDGET (child);
|
||||
}
|
||||
else
|
||||
d->idx -= 1;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_flow_box_accessible_ref_selection (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
AtkObject *accessible;
|
||||
FindSelectedData data;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return NULL;
|
||||
|
||||
data.idx = idx;
|
||||
data.child = NULL;
|
||||
gtk_flow_box_selected_foreach (GTK_FLOW_BOX (box), find_selected_child, &data);
|
||||
|
||||
if (data.child == NULL)
|
||||
return NULL;
|
||||
|
||||
accessible = gtk_widget_get_accessible (data.child);
|
||||
g_object_ref (accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
count_selected (GtkFlowBox *box,
|
||||
GtkFlowBoxChild *child,
|
||||
gpointer data)
|
||||
{
|
||||
int *count = data;
|
||||
*count += 1;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_flow_box_accessible_get_selection_count (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *box;
|
||||
int count;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return 0;
|
||||
|
||||
count = 0;
|
||||
gtk_flow_box_selected_foreach (GTK_FLOW_BOX (box), count_selected, &count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_flow_box_accessible_is_child_selected (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkFlowBoxChild *child;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
child = gtk_flow_box_get_child_at_index (GTK_FLOW_BOX (box), idx);
|
||||
|
||||
return gtk_flow_box_child_is_selected (child);
|
||||
}
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface)
|
||||
{
|
||||
iface->add_selection = gtk_flow_box_accessible_add_selection;
|
||||
iface->remove_selection = gtk_flow_box_accessible_remove_selection;
|
||||
iface->clear_selection = gtk_flow_box_accessible_clear_selection;
|
||||
iface->ref_selection = gtk_flow_box_accessible_ref_selection;
|
||||
iface->get_selection_count = gtk_flow_box_accessible_get_selection_count;
|
||||
iface->is_child_selected = gtk_flow_box_accessible_is_child_selected;
|
||||
iface->select_all_selection = gtk_flow_box_accessible_select_all;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_flow_box_accessible_selection_changed (GtkWidget *box)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
accessible = gtk_widget_get_accessible (box);
|
||||
g_signal_emit_by_name (accessible, "selection-changed");
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_flow_box_accessible_update_cursor (GtkWidget *box,
|
||||
GtkWidget *child)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
AtkObject *descendant;
|
||||
accessible = gtk_widget_get_accessible (box);
|
||||
descendant = child ? gtk_widget_get_accessible (child) : NULL;
|
||||
g_signal_emit_by_name (accessible, "active-descendant-changed", descendant);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FLOW_BOX_ACCESSIBLE_H__
|
||||
#define __GTK_FLOW_BOX_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_FLOW_BOX_ACCESSIBLE (gtk_flow_box_accessible_get_type ())
|
||||
#define GTK_FLOW_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FLOW_BOX_ACCESSIBLE, GtkFlowBoxAccessible))
|
||||
#define GTK_FLOW_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FLOW_BOX_ACCESSIBLE, GtkFlowBoxAccessibleClass))
|
||||
#define GTK_IS_FLOW_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FLOW_BOX_ACCESSIBLE))
|
||||
#define GTK_IS_FLOW_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FLOW_BOX_ACCESSIBLE))
|
||||
#define GTK_FLOW_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FLOW_BOX_ACCESSIBLE, GtkFlowBoxAccessibleClass))
|
||||
|
||||
typedef struct _GtkFlowBoxAccessible GtkFlowBoxAccessible;
|
||||
typedef struct _GtkFlowBoxAccessibleClass GtkFlowBoxAccessibleClass;
|
||||
typedef struct _GtkFlowBoxAccessiblePrivate GtkFlowBoxAccessiblePrivate;
|
||||
|
||||
struct _GtkFlowBoxAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkFlowBoxAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkFlowBoxAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_flow_box_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FLOW_BOX_ACCESSIBLE_H__ */
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FLOW_BOX_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_FLOW_BOX_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkflowboxaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_flow_box_accessible_selection_changed (GtkWidget *box);
|
||||
void _gtk_flow_box_accessible_update_cursor (GtkWidget *box,
|
||||
GtkWidget *child);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FLOW_BOX_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkflowboxchildaccessible.h"
|
||||
|
||||
#include "gtk/gtkflowbox.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkFlowBoxChildAccessible, gtk_flow_box_child_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
gtk_flow_box_child_accessible_init (GtkFlowBoxChildAccessible *accessible)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_flow_box_child_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_flow_box_child_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_TABLE_CELL;
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_flow_box_child_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget, *parent;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_flow_box_child_accessible_parent_class)->ref_state_set (obj);
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget != NULL)
|
||||
{
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (gtk_flow_box_get_selection_mode (GTK_FLOW_BOX (parent)) != GTK_SELECTION_NONE)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
|
||||
|
||||
if (gtk_flow_box_child_is_selected (GTK_FLOW_BOX_CHILD (widget)))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
|
||||
}
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_flow_box_child_accessible_class_init (GtkFlowBoxChildAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->initialize = gtk_flow_box_child_accessible_initialize;
|
||||
object_class->ref_state_set = gtk_flow_box_child_accessible_ref_state_set;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FLOW_BOX_CHILD_ACCESSIBLE_H__
|
||||
#define __GTK_FLOW_BOX_CHILD_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE (gtk_flow_box_child_accessible_get_type ())
|
||||
#define GTK_FLOW_BOX_CHILD_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE, GtkFlowBoxChildAccessible))
|
||||
#define GTK_FLOW_BOX_CHILD_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE, GtkFlowBoxChildAccessibleClass))
|
||||
#define GTK_IS_FLOW_BOX_CHILD_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE))
|
||||
#define GTK_IS_FLOW_BOX_CHILD_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE))
|
||||
#define GTK_FLOW_BOX_CHILD_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FLOW_BOX_CHILD_ACCESSIBLE, GtkFlowBoxChildAccessibleClass))
|
||||
|
||||
typedef struct _GtkFlowBoxChildAccessible GtkFlowBoxChildAccessible;
|
||||
typedef struct _GtkFlowBoxChildAccessibleClass GtkFlowBoxChildAccessibleClass;
|
||||
|
||||
struct _GtkFlowBoxChildAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkFlowBoxChildAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_flow_box_child_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FLOW_BOX_CHILD_ACCESSIBLE_H__ */
|
@ -1,65 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkframeaccessible.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkFrameAccessible, gtk_frame_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
gtk_frame_accessible_initialize (AtkObject *accessible,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->initialize (accessible, data);
|
||||
|
||||
accessible->role = ATK_ROLE_PANEL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_frame_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
const char *name;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_frame_accessible_parent_class)->get_name (obj);
|
||||
if (name != NULL)
|
||||
return name;
|
||||
|
||||
return gtk_frame_get_label (GTK_FRAME (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_frame_accessible_class_init (GtkFrameAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gtk_frame_accessible_initialize;
|
||||
class->get_name = gtk_frame_accessible_get_name;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_frame_accessible_init (GtkFrameAccessible *frame)
|
||||
{
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_FRAME_ACCESSIBLE_H__
|
||||
#define __GTK_FRAME_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_FRAME_ACCESSIBLE (gtk_frame_accessible_get_type ())
|
||||
#define GTK_FRAME_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessible))
|
||||
#define GTK_FRAME_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass))
|
||||
#define GTK_IS_FRAME_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_FRAME_ACCESSIBLE))
|
||||
#define GTK_IS_FRAME_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FRAME_ACCESSIBLE))
|
||||
#define GTK_FRAME_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FRAME_ACCESSIBLE, GtkFrameAccessibleClass))
|
||||
|
||||
typedef struct _GtkFrameAccessible GtkFrameAccessible;
|
||||
typedef struct _GtkFrameAccessibleClass GtkFrameAccessibleClass;
|
||||
typedef struct _GtkFrameAccessiblePrivate GtkFrameAccessiblePrivate;
|
||||
|
||||
struct _GtkFrameAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkFrameAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkFrameAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_frame_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_FRAME_ACCESSIBLE_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -1,54 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ICON_VIEW_ACCESSIBLE_H__
|
||||
#define __GTK_ICON_VIEW_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_ICON_VIEW_ACCESSIBLE (gtk_icon_view_accessible_get_type ())
|
||||
#define GTK_ICON_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE, GtkIconViewAccessible))
|
||||
#define GTK_ICON_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ICON_VIEW_ACCESSIBLE, GtkIconViewAccessibleClass))
|
||||
#define GTK_IS_ICON_VIEW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE))
|
||||
#define GTK_IS_ICON_VIEW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ICON_VIEW_ACCESSIBLE))
|
||||
#define GTK_ICON_VIEW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ICON_VIEW_ACCESSIBLE, GtkIconViewAccessibleClass))
|
||||
|
||||
typedef struct _GtkIconViewAccessible GtkIconViewAccessible;
|
||||
typedef struct _GtkIconViewAccessibleClass GtkIconViewAccessibleClass;
|
||||
|
||||
struct _GtkIconViewAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkIconViewAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_icon_view_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ICON_VIEW_ACCESSIBLE_H__ */
|
@ -1,33 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_ICON_VIEW_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_ICON_VIEW_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkiconviewaccessible.h>
|
||||
#include <gtk/gtkiconview.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_icon_view_accessible_adjustment_changed (GtkIconViewAccessible *self);
|
||||
|
||||
void gtk_icon_view_accessible_update_model (GtkIconViewAccessible *self,
|
||||
GtkTreeModel *model);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_ICON_VIEW_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,338 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkimageaccessible.h"
|
||||
#include "gtkimageprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
struct _GtkImageAccessiblePrivate
|
||||
{
|
||||
char *image_description;
|
||||
char *stock_name;
|
||||
};
|
||||
|
||||
static void atk_image_interface_init (AtkImageIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkImageAccessible, gtk_image_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkImageAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
|
||||
|
||||
static void
|
||||
gtk_image_accessible_initialize (AtkObject *accessible,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_image_accessible_parent_class)->initialize (accessible, data);
|
||||
|
||||
accessible->role = ATK_ROLE_ICON;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *label;
|
||||
} NameMapEntry;
|
||||
|
||||
static const NameMapEntry name_map[] = {
|
||||
{ "help-about", NC_("Stock label", "_About") },
|
||||
{ "list-add", NC_("Stock label", "_Add") },
|
||||
{ "format-text-bold", NC_("Stock label", "_Bold") },
|
||||
{ "media-optical", NC_("Stock label", "_CD-ROM") },
|
||||
{ "edit-clear", NC_("Stock label", "_Clear") },
|
||||
{ "window-close", NC_("Stock label", "_Close") },
|
||||
{ "window-minimize", N_("Minimize") },
|
||||
{ "window-maximize", N_("Maximize") },
|
||||
{ "window-restore", N_("Restore") },
|
||||
{ "edit-copy", NC_("Stock label", "_Copy") },
|
||||
{ "edit-cut", NC_("Stock label", "Cu_t") },
|
||||
{ "edit-delete", NC_("Stock label", "_Delete") },
|
||||
{ "dialog-error", NC_("Stock label", "Error") },
|
||||
{ "dialog-information", NC_("Stock label", "Information") },
|
||||
{ "dialog-question", NC_("Stock label", "Question") },
|
||||
{ "dialog-warning", NC_("Stock label", "Warning") },
|
||||
{ "system-run", NC_("Stock label", "_Execute") },
|
||||
{ "text-x-generic", NC_("Stock label", "_File") },
|
||||
{ "edit-find", NC_("Stock label", "_Find") },
|
||||
{ "edit-find-replace", NC_("Stock label", "Find and _Replace") },
|
||||
{ "media-floppy", NC_("Stock label", "_Floppy") },
|
||||
{ "view-fullscreen", NC_("Stock label", "_Fullscreen") },
|
||||
{ "go-bottom", NC_("Stock label, navigation", "_Bottom") },
|
||||
{ "go-first", NC_("Stock label, navigation", "_First") },
|
||||
{ "go-last", NC_("Stock label, navigation", "_Last") },
|
||||
{ "go-top", NC_("Stock label, navigation", "_Top") },
|
||||
{ "go-previous", NC_("Stock label, navigation", "_Back") },
|
||||
{ "go-down", NC_("Stock label, navigation", "_Down") },
|
||||
{ "go-next", NC_("Stock label, navigation", "_Forward") },
|
||||
{ "go-up", NC_("Stock label, navigation", "_Up") },
|
||||
{ "drive-harddisk", NC_("Stock label", "_Hard Disk") },
|
||||
{ "help-contents", NC_("Stock label", "_Help") },
|
||||
{ "go-home", NC_("Stock label", "_Home") },
|
||||
{ "format-indent-more", NC_("Stock label", "Increase Indent") },
|
||||
{ "format-text-italic", NC_("Stock label", "_Italic") },
|
||||
{ "go-jump", NC_("Stock label", "_Jump to") },
|
||||
{ "format-justify-center", NC_("Stock label", "_Center") },
|
||||
{ "format-justify-fill", NC_("Stock label", "_Fill") },
|
||||
{ "format-justify-left", NC_("Stock label", "_Left") },
|
||||
{ "format-justify-right", NC_("Stock label", "_Right") },
|
||||
{ "view-restore", NC_("Stock label", "_Leave Fullscreen") },
|
||||
{ "media-seek-forward", NC_("Stock label, media", "_Forward") },
|
||||
{ "media-skip-forward", NC_("Stock label, media", "_Next") },
|
||||
{ "media-playback-pause", NC_("Stock label, media", "P_ause") },
|
||||
{ "media-playback-start", NC_("Stock label, media", "_Play") },
|
||||
{ "media-skip-backward", NC_("Stock label, media", "Pre_vious") },
|
||||
{ "media-record", NC_("Stock label, media", "_Record") },
|
||||
{ "media-seek-backward", NC_("Stock label, media", "R_ewind") },
|
||||
{ "media-playback-stop", NC_("Stock label, media", "_Stop") },
|
||||
{ "network-idle", NC_("Stock label", "_Network") },
|
||||
{ "document-new", NC_("Stock label", "_New") },
|
||||
{ "document-open", NC_("Stock label", "_Open") },
|
||||
{ "edit-paste", NC_("Stock label", "_Paste") },
|
||||
{ "document-print", NC_("Stock label", "_Print") },
|
||||
{ "document-print-preview", NC_("Stock label", "Print Pre_view") },
|
||||
{ "document-properties", NC_("Stock label", "_Properties") },
|
||||
{ "application-exit", NC_("Stock label", "_Quit") },
|
||||
{ "edit-redo", NC_("Stock label", "_Redo") },
|
||||
{ "view-refresh", NC_("Stock label", "_Refresh") },
|
||||
{ "list-remove", NC_("Stock label", "_Remove") },
|
||||
{ "document-revert", NC_("Stock label", "_Revert") },
|
||||
{ "document-save", NC_("Stock label", "_Save") },
|
||||
{ "document-save-as", NC_("Stock label", "Save _As") },
|
||||
{ "edit-select-all", NC_("Stock label", "Select _All") },
|
||||
{ "view-sort-ascending", NC_("Stock label", "_Ascending") },
|
||||
{ "view-sort-descending", NC_("Stock label", "_Descending") },
|
||||
{ "tools-check-spelling", NC_("Stock label", "_Spell Check") },
|
||||
{ "process-stop", NC_("Stock label", "_Stop") },
|
||||
{ "format-text-strikethrough", NC_("Stock label", "_Strikethrough") },
|
||||
{ "format-text-underline", NC_("Stock label", "_Underline") },
|
||||
{ "edit-undo", NC_("Stock label", "_Undo") },
|
||||
{ "format-indent-less", NC_("Stock label", "Decrease Indent") },
|
||||
{ "zoom-original", NC_("Stock label", "_Normal Size") },
|
||||
{ "zoom-fit-best", NC_("Stock label", "Best _Fit") },
|
||||
{ "zoom-in", NC_("Stock label", "Zoom _In") },
|
||||
{ "zoom-out", NC_("Stock label", "Zoom _Out") }
|
||||
};
|
||||
|
||||
/* GTK+ internal methods */
|
||||
static char *
|
||||
elide_underscores (const char *original)
|
||||
{
|
||||
char *q, *result;
|
||||
const char *p, *end;
|
||||
gsize len;
|
||||
gboolean last_underscore;
|
||||
|
||||
if (!original)
|
||||
return NULL;
|
||||
|
||||
len = strlen (original);
|
||||
q = result = g_malloc (len + 1);
|
||||
last_underscore = FALSE;
|
||||
|
||||
end = original + len;
|
||||
for (p = original; p < end; p++)
|
||||
{
|
||||
if (!last_underscore && *p == '_')
|
||||
last_underscore = TRUE;
|
||||
else
|
||||
{
|
||||
last_underscore = FALSE;
|
||||
if (original + 2 <= p && p + 1 <= end &&
|
||||
p[-2] == '(' && p[-1] == '_' && p[0] != '_' && p[1] == ')')
|
||||
{
|
||||
q--;
|
||||
*q = '\0';
|
||||
p++;
|
||||
}
|
||||
else
|
||||
*q++ = *p;
|
||||
}
|
||||
}
|
||||
|
||||
if (last_underscore)
|
||||
*q++ = '_';
|
||||
|
||||
*q = '\0';
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static char *
|
||||
name_from_icon_name (const char *icon_name)
|
||||
{
|
||||
char *name;
|
||||
const char *label;
|
||||
int i;
|
||||
|
||||
name = g_strdup (icon_name);
|
||||
if (g_str_has_suffix (name, "-symbolic"))
|
||||
name[strlen (name) - strlen ("-symbolic")] = '\0';
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (name_map); i++)
|
||||
{
|
||||
if (g_str_equal (name, name_map[i].name))
|
||||
{
|
||||
label = g_dpgettext2 (GETTEXT_PACKAGE, "Stock label", name_map[i].label);
|
||||
g_free (name);
|
||||
|
||||
return elide_underscores (label);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkImageAccessible *aimage = GTK_IMAGE_ACCESSIBLE (object);
|
||||
|
||||
g_free (aimage->priv->image_description);
|
||||
g_free (aimage->priv->stock_name);
|
||||
|
||||
G_OBJECT_CLASS (gtk_image_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_image_accessible_get_name (AtkObject *accessible)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
GtkImage *image;
|
||||
GtkImageAccessible *image_accessible;
|
||||
const char *name;
|
||||
GtkImageType storage_type;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_image_accessible_parent_class)->get_name (accessible);
|
||||
if (name)
|
||||
return name;
|
||||
|
||||
image = GTK_IMAGE (widget);
|
||||
image_accessible = GTK_IMAGE_ACCESSIBLE (accessible);
|
||||
|
||||
g_free (image_accessible->priv->stock_name);
|
||||
image_accessible->priv->stock_name = NULL;
|
||||
|
||||
storage_type = gtk_image_get_storage_type (image);
|
||||
|
||||
if (storage_type == GTK_IMAGE_ICON_NAME)
|
||||
{
|
||||
image_accessible->priv->stock_name = name_from_icon_name (gtk_image_get_icon_name (image));
|
||||
}
|
||||
else if (storage_type == GTK_IMAGE_GICON)
|
||||
{
|
||||
GIcon *icon;
|
||||
const char * const *icon_names;
|
||||
|
||||
icon = gtk_image_get_gicon (image);
|
||||
if (G_IS_THEMED_ICON (icon))
|
||||
{
|
||||
icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon));
|
||||
image_accessible->priv->stock_name = name_from_icon_name (icon_names[0]);
|
||||
}
|
||||
}
|
||||
|
||||
return image_accessible->priv->stock_name;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_accessible_class_init (GtkImageAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gtk_image_accessible_finalize;
|
||||
class->initialize = gtk_image_accessible_initialize;
|
||||
class->get_name = gtk_image_accessible_get_name;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_accessible_init (GtkImageAccessible *image)
|
||||
{
|
||||
image->priv = gtk_image_accessible_get_instance_private (image);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_image_accessible_get_image_description (AtkImage *image)
|
||||
{
|
||||
GtkImageAccessible *accessible = GTK_IMAGE_ACCESSIBLE (image);
|
||||
|
||||
return accessible->priv->image_description;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_accessible_get_image_position (AtkImage *image,
|
||||
int *x,
|
||||
int *y,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL,
|
||||
coord_type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_accessible_get_image_size (AtkImage *image,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
GtkImage *gtk_image;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
if (widget == NULL)
|
||||
{
|
||||
*height = -1;
|
||||
*width = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_image = GTK_IMAGE (widget);
|
||||
|
||||
if (gtk_image_get_storage_type (gtk_image) != GTK_IMAGE_EMPTY)
|
||||
gtk_image_get_image_size (gtk_image, width, height);
|
||||
else
|
||||
{
|
||||
*height = 0;
|
||||
*width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_image_accessible_set_image_description (AtkImage *image,
|
||||
const char *description)
|
||||
{
|
||||
GtkImageAccessible* accessible = GTK_IMAGE_ACCESSIBLE (image);
|
||||
|
||||
g_free (accessible->priv->image_description);
|
||||
accessible->priv->image_description = g_strdup (description);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_image_interface_init (AtkImageIface *iface)
|
||||
{
|
||||
iface->get_image_description = gtk_image_accessible_get_image_description;
|
||||
iface->get_image_position = gtk_image_accessible_get_image_position;
|
||||
iface->get_image_size = gtk_image_accessible_get_image_size;
|
||||
iface->set_image_description = gtk_image_accessible_set_image_description;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_IMAGE_ACCESSIBLE_H__
|
||||
#define __GTK_IMAGE_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_IMAGE_ACCESSIBLE (gtk_image_accessible_get_type ())
|
||||
#define GTK_IMAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessible))
|
||||
#define GTK_IMAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessibleClass))
|
||||
#define GTK_IS_IMAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE_ACCESSIBLE))
|
||||
#define GTK_IS_IMAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_ACCESSIBLE))
|
||||
#define GTK_IMAGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessibleClass))
|
||||
|
||||
typedef struct _GtkImageAccessible GtkImageAccessible;
|
||||
typedef struct _GtkImageAccessibleClass GtkImageAccessibleClass;
|
||||
typedef struct _GtkImageAccessiblePrivate GtkImageAccessiblePrivate;
|
||||
|
||||
struct _GtkImageAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkImageAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkImageAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_image_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_IMAGE_ACCESSIBLE_H__ */
|
@ -1,123 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkimagecellaccessible.h"
|
||||
|
||||
struct _GtkImageCellAccessiblePrivate
|
||||
{
|
||||
char *image_description;
|
||||
};
|
||||
|
||||
static void atk_image_interface_init (AtkImageIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkImageCellAccessible, gtk_image_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkImageCellAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, atk_image_interface_init))
|
||||
|
||||
static void
|
||||
gtk_image_cell_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (object);
|
||||
|
||||
g_free (image_cell->priv->image_description);
|
||||
G_OBJECT_CLASS (gtk_image_cell_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_cell_accessible_class_init (GtkImageCellAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gtk_image_cell_accessible_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_cell_accessible_init (GtkImageCellAccessible *image_cell)
|
||||
{
|
||||
image_cell->priv = gtk_image_cell_accessible_get_instance_private (image_cell);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_image_cell_accessible_get_image_description (AtkImage *image)
|
||||
{
|
||||
GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
|
||||
|
||||
return image_cell->priv->image_description;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_image_cell_accessible_set_image_description (AtkImage *image,
|
||||
const char *description)
|
||||
{
|
||||
GtkImageCellAccessible *image_cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
|
||||
|
||||
g_free (image_cell->priv->image_description);
|
||||
image_cell->priv->image_description = g_strdup (description);
|
||||
|
||||
if (image_cell->priv->image_description)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_cell_accessible_get_image_position (AtkImage *image,
|
||||
int *x,
|
||||
int *y,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL,
|
||||
coord_type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_image_cell_accessible_get_image_size (AtkImage *image,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkImageCellAccessible *cell = GTK_IMAGE_CELL_ACCESSIBLE (image);
|
||||
GtkCellRenderer *cell_renderer;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
g_object_get (cell, "renderer", &cell_renderer, NULL);
|
||||
g_object_get (cell_renderer,
|
||||
"pixbuf", &pixbuf,
|
||||
NULL);
|
||||
g_object_unref (cell_renderer);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
*width = gdk_pixbuf_get_width (pixbuf);
|
||||
*height = gdk_pixbuf_get_height (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_image_interface_init (AtkImageIface *iface)
|
||||
{
|
||||
iface->get_image_description = gtk_image_cell_accessible_get_image_description;
|
||||
iface->set_image_description = gtk_image_cell_accessible_set_image_description;
|
||||
iface->get_image_position = gtk_image_cell_accessible_get_image_position;
|
||||
iface->get_image_size = gtk_image_cell_accessible_get_image_size;
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_IMAGE_CELL_ACCESSIBLE_H__
|
||||
#define __GTK_IMAGE_CELL_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/a11y/gtkrenderercellaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_IMAGE_CELL_ACCESSIBLE (gtk_image_cell_accessible_get_type ())
|
||||
#define GTK_IMAGE_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IMAGE_CELL_ACCESSIBLE, GtkImageCellAccessible))
|
||||
#define GTK_IMAGE_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_IMAGE_CELL_ACCESSIBLE, GtkImageCellAccessibleClass))
|
||||
#define GTK_IS_IMAGE_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IMAGE_CELL_ACCESSIBLE))
|
||||
#define GTK_IS_IMAGE_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_CELL_ACCESSIBLE))
|
||||
#define GTK_IMAGE_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_CELL_ACCESSIBLE, GtkImageCellAccessibleClass))
|
||||
|
||||
typedef struct _GtkImageCellAccessible GtkImageCellAccessible;
|
||||
typedef struct _GtkImageCellAccessibleClass GtkImageCellAccessibleClass;
|
||||
typedef struct _GtkImageCellAccessiblePrivate GtkImageCellAccessiblePrivate;
|
||||
|
||||
struct _GtkImageCellAccessible
|
||||
{
|
||||
GtkRendererCellAccessible parent;
|
||||
|
||||
GtkImageCellAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkImageCellAccessibleClass
|
||||
{
|
||||
GtkRendererCellAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_image_cell_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_IMAGE_CELL_ACCESSIBLE_H__ */
|
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LABEL_ACCESSIBLE_H__
|
||||
#define __GTK_LABEL_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_LABEL_ACCESSIBLE (gtk_label_accessible_get_type ())
|
||||
#define GTK_LABEL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LABEL_ACCESSIBLE, GtkLabelAccessible))
|
||||
#define GTK_LABEL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LABEL_ACCESSIBLE, GtkLabelAccessibleClass))
|
||||
#define GTK_IS_LABEL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LABEL_ACCESSIBLE))
|
||||
#define GTK_IS_LABEL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LABEL_ACCESSIBLE))
|
||||
#define GTK_LABEL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LABEL_ACCESSIBLE, GtkLabelAccessibleClass))
|
||||
|
||||
typedef struct _GtkLabelAccessible GtkLabelAccessible;
|
||||
typedef struct _GtkLabelAccessibleClass GtkLabelAccessibleClass;
|
||||
typedef struct _GtkLabelAccessiblePrivate GtkLabelAccessiblePrivate;
|
||||
|
||||
struct _GtkLabelAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkLabelAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkLabelAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_label_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LABEL_ACCESSIBLE_H__ */
|
@ -1,34 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright (C) 2002, 2004 Anders Carlsson <andersca@gnu.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LABEL_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_LABEL_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtklabelaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_label_accessible_text_deleted (GtkLabel *label);
|
||||
void _gtk_label_accessible_text_inserted (GtkLabel *label);
|
||||
void _gtk_label_accessible_update_links (GtkLabel *label);
|
||||
void _gtk_label_accessible_focus_link_changed (GtkLabel *label);
|
||||
void _gtk_label_accessible_selection_bound_changed (GtkLabel *label);
|
||||
void _gtk_label_accessible_cursor_position_changed (GtkLabel *label);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LABEL_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,178 +0,0 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2001, 2002, 2003 Sun Microsystems Inc.
|
||||
* Copyright 2013 SUSE LLC.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtklevelbaraccessible.h"
|
||||
|
||||
#include "gtklevelbar.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkLevelBarAccessible, gtk_level_bar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
on_value_changed (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkLevelBarAccessible *self = user_data;
|
||||
|
||||
g_object_notify (G_OBJECT (self), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_initialize (AtkObject *object,
|
||||
gpointer data)
|
||||
{
|
||||
GtkLevelBar *level_bar = data;
|
||||
|
||||
g_signal_connect (level_bar, "notify::value", G_CALLBACK (on_value_changed), object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_class_init (GtkLevelBarAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->initialize = gtk_level_bar_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_init (GtkLevelBarAccessible *self)
|
||||
{
|
||||
ATK_OBJECT (self)->role = ATK_ROLE_LEVEL_BAR;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_level_bar_get_value (level_bar));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_level_bar_get_max_value (level_bar));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_level_bar_get_min_value (level_bar));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_level_bar_accessible_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
gtk_level_bar_set_value (level_bar, g_value_get_double (value));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_get_value_and_text (AtkValue *obj,
|
||||
double *value,
|
||||
char **text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
*value = gtk_level_bar_get_value (level_bar);
|
||||
*text = NULL;
|
||||
}
|
||||
|
||||
static AtkRange *
|
||||
gtk_level_bar_accessible_get_range (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
return atk_range_new (gtk_level_bar_get_min_value (level_bar),
|
||||
gtk_level_bar_get_max_value (level_bar),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_level_bar_accessible_set_value (AtkValue *obj,
|
||||
const double value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkLevelBar *level_bar;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
level_bar = GTK_LEVEL_BAR (widget);
|
||||
|
||||
gtk_level_bar_set_value (level_bar, value);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_level_bar_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_level_bar_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_level_bar_accessible_get_minimum_value;
|
||||
iface->set_current_value = gtk_level_bar_accessible_set_current_value;
|
||||
|
||||
iface->get_value_and_text = gtk_level_bar_accessible_get_value_and_text;
|
||||
iface->get_range = gtk_level_bar_accessible_get_range;
|
||||
iface->set_value = gtk_level_bar_accessible_set_value;
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
/* GAIL - The GNOME Accessibility Implementation Library
|
||||
* Copyright 2001 Sun Microsystems Inc.
|
||||
* Copyright 2013 SUSE LLC.
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LEVEL_BAR_ACCESSIBLE_H__
|
||||
#define __GTK_LEVEL_BAR_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_LEVEL_BAR_ACCESSIBLE (gtk_level_bar_accessible_get_type ())
|
||||
#define GTK_LEVEL_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LEVEL_BAR_ACCESSIBLE, GtkLevelBarAccessible))
|
||||
#define GTK_LEVEL_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LEVEL_BAR_ACCESSIBLE, GtkLevelBarAccessibleClass))
|
||||
#define GTK_IS_LEVEL_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LEVEL_BAR_ACCESSIBLE))
|
||||
#define GTK_IS_LEVEL_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LEVEL_BAR_ACCESSIBLE))
|
||||
#define GTK_LEVEL_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LEVEL_BAR_ACCESSIBLE, GtkLevelBarAccessibleClass))
|
||||
|
||||
typedef struct _GtkLevelBarAccessible GtkLevelBarAccessible;
|
||||
typedef struct _GtkLevelBarAccessibleClass GtkLevelBarAccessibleClass;
|
||||
typedef struct _GtkLevelBarAccessiblePrivate GtkLevelBarAccessiblePrivate;
|
||||
|
||||
struct _GtkLevelBarAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkLevelBarAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkLevelBarAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_level_bar_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LEVEL_BAR_ACCESSIBLE_H__ */
|
@ -1,234 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2011 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtklinkbuttonaccessible.h"
|
||||
|
||||
typedef struct _GtkLinkButtonAccessibleLink GtkLinkButtonAccessibleLink;
|
||||
typedef struct _GtkLinkButtonAccessibleLinkClass GtkLinkButtonAccessibleLinkClass;
|
||||
|
||||
struct _GtkLinkButtonAccessiblePrivate
|
||||
{
|
||||
AtkHyperlink *link;
|
||||
};
|
||||
|
||||
struct _GtkLinkButtonAccessibleLink
|
||||
{
|
||||
AtkHyperlink parent;
|
||||
|
||||
GtkLinkButtonAccessible *button;
|
||||
};
|
||||
|
||||
struct _GtkLinkButtonAccessibleLinkClass
|
||||
{
|
||||
AtkHyperlinkClass parent_class;
|
||||
};
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
GType _gtk_link_button_accessible_link_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkLinkButtonAccessibleLink, _gtk_link_button_accessible_link, ATK_TYPE_HYPERLINK,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
|
||||
|
||||
static AtkHyperlink *
|
||||
gtk_link_button_accessible_link_new (GtkLinkButtonAccessible *button)
|
||||
{
|
||||
GtkLinkButtonAccessibleLink *l;
|
||||
|
||||
l = g_object_new (_gtk_link_button_accessible_link_get_type (), NULL);
|
||||
l->button = button;
|
||||
|
||||
return ATK_HYPERLINK (l);
|
||||
}
|
||||
|
||||
static char *
|
||||
gtk_link_button_accessible_link_get_uri (AtkHyperlink *atk_link,
|
||||
int i)
|
||||
{
|
||||
GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)atk_link;
|
||||
GtkWidget *widget;
|
||||
const char *uri;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (l->button));
|
||||
uri = gtk_link_button_get_uri (GTK_LINK_BUTTON (widget));
|
||||
|
||||
return g_strdup (uri);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_link_button_accessible_link_get_n_anchors (AtkHyperlink *atk_link)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_link_button_accessible_link_is_valid (AtkHyperlink *atk_link)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_link_button_accessible_link_get_object (AtkHyperlink *atk_link,
|
||||
int i)
|
||||
{
|
||||
GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)atk_link;
|
||||
|
||||
return ATK_OBJECT (l->button);
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_link_button_accessible_link_init (GtkLinkButtonAccessibleLink *l)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
_gtk_link_button_accessible_link_class_init (GtkLinkButtonAccessibleLinkClass *class)
|
||||
{
|
||||
AtkHyperlinkClass *atk_link_class = ATK_HYPERLINK_CLASS (class);
|
||||
|
||||
atk_link_class->get_uri = gtk_link_button_accessible_link_get_uri;
|
||||
atk_link_class->get_n_anchors = gtk_link_button_accessible_link_get_n_anchors;
|
||||
atk_link_class->is_valid = gtk_link_button_accessible_link_is_valid;
|
||||
atk_link_class->get_object = gtk_link_button_accessible_link_get_object;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_link_button_accessible_link_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkLinkButtonAccessibleLink *l = (GtkLinkButtonAccessibleLink *)action;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_WIDGET (l->button);
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (i != 0)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||
return FALSE;
|
||||
|
||||
g_signal_emit_by_name (widget, "clicked");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_link_button_accessible_link_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_link_button_accessible_link_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
return "activate";
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_link_button_accessible_link_do_action;
|
||||
iface->get_n_actions = gtk_link_button_accessible_link_get_n_actions;
|
||||
iface->get_name = gtk_link_button_accessible_link_get_name;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
activate_link (GtkLinkButton *button,
|
||||
AtkHyperlink *atk_link)
|
||||
{
|
||||
g_signal_emit_by_name (atk_link, "link-activated");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static AtkHyperlink *
|
||||
gtk_link_button_accessible_get_hyperlink (AtkHyperlinkImpl *impl)
|
||||
{
|
||||
GtkLinkButtonAccessible *button = GTK_LINK_BUTTON_ACCESSIBLE (impl);
|
||||
|
||||
if (!button->priv->link)
|
||||
{
|
||||
button->priv->link = gtk_link_button_accessible_link_new (button);
|
||||
g_signal_connect (gtk_accessible_get_widget (GTK_ACCESSIBLE (button)),
|
||||
"activate-link", G_CALLBACK (activate_link), button->priv->link);
|
||||
}
|
||||
|
||||
return g_object_ref (button->priv->link);
|
||||
}
|
||||
|
||||
static void atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkLinkButtonAccessible, gtk_link_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkLinkButtonAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_HYPERLINK_IMPL, atk_hypertext_impl_interface_init))
|
||||
|
||||
static void
|
||||
gtk_link_button_accessible_init (GtkLinkButtonAccessible *button)
|
||||
{
|
||||
button->priv = gtk_link_button_accessible_get_instance_private (button);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_link_button_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkLinkButtonAccessible *button = GTK_LINK_BUTTON_ACCESSIBLE (object);
|
||||
|
||||
if (button->priv->link)
|
||||
g_object_unref (button->priv->link);
|
||||
|
||||
G_OBJECT_CLASS (gtk_link_button_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_link_button_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_link_button_accessible_parent_class)->ref_state_set (accessible);
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
if (widget != NULL)
|
||||
{
|
||||
if (gtk_link_button_get_visited (GTK_LINK_BUTTON (widget)))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_VISITED);
|
||||
}
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_link_button_accessible_class_init (GtkLinkButtonAccessibleClass *klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->finalize = gtk_link_button_accessible_finalize;
|
||||
ATK_OBJECT_CLASS (klass)->ref_state_set = gtk_link_button_ref_state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_hypertext_impl_interface_init (AtkHyperlinkImplIface *iface)
|
||||
{
|
||||
iface->get_hyperlink = gtk_link_button_accessible_get_hyperlink;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2011 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LINK_BUTTON_ACCESSIBLE_H__
|
||||
#define __GTK_LINK_BUTTON_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkbuttonaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_LINK_BUTTON_ACCESSIBLE (gtk_link_button_accessible_get_type ())
|
||||
#define GTK_LINK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessible))
|
||||
#define GTK_LINK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessibleClass))
|
||||
#define GTK_IS_LINK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE))
|
||||
#define GTK_IS_LINK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LINK_BUTTON_ACCESSIBLE))
|
||||
#define GTK_LINK_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LINK_BUTTON_ACCESSIBLE, GtkLinkButtonAccessibleClass))
|
||||
|
||||
typedef struct _GtkLinkButtonAccessible GtkLinkButtonAccessible;
|
||||
typedef struct _GtkLinkButtonAccessibleClass GtkLinkButtonAccessibleClass;
|
||||
typedef struct _GtkLinkButtonAccessiblePrivate GtkLinkButtonAccessiblePrivate;
|
||||
|
||||
struct _GtkLinkButtonAccessible
|
||||
{
|
||||
GtkButtonAccessible parent;
|
||||
|
||||
GtkLinkButtonAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkLinkButtonAccessibleClass
|
||||
{
|
||||
GtkButtonAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_link_button_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LINK_BUTTON_ACCESSIBLE_H__ */
|
@ -1,248 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtklistboxaccessibleprivate.h"
|
||||
|
||||
#include "gtk/gtklistbox.h"
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkListBoxAccessible, gtk_list_box_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
|
||||
|
||||
static void
|
||||
gtk_list_box_accessible_init (GtkListBoxAccessible *accessible)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_list_box_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_LIST_BOX;
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gtk_list_box_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_list_box_accessible_parent_class)->ref_state_set (obj);
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
|
||||
if (widget != NULL)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_MANAGES_DESCENDANTS);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_accessible_class_init (GtkListBoxAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->initialize = gtk_list_box_accessible_initialize;
|
||||
object_class->ref_state_set = gtk_list_box_accessible_ref_state_set;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_list_box_accessible_add_selection (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkListBoxRow *row;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (box), idx);
|
||||
if (row)
|
||||
{
|
||||
gtk_list_box_select_row (GTK_LIST_BOX (box), row);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_list_box_accessible_remove_selection (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkListBoxRow *row;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (box), idx);
|
||||
if (row)
|
||||
{
|
||||
gtk_list_box_unselect_row (GTK_LIST_BOX (box), row);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_list_box_accessible_clear_selection (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *box;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_list_box_unselect_all (GTK_LIST_BOX (box));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_list_box_accessible_select_all (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *box;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_list_box_select_all (GTK_LIST_BOX (box));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int idx;
|
||||
GtkWidget *row;
|
||||
} FindSelectedData;
|
||||
|
||||
static void
|
||||
find_selected_row (GtkListBox *box,
|
||||
GtkListBoxRow *row,
|
||||
gpointer data)
|
||||
{
|
||||
FindSelectedData *d = data;
|
||||
|
||||
if (d->idx == 0)
|
||||
{
|
||||
if (d->row == NULL)
|
||||
d->row = GTK_WIDGET (row);
|
||||
}
|
||||
else
|
||||
d->idx -= 1;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_list_box_accessible_ref_selection (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
AtkObject *accessible;
|
||||
FindSelectedData data;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return NULL;
|
||||
|
||||
data.idx = idx;
|
||||
data.row = NULL;
|
||||
gtk_list_box_selected_foreach (GTK_LIST_BOX (box), find_selected_row, &data);
|
||||
|
||||
if (data.row == NULL)
|
||||
return NULL;
|
||||
|
||||
accessible = gtk_widget_get_accessible (data.row);
|
||||
g_object_ref (accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static void
|
||||
count_selected (GtkListBox *box,
|
||||
GtkListBoxRow *row,
|
||||
gpointer data)
|
||||
{
|
||||
int *count = data;
|
||||
*count += 1;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_list_box_accessible_get_selection_count (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *box;
|
||||
int count;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return 0;
|
||||
|
||||
count = 0;
|
||||
gtk_list_box_selected_foreach (GTK_LIST_BOX (box), count_selected, &count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_list_box_accessible_is_child_selected (AtkSelection *selection,
|
||||
int idx)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkListBoxRow *row;
|
||||
|
||||
box = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (box == NULL)
|
||||
return FALSE;
|
||||
|
||||
row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (box), idx);
|
||||
|
||||
return gtk_list_box_row_is_selected (row);
|
||||
}
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface)
|
||||
{
|
||||
iface->add_selection = gtk_list_box_accessible_add_selection;
|
||||
iface->remove_selection = gtk_list_box_accessible_remove_selection;
|
||||
iface->clear_selection = gtk_list_box_accessible_clear_selection;
|
||||
iface->ref_selection = gtk_list_box_accessible_ref_selection;
|
||||
iface->get_selection_count = gtk_list_box_accessible_get_selection_count;
|
||||
iface->is_child_selected = gtk_list_box_accessible_is_child_selected;
|
||||
iface->select_all_selection = gtk_list_box_accessible_select_all;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_list_box_accessible_selection_changed (GtkListBox *box)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
accessible = gtk_widget_get_accessible (GTK_WIDGET (box));
|
||||
g_signal_emit_by_name (accessible, "selection-changed");
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_list_box_accessible_update_cursor (GtkListBox *box,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
AtkObject *descendant;
|
||||
accessible = gtk_widget_get_accessible (GTK_WIDGET (box));
|
||||
descendant = row ? gtk_widget_get_accessible (GTK_WIDGET (row)) : NULL;
|
||||
g_signal_emit_by_name (accessible, "active-descendant-changed", descendant);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LIST_BOX_ACCESSIBLE_H__
|
||||
#define __GTK_LIST_BOX_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_LIST_BOX_ACCESSIBLE (gtk_list_box_accessible_get_type ())
|
||||
#define GTK_LIST_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_BOX_ACCESSIBLE, GtkListBoxAccessible))
|
||||
#define GTK_LIST_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_BOX_ACCESSIBLE, GtkListBoxAccessibleClass))
|
||||
#define GTK_IS_LIST_BOX_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_BOX_ACCESSIBLE))
|
||||
#define GTK_IS_LIST_BOX_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_BOX_ACCESSIBLE))
|
||||
#define GTK_LIST_BOX_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_BOX_ACCESSIBLE, GtkListBoxAccessibleClass))
|
||||
|
||||
typedef struct _GtkListBoxAccessible GtkListBoxAccessible;
|
||||
typedef struct _GtkListBoxAccessibleClass GtkListBoxAccessibleClass;
|
||||
typedef struct _GtkListBoxAccessiblePrivate GtkListBoxAccessiblePrivate;
|
||||
|
||||
struct _GtkListBoxAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkListBoxAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkListBoxAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_list_box_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LIST_BOX_ACCESSIBLE_H__ */
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LIST_BOX_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_LIST_BOX_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtklistboxaccessible.h>
|
||||
|
||||
#include <gtk/gtklistbox.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_list_box_accessible_update_cursor (GtkListBox *box,
|
||||
GtkListBoxRow *row);
|
||||
void _gtk_list_box_accessible_selection_changed (GtkListBox *box);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LIST_BOX_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtklistboxrowaccessible.h"
|
||||
|
||||
#include "gtk/gtklistbox.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkListBoxRowAccessible, gtk_list_box_row_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
gtk_list_box_row_accessible_init (GtkListBoxRowAccessible *accessible)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_row_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_list_box_row_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
obj->role = ATK_ROLE_LIST_ITEM;
|
||||
}
|
||||
|
||||
static AtkStateSet*
|
||||
gtk_list_box_row_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget, *parent;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_list_box_row_accessible_parent_class)->ref_state_set (obj);
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget != NULL)
|
||||
{
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (parent != NULL &&
|
||||
GTK_IS_LIST_BOX (parent) &&
|
||||
gtk_list_box_get_selection_mode (GTK_LIST_BOX (parent)) != GTK_SELECTION_NONE)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
|
||||
|
||||
if (gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW (widget)))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
|
||||
}
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_row_accessible_class_init (GtkListBoxRowAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->initialize = gtk_list_box_row_accessible_initialize;
|
||||
object_class->ref_state_set = gtk_list_box_row_accessible_ref_state_set;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Red Hat, 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LIST_BOX_ROW_ACCESSIBLE_H__
|
||||
#define __GTK_LIST_BOX_ROW_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE (gtk_list_box_row_accessible_get_type ())
|
||||
#define GTK_LIST_BOX_ROW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE, GtkListBoxRowAccessible))
|
||||
#define GTK_LIST_BOX_ROW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE, GtkListBoxRowAccessibleClass))
|
||||
#define GTK_IS_LIST_BOX_ROW_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE))
|
||||
#define GTK_IS_LIST_BOX_ROW_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE))
|
||||
#define GTK_LIST_BOX_ROW_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LIST_BOX_ROW_ACCESSIBLE, GtkListBoxRowAccessibleClass))
|
||||
|
||||
typedef struct _GtkListBoxRowAccessible GtkListBoxRowAccessible;
|
||||
typedef struct _GtkListBoxRowAccessibleClass GtkListBoxRowAccessibleClass;
|
||||
|
||||
struct _GtkListBoxRowAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkListBoxRowAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_list_box_row_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LIST_BOX_ROW_ACCESSIBLE_H__ */
|
@ -1,63 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtklockbuttonaccessibleprivate.h"
|
||||
|
||||
#include "gtk/gtklockbuttonprivate.h"
|
||||
#include "gtk/gtkwidgetprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkLockButtonAccessible, gtk_lock_button_accessible, GTK_TYPE_BUTTON_ACCESSIBLE)
|
||||
|
||||
static const char *
|
||||
gtk_lock_button_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
GtkLockButton *lockbutton;
|
||||
|
||||
lockbutton = GTK_LOCK_BUTTON (gtk_accessible_get_widget (GTK_ACCESSIBLE (obj)));
|
||||
if (lockbutton == NULL)
|
||||
return NULL;
|
||||
|
||||
return _gtk_lock_button_get_current_text (lockbutton);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_lock_button_accessible_class_init (GtkLockButtonAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
atk_object_class->get_name = gtk_lock_button_accessible_get_name;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_lock_button_accessible_init (GtkLockButtonAccessible *lockbutton)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton)
|
||||
{
|
||||
AtkObject *obj;
|
||||
|
||||
obj = _gtk_widget_peek_accessible (GTK_WIDGET (lockbutton));
|
||||
if (obj == NULL)
|
||||
return;
|
||||
|
||||
g_object_notify (G_OBJECT (obj), "accessible-name");
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LOCK_BUTTON_ACCESSIBLE_H__
|
||||
#define __GTK_LOCK_BUTTON_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkbuttonaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_LOCK_BUTTON_ACCESSIBLE (gtk_lock_button_accessible_get_type ())
|
||||
#define GTK_LOCK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE, GtkLockButtonAccessible))
|
||||
#define GTK_LOCK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE, GtkLockButtonAccessibleClass))
|
||||
#define GTK_IS_LOCK_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE))
|
||||
#define GTK_IS_LOCK_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE))
|
||||
#define GTK_LOCK_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_LOCK_BUTTON_ACCESSIBLE, GtkLockButtonAccessibleClass))
|
||||
|
||||
typedef struct _GtkLockButtonAccessible GtkLockButtonAccessible;
|
||||
typedef struct _GtkLockButtonAccessibleClass GtkLockButtonAccessibleClass;
|
||||
typedef struct _GtkLockButtonAccessiblePrivate GtkLockButtonAccessiblePrivate;
|
||||
|
||||
struct _GtkLockButtonAccessible
|
||||
{
|
||||
GtkButtonAccessible parent;
|
||||
|
||||
GtkLockButtonAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkLockButtonAccessibleClass
|
||||
{
|
||||
GtkButtonAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_lock_button_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LOCK_BUTTON_ACCESSIBLE_H__ */
|
@ -1,31 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_LOCK_BUTTON_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_LOCK_BUTTON_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtklockbuttonaccessible.h>
|
||||
|
||||
#include <gtk/gtklockbutton.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_lock_button_accessible_name_changed (GtkLockButton *lockbutton);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LOCK_BUTTON_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,117 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkmenubuttonaccessible.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkMenuButtonAccessible, gtk_menu_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
gtk_menu_button_accessible_initialize (AtkObject *accessible,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->initialize (accessible, data);
|
||||
|
||||
accessible->role = ATK_ROLE_TOGGLE_BUTTON;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_menu_button_accessible_get_n_children (AtkObject* obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
int count = 0;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return count;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_menu_button_accessible_ref_child (AtkObject *obj,
|
||||
int i)
|
||||
{
|
||||
AtkObject *accessible = NULL;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_menu_button_accessible_get_name (AtkObject *obj)
|
||||
{
|
||||
const char *name = NULL;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->get_name (obj);
|
||||
if (name != NULL)
|
||||
return name;
|
||||
|
||||
return _("Menu");
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_menu_button_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *button;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
button = gtk_widget_get_first_child (widget);
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_menu_button_accessible_parent_class)->ref_state_set (obj);
|
||||
|
||||
atk_state_set_add_state (state_set, ATK_STATE_FOCUSABLE);
|
||||
if (gtk_widget_has_focus (button))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_FOCUSED);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_button_accessible_class_init (GtkMenuButtonAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_name = gtk_menu_button_accessible_get_name;
|
||||
class->initialize = gtk_menu_button_accessible_initialize;
|
||||
class->get_n_children = gtk_menu_button_accessible_get_n_children;
|
||||
class->ref_child = gtk_menu_button_accessible_ref_child;
|
||||
class->ref_state_set = gtk_menu_button_accessible_ref_state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_button_accessible_init (GtkMenuButtonAccessible *menu_button)
|
||||
{
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_MENU_BUTTON_ACCESSIBLE_H__
|
||||
#define __GTK_MENU_BUTTON_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_MENU_BUTTON_ACCESSIBLE (gtk_menu_button_accessible_get_type ())
|
||||
#define GTK_MENU_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_BUTTON_ACCESSIBLE, GtkMenuButtonAccessible))
|
||||
#define GTK_MENU_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_BUTTON_ACCESSIBLE, GtkMenuButtonAccessibleClass))
|
||||
#define GTK_IS_MENU_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_BUTTON_ACCESSIBLE))
|
||||
#define GTK_IS_MENU_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_BUTTON_ACCESSIBLE))
|
||||
#define GTK_MENU_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_BUTTON_ACCESSIBLE, GtkMenuButtonAccessibleClass))
|
||||
|
||||
typedef struct _GtkMenuButtonAccessible GtkMenuButtonAccessible;
|
||||
typedef struct _GtkMenuButtonAccessibleClass GtkMenuButtonAccessibleClass;
|
||||
typedef struct _GtkMenuButtonAccessiblePrivate GtkMenuButtonAccessiblePrivate;
|
||||
|
||||
struct _GtkMenuButtonAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkMenuButtonAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkMenuButtonAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_menu_button_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_MENU_BUTTON_ACCESSIBLE_H__ */
|
@ -1,312 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtknotebookaccessibleprivate.h"
|
||||
|
||||
#include "gtknotebookpageaccessible.h"
|
||||
#include "gtknotebook.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
struct _GtkNotebookAccessiblePrivate
|
||||
{
|
||||
/*
|
||||
* page_cache maintains a list of pre-ref'd Notebook Pages.
|
||||
* This cache is queried by gtk_notebook_accessible_ref_child().
|
||||
* If the page is found in the list then a new page does not
|
||||
* need to be created
|
||||
*/
|
||||
GHashTable * pages;
|
||||
int selected_page;
|
||||
};
|
||||
|
||||
static void atk_selection_interface_init (AtkSelectionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkNotebookAccessible, gtk_notebook_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkNotebookAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_SELECTION, atk_selection_interface_init))
|
||||
|
||||
static void
|
||||
create_notebook_page_accessible (GtkNotebookAccessible *accessible,
|
||||
GtkNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
int page_num)
|
||||
{
|
||||
AtkObject *obj;
|
||||
|
||||
obj = gtk_notebook_page_accessible_new (accessible, child);
|
||||
g_hash_table_insert (accessible->priv->pages, child, obj);
|
||||
atk_object_set_parent (obj, ATK_OBJECT (accessible));
|
||||
g_signal_emit_by_name (accessible, "children-changed::add", page_num, obj, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
page_added_cb (GtkNotebook *notebook,
|
||||
GtkWidget *child,
|
||||
guint page_num,
|
||||
gpointer data)
|
||||
{
|
||||
AtkObject *atk_obj;
|
||||
GtkNotebookAccessible *accessible;
|
||||
|
||||
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (notebook));
|
||||
accessible = GTK_NOTEBOOK_ACCESSIBLE (atk_obj);
|
||||
create_notebook_page_accessible (accessible, notebook, child, page_num);
|
||||
}
|
||||
|
||||
static void
|
||||
page_removed_cb (GtkNotebook *notebook,
|
||||
GtkWidget *widget,
|
||||
guint page_num,
|
||||
gpointer data)
|
||||
{
|
||||
GtkNotebookAccessible *accessible;
|
||||
AtkObject *obj;
|
||||
|
||||
accessible = GTK_NOTEBOOK_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (notebook)));
|
||||
|
||||
obj = g_hash_table_lookup (accessible->priv->pages, widget);
|
||||
g_return_if_fail (obj);
|
||||
g_signal_emit_by_name (accessible, "children-changed::remove",
|
||||
page_num, obj, NULL);
|
||||
gtk_notebook_page_accessible_invalidate (GTK_NOTEBOOK_PAGE_ACCESSIBLE (obj));
|
||||
g_hash_table_remove (accessible->priv->pages, widget);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_notebook_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkNotebookAccessible *accessible;
|
||||
GtkNotebook *notebook;
|
||||
int i;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_notebook_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
accessible = GTK_NOTEBOOK_ACCESSIBLE (obj);
|
||||
notebook = GTK_NOTEBOOK (data);
|
||||
for (i = 0; i < gtk_notebook_get_n_pages (notebook); i++)
|
||||
{
|
||||
create_notebook_page_accessible (accessible,
|
||||
notebook,
|
||||
gtk_notebook_get_nth_page (notebook, i),
|
||||
i);
|
||||
}
|
||||
accessible->priv->selected_page = gtk_notebook_get_current_page (notebook);
|
||||
|
||||
g_signal_connect (notebook, "page-added",
|
||||
G_CALLBACK (page_added_cb), NULL);
|
||||
g_signal_connect (notebook, "page-removed",
|
||||
G_CALLBACK (page_removed_cb), NULL);
|
||||
|
||||
obj->role = ATK_ROLE_PAGE_TAB_LIST;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkNotebookAccessible *accessible = GTK_NOTEBOOK_ACCESSIBLE (object);
|
||||
|
||||
g_hash_table_destroy (accessible->priv->pages);
|
||||
|
||||
G_OBJECT_CLASS (gtk_notebook_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_notebook_accessible_ref_child (AtkObject *obj,
|
||||
int i)
|
||||
{
|
||||
AtkObject *child;
|
||||
GtkNotebookAccessible *accessible;
|
||||
GtkNotebook *notebook;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
accessible = GTK_NOTEBOOK_ACCESSIBLE (obj);
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
|
||||
child = g_hash_table_lookup (accessible->priv->pages,
|
||||
gtk_notebook_get_nth_page (notebook, i));
|
||||
/* can return NULL when i >= n_children */
|
||||
|
||||
if (child)
|
||||
g_object_ref (child);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_notebook_accessible_update_page (GtkNotebookAccessible *self,
|
||||
int page_num)
|
||||
{
|
||||
GtkNotebookAccessiblePrivate *priv = gtk_notebook_accessible_get_instance_private (self);
|
||||
AtkObject *atk_obj = ATK_OBJECT (self);
|
||||
int old_page_num = priv->selected_page;
|
||||
|
||||
priv->selected_page = page_num;
|
||||
|
||||
/* Notify SELECTED state change for old and new page */
|
||||
if (page_num != old_page_num)
|
||||
{
|
||||
AtkObject *child;
|
||||
|
||||
if (old_page_num != -1)
|
||||
{
|
||||
child = gtk_notebook_accessible_ref_child (atk_obj, old_page_num);
|
||||
if (child != NULL)
|
||||
{
|
||||
atk_object_notify_state_change (child, ATK_STATE_SELECTED, FALSE);
|
||||
g_object_unref (child);
|
||||
}
|
||||
}
|
||||
|
||||
child = gtk_notebook_accessible_ref_child (atk_obj, page_num);
|
||||
if (child != NULL)
|
||||
{
|
||||
atk_object_notify_state_change (child, ATK_STATE_SELECTED, TRUE);
|
||||
g_object_unref (child);
|
||||
}
|
||||
|
||||
g_signal_emit_by_name (atk_obj, "selection-changed");
|
||||
g_signal_emit_by_name (atk_obj, "visible-data-changed");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* GtkNotebook only supports the selection of one page at a time.
|
||||
* Selecting a page unselects any previous selection, so this
|
||||
* changes the current selection instead of adding to it.
|
||||
*/
|
||||
static gboolean
|
||||
gtk_notebook_accessible_add_selection (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
GtkNotebook *notebook;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
gtk_notebook_set_current_page (notebook, i);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_accessible_class_init (GtkNotebookAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gtk_notebook_accessible_finalize;
|
||||
|
||||
class->ref_child = gtk_notebook_accessible_ref_child;
|
||||
class->initialize = gtk_notebook_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_accessible_init (GtkNotebookAccessible *notebook)
|
||||
{
|
||||
notebook->priv = gtk_notebook_accessible_get_instance_private (notebook);
|
||||
notebook->priv->pages = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
g_object_unref);
|
||||
notebook->priv->selected_page = -1;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_notebook_accessible_ref_selection (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
AtkObject *accessible;
|
||||
GtkWidget *widget;
|
||||
GtkNotebook *notebook;
|
||||
int pagenum;
|
||||
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
pagenum = gtk_notebook_get_current_page (notebook);
|
||||
if (pagenum == -1)
|
||||
return NULL;
|
||||
accessible = gtk_notebook_accessible_ref_child (ATK_OBJECT (selection), pagenum);
|
||||
|
||||
return accessible;
|
||||
}
|
||||
|
||||
/* Always return 1 because there can only be one page
|
||||
* selected at any time
|
||||
*/
|
||||
static int
|
||||
gtk_notebook_accessible_get_selection_count (AtkSelection *selection)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkNotebook *notebook;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
if (notebook == NULL || gtk_notebook_get_current_page (notebook) == -1)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_notebook_accessible_is_child_selected (AtkSelection *selection,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkNotebook *notebook;
|
||||
int pagenumber;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
notebook = GTK_NOTEBOOK (widget);
|
||||
pagenumber = gtk_notebook_get_current_page(notebook);
|
||||
|
||||
if (pagenumber == i)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_selection_interface_init (AtkSelectionIface *iface)
|
||||
{
|
||||
iface->add_selection = gtk_notebook_accessible_add_selection;
|
||||
iface->ref_selection = gtk_notebook_accessible_ref_selection;
|
||||
iface->get_selection_count = gtk_notebook_accessible_get_selection_count;
|
||||
iface->is_child_selected = gtk_notebook_accessible_is_child_selected;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_NOTEBOOK_ACCESSIBLE_H__
|
||||
#define __GTK_NOTEBOOK_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_NOTEBOOK_ACCESSIBLE (gtk_notebook_accessible_get_type ())
|
||||
#define GTK_NOTEBOOK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_NOTEBOOK_ACCESSIBLE, GtkNotebookAccessible))
|
||||
#define GTK_NOTEBOOK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK_ACCESSIBLE, GtkNotebookAccessibleClass))
|
||||
#define GTK_IS_NOTEBOOK_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK_ACCESSIBLE))
|
||||
#define GTK_IS_NOTEBOOK_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK_ACCESSIBLE))
|
||||
#define GTK_NOTEBOOK_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK_ACCESSIBLE, GtkNotebookAccessibleClass))
|
||||
|
||||
typedef struct _GtkNotebookAccessible GtkNotebookAccessible;
|
||||
typedef struct _GtkNotebookAccessibleClass GtkNotebookAccessibleClass;
|
||||
typedef struct _GtkNotebookAccessiblePrivate GtkNotebookAccessiblePrivate;
|
||||
|
||||
struct _GtkNotebookAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkNotebookAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkNotebookAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_notebook_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_NOTEBOOK_ACCESSIBLE_H__ */
|
@ -1,30 +0,0 @@
|
||||
/* gtknotebookaccessibleprivate.h: GtkNotebookAccessible private API
|
||||
*
|
||||
* Copyright 2020 GNOME Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtknotebookaccessible.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_notebook_accessible_update_page (GtkNotebookAccessible *self,
|
||||
int page_num);
|
||||
|
||||
G_END_DECLS
|
@ -1,334 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtknotebookpageaccessible.h"
|
||||
|
||||
|
||||
struct _GtkNotebookPageAccessiblePrivate
|
||||
{
|
||||
GtkAccessible *notebook;
|
||||
GtkWidget *child;
|
||||
};
|
||||
|
||||
static void atk_component_interface_init (AtkComponentIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkNotebookPageAccessible, gtk_notebook_page_accessible, ATK_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (GtkNotebookPageAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, atk_component_interface_init))
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
find_label_child (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
for (child = gtk_widget_get_first_child (widget);
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
if (GTK_IS_LABEL (child))
|
||||
return child;
|
||||
else
|
||||
{
|
||||
GtkWidget *w = find_label_child (child);
|
||||
if (w)
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
get_label_from_notebook_page (GtkNotebookPageAccessible *page)
|
||||
{
|
||||
GtkWidget *child;
|
||||
GtkNotebook *notebook;
|
||||
|
||||
notebook = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook));
|
||||
if (!notebook)
|
||||
return NULL;
|
||||
|
||||
if (!gtk_notebook_get_show_tabs (notebook))
|
||||
return NULL;
|
||||
|
||||
child = gtk_notebook_get_tab_label (notebook, page->priv->child);
|
||||
|
||||
if (GTK_IS_LABEL (child))
|
||||
return child;
|
||||
|
||||
return find_label_child (child);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_notebook_page_accessible_get_name (AtkObject *accessible)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
if (accessible->name != NULL)
|
||||
return accessible->name;
|
||||
|
||||
label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible));
|
||||
if (GTK_IS_LABEL (label))
|
||||
return gtk_label_get_text (GTK_LABEL (label));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_notebook_page_accessible_get_parent (AtkObject *accessible)
|
||||
{
|
||||
GtkNotebookPageAccessible *page;
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
|
||||
return ATK_OBJECT (page->priv->notebook);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_notebook_page_accessible_get_n_children (AtkObject *accessible)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_notebook_page_accessible_ref_child (AtkObject *accessible,
|
||||
int i)
|
||||
{
|
||||
AtkObject *child_obj;
|
||||
GtkNotebookPageAccessible *page = NULL;
|
||||
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
if (!page->priv->child)
|
||||
return NULL;
|
||||
|
||||
child_obj = gtk_widget_get_accessible (page->priv->child);
|
||||
g_object_ref (child_obj);
|
||||
|
||||
return child_obj;
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_notebook_page_accessible_ref_state_set (AtkObject *accessible)
|
||||
{
|
||||
GtkNotebookPageAccessible *page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
AtkStateSet *state_set, *label_state_set, *merged_state_set;
|
||||
AtkObject *atk_label;
|
||||
GtkWidget *label;
|
||||
AtkObject *selected;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_notebook_page_accessible_parent_class)->ref_state_set (accessible);
|
||||
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
|
||||
|
||||
selected = atk_selection_ref_selection (ATK_SELECTION (page->priv->notebook), 0);
|
||||
if (selected)
|
||||
{
|
||||
if (selected == accessible)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTED);
|
||||
|
||||
g_object_unref (selected);
|
||||
}
|
||||
|
||||
label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible));
|
||||
if (label)
|
||||
{
|
||||
atk_label = gtk_widget_get_accessible (label);
|
||||
label_state_set = atk_object_ref_state_set (atk_label);
|
||||
merged_state_set = atk_state_set_or_sets (state_set, label_state_set);
|
||||
g_object_unref (label_state_set);
|
||||
g_object_unref (state_set);
|
||||
}
|
||||
else
|
||||
{
|
||||
AtkObject *child;
|
||||
|
||||
child = atk_object_ref_accessible_child (accessible, 0);
|
||||
if (!child)
|
||||
return state_set;
|
||||
|
||||
merged_state_set = state_set;
|
||||
state_set = atk_object_ref_state_set (child);
|
||||
if (atk_state_set_contains_state (state_set, ATK_STATE_VISIBLE))
|
||||
{
|
||||
atk_state_set_add_state (merged_state_set, ATK_STATE_VISIBLE);
|
||||
if (atk_state_set_contains_state (state_set, ATK_STATE_ENABLED))
|
||||
atk_state_set_add_state (merged_state_set, ATK_STATE_ENABLED);
|
||||
if (atk_state_set_contains_state (state_set, ATK_STATE_SHOWING))
|
||||
atk_state_set_add_state (merged_state_set, ATK_STATE_SHOWING);
|
||||
|
||||
}
|
||||
g_object_unref (state_set);
|
||||
g_object_unref (child);
|
||||
}
|
||||
return merged_state_set;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_notebook_page_accessible_get_index_in_parent (AtkObject *accessible)
|
||||
{
|
||||
GtkNotebookPageAccessible *page;
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (accessible);
|
||||
if (!page->priv->child)
|
||||
return -1;
|
||||
|
||||
return gtk_notebook_page_num (GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook)),
|
||||
page->priv->child);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_page_accessible_class_init (GtkNotebookPageAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_name = gtk_notebook_page_accessible_get_name;
|
||||
class->get_parent = gtk_notebook_page_accessible_get_parent;
|
||||
class->get_n_children = gtk_notebook_page_accessible_get_n_children;
|
||||
class->ref_child = gtk_notebook_page_accessible_ref_child;
|
||||
class->ref_state_set = gtk_notebook_page_accessible_ref_state_set;
|
||||
class->get_index_in_parent = gtk_notebook_page_accessible_get_index_in_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_page_accessible_init (GtkNotebookPageAccessible *page)
|
||||
{
|
||||
page->priv = gtk_notebook_page_accessible_get_instance_private (page);
|
||||
}
|
||||
|
||||
static void
|
||||
notify_tab_label (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
AtkObject *atk_obj)
|
||||
{
|
||||
if (atk_obj->name == NULL)
|
||||
g_object_notify (G_OBJECT (atk_obj), "accessible-name");
|
||||
g_signal_emit_by_name (atk_obj, "visible-data-changed");
|
||||
}
|
||||
|
||||
AtkObject *
|
||||
gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GObject *object;
|
||||
AtkObject *atk_object;
|
||||
GtkNotebookPageAccessible *page;
|
||||
GtkNotebook *nb;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_NOTEBOOK_ACCESSIBLE (notebook), NULL);
|
||||
g_return_val_if_fail (GTK_WIDGET (child), NULL);
|
||||
|
||||
object = g_object_new (GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, NULL);
|
||||
|
||||
page = GTK_NOTEBOOK_PAGE_ACCESSIBLE (object);
|
||||
page->priv->notebook = GTK_ACCESSIBLE (notebook);
|
||||
page->priv->child = child;
|
||||
|
||||
atk_object = ATK_OBJECT (page);
|
||||
atk_object->role = ATK_ROLE_PAGE_TAB;
|
||||
atk_object->layer = ATK_LAYER_WIDGET;
|
||||
|
||||
atk_object_set_parent (gtk_widget_get_accessible (child), atk_object);
|
||||
nb = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook));
|
||||
|
||||
g_signal_connect (gtk_notebook_get_page (nb, child),
|
||||
"notify::tab-label",
|
||||
G_CALLBACK (notify_tab_label), page);
|
||||
|
||||
return atk_object;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_notebook_page_accessible_invalidate (GtkNotebookPageAccessible *page)
|
||||
{
|
||||
AtkObject *obj = ATK_OBJECT (page);
|
||||
GtkWidget *notebook;
|
||||
|
||||
notebook = gtk_accessible_get_widget (page->priv->notebook);
|
||||
if (notebook)
|
||||
g_signal_handlers_disconnect_by_func (notebook, notify_tab_label, page);
|
||||
|
||||
atk_object_notify_state_change (obj, ATK_STATE_DEFUNCT, TRUE);
|
||||
atk_object_set_parent (obj, NULL);
|
||||
page->priv->notebook = NULL;
|
||||
atk_object_set_parent (gtk_widget_get_accessible (page->priv->child), NULL);
|
||||
page->priv->child = NULL;
|
||||
}
|
||||
|
||||
static AtkObject*
|
||||
gtk_notebook_page_accessible_ref_accessible_at_point (AtkComponent *component,
|
||||
int x,
|
||||
int y,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
/* There is only one child so we return it */
|
||||
AtkObject* child;
|
||||
|
||||
child = atk_object_ref_accessible_child (ATK_OBJECT (component), 0);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_page_accessible_get_extents (AtkComponent *component,
|
||||
int *x,
|
||||
int *y,
|
||||
int *width,
|
||||
int *height,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
GtkWidget *label;
|
||||
AtkObject *atk_label;
|
||||
|
||||
label = get_label_from_notebook_page (GTK_NOTEBOOK_PAGE_ACCESSIBLE (component));
|
||||
if (!label)
|
||||
{
|
||||
AtkObject *child;
|
||||
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
child = atk_object_ref_accessible_child (ATK_OBJECT (component), 0);
|
||||
if (!child)
|
||||
return;
|
||||
|
||||
atk_component_get_extents (ATK_COMPONENT (child), x, y, NULL, NULL,
|
||||
coord_type);
|
||||
g_object_unref (child);
|
||||
}
|
||||
else
|
||||
{
|
||||
atk_label = gtk_widget_get_accessible (label);
|
||||
atk_component_get_extents (ATK_COMPONENT (atk_label),
|
||||
x, y, width, height, coord_type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_component_interface_init (AtkComponentIface *iface)
|
||||
{
|
||||
/* We use the default implementations for contains, get_position, get_size */
|
||||
iface->ref_accessible_at_point = gtk_notebook_page_accessible_ref_accessible_at_point;
|
||||
iface->get_extents = gtk_notebook_page_accessible_get_extents;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_NOTEBOOK_PAGE_ACCESSIBLE_H__
|
||||
#define __GTK_NOTEBOOK_PAGE_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtknotebookaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE (gtk_notebook_page_accessible_get_type ())
|
||||
#define GTK_NOTEBOOK_PAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessible))
|
||||
#define GTK_NOTEBOOK_PAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessibleClass))
|
||||
#define GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE))
|
||||
#define GTK_IS_NOTEBOOK_PAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE))
|
||||
#define GTK_NOTEBOOK_PAGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK_PAGE_ACCESSIBLE, GtkNotebookPageAccessibleClass))
|
||||
|
||||
typedef struct _GtkNotebookPageAccessible GtkNotebookPageAccessible;
|
||||
typedef struct _GtkNotebookPageAccessibleClass GtkNotebookPageAccessibleClass;
|
||||
typedef struct _GtkNotebookPageAccessiblePrivate GtkNotebookPageAccessiblePrivate;
|
||||
|
||||
struct _GtkNotebookPageAccessible
|
||||
{
|
||||
AtkObject parent;
|
||||
|
||||
GtkNotebookPageAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkNotebookPageAccessibleClass
|
||||
{
|
||||
AtkObjectClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_notebook_page_accessible_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
AtkObject *gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook,
|
||||
GtkWidget *child);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_notebook_page_accessible_invalidate (GtkNotebookPageAccessible *page);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_NOTEBOOK_PAGE_ACCESSIBLE_H__ */
|
@ -1,200 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkpanedaccessible.h"
|
||||
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPanedAccessible, gtk_paned_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_position_changed (GtkWidget *widget)
|
||||
{
|
||||
AtkObject *obj = gtk_widget_get_accessible (widget);
|
||||
|
||||
g_object_notify (G_OBJECT (obj), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_paned_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (data, "notify::position",
|
||||
G_CALLBACK (gtk_paned_accessible_position_changed), NULL);
|
||||
|
||||
obj->role = ATK_ROLE_SPLIT_PANE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_class_init (GtkPanedAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gtk_paned_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_init (GtkPanedAccessible *paned)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
int current_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
current_value = gtk_paned_get_position (GTK_PANED (widget));
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_INT);
|
||||
g_value_set_int (value, current_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
int maximum_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
g_object_get (GTK_PANED (widget),
|
||||
"max-position", &maximum_value,
|
||||
NULL);
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_INT);
|
||||
g_value_set_int (value, maximum_value);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
int minimum_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
g_object_get (GTK_PANED (widget),
|
||||
"min-position", &minimum_value,
|
||||
NULL);
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_INT);
|
||||
g_value_set_int (value, minimum_value);
|
||||
}
|
||||
|
||||
/* Calling atk_value_set_current_value() is no guarantee that the value
|
||||
* is acceptable; it is necessary to listen for accessible-value signals
|
||||
* and check whether the current value has been changed or check what the
|
||||
* maximum and minimum values are.
|
||||
*/
|
||||
static gboolean
|
||||
gtk_paned_accessible_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
int new_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (G_VALUE_HOLDS_INT (value))
|
||||
{
|
||||
new_value = g_value_get_int (value);
|
||||
gtk_paned_set_position (GTK_PANED (widget), new_value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_get_value_and_text (AtkValue *obj,
|
||||
double *value,
|
||||
char **text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkPaned *paned;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
paned = GTK_PANED (widget);
|
||||
|
||||
*value = gtk_paned_get_position (paned);
|
||||
*text = NULL;
|
||||
}
|
||||
|
||||
static AtkRange *
|
||||
gtk_paned_accessible_get_range (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
int minimum_value;
|
||||
int maximum_value;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
|
||||
g_object_get (widget,
|
||||
"min-position", &minimum_value,
|
||||
"max-position", &maximum_value,
|
||||
NULL);
|
||||
|
||||
return atk_range_new (minimum_value, maximum_value, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_accessible_set_value (AtkValue *obj,
|
||||
const double value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkPaned *paned;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
paned = GTK_PANED (widget);
|
||||
|
||||
gtk_paned_set_position (paned, (int)(value + 0.5));
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_paned_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_paned_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_paned_accessible_get_minimum_value;
|
||||
iface->set_current_value = gtk_paned_accessible_set_current_value;
|
||||
|
||||
iface->get_value_and_text = gtk_paned_accessible_get_value_and_text;
|
||||
iface->get_range = gtk_paned_accessible_get_range;
|
||||
iface->set_value = gtk_paned_accessible_set_value;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_PANED_ACCESSIBLE_H__
|
||||
#define __GTK_PANED_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PANED_ACCESSIBLE (gtk_paned_accessible_get_type ())
|
||||
#define GTK_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessible))
|
||||
#define GTK_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass))
|
||||
#define GTK_IS_PANED_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PANED_ACCESSIBLE))
|
||||
#define GTK_IS_PANED_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PANED_ACCESSIBLE))
|
||||
#define GTK_PANED_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PANED_ACCESSIBLE, GtkPanedAccessibleClass))
|
||||
|
||||
typedef struct _GtkPanedAccessible GtkPanedAccessible;
|
||||
typedef struct _GtkPanedAccessibleClass GtkPanedAccessibleClass;
|
||||
typedef struct _GtkPanedAccessiblePrivate GtkPanedAccessiblePrivate;
|
||||
|
||||
struct _GtkPanedAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkPanedAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkPanedAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_paned_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PANED_ACCESSIBLE_H__ */
|
@ -1,654 +0,0 @@
|
||||
/* gtkpasswordentryaccessible.c: A GtkWidgetAccessible for GtkPasswordEntry
|
||||
*
|
||||
* Copyright 2020 GNOME Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkpasswordentryaccessibleprivate.h"
|
||||
|
||||
#include "gtkeditable.h"
|
||||
#include "gtkimage.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkpango.h"
|
||||
#include "gtkpasswordentryprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktextprivate.h"
|
||||
|
||||
struct _GtkPasswordEntryAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent_instance;
|
||||
|
||||
int cursor_position;
|
||||
int selection_bound;
|
||||
};
|
||||
|
||||
static void atk_editable_text_interface_init (AtkEditableTextIface *iface);
|
||||
static void atk_text_interface_init (AtkTextIface *iface);
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPasswordEntryAccessible, gtk_password_entry_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_EDITABLE_TEXT, atk_editable_text_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, atk_text_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init))
|
||||
|
||||
static inline GtkText *
|
||||
get_text_widget (GtkAccessible *accessible)
|
||||
{
|
||||
GtkWidget *widget = gtk_accessible_get_widget (accessible);
|
||||
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
|
||||
|
||||
return gtk_password_entry_get_text_widget (entry);
|
||||
}
|
||||
|
||||
static gunichar
|
||||
gtk_password_entry_accessible_get_character_at_offset (AtkText *atk_text,
|
||||
int offset)
|
||||
{
|
||||
GtkText *text;
|
||||
char *contents, *index;
|
||||
gunichar result;
|
||||
|
||||
result = '\0';
|
||||
|
||||
text = get_text_widget (GTK_ACCESSIBLE (atk_text));
|
||||
if (text == NULL)
|
||||
return 0;
|
||||
|
||||
if (!gtk_text_get_visibility (text))
|
||||
return result;
|
||||
|
||||
contents = gtk_text_get_display_text (text, 0, -1);
|
||||
if (offset < g_utf8_strlen (contents, -1))
|
||||
{
|
||||
index = g_utf8_offset_to_pointer (contents, offset);
|
||||
result = g_utf8_get_char (index);
|
||||
g_free (contents);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_password_entry_accessible_get_caret_offset (AtkText *atk_text)
|
||||
{
|
||||
GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text));
|
||||
|
||||
if (widget == NULL)
|
||||
return -1;
|
||||
|
||||
int cursor_position = 0;
|
||||
gboolean result = gtk_editable_get_selection_bounds (GTK_EDITABLE (widget), NULL, &cursor_position);
|
||||
if (!result)
|
||||
return -1;
|
||||
|
||||
return cursor_position;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_password_entry_accessible_set_caret_offset (AtkText *atk_text,
|
||||
int offset)
|
||||
{
|
||||
GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (atk_text));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_editable_set_position (GTK_EDITABLE (widget), offset);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_password_entry_accessible_get_character_count (AtkText *atk_text)
|
||||
{
|
||||
GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text));
|
||||
if (text == NULL)
|
||||
return 0;
|
||||
|
||||
char *display_text = gtk_text_get_display_text (text, 0, -1);
|
||||
|
||||
int char_count = 0;
|
||||
if (display_text)
|
||||
{
|
||||
char_count = g_utf8_strlen (display_text, -1);
|
||||
g_free (display_text);
|
||||
}
|
||||
|
||||
return char_count;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_password_entry_accessible_get_offset_at_point (AtkText *atk_text,
|
||||
int x,
|
||||
int y,
|
||||
AtkCoordType coords)
|
||||
{
|
||||
GtkText *text = get_text_widget (GTK_ACCESSIBLE (atk_text));
|
||||
int index, x_layout, y_layout;
|
||||
int x_local, y_local;
|
||||
glong offset;
|
||||
|
||||
if (text == NULL)
|
||||
return 1;
|
||||
|
||||
gtk_text_get_layout_offsets (text, &x_layout, &y_layout);
|
||||
|
||||
x_local = x - x_layout;
|
||||
y_local = y - y_layout;
|
||||
|
||||
if (!pango_layout_xy_to_index (gtk_text_get_layout (text),
|
||||
x_local * PANGO_SCALE,
|
||||
y_local * PANGO_SCALE,
|
||||
&index, NULL))
|
||||
{
|
||||
if (x_local < 0 || y_local < 0)
|
||||
index = 0;
|
||||
else
|
||||
index = -1;
|
||||
}
|
||||
|
||||
offset = -1;
|
||||
if (index != -1)
|
||||
{
|
||||
char *entry_text = gtk_text_get_display_text (text, 0, -1);
|
||||
offset = g_utf8_pointer_to_offset (entry_text, entry_text + index);
|
||||
g_free (entry_text);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_text_interface_init (AtkTextIface *iface)
|
||||
{
|
||||
iface->get_character_at_offset = gtk_password_entry_accessible_get_character_at_offset;
|
||||
iface->get_caret_offset = gtk_password_entry_accessible_get_caret_offset;
|
||||
iface->set_caret_offset = gtk_password_entry_accessible_set_caret_offset;
|
||||
iface->get_character_count = gtk_password_entry_accessible_get_character_count;
|
||||
iface->get_offset_at_point = gtk_password_entry_accessible_get_offset_at_point;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_set_text_contents (AtkEditableText *text,
|
||||
const char *string)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
if (!gtk_editable_get_editable (GTK_EDITABLE (widget)))
|
||||
return;
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (widget), string);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_insert_text (AtkEditableText *text,
|
||||
const char *string,
|
||||
int length,
|
||||
int *position)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkEditable *editable;
|
||||
int pos = 0;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
if (!gtk_editable_get_editable (editable))
|
||||
return;
|
||||
|
||||
if (position != NULL)
|
||||
pos = *position;
|
||||
|
||||
gtk_editable_insert_text (editable, string, length, &pos);
|
||||
gtk_editable_set_position (editable, pos);
|
||||
|
||||
if (position != NULL)
|
||||
*position = pos;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_delete_text (AtkEditableText *text,
|
||||
int start_pos,
|
||||
int end_pos)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkEditable *editable;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
if (!gtk_editable_get_editable (editable))
|
||||
return;
|
||||
|
||||
gtk_editable_delete_text (editable, start_pos, end_pos);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkEditable *entry;
|
||||
int position;
|
||||
} PasteData;
|
||||
|
||||
static void
|
||||
paste_received_cb (GObject *clipboard,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
PasteData *paste = data;
|
||||
char *text;
|
||||
|
||||
text = gdk_clipboard_read_text_finish (GDK_CLIPBOARD (clipboard), result, NULL);
|
||||
if (text != NULL)
|
||||
gtk_editable_insert_text (paste->entry,
|
||||
text, -1,
|
||||
&(paste->position));
|
||||
|
||||
g_object_unref (paste->entry);
|
||||
g_free (paste);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_paste_text (AtkEditableText *text,
|
||||
int position)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkEditable *editable;
|
||||
PasteData *paste;
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (text));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
editable = GTK_EDITABLE (widget);
|
||||
if (!gtk_editable_get_editable (editable))
|
||||
return;
|
||||
|
||||
paste = g_new0 (PasteData, 1);
|
||||
paste->entry = GTK_EDITABLE (widget);
|
||||
paste->position = position;
|
||||
|
||||
g_object_ref (paste->entry);
|
||||
clipboard = gtk_widget_get_clipboard (widget);
|
||||
gdk_clipboard_read_text_async (clipboard, NULL, paste_received_cb, paste);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_editable_text_interface_init (AtkEditableTextIface *iface)
|
||||
{
|
||||
iface->set_text_contents = gtk_password_entry_accessible_set_text_contents;
|
||||
iface->insert_text = gtk_password_entry_accessible_insert_text;
|
||||
iface->copy_text = NULL;
|
||||
iface->cut_text = NULL;
|
||||
iface->delete_text = gtk_password_entry_accessible_delete_text;
|
||||
iface->paste_text = gtk_password_entry_accessible_paste_text;
|
||||
iface->set_run_attributes = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_password_entry_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||
return FALSE;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
gtk_widget_activate (widget);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
GtkText *text = get_text_widget (GTK_ACCESSIBLE (action));
|
||||
|
||||
gboolean visibility = gtk_text_get_visibility (text);
|
||||
gtk_text_set_visibility (text, !visibility);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_password_entry_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
GtkAccessible *accessible = GTK_ACCESSIBLE (action);
|
||||
|
||||
GtkWidget *widget = gtk_accessible_get_widget (accessible);
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
int n_actions = 1;
|
||||
if (gtk_password_entry_get_show_peek_icon (GTK_PASSWORD_ENTRY (widget)))
|
||||
n_actions += 1;
|
||||
|
||||
return n_actions;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_password_entry_accessible_get_keybinding (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkWidget *label;
|
||||
AtkRelationSet *set;
|
||||
AtkRelation *relation;
|
||||
GPtrArray *target;
|
||||
gpointer target_object;
|
||||
guint key_val;
|
||||
|
||||
if (i != 0)
|
||||
return NULL;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
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);
|
||||
label = gtk_accessible_get_widget (GTK_ACCESSIBLE (target_object));
|
||||
}
|
||||
|
||||
g_object_unref (set);
|
||||
|
||||
if (GTK_IS_LABEL (label))
|
||||
{
|
||||
key_val = gtk_label_get_mnemonic_keyval (GTK_LABEL (label));
|
||||
if (key_val != GDK_KEY_VoidSymbol)
|
||||
return gtk_accelerator_name (key_val, GDK_ALT_MASK);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_password_entry_accessible_action_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return "activate";
|
||||
|
||||
case 1:
|
||||
return "peek";
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_password_entry_accessible_action_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action name", "Activate");
|
||||
if (i == 1)
|
||||
return C_("Action name", "Peek");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_password_entry_accessible_action_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
if (i == 0)
|
||||
return C_("Action description", "Activates the entry");
|
||||
|
||||
if (i == 1)
|
||||
return C_("Action description", "Reveals the contents the entry");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_password_entry_accessible_do_action;
|
||||
iface->get_n_actions = gtk_password_entry_accessible_get_n_actions;
|
||||
iface->get_keybinding = gtk_password_entry_accessible_get_keybinding;
|
||||
iface->get_name = gtk_password_entry_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_password_entry_accessible_action_get_localized_name;
|
||||
iface->get_description = gtk_password_entry_accessible_action_get_description;
|
||||
}
|
||||
|
||||
static AtkAttributeSet *
|
||||
gtk_password_entry_accessible_get_attributes (AtkObject *accessible)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
AtkAttributeSet *attributes;
|
||||
AtkAttribute *placeholder_text;
|
||||
char *text = NULL;
|
||||
|
||||
attributes = ATK_OBJECT_CLASS (gtk_password_entry_accessible_parent_class)->get_attributes (accessible);
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
if (widget == NULL)
|
||||
return attributes;
|
||||
|
||||
g_object_get (widget, "placeholder-text", &text, NULL);
|
||||
if (text == NULL)
|
||||
return attributes;
|
||||
|
||||
placeholder_text = g_malloc (sizeof (AtkAttribute));
|
||||
placeholder_text->name = g_strdup ("placeholder-text");
|
||||
placeholder_text->value = text;
|
||||
|
||||
attributes = g_slist_append (attributes, placeholder_text);
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_for_selection_change (GtkPasswordEntryAccessible *self,
|
||||
GtkEditable *editable)
|
||||
{
|
||||
gboolean ret_val = FALSE;
|
||||
int start, end;
|
||||
|
||||
if (gtk_editable_get_selection_bounds (editable, &start, &end))
|
||||
{
|
||||
if (end != self->cursor_position ||
|
||||
start != self->selection_bound)
|
||||
/*
|
||||
* This check is here as this function can be called
|
||||
* for notification of selection_bound and current_pos.
|
||||
* The values of current_pos and selection_bound may be the same
|
||||
* for both notifications and we only want to generate one
|
||||
* text_selection_changed signal.
|
||||
*/
|
||||
ret_val = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We had a selection */
|
||||
ret_val = (self->cursor_position != self->selection_bound);
|
||||
}
|
||||
|
||||
self->cursor_position = end;
|
||||
self->selection_bound = start;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
static void
|
||||
on_cursor_position_changed (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkPasswordEntryAccessible *self = data;
|
||||
GtkEditable *editable = GTK_EDITABLE (gobject);
|
||||
|
||||
if (check_for_selection_change (self, editable))
|
||||
g_signal_emit_by_name (self, "text-selection-changed");
|
||||
|
||||
// The entry cursor position has moved so generate the signal
|
||||
g_signal_emit_by_name (self, "text-caret-moved",
|
||||
gtk_editable_get_position (editable));
|
||||
}
|
||||
|
||||
static void
|
||||
on_selection_bound_changed (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkPasswordEntryAccessible *self = data;
|
||||
GtkEditable *editable = GTK_EDITABLE (gobject);
|
||||
|
||||
if (check_for_selection_change (self, editable))
|
||||
g_signal_emit_by_name (self, "text-selection-changed");
|
||||
}
|
||||
|
||||
static void
|
||||
insert_text_cb (GtkEditable *editable,
|
||||
char *new_text,
|
||||
int new_text_length,
|
||||
int *position,
|
||||
GtkPasswordEntryAccessible *self)
|
||||
{
|
||||
int length;
|
||||
|
||||
if (new_text_length == 0)
|
||||
return;
|
||||
|
||||
length = g_utf8_strlen (new_text, new_text_length);
|
||||
|
||||
g_signal_emit_by_name (self,
|
||||
"text-changed::insert",
|
||||
*position - length,
|
||||
length);
|
||||
}
|
||||
|
||||
static void
|
||||
delete_text_cb (GtkEditable *editable,
|
||||
int start,
|
||||
int end,
|
||||
GtkPasswordEntryAccessible *self)
|
||||
{
|
||||
GtkText *text;
|
||||
|
||||
text = get_text_widget (GTK_ACCESSIBLE (self));
|
||||
if (text == NULL)
|
||||
return;
|
||||
|
||||
if (end < 0)
|
||||
{
|
||||
char *contents;
|
||||
|
||||
contents = gtk_text_get_display_text (text, 0, -1);
|
||||
end = g_utf8_strlen (contents, -1);
|
||||
|
||||
g_free (contents);
|
||||
}
|
||||
|
||||
if (end == start)
|
||||
return;
|
||||
|
||||
g_signal_emit_by_name (self,
|
||||
"text-changed::delete",
|
||||
start,
|
||||
end - start);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_initialize (AtkObject *atk_object,
|
||||
gpointer data)
|
||||
{
|
||||
GtkPasswordEntryAccessible *self = GTK_PASSWORD_ENTRY_ACCESSIBLE (atk_object);
|
||||
GtkEditable *editable = data;
|
||||
GtkWidget *widget = data;
|
||||
int start_pos, end_pos;
|
||||
|
||||
gtk_editable_get_selection_bounds (editable, &start_pos, &end_pos);
|
||||
self->cursor_position = end_pos;
|
||||
self->selection_bound = start_pos;
|
||||
|
||||
/* Set up signal callbacks */
|
||||
g_signal_connect_after (widget, "insert-text", G_CALLBACK (insert_text_cb), self);
|
||||
g_signal_connect (widget, "delete-text", G_CALLBACK (delete_text_cb), self);
|
||||
g_signal_connect (widget, "notify::cursor-position",
|
||||
G_CALLBACK (on_cursor_position_changed), self);
|
||||
g_signal_connect (widget, "notify::selection-bound",
|
||||
G_CALLBACK (on_selection_bound_changed), self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_class_init (GtkPasswordEntryAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
atk_object_class->initialize = gtk_password_entry_accessible_initialize;
|
||||
atk_object_class->get_attributes = gtk_password_entry_accessible_get_attributes;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_accessible_init (GtkPasswordEntryAccessible *self)
|
||||
{
|
||||
AtkObject *atk_obj = ATK_OBJECT (self);
|
||||
|
||||
atk_obj->role = ATK_ROLE_PASSWORD_TEXT;
|
||||
atk_object_set_name (atk_obj, _("Password"));
|
||||
}
|
||||
|
||||
void
|
||||
gtk_password_entry_accessible_update_visibility (GtkPasswordEntryAccessible *self)
|
||||
{
|
||||
GtkText *text = get_text_widget (GTK_ACCESSIBLE (self));
|
||||
|
||||
if (text == NULL)
|
||||
return;
|
||||
|
||||
gboolean visibility = gtk_text_get_visibility (text);
|
||||
AtkRole role = visibility ? ATK_ROLE_TEXT : ATK_ROLE_PASSWORD_TEXT;
|
||||
atk_object_set_role (ATK_OBJECT (self), role);
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/* gtkpasswordentryaccessible.h: A GtkWidgetAccessible for GtkPasswordEntry
|
||||
*
|
||||
* Copyright 2020 GNOME Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkentryaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE (gtk_password_entry_accessible_get_type())
|
||||
#define GTK_PASSWORD_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE, GtkPasswordEntryAccessible))
|
||||
#define GTK_IS_PASSWORD_ENTRY_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PASSWORD_ENTRY_ACCESSIBLE))
|
||||
|
||||
typedef struct _GtkPasswordEntryAccessible GtkPasswordEntryAccessible;
|
||||
typedef struct _GtkPasswordEntryAccessibleClass GtkPasswordEntryAccessibleClass;
|
||||
|
||||
struct _GtkPasswordEntryAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_password_entry_accessible_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkPasswordEntryAccessible, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
@ -1,29 +0,0 @@
|
||||
/* gtkpasswordentryaccessibleprivate.h: Private API for GtkPasswordEntryAccessible
|
||||
*
|
||||
* Copyright 2020 GNOME Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtkpasswordentryaccessible.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_password_entry_accessible_update_visibility (GtkPasswordEntryAccessible *self);
|
||||
|
||||
G_END_DECLS
|
@ -1,136 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2018 Benjamin Otte
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkpictureaccessibleprivate.h"
|
||||
|
||||
#include "gtkpicture.h"
|
||||
|
||||
struct _GtkPictureAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent_instance;
|
||||
};
|
||||
|
||||
struct _GtkPictureAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
static const char *
|
||||
gtk_picture_accessible_get_image_description (AtkImage *image)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_picture_get_alternative_text (GTK_PICTURE (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_picture_accessible_get_image_position (AtkImage *image,
|
||||
int *x,
|
||||
int *y,
|
||||
AtkCoordType coord_type)
|
||||
{
|
||||
atk_component_get_extents (ATK_COMPONENT (image), x, y, NULL, NULL,
|
||||
coord_type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_picture_accessible_get_image_size (AtkImage *image,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
*width = -1;
|
||||
*height = -1;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (image));
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
paintable = gtk_picture_get_paintable (GTK_PICTURE (widget));
|
||||
if (paintable == NULL)
|
||||
return;
|
||||
|
||||
*width = gdk_paintable_get_intrinsic_width (paintable);
|
||||
if (*width == 0)
|
||||
*width = -1;
|
||||
|
||||
*height = gdk_paintable_get_intrinsic_height (paintable);
|
||||
if (*height == 0)
|
||||
*height = -1;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_picture_accessible_image_init (AtkImageIface *iface)
|
||||
{
|
||||
iface->get_image_description = gtk_picture_accessible_get_image_description;
|
||||
iface->get_image_position = gtk_picture_accessible_get_image_position;
|
||||
iface->get_image_size = gtk_picture_accessible_get_image_size;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPictureAccessible, gtk_picture_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_IMAGE, gtk_picture_accessible_image_init))
|
||||
|
||||
static void
|
||||
gtk_picture_accessible_initialize (AtkObject *accessible,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_picture_accessible_parent_class)->initialize (accessible, data);
|
||||
|
||||
accessible->role = ATK_ROLE_IMAGE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_picture_accessible_get_name (AtkObject *accessible)
|
||||
{
|
||||
GtkWidget* widget;
|
||||
const char *name;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
name = ATK_OBJECT_CLASS (gtk_picture_accessible_parent_class)->get_name (accessible);
|
||||
if (name)
|
||||
return name;
|
||||
|
||||
return gtk_picture_get_alternative_text (GTK_PICTURE (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_picture_accessible_class_init (GtkPictureAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
atkobject_class->initialize = gtk_picture_accessible_initialize;
|
||||
atkobject_class->get_name = gtk_picture_accessible_get_name;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_picture_accessible_init (GtkPictureAccessible *image)
|
||||
{
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2018 Benjamin Otte
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_PICTURE_ACCESSIBLE_PRIVATE_H__
|
||||
#define __GTK_PICTURE_ACCESSIBLE_PRIVATE_H__
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PICTURE_ACCESSIBLE (gtk_picture_accessible_get_type ())
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (GtkPictureAccessible, gtk_picture_accessible, GTK, PICTURE_ACCESSIBLE, GtkWidgetAccessible)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PICTURE_ACCESSIBLE_PRIVATE_H__ */
|
@ -1,93 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright © 2014 Red Hat 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkpopoveraccessible.h"
|
||||
|
||||
typedef struct _GtkPopoverAccessiblePrivate GtkPopoverAccessiblePrivate;
|
||||
|
||||
G_DEFINE_TYPE (GtkPopoverAccessible, gtk_popover_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
popover_update_modality (AtkObject *object,
|
||||
GtkPopover *popover)
|
||||
{
|
||||
atk_object_notify_state_change (object, ATK_STATE_MODAL,
|
||||
gtk_popover_get_autohide (popover));
|
||||
}
|
||||
|
||||
static void
|
||||
popover_notify_cb (GtkPopover *popover,
|
||||
GParamSpec *pspec,
|
||||
AtkObject *object)
|
||||
{
|
||||
AtkObject *popover_accessible;
|
||||
|
||||
popover_accessible = gtk_widget_get_accessible (GTK_WIDGET (popover));
|
||||
|
||||
if (strcmp (g_param_spec_get_name (pspec), "modal") == 0)
|
||||
popover_update_modality (popover_accessible, popover);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkPopover *popover = GTK_POPOVER (data);
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_popover_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (popover, "notify",
|
||||
G_CALLBACK (popover_notify_cb), obj);
|
||||
popover_update_modality (obj, popover);
|
||||
|
||||
obj->role = ATK_ROLE_PANEL;
|
||||
}
|
||||
|
||||
static AtkStateSet *
|
||||
gtk_popover_accessible_ref_state_set (AtkObject *obj)
|
||||
{
|
||||
AtkStateSet *state_set;
|
||||
GtkWidget *widget;
|
||||
|
||||
state_set = ATK_OBJECT_CLASS (gtk_popover_accessible_parent_class)->ref_state_set (obj);
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
|
||||
if (gtk_popover_get_autohide (GTK_POPOVER (widget)))
|
||||
atk_state_set_add_state (state_set, ATK_STATE_MODAL);
|
||||
|
||||
return state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_accessible_class_init (GtkPopoverAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gtk_popover_accessible_initialize;
|
||||
class->ref_state_set = gtk_popover_accessible_ref_state_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_accessible_init (GtkPopoverAccessible *popover)
|
||||
{
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright © 2014 Red Hat 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Author: Carlos Garnacho <carlosg@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_POPOVER_ACCESSIBLE_H__
|
||||
#define __GTK_POPOVER_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_POPOVER_ACCESSIBLE (gtk_popover_accessible_get_type ())
|
||||
#define GTK_POPOVER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_POPOVER_ACCESSIBLE, GtkPopoverAccessible))
|
||||
#define GTK_POPOVER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_POPOVER_ACCESSIBLE, GtkPopoverAccessibleClass))
|
||||
#define GTK_IS_POPOVER_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_POPOVER_ACCESSIBLE))
|
||||
#define GTK_IS_POPOVER_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_POPOVER_ACCESSIBLE))
|
||||
#define GTK_POPOVER_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_POPOVER_ACCESSIBLE, GtkPopoverAccessibleClass))
|
||||
|
||||
typedef struct _GtkPopoverAccessible GtkPopoverAccessible;
|
||||
typedef struct _GtkPopoverAccessibleClass GtkPopoverAccessibleClass;
|
||||
|
||||
struct _GtkPopoverAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkPopoverAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_popover_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_POPOVER_ACCESSIBLE_H__ */
|
@ -1,107 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkprogressbaraccessibleprivate.h"
|
||||
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkProgressBarAccessible, gtk_progress_bar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
void
|
||||
gtk_progress_bar_accessible_update_value (GtkProgressBarAccessible *self)
|
||||
{
|
||||
g_object_notify (G_OBJECT (self), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_accessible_class_init (GtkProgressBarAccessibleClass *klass)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_accessible_init (GtkProgressBarAccessible *self)
|
||||
{
|
||||
ATK_OBJECT (self)->role = ATK_ROLE_PROGRESS_BAR;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget)));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, 1.0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, 0.0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_progress_bar_accessible_get_value_and_text (AtkValue *obj,
|
||||
double *value,
|
||||
char **text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
|
||||
*value = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (widget));
|
||||
*text = NULL;
|
||||
}
|
||||
|
||||
static AtkRange *
|
||||
gtk_progress_bar_accessible_get_range (AtkValue *obj)
|
||||
{
|
||||
return atk_range_new (0.0, 1.0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_progress_bar_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_progress_bar_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_progress_bar_accessible_get_minimum_value;
|
||||
|
||||
iface->get_value_and_text = gtk_progress_bar_accessible_get_value_and_text;
|
||||
iface->get_range = gtk_progress_bar_accessible_get_range;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_PROGRESS_BAR_ACCESSIBLE_H__
|
||||
#define __GTK_PROGRESS_BAR_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PROGRESS_BAR_ACCESSIBLE (gtk_progress_bar_accessible_get_type ())
|
||||
#define GTK_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessible))
|
||||
#define GTK_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass))
|
||||
#define GTK_IS_PROGRESS_BAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE))
|
||||
#define GTK_IS_PROGRESS_BAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE))
|
||||
#define GTK_PROGRESS_BAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PROGRESS_BAR_ACCESSIBLE, GtkProgressBarAccessibleClass))
|
||||
|
||||
typedef struct _GtkProgressBarAccessible GtkProgressBarAccessible;
|
||||
typedef struct _GtkProgressBarAccessibleClass GtkProgressBarAccessibleClass;
|
||||
typedef struct _GtkProgressBarAccessiblePrivate GtkProgressBarAccessiblePrivate;
|
||||
|
||||
struct _GtkProgressBarAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
|
||||
GtkProgressBarAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkProgressBarAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_progress_bar_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_PROGRESS_BAR_ACCESSIBLE_H__ */
|
@ -1,29 +0,0 @@
|
||||
/* gtkprogressbaraccessibleprivate.h: Private GtkProgressBarAccessible API
|
||||
*
|
||||
* Copyright 2020 GNOME Foundation
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*
|
||||
* 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.1 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtkprogressbaraccessible.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_progress_bar_accessible_update_value (GtkProgressBarAccessible *self);
|
||||
|
||||
G_END_DECLS
|
@ -1,118 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkradiobuttonaccessible.h"
|
||||
|
||||
struct _GtkRadioButtonAccessiblePrivate
|
||||
{
|
||||
GSList *old_group;
|
||||
};
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkRadioButtonAccessible, gtk_radio_button_accessible, GTK_TYPE_TOGGLE_BUTTON_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
gtk_radio_button_accessible_initialize (AtkObject *accessible,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_radio_button_accessible_parent_class)->initialize (accessible, data);
|
||||
|
||||
accessible->role = ATK_ROLE_RADIO_BUTTON;
|
||||
}
|
||||
|
||||
static AtkRelationSet *
|
||||
gtk_radio_button_accessible_ref_relation_set (AtkObject *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
AtkRelationSet *relation_set;
|
||||
GSList *list;
|
||||
GtkRadioButtonAccessible *radio_button;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
radio_button = GTK_RADIO_BUTTON_ACCESSIBLE (obj);
|
||||
|
||||
relation_set = ATK_OBJECT_CLASS (gtk_radio_button_accessible_parent_class)->ref_relation_set (obj);
|
||||
|
||||
/* If the radio button'group has changed remove the relation */
|
||||
list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget));
|
||||
|
||||
if (radio_button->priv->old_group != list)
|
||||
{
|
||||
AtkRelation *relation;
|
||||
|
||||
relation = atk_relation_set_get_relation_by_type (relation_set, ATK_RELATION_MEMBER_OF);
|
||||
atk_relation_set_remove (relation_set, relation);
|
||||
}
|
||||
|
||||
if (!atk_relation_set_contains (relation_set, ATK_RELATION_MEMBER_OF))
|
||||
{
|
||||
/*
|
||||
* Get the members of the button group
|
||||
*/
|
||||
radio_button->priv->old_group = list;
|
||||
if (list)
|
||||
{
|
||||
AtkObject **accessible_array;
|
||||
guint list_length;
|
||||
AtkRelation* relation;
|
||||
int i = 0;
|
||||
|
||||
list_length = g_slist_length (list);
|
||||
accessible_array = g_new (AtkObject *, list_length);
|
||||
while (list != NULL)
|
||||
{
|
||||
GtkWidget* list_item = list->data;
|
||||
|
||||
accessible_array[i++] = gtk_widget_get_accessible (list_item);
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
relation = atk_relation_new (accessible_array, list_length,
|
||||
ATK_RELATION_MEMBER_OF);
|
||||
g_free (accessible_array);
|
||||
|
||||
atk_relation_set_add (relation_set, relation);
|
||||
/*
|
||||
* Unref the relation so that it is not leaked.
|
||||
*/
|
||||
g_object_unref (relation);
|
||||
}
|
||||
}
|
||||
|
||||
return relation_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_radio_button_accessible_class_init (GtkRadioButtonAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->initialize = gtk_radio_button_accessible_initialize;
|
||||
class->ref_relation_set = gtk_radio_button_accessible_ref_relation_set;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_radio_button_accessible_init (GtkRadioButtonAccessible *radio_button)
|
||||
{
|
||||
radio_button->priv = gtk_radio_button_accessible_get_instance_private (radio_button);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RADIO_BUTTON_ACCESSIBLE_H__
|
||||
#define __GTK_RADIO_BUTTON_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtktogglebuttonaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_RADIO_BUTTON_ACCESSIBLE (gtk_radio_button_accessible_get_type ())
|
||||
#define GTK_RADIO_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE, GtkRadioButtonAccessible))
|
||||
#define GTK_RADIO_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE, GtkRadioButtonAccessibleClass))
|
||||
#define GTK_IS_RADIO_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE))
|
||||
#define GTK_IS_RADIO_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE))
|
||||
#define GTK_RADIO_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RADIO_BUTTON_ACCESSIBLE, GtkRadioButtonAccessibleClass))
|
||||
|
||||
typedef struct _GtkRadioButtonAccessible GtkRadioButtonAccessible;
|
||||
typedef struct _GtkRadioButtonAccessibleClass GtkRadioButtonAccessibleClass;
|
||||
typedef struct _GtkRadioButtonAccessiblePrivate GtkRadioButtonAccessiblePrivate;
|
||||
|
||||
struct _GtkRadioButtonAccessible
|
||||
{
|
||||
GtkToggleButtonAccessible parent;
|
||||
|
||||
GtkRadioButtonAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkRadioButtonAccessibleClass
|
||||
{
|
||||
GtkToggleButtonAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_radio_button_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RADIO_BUTTON_ACCESSIBLE_H__ */
|
@ -1,305 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkrangeaccessible.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
gulong value_changed_id;
|
||||
} GtkRangeAccessiblePrivate;
|
||||
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkRangeAccessible, gtk_range_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkRangeAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
gtk_range_accessible_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
g_object_notify (G_OBJECT (data), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_widget_set (GtkAccessible *accessible)
|
||||
{
|
||||
GtkRangeAccessible *self = GTK_RANGE_ACCESSIBLE (accessible);
|
||||
GtkRangeAccessiblePrivate *priv = gtk_range_accessible_get_instance_private (self);
|
||||
GtkWidget *range;
|
||||
GtkAdjustment *adj;
|
||||
|
||||
range = gtk_accessible_get_widget (accessible);
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (range));
|
||||
if (adj != NULL)
|
||||
{
|
||||
priv->adjustment = g_object_ref (adj);
|
||||
priv->value_changed_id =
|
||||
g_signal_connect (priv->adjustment, "value-changed",
|
||||
G_CALLBACK (gtk_range_accessible_value_changed),
|
||||
self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_widget_unset (GtkAccessible *accessible)
|
||||
{
|
||||
GtkRangeAccessible *self = GTK_RANGE_ACCESSIBLE (accessible);
|
||||
GtkRangeAccessiblePrivate *priv = gtk_range_accessible_get_instance_private (self);
|
||||
|
||||
if (priv->adjustment != NULL &&
|
||||
priv->value_changed_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id);
|
||||
priv->value_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_range_accessible_update_adjustment (GtkRangeAccessible *self)
|
||||
{
|
||||
gtk_range_accessible_widget_unset (GTK_ACCESSIBLE (self));
|
||||
gtk_range_accessible_widget_set (GTK_ACCESSIBLE (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
ATK_OBJECT_CLASS (gtk_range_accessible_parent_class)->initialize (obj, data);
|
||||
obj->role = ATK_ROLE_SLIDER;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_dispose (GObject *gobject)
|
||||
{
|
||||
GtkRangeAccessible *self = GTK_RANGE_ACCESSIBLE (gobject);
|
||||
GtkRangeAccessiblePrivate *priv = gtk_range_accessible_get_instance_private (self);
|
||||
|
||||
if (priv->adjustment != NULL && priv->value_changed_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id);
|
||||
priv->value_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
|
||||
G_OBJECT_CLASS (gtk_range_accessible_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_class_init (GtkRangeAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
AtkObjectClass *atkobject_class = ATK_OBJECT_CLASS (klass);
|
||||
GtkAccessibleClass *accessible_class = (GtkAccessibleClass*)klass;
|
||||
|
||||
gobject_class->dispose = gtk_range_accessible_dispose;
|
||||
|
||||
atkobject_class->initialize = gtk_range_accessible_initialize;
|
||||
|
||||
accessible_class->widget_set = gtk_range_accessible_widget_set;
|
||||
accessible_class->widget_unset = gtk_range_accessible_widget_unset;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_init (GtkRangeAccessible *range)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_value (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
double max;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
max = gtk_adjustment_get_upper (adjustment)
|
||||
- gtk_adjustment_get_page_size (adjustment);
|
||||
|
||||
if (gtk_range_get_restrict_to_fill_level (GTK_RANGE (widget)))
|
||||
max = MIN (max, gtk_range_get_fill_level (GTK_RANGE (widget)));
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, max);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_lower (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_get_minimum_increment (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_range_accessible_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, g_value_get_double (value));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_get_value_and_text (AtkValue *obj,
|
||||
double *value,
|
||||
char **text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
*value = gtk_adjustment_get_value (adjustment);
|
||||
*text = NULL;
|
||||
}
|
||||
|
||||
static AtkRange *
|
||||
gtk_range_accessible_get_range (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
double min, max;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return NULL;
|
||||
|
||||
min = gtk_adjustment_get_lower (adjustment);
|
||||
max = gtk_adjustment_get_upper (adjustment)
|
||||
- gtk_adjustment_get_page_size (adjustment);
|
||||
|
||||
if (gtk_range_get_restrict_to_fill_level (GTK_RANGE (widget)))
|
||||
max = MIN (max, gtk_range_get_fill_level (GTK_RANGE (widget)));
|
||||
|
||||
return atk_range_new (min, max, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_range_accessible_set_value (AtkValue *obj,
|
||||
const double value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, value);
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_range_accessible_get_increment (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (widget));
|
||||
if (adjustment == NULL)
|
||||
return 0;
|
||||
|
||||
return gtk_adjustment_get_minimum_increment (adjustment);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_range_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_range_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_range_accessible_get_minimum_value;
|
||||
iface->get_minimum_increment = gtk_range_accessible_get_minimum_increment;
|
||||
iface->set_current_value = gtk_range_accessible_set_current_value;
|
||||
|
||||
iface->get_value_and_text = gtk_range_accessible_get_value_and_text;
|
||||
iface->get_range = gtk_range_accessible_get_range;
|
||||
iface->set_value = gtk_range_accessible_set_value;
|
||||
iface->get_increment = gtk_range_accessible_get_increment;
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RANGE_ACCESSIBLE_H__
|
||||
#define __GTK_RANGE_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_RANGE_ACCESSIBLE (gtk_range_accessible_get_type ())
|
||||
#define GTK_RANGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessible))
|
||||
#define GTK_RANGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessibleClass))
|
||||
#define GTK_IS_RANGE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RANGE_ACCESSIBLE))
|
||||
#define GTK_IS_RANGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RANGE_ACCESSIBLE))
|
||||
#define GTK_RANGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RANGE_ACCESSIBLE, GtkRangeAccessibleClass))
|
||||
|
||||
typedef struct _GtkRangeAccessible GtkRangeAccessible;
|
||||
typedef struct _GtkRangeAccessibleClass GtkRangeAccessibleClass;
|
||||
|
||||
struct _GtkRangeAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkRangeAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_range_accessible_get_type (void);
|
||||
|
||||
/*< private >*/
|
||||
void gtk_range_accessible_update_adjustment (GtkRangeAccessible *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RANGE_ACCESSIBLE_H__ */
|
@ -1,123 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkrenderercellaccessible.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
struct _GtkRendererCellAccessiblePrivate
|
||||
{
|
||||
GtkCellRenderer *renderer;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_RENDERER
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkRendererCellAccessible, gtk_renderer_cell_accessible, GTK_TYPE_CELL_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
gtk_renderer_cell_accessible_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRendererCellAccessible *accessible = GTK_RENDERER_CELL_ACCESSIBLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_RENDERER:
|
||||
accessible->priv->renderer = g_value_dup_object (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_cell_accessible_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRendererCellAccessible *accessible = GTK_RENDERER_CELL_ACCESSIBLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_RENDERER:
|
||||
g_value_set_object (value, accessible->priv->renderer);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_cell_accessible_finalize (GObject *object)
|
||||
{
|
||||
GtkRendererCellAccessible *renderer_cell = GTK_RENDERER_CELL_ACCESSIBLE (object);
|
||||
|
||||
if (renderer_cell->priv->renderer)
|
||||
g_object_unref (renderer_cell->priv->renderer);
|
||||
|
||||
G_OBJECT_CLASS (gtk_renderer_cell_accessible_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_cell_accessible_class_init (GtkRendererCellAccessibleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->get_property = gtk_renderer_cell_accessible_get_property;
|
||||
gobject_class->set_property = gtk_renderer_cell_accessible_set_property;
|
||||
gobject_class->finalize = gtk_renderer_cell_accessible_finalize;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RENDERER,
|
||||
g_param_spec_object ("renderer",
|
||||
P_("Cell renderer"),
|
||||
P_("The cell renderer represented by this accessible"),
|
||||
GTK_TYPE_CELL_RENDERER,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_cell_accessible_init (GtkRendererCellAccessible *renderer_cell)
|
||||
{
|
||||
renderer_cell->priv = gtk_renderer_cell_accessible_get_instance_private (renderer_cell);
|
||||
}
|
||||
|
||||
AtkObject *
|
||||
gtk_renderer_cell_accessible_new (GtkCellRenderer *renderer)
|
||||
{
|
||||
AtkObject *object;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), NULL);
|
||||
|
||||
object = g_object_new (_gtk_cell_renderer_get_accessible_type (renderer),
|
||||
"renderer", renderer,
|
||||
NULL);
|
||||
|
||||
atk_object_set_role (object, ATK_ROLE_TABLE_CELL);
|
||||
|
||||
return object;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RENDERER_CELL_ACCESSIBLE_H__
|
||||
#define __GTK_RENDERER_CELL_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <gtk/a11y/gtkcellaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_RENDERER_CELL_ACCESSIBLE (gtk_renderer_cell_accessible_get_type ())
|
||||
#define GTK_RENDERER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessible))
|
||||
#define GTK_RENDERER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessibleClass))
|
||||
#define GTK_IS_RENDERER_CELL_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE))
|
||||
#define GTK_IS_RENDERER_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_RENDERER_CELL_ACCESSIBLE))
|
||||
#define GTK_RENDERER_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_RENDERER_CELL_ACCESSIBLE, GtkRendererCellAccessibleClass))
|
||||
|
||||
typedef struct _GtkRendererCellAccessible GtkRendererCellAccessible;
|
||||
typedef struct _GtkRendererCellAccessibleClass GtkRendererCellAccessibleClass;
|
||||
typedef struct _GtkRendererCellAccessiblePrivate GtkRendererCellAccessiblePrivate;
|
||||
|
||||
struct _GtkRendererCellAccessible
|
||||
{
|
||||
GtkCellAccessible parent;
|
||||
|
||||
GtkRendererCellAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkRendererCellAccessibleClass
|
||||
{
|
||||
GtkCellAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_renderer_cell_accessible_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
AtkObject *gtk_renderer_cell_accessible_new (GtkCellRenderer * renderer);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDERER_CELL_ACCESSIBLE_H__ */
|
@ -1,53 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkscaleaccessible.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkScaleAccessible, gtk_scale_accessible, GTK_TYPE_RANGE_ACCESSIBLE)
|
||||
|
||||
static const char *
|
||||
gtk_scale_accessible_get_description (AtkObject *object)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
PangoLayout *layout;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
layout = gtk_scale_get_layout (GTK_SCALE (widget));
|
||||
if (layout)
|
||||
return pango_layout_get_text (layout);
|
||||
|
||||
return ATK_OBJECT_CLASS (gtk_scale_accessible_parent_class)->get_description (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_accessible_class_init (GtkScaleAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_description = gtk_scale_accessible_get_description;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_accessible_init (GtkScaleAccessible *scale)
|
||||
{
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SCALE_ACCESSIBLE_H__
|
||||
#define __GTK_SCALE_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkrangeaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SCALE_ACCESSIBLE (gtk_scale_accessible_get_type ())
|
||||
#define GTK_SCALE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessible))
|
||||
#define GTK_SCALE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass))
|
||||
#define GTK_IS_SCALE_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_ACCESSIBLE))
|
||||
#define GTK_IS_SCALE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_ACCESSIBLE))
|
||||
#define GTK_SCALE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_ACCESSIBLE, GtkScaleAccessibleClass))
|
||||
|
||||
typedef struct _GtkScaleAccessible GtkScaleAccessible;
|
||||
typedef struct _GtkScaleAccessibleClass GtkScaleAccessibleClass;
|
||||
typedef struct _GtkScaleAccessiblePrivate GtkScaleAccessiblePrivate;
|
||||
|
||||
struct _GtkScaleAccessible
|
||||
{
|
||||
GtkRangeAccessible parent;
|
||||
|
||||
GtkScaleAccessiblePrivate *priv;
|
||||
};
|
||||
|
||||
struct _GtkScaleAccessibleClass
|
||||
{
|
||||
GtkRangeAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_scale_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SCALE_ACCESSIBLE_H__ */
|
@ -1,376 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2008 Jan Arne Petersen
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkscalebuttonaccessible.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef struct {
|
||||
GtkAdjustment *adjustment;
|
||||
gulong value_changed_id;
|
||||
} GtkScaleButtonAccessiblePrivate;
|
||||
|
||||
static void atk_action_interface_init (AtkActionIface *iface);
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkScaleButtonAccessible, gtk_scale_button_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkScaleButtonAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, atk_action_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init));
|
||||
|
||||
static void
|
||||
on_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScaleButtonAccessible *self = data;
|
||||
|
||||
g_object_notify (G_OBJECT (self), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
on_adjustment_changed (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScaleButton *scale_button = GTK_SCALE_BUTTON (gobject);
|
||||
GtkScaleButtonAccessible *self = data;
|
||||
GtkScaleButtonAccessiblePrivate *priv =
|
||||
gtk_scale_button_accessible_get_instance_private (self);
|
||||
GtkAdjustment *adjustment =
|
||||
gtk_scale_button_get_adjustment (scale_button);
|
||||
|
||||
if (priv->adjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->adjustment != NULL && priv->value_changed_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id);
|
||||
priv->value_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
|
||||
if (adjustment != NULL)
|
||||
{
|
||||
priv->adjustment = g_object_ref (adjustment);
|
||||
priv->value_changed_id =
|
||||
g_signal_connect (priv->adjustment, "notify::value-changed",
|
||||
G_CALLBACK (on_value_changed),
|
||||
self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScaleButton *scale_button = data;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_scale_button_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (scale_button, "notify::adjustment",
|
||||
G_CALLBACK (on_adjustment_changed),
|
||||
obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_dispose (GObject *gobject)
|
||||
{
|
||||
GtkScaleButtonAccessible *self = GTK_SCALE_BUTTON_ACCESSIBLE (gobject);
|
||||
GtkScaleButtonAccessiblePrivate *priv =
|
||||
gtk_scale_button_accessible_get_instance_private (self);
|
||||
|
||||
if (priv->adjustment != NULL && priv->value_changed_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id);
|
||||
priv->value_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
|
||||
G_OBJECT_CLASS (gtk_scale_button_accessible_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_class_init (GtkScaleButtonAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gtk_scale_button_accessible_dispose;
|
||||
|
||||
atk_object_class->initialize = gtk_scale_button_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_init (GtkScaleButtonAccessible *self)
|
||||
{
|
||||
ATK_OBJECT (self)->role = ATK_ROLE_SLIDER;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_scale_button_accessible_do_action (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (action));
|
||||
if (widget == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!gtk_widget_is_sensitive (widget) || !gtk_widget_get_visible (widget))
|
||||
return FALSE;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
g_signal_emit_by_name (widget, "popup");
|
||||
return TRUE;
|
||||
case 1:
|
||||
g_signal_emit_by_name (widget, "popdown");
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_scale_button_accessible_get_n_actions (AtkAction *action)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_scale_button_accessible_get_description (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action description", "Pops up the slider");
|
||||
case 1:
|
||||
return C_("Action description", "Dismisses the slider");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_scale_button_accessible_action_get_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return "popup";
|
||||
case 1:
|
||||
return "popdown";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
gtk_scale_button_accessible_action_get_localized_name (AtkAction *action,
|
||||
int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return C_("Action name", "Popup");
|
||||
case 1:
|
||||
return C_("Action name", "Dismiss");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
atk_action_interface_init (AtkActionIface *iface)
|
||||
{
|
||||
iface->do_action = gtk_scale_button_accessible_do_action;
|
||||
iface->get_n_actions = gtk_scale_button_accessible_get_n_actions;
|
||||
iface->get_description = gtk_scale_button_accessible_get_description;
|
||||
iface->get_name = gtk_scale_button_accessible_action_get_name;
|
||||
iface->get_localized_name = gtk_scale_button_accessible_action_get_localized_name;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_value (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_upper (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_lower (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_get_minimum_increment (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_scale_button_accessible_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, g_value_get_double (value));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_get_value_and_text (AtkValue *obj,
|
||||
double *value,
|
||||
char **text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
*value = gtk_adjustment_get_value (adjustment);
|
||||
*text = NULL;
|
||||
}
|
||||
|
||||
static AtkRange *
|
||||
gtk_scale_button_accessible_get_range (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return NULL;
|
||||
|
||||
return atk_range_new (gtk_adjustment_get_lower (adjustment),
|
||||
gtk_adjustment_get_upper (adjustment),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scale_button_accessible_set_value (AtkValue *obj,
|
||||
const double value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, value);
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_scale_button_accessible_get_increment (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (widget));
|
||||
if (adjustment == NULL)
|
||||
return 0;
|
||||
|
||||
return gtk_adjustment_get_minimum_increment (adjustment);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_scale_button_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_scale_button_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_scale_button_accessible_get_minimum_value;
|
||||
iface->get_minimum_increment = gtk_scale_button_accessible_get_minimum_increment;
|
||||
iface->set_current_value = gtk_scale_button_accessible_set_current_value;
|
||||
|
||||
iface->get_value_and_text = gtk_scale_button_accessible_get_value_and_text;
|
||||
iface->get_range = gtk_scale_button_accessible_get_range;
|
||||
iface->set_value = gtk_scale_button_accessible_set_value;
|
||||
iface->get_increment = gtk_scale_button_accessible_get_increment;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* Copyright 2008 Jan Arne Petersen <jap@gnome.org>
|
||||
*
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SCALE_BUTTON_ACCESSIBLE_H__
|
||||
#define __GTK_SCALE_BUTTON_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkbuttonaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SCALE_BUTTON_ACCESSIBLE (gtk_scale_button_accessible_get_type ())
|
||||
#define GTK_SCALE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE, GtkScaleButtonAccessible))
|
||||
#define GTK_SCALE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE, GtkScaleButtonAccessibleClass))
|
||||
#define GTK_IS_SCALE_BUTTON_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE))
|
||||
#define GTK_IS_SCALE_BUTTON_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE))
|
||||
#define GTK_SCALE_BUTTON_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCALE_BUTTON_ACCESSIBLE, GtkScaleButtonAccessibleClass))
|
||||
|
||||
typedef struct _GtkScaleButtonAccessible GtkScaleButtonAccessible;
|
||||
typedef struct _GtkScaleButtonAccessibleClass GtkScaleButtonAccessibleClass;
|
||||
|
||||
struct _GtkScaleButtonAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkScaleButtonAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_scale_button_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SCALE_BUTTON_ACCESSIBLE_H__ */
|
@ -1,293 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkscrollbaraccessible.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
gulong value_changed_id;
|
||||
} GtkScrollbarAccessiblePrivate;
|
||||
|
||||
static void atk_value_interface_init (AtkValueIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkScrollbarAccessible, gtk_scrollbar_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
|
||||
G_ADD_PRIVATE (GtkScrollbarAccessible)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
|
||||
|
||||
static void
|
||||
on_value_changed (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScrollbarAccessible *self = data;
|
||||
|
||||
g_object_notify (G_OBJECT (self), "accessible-value");
|
||||
}
|
||||
|
||||
static void
|
||||
on_adjustment_changed (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScrollbar *scrollbar = GTK_SCROLLBAR (gobject);
|
||||
GtkScrollbarAccessible *self = data;
|
||||
GtkScrollbarAccessiblePrivate *priv =
|
||||
gtk_scrollbar_accessible_get_instance_private (self);
|
||||
GtkAdjustment *adjustment =
|
||||
gtk_scrollbar_get_adjustment (scrollbar);
|
||||
|
||||
if (priv->adjustment == adjustment)
|
||||
return;
|
||||
|
||||
if (priv->adjustment != NULL && priv->value_changed_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id);
|
||||
priv->value_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
|
||||
if (adjustment != NULL)
|
||||
{
|
||||
priv->adjustment = g_object_ref (adjustment);
|
||||
priv->value_changed_id =
|
||||
g_signal_connect (priv->adjustment, "value-changed",
|
||||
G_CALLBACK (on_value_changed),
|
||||
self);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_dispose (GObject *gobject)
|
||||
{
|
||||
GtkScrollbarAccessible *self = GTK_SCROLLBAR_ACCESSIBLE (gobject);
|
||||
GtkScrollbarAccessiblePrivate *priv =
|
||||
gtk_scrollbar_accessible_get_instance_private (self);
|
||||
|
||||
if (priv->adjustment != NULL && priv->value_changed_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (priv->adjustment, priv->value_changed_id);
|
||||
priv->value_changed_id = 0;
|
||||
}
|
||||
|
||||
g_clear_object (&priv->adjustment);
|
||||
|
||||
G_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScrollbar *scrollbar = data;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_scrollbar_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
g_signal_connect (scrollbar, "notify::adjustment",
|
||||
G_CALLBACK (on_adjustment_changed),
|
||||
obj);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_class_init (GtkScrollbarAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
atk_object_class->initialize = gtk_scrollbar_accessible_initialize;
|
||||
|
||||
gobject_class->dispose = gtk_scrollbar_accessible_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_init (GtkScrollbarAccessible *self)
|
||||
{
|
||||
ATK_OBJECT (self)->role = ATK_ROLE_SCROLL_BAR;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_get_current_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_value (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_get_maximum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
double max;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
max = gtk_adjustment_get_upper (adjustment)
|
||||
- gtk_adjustment_get_page_size (adjustment);
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, max);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_get_minimum_value (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_lower (adjustment));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_get_minimum_increment (AtkValue *obj,
|
||||
GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, gtk_adjustment_get_minimum_increment (adjustment));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_scrollbar_accessible_set_current_value (AtkValue *obj,
|
||||
const GValue *value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, g_value_get_double (value));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_get_value_and_text (AtkValue *obj,
|
||||
double *value,
|
||||
char **text)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
*value = gtk_adjustment_get_value (adjustment);
|
||||
*text = NULL;
|
||||
}
|
||||
|
||||
static AtkRange *
|
||||
gtk_scrollbar_accessible_get_range (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
double min, max;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return NULL;
|
||||
|
||||
min = gtk_adjustment_get_lower (adjustment);
|
||||
max = gtk_adjustment_get_upper (adjustment)
|
||||
- gtk_adjustment_get_page_size (adjustment);
|
||||
|
||||
return atk_range_new (min, max, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrollbar_accessible_set_value (AtkValue *obj,
|
||||
const double value)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return;
|
||||
|
||||
gtk_adjustment_set_value (adjustment, value);
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_scrollbar_accessible_get_increment (AtkValue *obj)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkAdjustment *adjustment;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
adjustment = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (widget));
|
||||
if (adjustment == NULL)
|
||||
return 0;
|
||||
|
||||
return gtk_adjustment_get_minimum_increment (adjustment);
|
||||
}
|
||||
|
||||
static void
|
||||
atk_value_interface_init (AtkValueIface *iface)
|
||||
{
|
||||
iface->get_current_value = gtk_scrollbar_accessible_get_current_value;
|
||||
iface->get_maximum_value = gtk_scrollbar_accessible_get_maximum_value;
|
||||
iface->get_minimum_value = gtk_scrollbar_accessible_get_minimum_value;
|
||||
iface->get_minimum_increment = gtk_scrollbar_accessible_get_minimum_increment;
|
||||
iface->set_current_value = gtk_scrollbar_accessible_set_current_value;
|
||||
|
||||
iface->get_value_and_text = gtk_scrollbar_accessible_get_value_and_text;
|
||||
iface->get_range = gtk_scrollbar_accessible_get_range;
|
||||
iface->set_value = gtk_scrollbar_accessible_set_value;
|
||||
iface->get_increment = gtk_scrollbar_accessible_get_increment;
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SCROLLBAR_ACCESSIBLE_H__
|
||||
#define __GTK_SCROLLBAR_ACCESSIBLE_H__
|
||||
|
||||
#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk-a11y.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gtk/a11y/gtkwidgetaccessible.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SCROLLBAR_ACCESSIBLE (gtk_scrollbar_accessible_get_type ())
|
||||
#define GTK_SCROLLBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessible))
|
||||
#define GTK_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass))
|
||||
#define GTK_IS_SCROLLBAR_ACCESSIBLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE))
|
||||
#define GTK_IS_SCROLLBAR_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SCROLLBAR_ACCESSIBLE))
|
||||
#define GTK_SCROLLBAR_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SCROLLBAR_ACCESSIBLE, GtkScrollbarAccessibleClass))
|
||||
|
||||
typedef struct _GtkScrollbarAccessible GtkScrollbarAccessible;
|
||||
typedef struct _GtkScrollbarAccessibleClass GtkScrollbarAccessibleClass;
|
||||
|
||||
struct _GtkScrollbarAccessible
|
||||
{
|
||||
GtkWidgetAccessible parent;
|
||||
};
|
||||
|
||||
struct _GtkScrollbarAccessibleClass
|
||||
{
|
||||
GtkWidgetAccessibleClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_scrollbar_accessible_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SCROLLBAR_ACCESSIBLE_H__ */
|
@ -1,173 +0,0 @@
|
||||
/* GTK+ - accessibility implementations
|
||||
* 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkscrolledwindowaccessible.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GtkScrolledWindowAccessible, gtk_scrolled_window_accessible, GTK_TYPE_WIDGET_ACCESSIBLE)
|
||||
|
||||
static void
|
||||
visibility_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (!g_strcmp0 (pspec->name, "visible"))
|
||||
{
|
||||
int index;
|
||||
int n_children;
|
||||
gboolean child_added = FALSE;
|
||||
AtkObject *child;
|
||||
GtkWidget *widget;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
GtkWidget *hscrollbar, *vscrollbar;
|
||||
GtkAccessible *accessible = GTK_ACCESSIBLE (user_data);
|
||||
|
||||
widget = gtk_accessible_get_widget (user_data);
|
||||
if (widget == NULL)
|
||||
return;
|
||||
|
||||
scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||
index = n_children = 1;
|
||||
|
||||
hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window);
|
||||
vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window);
|
||||
|
||||
if ((gpointer) object == (gpointer) (hscrollbar))
|
||||
{
|
||||
if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
|
||||
child_added = TRUE;
|
||||
|
||||
child = gtk_widget_get_accessible (hscrollbar);
|
||||
}
|
||||
else if ((gpointer) object == (gpointer) (vscrollbar))
|
||||
{
|
||||
if (gtk_scrolled_window_get_vscrollbar (scrolled_window))
|
||||
child_added = TRUE;
|
||||
|
||||
child = gtk_widget_get_accessible (vscrollbar);
|
||||
if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
|
||||
index = n_children + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
|
||||
if (child_added)
|
||||
g_signal_emit_by_name (accessible, "children-changed::add", index, child, NULL);
|
||||
else
|
||||
g_signal_emit_by_name (accessible, "children-changed::remove", index, child, NULL);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_accessible_initialize (AtkObject *obj,
|
||||
gpointer data)
|
||||
{
|
||||
GtkScrolledWindow *window;
|
||||
|
||||
ATK_OBJECT_CLASS (gtk_scrolled_window_accessible_parent_class)->initialize (obj, data);
|
||||
|
||||
window = GTK_SCROLLED_WINDOW (data);
|
||||
|
||||
g_signal_connect_object (gtk_scrolled_window_get_hscrollbar (window), "notify::visible",
|
||||
G_CALLBACK (visibility_changed),
|
||||
obj, 0);
|
||||
g_signal_connect_object (gtk_scrolled_window_get_vscrollbar (window), "notify::visible",
|
||||
G_CALLBACK (visibility_changed),
|
||||
obj, 0);
|
||||
|
||||
obj->role = ATK_ROLE_SCROLL_PANE;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_scrolled_window_accessible_get_n_children (AtkObject *object)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
int n_children;
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (object));
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||
|
||||
n_children = 0;
|
||||
if (gtk_scrolled_window_get_child (scrolled_window))
|
||||
n_children++;
|
||||
if (gtk_scrolled_window_get_hscrollbar (scrolled_window))
|
||||
n_children++;
|
||||
if (gtk_scrolled_window_get_vscrollbar (scrolled_window))
|
||||
n_children++;
|
||||
|
||||
return n_children;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
gtk_scrolled_window_accessible_ref_child (AtkObject *obj,
|
||||
int child)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkScrolledWindow *scrolled_window;
|
||||
GtkWidget *hscrollbar, *vscrollbar;
|
||||
GtkWidget *c;
|
||||
GtkWidget *chosen = NULL;
|
||||
|
||||
g_return_val_if_fail (child >= 0, NULL);
|
||||
|
||||
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
|
||||
if (widget == NULL)
|
||||
return NULL;
|
||||
|
||||
scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||
c = gtk_scrolled_window_get_child (scrolled_window);
|
||||
hscrollbar = gtk_scrolled_window_get_hscrollbar (scrolled_window);
|
||||
vscrollbar = gtk_scrolled_window_get_vscrollbar (scrolled_window);
|
||||
|
||||
if (child == 2)
|
||||
chosen = vscrollbar;
|
||||
else if (child == 1)
|
||||
chosen = c ? hscrollbar : vscrollbar;
|
||||
else if (child == 0)
|
||||
chosen = c ? c : (hscrollbar ? hscrollbar : vscrollbar);
|
||||
|
||||
if (chosen)
|
||||
return g_object_ref (gtk_widget_get_accessible (chosen));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_accessible_class_init (GtkScrolledWindowAccessibleClass *klass)
|
||||
{
|
||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
||||
|
||||
class->get_n_children = gtk_scrolled_window_accessible_get_n_children;
|
||||
class->ref_child = gtk_scrolled_window_accessible_ref_child;
|
||||
class->initialize = gtk_scrolled_window_accessible_initialize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_accessible_init (GtkScrolledWindowAccessible *window)
|
||||
{
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user