Add first pass at text interface
[platform/upstream/at-spi2-core.git] / atspi / atspi-text.h
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2002 Ximian, Inc.
6  *           2002 Sun Microsystems Inc.
7  *           
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  */
24
25 #ifndef _ATSPI_TEXT_H_
26 #define _ATSPI_TEXT_H_
27
28 #include "glib-object.h"
29
30 #include "atspi-constants.h"
31
32 #include "atspi-types.h"
33
34 typedef struct _AtspiRange AtspiRange;
35 struct _AtspiRange
36 {
37   gint start_offset;
38   gint end_offset;
39 };
40
41 /**
42  * ATSPI_TYPE_RANGE:
43  * 
44  * The #GType for a boxed type holding a range within a text bock.
45  */
46 #define ATSPI_TYPE_RANGE atspi_range_get_type ()
47
48 GType atspi_range_get_type ();
49
50 typedef struct _AtspiRangedAttributeSet AtspiRangedAttributeSet;
51 struct _AtspiRangedAttributeSet
52 {
53   GHashTable *attributes;
54   gint start_offset;
55   gint end_offset;
56 };
57
58 /**
59  * ATSPI_TYPE_RANGED_ATTRIBUTE_SET:
60  * 
61  * The #GType for a boxed type holding an attribute set within a text block.
62  */
63 #define ATSPI_TYPE_RANGED_ATTRIBUTE_SET atspi_ranged_attribute_set_get_type ()
64
65 GType atspi_ranged_attribute_set_get_type ();
66
67 typedef struct _AtspiTextRange AtspiTextRange;
68 struct _AtspiTextRange
69 {
70   gint start_offset;
71   gint end_offset;
72   gchar *text;
73 };
74
75 /**
76  * ATSPI_TYPE_TEXT_RANGE:
77  * 
78  * The #GType for a boxed type holding a range within a text bock.
79  */
80 #define ATSPI_TYPE_TEXT_RANGE atspi_text_range_get_type ()
81
82 #define ATSPI_TYPE_TEXT                    (atspi_text_get_type ())
83 #define ATSPI_IS_TEXT(obj)                 G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATSPI_TYPE_TEXT)
84 #define ATSPI_TEXT(obj)                    G_TYPE_CHECK_INSTANCE_CAST ((obj), ATSPI_TYPE_TEXT, AtspiText)
85 #define ATSPI_TEXT_GET_IFACE(obj)          (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATSPI_TYPE_TEXT, AtspiText))
86
87 GType atspi_text_get_type ();
88
89 struct _AtspiText
90 {
91   GTypeInterface parent;
92 };
93
94
95 GType atspi_text_range_get_type ();
96
97 gint atspi_text_get_character_count (AtspiText *obj, GError **error);
98
99 gchar * atspi_text_get_text (AtspiText *obj, gint start_offset, gint end_offset, GError **error);
100
101 gint atspi_text_get_caret_offset (AtspiText *obj, GError **error);
102
103 AtspiRangedAttributeSet * atspi_text_get_attributes (AtspiText *obj, gint offset, GError **error);
104
105 AtspiRangedAttributeSet * atspi_text_get_attribute_run (AtspiText *obj, gint offset, gboolean include_defaults, GError **error);
106
107 gchar * atspi_text_get_attribute_value (AtspiText *obj, gint offset, gchar *attribute_value, GError **error);
108
109 GHashTable * atspi_text_get_default_attributes (AtspiAccessible *obj, GError **error);
110
111 gboolean atspi_text_set_caret_offset (AtspiText *obj, gint new_offset, GError **error);
112
113 AtspiTextRange * atspi_text_get_text_before_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error);
114
115 AtspiTextRange * atspi_text_get_text_at_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error);
116
117 AtspiTextRange * atspi_text_get_text_after_offset (AtspiText *obj, gint offset, AtspiTextBoundaryType type, GError **error);
118
119 guint atspi_text_get_character_at_offset (AtspiText *obj, gint offset, GError **error);
120
121 AtspiRect * atspi_text_get_character_extents (AtspiText *obj, gint offset, AtspiCoordType type, GError **error);
122
123 gint atspi_text_get_offset_at_point (AtspiText *obj, gint x, gint y, AtspiCoordType type, GError **error);
124
125 AtspiRect * atspi_text_get_range_extents (AtspiText *obj, gint start_offset, gint end_offset, AtspiCoordType type, GError **error);
126
127 GArray * atspi_text_get_bounded_ranges (AtspiText *obj, gint x, gint y, gint width, gint height, AtspiCoordType type, AtspiTextClipType clipTypeX, AtspiTextClipType clipTypeY, GError **error);
128
129 gint atspi_text_get_n_selections (AtspiText *obj, GError **error);
130
131 AtspiRange * atspi_text_get_selection (AtspiText *obj, gint selection_num, GError **error);
132
133 gboolean atspi_text_add_selection (AtspiText *obj, gint start_offset, gint end_offset, GError **error);
134
135 gboolean atspi_text_remove_selection (AtspiText *obj, gint selection_num, GError **error);
136
137 gboolean atspi_text_set_selection (AtspiText *obj, gint selection_num, gint start_offset, gint end_offset, GError **error);
138 #endif  /* _ATSPI_TEXT_H_ */