diff options
Diffstat (limited to 'atspi')
-rw-r--r-- | atspi/Makefile.am | 12 | ||||
-rw-r--r-- | atspi/atspi-accessible.c | 75 | ||||
-rw-r--r-- | atspi/atspi-accessible.h | 10 | ||||
-rw-r--r-- | atspi/atspi-action.c | 179 | ||||
-rw-r--r-- | atspi/atspi-action.h | 56 | ||||
-rw-r--r-- | atspi/atspi-component.c | 2 | ||||
-rw-r--r-- | atspi/atspi-component.h | 2 | ||||
-rw-r--r-- | atspi/atspi-document.c | 125 | ||||
-rw-r--r-- | atspi/atspi-document.h | 52 | ||||
-rw-r--r-- | atspi/atspi-editabletext.c | 256 | ||||
-rw-r--r-- | atspi/atspi-editabletext.h | 62 | ||||
-rw-r--r-- | atspi/atspi-image.c | 165 | ||||
-rw-r--r-- | atspi/atspi-image.h | 55 | ||||
-rw-r--r-- | atspi/atspi-text.h | 2 | ||||
-rw-r--r-- | atspi/atspi-types.h | 9 | ||||
-rw-r--r-- | atspi/atspi-value.c | 152 | ||||
-rw-r--r-- | atspi/atspi-value.h | 56 | ||||
-rw-r--r-- | atspi/atspi.h | 5 |
18 files changed, 1242 insertions, 33 deletions
diff --git a/atspi/Makefile.am b/atspi/Makefile.am index 4da8fa00..528f313f 100644 --- a/atspi/Makefile.am +++ b/atspi/Makefile.am @@ -16,6 +16,8 @@ libatspi_la_SOURCES = \ atspi.h \ atspi-accessible.c \ atspi-accessible.h \ + atspi-action.c \ + atspi-action.h \ atspi-application.c \ atspi-application.h \ atspi-component.c \ @@ -24,9 +26,15 @@ libatspi_la_SOURCES = \ atspi-device-listener.c \ atspi-device-listener.h \ atspi-device-listener-private.h \ + atspi-document.c \ + atspi-document.h \ + atspi-editabletext.c \ + atspi-editabletext.h \ atspi-event-listener.c \ atspi-event-listener.h \ atspi-event-listener-private.h \ + atspi-image.c \ + atspi-image.h \ atspi-misc.c \ atspi-misc.h \ atspi-misc-private.h \ @@ -41,7 +49,9 @@ libatspi_la_SOURCES = \ atspi-table.h \ atspi-text.c \ atspi-text.h \ - atspi-types.h + atspi-types.h \ + atspi-value.c \ + atspi-value.h #BUILT_SOURCES = atspi-constants.h diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index a413f654..679491a0 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -25,10 +25,24 @@ #include <string.h> static void +atspi_action_interface_init (AtspiAction *action) +{ +} + +static void atspi_component_interface_init (AtspiComponent *component) { } +atspi_editable_text_interface_init (AtspiEditableText *editable_text) +{ +} + +static void +atspi_image_interface_init (AtspiImage *image) +{ +} + static void atspi_selection_interface_init (AtspiSelection *selection) { @@ -44,11 +58,20 @@ atspi_text_interface_init (AtspiText *text) { } +static void +atspi_value_interface_init (AtspiValue *value) +{ +} + G_DEFINE_TYPE_WITH_CODE (AtspiAccessible, atspi_accessible, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (ATSPI_TYPE_ACTION, atspi_action_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_COMPONENT, atspi_component_interface_init) + G_IMPLEMENT_INTERFACE (ATSPI_TYPE_EDITABLE_TEXT, atspi_editable_text_interface_init) + G_IMPLEMENT_INTERFACE (ATSPI_TYPE_IMAGE, atspi_image_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_SELECTION, atspi_selection_interface_init) G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TABLE, atspi_table_interface_init) - G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TEXT, atspi_text_interface_init)) + G_IMPLEMENT_INTERFACE (ATSPI_TYPE_TEXT, atspi_text_interface_init) + G_IMPLEMENT_INTERFACE (ATSPI_TYPE_VALUE, atspi_value_interface_init)) static void atspi_accessible_init (AtspiAccessible *accessible) @@ -550,7 +573,6 @@ atspi_accessible_get_host_application (AtspiAccessible *obj, GError **error) } } -#if 0 // TODO: interfaces */ /* Interface query methods */ /** @@ -783,17 +805,18 @@ AtspiApplication * atspi_accessible_get_application (AtspiAccessible *accessible) { return (_atspi_accessible_is_a (accessible, atspi_interface_application) ? - accessible : NULL); + g_object_ref (ATSPI_ACTION (accessible)) : NULL); } +#if 0 /** * atspi_accessible_get_action: * @obj: a pointer to the #AtspiAccessible instance to query. * * Get the #AtspiAction interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiAction interface instance, or - * NULL if @obj does not implement #AtspiAction. + * Returns: (transfer full): a pointer to an #AtspiAction interface + * instance, or NULL if @obj does not implement #AtspiAction. **/ AtspiAction * atspi_accessible_get_action (AtspiAccessible *accessible) @@ -808,8 +831,8 @@ atspi_accessible_get_action (AtspiAccessible *accessible) * * Get the #AtspiCollection interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiCollection interface instance, or - * NULL if @obj does not implement #AtspiCollection. + * Returns: (transfer full): a pointer to an #AtspiCollection interface + * instance, or NULL if @obj does not implement #AtspiCollection. **/ AtspiCollection * atspi_accessible_get_collection (AtspiAccessible *accessible) @@ -835,21 +858,20 @@ atspi_accessible_get_component (AtspiAccessible *obj) g_object_ref (ATSPI_COMPONENT (obj)) : NULL); } -#if 0 /** * atspi_accessible_get_document: * @obj: a pointer to the #AtspiAccessible instance to query. * * Get the #AtspiDocument interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiDocument interface instance, or - * NULL if @obj does not implement #AtspiDocument. + * Returns: (transfer full): a pointer to an #AtspiDocument interface + * instance, or NULL if @obj does not implement #AtspiDocument. **/ AtspiDocument * atspi_accessible_get_document (AtspiAccessible *accessible) { return (_atspi_accessible_is_a (accessible, atspi_interface_document) ? - accessible : NULL); + g_object_ref (ATSPI_DOCUMENT (accessible)) : NULL); } /** @@ -858,24 +880,25 @@ atspi_accessible_get_document (AtspiAccessible *accessible) * * Get the #AtspiEditableText interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiEditableText interface instance, or - * NULL if @obj does not implement #AtspiEditableText. + * Returns: (transfer full): a pointer to an #AtspiEditableText interface + * instance, or NULL if @obj does not implement #AtspiEditableText. **/ AtspiEditableText * atspi_accessible_get_editable_text (AtspiAccessible *accessible) { return (_atspi_accessible_is_a (accessible, atspi_interface_editable_text) ? - accessible : NULL); + g_object_ref (ATSPI_EDITABLE_TEXT (accessible)) : NULL); } +#if 0 /** * atspi_accessible_get_hypertext: * @obj: a pointer to the #AtspiAccessible instance to query. * * Get the #AtspiHypertext interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiHypertext interface instance, or - * NULL if @obj does not implement #AtspiHypertext. + * Returns: (transfer full): a pointer to an #AtspiHypertext interface + * instance, or NULL if @obj does not implement #AtspiHypertext. **/ AtspiHypertext * atspi_accessible_get_hypertext (AtspiAccessible *accessible) @@ -883,6 +906,7 @@ atspi_accessible_get_hypertext (AtspiAccessible *accessible) return (_atspi_accessible_is_a (accessible, atspi_interface_hypertext) ? accessible : NULL); } +#endif /** * atspi_accessible_get_image: @@ -890,16 +914,15 @@ atspi_accessible_get_hypertext (AtspiAccessible *accessible) * * Get the #AtspiImage interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiImage interface instance, or + * Returns: (transfer full): a pointer to an #AtspiImage interface instance, or * NULL if @obj does not implement #AtspiImage. **/ AtspiImage * atspi_accessible_get_image (AtspiAccessible *accessible) { return (_atspi_accessible_is_a (accessible, atspi_interface_image) ? - accessible : NULL); + g_object_ref (ATSPI_IMAGE (accessible)) : NULL); } -#endif /** * atspi_accessible_get_selection: @@ -924,8 +947,8 @@ atspi_accessible_get_selection (AtspiAccessible *accessible) * * Get the #AtspiStreamableContent interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiStreamableContent interface instance, or - * NULL if @obj does not implement #AtspiStreamableContent. + * Returns: (transfer full): a pointer to an #AtspiStreamableContent interface + * instance, or NULL if @obj does not implement #AtspiStreamableContent. **/ AtspiStreamableContent * atspi_accessible_get_streamable_content (AtspiAccessible *accessible) @@ -967,23 +990,23 @@ atspi_accessible_get_text (AtspiAccessible *obj) g_object_ref (ATSPI_TEXT (obj)) : NULL); } -#if 0 /** * atspi_accessible_get_value: * @obj: a pointer to the #AtspiAccessible instance to query. * * Get the #AtspiTable interface for an #AtspiAccessible. * - * Returns: a pointer to an #AtspiTable interface instance, or - * NULL if @obj does not implement #AtspiTable. + * Returns: (transfer full): a pointer to an #AtspiValue interface instance, or + * NULL if @obj does not implement #AtspiValue. **/ -AtspiTable * +AtspiValue * atspi_accessible_get_value (AtspiAccessible *accessible) { return (_atspi_accessible_is_a (accessible, atspi_interface_value) ? - accessible : NULL); + g_object_ref (ATSPI_VALUE (accessible)) : NULL); } +#if 0 static gboolean cspi_init_relation_type_table (AccessibleRelationType *relation_type_table) { diff --git a/atspi/atspi-accessible.h b/atspi/atspi-accessible.h index 4c0f939c..f4f4fdc4 100644 --- a/atspi/atspi-accessible.h +++ b/atspi/atspi-accessible.h @@ -95,11 +95,21 @@ GArray * atspi_accessible_get_attributes_as_array (AtspiAccessible *obj, GError AtspiAccessible * atspi_accessible_get_host_application (AtspiAccessible *obj, GError **error); +AtspiAction * atspi_accessible_get_action (AtspiAccessible *obj); + AtspiComponent * atspi_accessible_get_component (AtspiAccessible *obj); +AtspiDocument * atspi_accessible_get_document (AtspiAccessible *obj); + +AtspiEditableText * atspi_accessible_get_editable_text (AtspiAccessible *obj); + +AtspiImage * atspi_accessible_get_image (AtspiAccessible *obj); + AtspiSelection * atspi_accessible_get_selection (AtspiAccessible *obj); AtspiTable * atspi_accessible_get_table (AtspiAccessible *obj); AtspiText * atspi_accessible_get_text (AtspiAccessible *obj); + +AtspiValue * atspi_accessible_get_value (AtspiAccessible *obj); #endif /* _ATSPI_ACCESSIBLE_H_ */ diff --git a/atspi/atspi-action.c b/atspi/atspi-action.c new file mode 100644 index 00000000..3530b10f --- /dev/null +++ b/atspi/atspi-action.c @@ -0,0 +1,179 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +/** + * atspi_action_get_n_actions: + * @obj: a pointer to the #AtspiAction to query. + * + * Get the number of actions invokable on an #AtspiAction implementor. + * + * Returns: an integer indicating the number of invocable actions. + **/ +gint +atspi_action_get_n_actions (AtspiAction *obj, GError **error) +{ + dbus_int32_t retval = 0; + + g_return_val_if_fail (obj != NULL, -1); + + _atspi_dbus_get_property (obj, atspi_interface_action, "NActions", error, "i", &retval); + + return retval; +} + +/** + * atspi_action_get_description: + * @obj: a pointer to the #AtspiAction implementor to query. + * @i: an integer indicating which action to query. + * + * Get the description of '@i-th' action invocable on an + * object implementing #AtspiAction. + * + * Returns: a UTF-8 string describing the '@i-th' invocable action. + **/ +gchar * +atspi_action_get_description (AtspiAction *obj, int i, GError **error) +{ + dbus_int32_t d_i = i; + char *retval = NULL; + + g_return_val_if_fail (obj != NULL, NULL); + + _atspi_dbus_call (obj, atspi_interface_action, "GetDescription", error, "i=>s", d_i, &retval); + + return retval; +} + +/** + * atspi_action_get_key_binding: + * @obj: a pointer to the #AtspiAction implementor to query. + * @i: an integer indicating which action to query. + * + * Get the keybindings for the @i-th action invocable on an + * object implementing #AtspiAction, if any are defined. + * The keybindings string format is as follows: + * there are multiple parts to a keybinding string (typically 3). + * They are delimited with ";". The first is the action's + * keybinding which is usable if the object implementing the action + * is currently posted to the screen, e.g. if a menu is posted + * then these keybindings for the corresponding menu-items are + * available. The second keybinding substring is the full key sequence + * necessary to post the action's widget and activate it, e.g. for + * a menu item such as "File->Open" it would both post the menu and + * activate the item. Thus the second keybinding string is available + * during the lifetime of the containing toplevel window as a whole, + * whereas the first keybinding string only works while the object + * implementing AtkAction is posted. The third (and optional) + * keybinding string is the "keyboard shortcut" which invokes the + * action without posting any menus. + * Meta-keys are indicated by the conventional strings + * "<Control>", "<Alt>", "<Shift>", "<Mod2>", + * etc. (we use the same string as gtk_accelerator_name() in + * gtk+-2.X. + * + * Returns: a UTF-8 string which can be parsed to determine the @i-th + * invocable action's keybindings. + **/ +gchar * +atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error) +{ + dbus_int32_t d_i = i; + char *retval = NULL; + + g_return_val_if_fail (obj != NULL, NULL); + + _atspi_dbus_call (obj, atspi_interface_action, "GetKeyBinding", error, "i=>s", d_i, &retval); + + return retval; +} + +/** + * atspi_action_get_name: + * @obj: a pointer to the #AtspiAction implementor to query. + * @i: an integer indicating which action to query. + * + * Get the name of the '@i-th' action invocable on an + * object implementing #AtspiAction. + * + * Returns: the 'event type' name of the action, as a UTF-8 string. + **/ +gchar * +atspi_action_get_name (AtspiAction *obj, gint i, GError **error) +{ + dbus_int32_t d_i = i; + char *retval = NULL; + + g_return_val_if_fail (obj != NULL, NULL); + + _atspi_dbus_call (obj, atspi_interface_action, "GetName", error, "i=>s", d_i, &retval); + + return retval; +} + +/** + * atspi_action_do_action: + * @obj: a pointer to the #AtspiAction to query. + * @i: an integer specifying which action to invoke. + * + * Invoke the action indicated by #index. + * + * Returns: #TRUE if the action is successfully invoked, otherwise #FALSE. + **/ +gboolean +atspi_action_do_action (AtspiAction *obj, gint i, GError **error) +{ + dbus_int32_t d_i = i; + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_action, "DoAction", error, "i=>b", d_i, &retval); + + return retval; +} + +static void +atspi_action_base_init (AtspiAction *klass) +{ +} + +GType +atspi_action_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = + { + sizeof (AtspiAction), + (GBaseInitFunc) atspi_action_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiAction", &tinfo, 0); + + } + return type; +} diff --git a/atspi/atspi-action.h b/atspi/atspi-action.h new file mode 100644 index 00000000..e9184148 --- /dev/null +++ b/atspi/atspi-action.h @@ -0,0 +1,56 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_ACTION_H_ +#define _ATSPI_ACTION_H_ + +#include "glib-object.h" + +#include "atspi-constants.h" + +#include "atspi-types.h" + +#define ATSPI_TYPE_ACTION (atspi_action_get_type ()) +#define ATSPI_IS_ACTION(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_ACTION) +#define ATSPI_ACTION(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_ACTION, AtspiAction) +#define ATSPI_ACTION_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_ACTION, AtspiAction)) + +GType atspi_action_get_type (); + +struct _AtspiAction +{ + GTypeInterface parent; +}; + +gint atspi_action_get_n_actions (AtspiAction *obj, GError **error); + +gchar * atspi_action_get_description (AtspiAction *obj, int i, GError **error); + +gchar * atspi_action_get_key_binding (AtspiAction *obj, gint i, GError **error); + +gchar * atspi_action_get_name (AtspiAction *obj, gint i, GError **error); + +gboolean atspi_action_do_action (AtspiAction *obj, gint i, GError **error); + +#endif /* _ATSPI_ACTION_H_ */ diff --git a/atspi/atspi-component.c b/atspi/atspi-component.c index ae51c34d..1f2bf557 100644 --- a/atspi/atspi-component.c +++ b/atspi/atspi-component.c @@ -47,7 +47,7 @@ atspi_rect_copy (AtspiRect *src) G_DEFINE_BOXED_TYPE (AtspiRect, atspi_rect, atspi_rect_copy, atspi_rect_free) -static AtspiPoint * +AtspiPoint * atspi_point_copy (AtspiPoint *src) { AtspiPoint *dst = g_new (AtspiPoint, 1); diff --git a/atspi/atspi-component.h b/atspi/atspi-component.h index 257f3c37..35ab84c0 100644 --- a/atspi/atspi-component.h +++ b/atspi/atspi-component.h @@ -67,6 +67,8 @@ struct _AtspiPoint GType atspi_point_get_type (); +AtspiPoint *atspi_point_copy (AtspiPoint *src); + #define ATSPI_TYPE_COMPONENT (atspi_component_get_type ()) #define ATSPI_IS_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_COMPONENT) #define ATSPI_COMPONENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_COMPONENT, AtspiComponent) diff --git a/atspi/atspi-document.c b/atspi/atspi-document.c new file mode 100644 index 00000000..be742b4a --- /dev/null +++ b/atspi/atspi-document.c @@ -0,0 +1,125 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +/** + * atspi_document_get_locale: + * @obj: a pointer to the #Accessible object on which to operate. + * + * Gets the locale associated with the document's content. + * e.g. the locale for LOCALE_TYPE_MESSAGES. + * + * Returns: a string compliant with the POSIX standard for locale description. + **/ +gchar * +atspi_document_get_locale (AtspiDocument *obj, GError **error) +{ + gchar *retval = NULL; + + g_return_val_if_fail (obj != NULL, g_strdup ("C")); + + _atspi_dbus_call (obj, atspi_interface_document, "GetLocale", error, "=>s", &retval); + + return retval; +} + +/** + * atspi_document_get_attribute_value: + * @obj: a pointer to the #Accessible object on which to operate. + * @attribute: a string indicating the name of a specific attribute + * + * Gets the value of a single attribute, if specified for the document as a whole. + * + * (name-value pair) being queried. + * + * Returns a string corresponding to the value of the specified attribute, or + * an empty string if the attribute is unspecified for the object. + **/ +gchar * +atspi_document_get_attribute_value (AtspiDocument *obj, + gchar *attribute, + GError **error) +{ + gchar *retval = NULL; + + g_return_val_if_fail (obj != NULL, NULL); + + _atspi_dbus_call (obj, atspi_interface_document, "GetAttributevaluee", error, "s=>s", attribute, &retval); + + if (!retval) + retval = g_strdup (""); + + return retval; +} + + +/** + * atspi_document_get_attributes: + * @obj: a pointer to the #Accessible object on which to operate. + * + * Gets all attributes specified for a document as a whole. + * + * For attributes which change within + * the document content, see atspi_text_get_attribute_run instead. + * + * Returns: (element-type gchar* gchar*) (transfer full): an ::AttributeSet + * containing the attributes of the document, as name-value pairs. + **/ +GHashTable * +atspi_document_get_attributes (AtspiDocument *obj, GError **error) +{ + DBusMessage *message; + GHashTable *ret; + + g_return_val_if_fail (obj != NULL, NULL); + + message = _atspi_dbus_call_partial (obj, atspi_interface_document, "GetAttributes", error, ""); + ret = _atspi_dbus_hash_from_message (message); + dbus_message_unref (message); + return ret; +} + +static void +atspi_document_base_init (AtspiDocument *klass) +{ +} + +GType +atspi_document_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = + { + sizeof (AtspiDocument), + (GBaseInitFunc) atspi_document_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiDocument", &tinfo, 0); + + } + return type; +} diff --git a/atspi/atspi-document.h b/atspi/atspi-document.h new file mode 100644 index 00000000..afe79695 --- /dev/null +++ b/atspi/atspi-document.h @@ -0,0 +1,52 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_DOCUMENT_H_ +#define _ATSPI_DOCUMENT_H_ + +#include "glib-object.h" + +#include "atspi-constants.h" + +#include "atspi-types.h" + +#define ATSPI_TYPE_DOCUMENT (atspi_document_get_type ()) +#define ATSPI_IS_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_DOCUMENT) +#define ATSPI_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_DOCUMENT, AtspiDocument) +#define ATSPI_DOCUMENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_DOCUMENT, AtspiDocument)) + +GType atspi_document_get_type (); + +struct _AtspiDocument +{ + GTypeInterface parent; +}; + +gchar * atspi_document_get_locale (AtspiDocument *obj, GError **error); + +gchar * atspi_document_get_attribute_value (AtspiDocument *obj, gchar *attribute, GError **error); + +GHashTable * atspi_document_get_attributes (AtspiDocument *obj, GError **error); + +#endif /* _ATSPI_DOCUMENT_H_ */ diff --git a/atspi/atspi-editabletext.c b/atspi/atspi-editabletext.c new file mode 100644 index 00000000..e0d0a4f4 --- /dev/null +++ b/atspi/atspi-editabletext.c @@ -0,0 +1,256 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +#if 0 +/* TODO: implement */ +/** + * atspi_editable_text_set_attributes: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @attributes: a character string indicating the attributes to apply to the range, + * delimited by ':'. + * @startOffset: a #long indicating the start of the desired text range. + * @endOffset: a #long indicating the first character past the desired range. + * + * Set the attributes applied to a range of text from an #AtspiEditableText + * object, and the bounds of the range. + * + * Returns: #TRUE if the operation was successful, otherwise #FALSE. + **/ +gboolean +atspi_editable_text_set_attributes (AtspiEditableText *obj, + const char *attributes, + gint start_pos, + gint end_pos, + GError **error +{ + dbus_int32_t d_start_pos = start_pos, d_end_pos = end_pos; + dbus_bool_t retval; + + cspi_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "SetAttributes", error, "sii=>b", attributes, d_start_pos, d_end_pos, &retval); + + return retval; +} +#endif + +/** + * atspi_editable_text_set_text_contents: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @new_contents: a character string, encoded in UTF-8, which is to + * become the new text contents of the #AtspiEditableText object. + * + * Replace the entire text contents of an #AtspiEditableText object. + * + * Returns: #TRUE if the operation was successful, otherwise #FALSE. + **/ +gboolean +atspi_editable_text_set_text_contents (AtspiEditableText *obj, + const gchar *new_contents, + GError **error) +{ + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "setTextContents", error, "s=>b", new_contents, &retval); + + return retval; +} + +/** + * atspi_editable_text_insert_text: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @position: an integer indicating the character offset at which to insert + * the new text. + * @text: a gchar* pointer to the text to insert, in UTF-8 encoding. + * @length: (frankly I'm not sure this parameter should be here) + * + * Insert text into an #AtspiEditableText object. + * As with all character offsets, the specified @position may not be the + * same as the resulting byte offset, since the text is in a + * variable-width encoding. + * + * Returns: #TRUE if the operation was successful, otherwise #FALSE. + **/ +gboolean +atspi_editable_text_insert_text (AtspiEditableText *obj, + gint position, + const gchar *text, + gint length, + GError **error) +{ + dbus_int32_t d_position = position, d_length = length; + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "InsertText", error, "isi=>b", d_position, text, d_length, &retval); + + return retval; +} + +/** + * atspi_editable_text_copy_text: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @start_pos: an integer indicating the starting character offset + * of the text to copy. + * @end_pos: an integer indicating the offset of the first character + * past the end of the text section to be copied. + * + * Copy text from an #AtspiEditableText object into the clipboard. + * + * see: atspi_editable_text_paste_text + * + * Returns: #TRUE if the operation was successful, otherwise #FALSE. + **/ +gboolean +atspi_editable_text_copy_text (AtspiEditableText *obj, + gint start_pos, + gint end_pos, + GError **error) +{ + dbus_int32_t d_start_pos = start_pos, d_end_pos = end_pos; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "CopyText", error, "ii", start_pos, end_pos); + + return TRUE; +} + +/** + * atspi_editable_text_cut_text: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @start_pos: an integer indicating the starting character offset + * of the text to cut. + * @end_pos: an integer indicating the offset of the first character + * past the end of the text section to be cut. + * + * Delete text from an #AtspiEditableText object, copying the + * excised portion into the clipboard. + * + * see: atspi_editable_text_paste_text + * + * Returns: #TRUE if operation was successful, #FALSE otherwise. + **/ +gboolean +atspi_editable_text_cut_text (AtspiEditableText *obj, + gint start_pos, + gint end_pos, + GError **error) +{ + dbus_int32_t d_start_pos = start_pos, d_end_pos = end_pos; + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "CutText", error, "ii=>b", d_start_pos, d_end_pos, &retval); + + return retval; +} + +/** + * atspi_editable_text_delete_text: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @start_pos: an integer indicating the starting character offset + * of the text to delete. + * @end_pos: an integer indicating the offset of the first character + * past the end of the text section to be deleted. + * + * Delete text from an #AtspiEditableText object, without copying the + * excised portion into the clipboard. + * + * see: atspi_editable_text_cut_text + * + * Returns: #TRUE if the operation was successful, otherwise #FALSE. + **/ +gboolean +atspi_editable_text_delete_text (AtspiEditableText *obj, + gint start_pos, + gint end_pos, + GError **error) +{ + dbus_int32_t d_start_pos = start_pos, d_end_pos = end_pos; + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "DeleteText", error, "ii=>b", d_start_pos, d_end_pos, &retval); + + return retval; +} + +/** + * atspi_editable_text_paste_text: + * @obj: a pointer to the #AtspiEditableText object to modify. + * @position: an integer indicating the character offset at which to insert + * the new text. + * + * Insert text from the clipboard into an #AtspiEditableText object. + * As with all character offsets, the specified @position may not be the + * same as the resulting byte offset, since the text is in a + * variable-width encoding. + * + * Returns: #TRUE if the operation was successful, otherwise #FALSE. + **/ +gboolean +atspi_editable_text_paste_text (AtspiEditableText *obj, + gint position, + GError **error) +{ + dbus_int32_t d_position = position; + dbus_bool_t retval = FALSE; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_editable_text, "PasteText", error, "i=>b", d_position, &retval); + + return retval; +} + +static void +atspi_editable_text_base_init (AtspiEditableText *klass) +{ +} + +GType +atspi_editable_text_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = + { + sizeof (AtspiEditableText), + (GBaseInitFunc) atspi_editable_text_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiEditableText", &tinfo, 0); + + } + return type; +} diff --git a/atspi/atspi-editabletext.h b/atspi/atspi-editabletext.h new file mode 100644 index 00000000..e7356c6f --- /dev/null +++ b/atspi/atspi-editabletext.h @@ -0,0 +1,62 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_EDITABLE_TEXT_H_ +#define _ATSPI_EDITABLE_TEXT_H_ + +#include "glib-object.h" + +#include "atspi-constants.h" + +#include "atspi-types.h" + +#define ATSPI_TYPE_EDITABLE_TEXT (atspi_editable_text_get_type ()) +#define ATSPI_IS_EDITABLE_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_EDITABLE_TEXT) +#define ATSPI_EDITABLE_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_EDITABLE_TEXT, AtspiEditableText) +#define ATSPI_EDITABLE_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_EDITABLE_TEXT, AtspiEditableText)) + +GType atspi_editable_text_get_type (); + +struct _AtspiEditableText +{ + GTypeInterface parent; +}; + +#if 0 +gboolean atspi_editable_text_set_attributes (AtspiEditableText *obj, const char *attributes, gint start_pos, gint end_pos, GError **error) +#endif + +gboolean atspi_editable_text_set_text_contents (AtspiEditableText *obj, const gchar *new_contents, GError **error); + +gboolean atspi_editable_text_insert_text (AtspiEditableText *obj, gint position, const gchar *text, gint length, GError **error); + +gboolean atspi_editable_text_copy_text (AtspiEditableText *obj, gint start_pos, gint end_pos, GError **error); + +gboolean atspi_editable_text_cut_text (AtspiEditableText *obj, gint start_pos, gint end_pos, GError **error); + +gboolean atspi_editable_text_delete_text (AtspiEditableText *obj, gint start_pos, gint end_pos, GError **error); + +gboolean atspi_editable_text_paste_text (AtspiEditableText *obj, gint position, GError **error); + +#endif /* _ATSPI_EDITABLE_TEXT_H_ */ diff --git a/atspi/atspi-image.c b/atspi/atspi-image.c new file mode 100644 index 00000000..10e9d1da --- /dev/null +++ b/atspi/atspi-image.c @@ -0,0 +1,165 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +/** + * atspi_image_get_image_description: + * @obj: a pointer to the #AtspiImage implementor on which to operate. + * + * Get the description of the image displayed in an #AtspiImage object. + * + * Returns: a UTF-8 string describing the image. + **/ +gchar * +atspi_image_get_image_description (AtspiImage *obj, GError **error) +{ + char *retval; + + g_return_val_if_fail (obj != NULL, NULL); + + _atspi_dbus_get_property (obj, atspi_interface_image, "Description", error, "s", &retval); + + return retval; +} + +/** + * atspi_image_get_image_size: + * @obj: a pointer to the #AtspiImage to query. + * + * Get the size of the image displayed in a specified #AtspiImage object. + **/ +AtspiPoint * +atspi_image_get_image_size (AtspiImage *obj, GError **error) +{ + dbus_int32_t d_w, d_h; + AtspiPoint ret; + + ret.x = ret.y = -1; + if (!obj) + return atspi_point_copy (&ret); + + _atspi_dbus_call (obj, atspi_interface_image, "GetImageSize", error, "=>ii", &d_w, &d_h); + ret.x = d_w; + ret.y = d_h; + return atspi_point_copy (&ret); +} + +/** + * atspi_image_get_image_position: + * @obj: a pointer to the #AtspiImage implementor to query. + * @ctype: the desired coordinate system into which to return the results, + * (e.g. ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_SCREEN). + * + * Get the minimum x and y coordinates of the image displayed in a + * specified #AtspiImage implementor. + **/ +AtspiPoint * +atspi_image_get_image_position (AtspiImage *obj, + AtspiCoordType ctype, + GError **error) +{ + dbus_int32_t d_x, d_y; + dbus_uint16_t d_ctype = ctype; + AtspiPoint ret; + + ret.x = ret.y = 0; + + if (!obj) + return atspi_point_copy (&ret); + + _atspi_dbus_call (obj, atspi_interface_image, "GetImagePosition", error, "u=>ii", d_ctype, &d_x, &d_y); + + ret.x = d_x; + ret.y = d_y; + return atspi_point_copy (&ret); +} + +/** + * atspi_image_get_image_extents: + * @obj: a pointer to the #AtspiImage implementor to query. + * @ctype: the desired coordinate system into which to return the results, + * (e.g. ATSPI_COORD_TYPE_WINDOW, ATSPI_COORD_TYPE_SCREEN). + * + * Get the bounding box of the image displayed in a + * specified #AtspiImage implementor. + **/ +AtspiRect * +atspi_image_get_image_extents (AtspiImage *obj, + AtspiCoordType ctype, + GError **error) +{ + dbus_uint32_t d_ctype = ctype; + AtspiRect bbox; + + bbox.x = bbox.y = bbox.width = bbox.height = -1; + g_return_val_if_fail (obj != NULL, atspi_rect_copy (&bbox)); + + _atspi_dbus_call (obj, atspi_interface_image, "GetImageExtents", error, "u=>(iiii)", d_ctype, &bbox); + + return atspi_rect_copy (&bbox); +} + +/** + * atspi_image_get_image_locale: + * @obj: The #AtspiImage being queried. + * + * Get the locale associated with an image and its textual representation. + * + * Returns: A POSIX LC_MESSAGES-style Locale value for image description and text. + **/ +gchar * +atspi_image_get_image_locale (AtspiImage *obj, GError **error) +{ + gchar *retval = NULL; + + g_return_val_if_fail (obj != NULL, g_strdup ("C")); + + _atspi_dbus_call (obj, atspi_interface_image, "GetImageLocale", error, "=>s", &retval); + + return retval; +} + +static void +atspi_image_base_init (AtspiImage *klass) +{ +} + +GType +atspi_image_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = + { + sizeof (AtspiImage), + (GBaseInitFunc) atspi_image_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiImage", &tinfo, 0); + + } + return type; +} diff --git a/atspi/atspi-image.h b/atspi/atspi-image.h new file mode 100644 index 00000000..6f0f7915 --- /dev/null +++ b/atspi/atspi-image.h @@ -0,0 +1,55 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_IMAGE_H_ +#define _ATSPI_IMAGE_H_ + +#include "glib-object.h" + +#include "atspi-constants.h" + +#include "atspi-types.h" + +#define ATSPI_TYPE_IMAGE (atspi_image_get_type ()) +#define ATSPI_IS_IMAGE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_IMAGE) +#define ATSPI_IMAGE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_IMAGE, AtspiImage) +#define ATSPI_IMAGE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_IMAGE, AtspiImage)) + +GType atspi_image_get_type (); + +struct _AtspiImage +{ + GTypeInterface parent; +}; + +gchar * atspi_image_get_image_description (AtspiImage *obj, GError **error); + +AtspiPoint * atspi_image_get_image_size (AtspiImage *obj, GError **error); + +AtspiPoint * atspi_image_get_image_position (AtspiImage *obj, AtspiCoordType ctype, GError **error); + +AtspiRect * atspi_image_get_image_extents (AtspiImage *obj, AtspiCoordType ctype, GError **error); + +gchar * atspi_image_get_image_locale (AtspiImage *obj, GError **error); +#endif /* _ATSPI_IMAGE_H_ */ diff --git a/atspi/atspi-text.h b/atspi/atspi-text.h index 6c6add18..25c2ae54 100644 --- a/atspi/atspi-text.h +++ b/atspi/atspi-text.h @@ -104,7 +104,7 @@ AtspiRangedAttributeSet * atspi_text_get_attributes (AtspiText *obj, gint offset AtspiRangedAttributeSet * atspi_text_get_attribute_run (AtspiText *obj, gint offset, gboolean include_defaults, GError **error); -gchar * atspi_text_get_attribute_value (AtspiText *obj, gint offset, gchar *attribute_value, GError **error); +gchar * atspi_text_get_attribute_value (AtspiText *obj, gint offset, gchar *attribute_name, GError **error); GHashTable * atspi_text_get_default_attributes (AtspiAccessible *obj, GError **error); diff --git a/atspi/atspi-types.h b/atspi/atspi-types.h index eb7c7a37..b34f264a 100644 --- a/atspi/atspi-types.h +++ b/atspi/atspi-types.h @@ -30,16 +30,17 @@ #include "atspi-constants.h" typedef struct _AtspiAccessible AtspiAccessible; -typedef struct _AtspiAccessible AtspiAction; +typedef struct _AtspiAction AtspiAction; typedef struct _AtspiAccessible AtspiCollection; typedef struct _AtspiComponent AtspiComponent; -typedef struct _AtspiAccessible AtspiDocument; -typedef struct _AtspiAccessible AtspiEditableText; +typedef struct _AtspiDocument AtspiDocument; +typedef struct _AtspiEditableText AtspiEditableText; typedef struct _AtspiAccessible AtspiHypertext; +typedef struct _AtspiImage AtspiImage; typedef struct _AtspiSelection AtspiSelection; typedef struct _AtspiTable AtspiTable; typedef struct _AtspiText AtspiText; -typedef struct _AtspiAccessible AtspiValue; +typedef struct _AtspiValue AtspiValue; typedef guint AtspiControllerEventMask; diff --git a/atspi/atspi-value.c b/atspi/atspi-value.c new file mode 100644 index 00000000..32071b39 --- /dev/null +++ b/atspi/atspi-value.c @@ -0,0 +1,152 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2001, 2002 Sun Microsystems Inc., + * Copyright 2001, 2002 Ximian, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "atspi-private.h" + +/** + * atspi_value_get_minimum_value: + * @obj: a pointer to the #AtspiValue implementor on which to operate. + * + * Get the minimum allowed value for an #AtspiValue. + * + * Returns: the minimum allowed value for this object. + * + **/ +gdouble +atspi_value_get_minimum_value (AtspiValue *obj, GError **error) +{ + double retval; + + g_return_val_if_fail (obj != NULL, 0.0); + _atspi_dbus_get_property (obj, atspi_interface_value, "MinimumValue", error, "d", &retval); + + return retval; +} + +/** + * atspi_value_get_current_value: + * @obj: a pointer to the #AtspiValue implementor on which to operate. + * + * Get the current value for an #AtspiValue. + * + * Returns: the current value for this object. + **/ +gdouble +atspi_value_get_current_value (AtspiValue *obj, GError **error) +{ + double retval; + + g_return_val_if_fail (obj != NULL, 0.0); + + _atspi_dbus_get_property (obj, atspi_interface_value, "CurrentValue", error, "d", &retval); + + return retval; +} + +/** + * atspi_value_get_maximum_value: + * @obj: a pointer to the #AtspiValue implementor on which to operate. + * + * Get the maximum allowed value for an #AtspiValue. + * + * Returns: the maximum allowed value for this object. + **/ +gdouble +atspi_value_get_maximum_value (AtspiValue *obj, GError **error) +{ + double retval; + + g_return_val_if_fail (obj != NULL, 0.0); + + _atspi_dbus_get_property (obj, atspi_interface_value, "MaximumValue", error, "d", &retval); + + return retval; +} + +/** + * atspi_value_set_current_value: + * @obj: a pointer to the #AtspiValue implementor on which to operate. + * @new_value: a #float value which is the desired new value of the object. + * + * Set the current value of an #AtspiValue. + * + * Returns: #TRUE if the value could be assigned the specified value, + * #FALSE otherwise. + **/ +gboolean +atspi_value_set_current_value (AtspiValue *obj, gdouble new_value, GError **error) +{ + double d_new_value = new_value; + + g_return_val_if_fail (obj != NULL, FALSE); + + _atspi_dbus_call (obj, atspi_interface_value, "SetCurrentValue", error, "d", &d_new_value); + + return TRUE; +} + +/** + * atspi_value_get_minimum_increment: + * @obj: a pointer to the #AtspiValue implementor on which to operate. + * + * Get the minimum increment by which an #AtspiValue can be adjusted. + * + * Returns: the minimum increment by which the value may be changed, or + * zero if the minimum increment cannot be determined. + * + **/ +gdouble +atspi_value_get_minimum_increment (AtspiValue *obj, GError **error) +{ + double retval; + + g_return_val_if_fail (obj != NULL, 0.0); + + _atspi_dbus_get_property (obj, atspi_interface_value, "MinimumIncrement", error, "d", &retval); + + return retval; +} + +static void +atspi_value_base_init (AtspiValue *klass) +{ +} + +GType +atspi_value_get_type (void) +{ + static GType type = 0; + + if (!type) { + static const GTypeInfo tinfo = + { + sizeof (AtspiValue), + (GBaseInitFunc) atspi_value_base_init, + (GBaseFinalizeFunc) NULL, + }; + + type = g_type_register_static (G_TYPE_INTERFACE, "AtspiValue", &tinfo, 0); + + } + return type; +} diff --git a/atspi/atspi-value.h b/atspi/atspi-value.h new file mode 100644 index 00000000..587d3c9c --- /dev/null +++ b/atspi/atspi-value.h @@ -0,0 +1,56 @@ +/* + * AT-SPI - Assistive Technology Service Provider Interface + * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap) + * + * Copyright 2002 Ximian, Inc. + * 2002 Sun Microsystems Inc. + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef _ATSPI_VALUE_H_ +#define _ATSPI_VALUE_H_ + +#include "glib-object.h" + +#include "atspi-constants.h" + +#include "atspi-types.h" + +#define ATSPI_TYPE_VALUE (atspi_value_get_type ()) +#define ATSPI_IS_VALUE(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_VALUE) +#define ATSPI_VALUE(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_VALUE, AtspiValue) +#define ATSPI_VALUE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_VALUE, AtspiValue)) + +GType atspi_value_get_type (); + +struct _AtspiValue +{ + GTypeInterface parent; +}; + +gdouble atspi_value_get_minimum_value (AtspiValue *obj, GError **error); + +gdouble atspi_value_get_current_value (AtspiValue *obj, GError **error); + +gdouble atspi_value_get_maximum_value (AtspiValue *obj, GError **error); + +gboolean atspi_value_set_current_value (AtspiValue *obj, gdouble new_value, GError **error); + +gdouble atspi_value_get_minimum_increment (AtspiValue *obj, GError **error); + +#endif /* _ATSPI_VALUE_H_ */ diff --git a/atspi/atspi.h b/atspi/atspi.h index ff4ba06a..a306ed25 100644 --- a/atspi/atspi.h +++ b/atspi/atspi.h @@ -29,13 +29,18 @@ #include "atspi-constants.h" #include "atspi-types.h" #include "atspi-accessible.h" +#include "atspi-action.h" #include "atspi-component.h" #include "atspi-device-listener.h" +#include "atspi-document.h" +#include "atspi-editabletext.h" #include "atspi-event-listener.h" +#include "atspi-image.h" #include "atspi-misc.h" #include "atspi-registry.h" #include "atspi-selection.h" #include "atspi-table.h" #include "atspi-text.h" +#include "atspi-value.h" #endif |