Here is a patch for
[platform/upstream/atk.git] / atk / atktext.h
1 /* ATK - The Accessibility Toolkit for GTK+
2  * Copyright 2001 Sun Microsystems Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __ATK_TEXT_H__
22 #define __ATK_TEXT_H__
23
24 #include <pango/pango.h>
25 #include <glib-object.h>
26 #include <atk/atkobject.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31
32 typedef GSList AtkAttributeSet;
33
34 typedef struct _AtkAttribute {
35   gchar* name;
36   gchar* value;
37 }AtkAttribute;
38
39 #define ATK_TYPE_TEXT                    (atk_text_get_type ())
40 #define ATK_IS_TEXT(obj)                 G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
41 #define ATK_TEXT(obj)                    G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
42 #define ATK_TEXT_GET_IFACE(obj)          (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
43
44 #ifndef _TYPEDEF_ATK_TEXT_
45 #define _TYPEDEF_ATK_TEXT_
46 typedef struct _AtkText AtkText;
47 #endif
48 typedef struct _AtkTextIface AtkTextIface;
49
50
51 /**
52  *AtkXYCoords:
53  *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
54  *@ATK_XY_WIDGET: specifies xy coordinates relative to the widgets window
55  *
56  *Specifies what type of coordinates are to be returned for functions that
57  *return position coordinates
58  **/
59 typedef enum {
60   ATK_XY_SCREEN,
61   ATK_XY_WIDGET
62 }AtkXYCoords;
63
64 /**
65  *AtkTextBoundary:
66  *@ATK_TEXT_BOUNDARY_CHAR:
67  *@ATK_TEXT_BOUNDARY_CURSOR_POS:
68  *@ATK_TEXT_BOUNDARY_WORD_START:
69  *@ATK_TEXT_BOUNDARY_WORD_END:
70  *@ATK_TEXT_BOUNDARY_SENTENCE_START:
71  *@ATK_TEXT_BOUNDARY_SENTENCE_END:
72  *@ATK_TEXT_BOUNDARY_LINE_START:
73  *@ATK_TEXT_BOUNDARY_LINE_END:
74  *
75  *Text boundary types used for specifying boundaries for regions of text
76  **/
77 typedef enum {
78   ATK_TEXT_BOUNDARY_CHAR,
79   ATK_TEXT_BOUNDARY_CURSOR_POS,
80   ATK_TEXT_BOUNDARY_WORD_START,
81   ATK_TEXT_BOUNDARY_WORD_END,
82   ATK_TEXT_BOUNDARY_SENTENCE_START,
83   ATK_TEXT_BOUNDARY_SENTENCE_END,
84   ATK_TEXT_BOUNDARY_LINE_START,
85   ATK_TEXT_BOUNDARY_LINE_END
86 } AtkTextBoundary;
87
88 struct _AtkTextIface
89 {
90   GTypeInterface parent;
91
92   gchar*         (* get_text)                     (AtkText          *text,
93                                                    gint             start_offset,
94                                                    gint             end_offset);
95   gchar*         (* get_text_after_offset)        (AtkText          *text,
96                                                    gint             offset,
97                                                    AtkTextBoundary  boundary_type,
98                                                    gint             *startOffset,
99                                                    gint             *endOffset);
100   gchar*         (* get_text_at_offset)           (AtkText          *text,
101                                                    gint             offset,
102                                                    AtkTextBoundary  boundary_type,
103                                                    gint             *startOffset,
104                                                    gint             *endOffset);
105   gunichar       (* get_character_at_offset)      (AtkText          *text,
106                                                    gint             offset);
107   gchar*         (* get_text_before_offset)       (AtkText          *text,
108                                                    gint             offset,
109                                                    AtkTextBoundary  boundary_type,
110                                                    gint             *startOffset,
111                                                    gint             *endOffset);
112   gint           (* get_caret_offset)             (AtkText          *text);
113   AtkAttributeSet* (* ref_run_attributes)         (AtkText          *text,
114                                                    gint             offset,
115                                                    gint             *start_offset,
116                                                    gint             *end_offset);
117   void           (* get_character_extents)        (AtkText          *text,
118                                                    gint             offset,
119                                                    gint             *x,
120                                                    gint             *y,
121                                                    gint             *length,
122                                                    gint             *width,
123                                                    AtkXYCoords      coords);
124   gint           (* get_character_count)          (AtkText          *text);
125   gint           (* get_offset_at_point)          (AtkText          *text,
126                                                    gint             x,
127                                                    gint             y,
128                                                    AtkXYCoords      coords);
129   gint           (* get_n_selections)             (AtkText          *text);
130   gchar*         (* get_selection)                (AtkText          *text,
131                                                    gint             selection_num,
132                                                    gint             *start_offset,
133                                                    gint             *end_offset);
134   gboolean       (* add_selection)                (AtkText          *text,
135                                                    gint             start_offset,
136                                                    gint             end_offset);
137   gboolean       (* remove_selection)             (AtkText          *text,
138                                                    gint             selection_num);
139   gboolean       (* set_selection)                (AtkText          *text,
140                                                    gint             selection_num,
141                                                    gint             start_offset,
142                                                    gint             end_offset);
143   gboolean       (* set_caret_offset)             (AtkText          *text,
144                                                    gint             offset);
145   void           (* text_changed)                 (AtkText          *text);
146   void           (* caret_changed)                (AtkText          *text,
147                                                    gint             location);
148 };
149 GType            atk_text_get_type (void);
150
151
152 /*
153  * Additional AtkObject properties used by AtkText:
154  *    "accessible_text" (accessible text has changed)
155  *    "accessible_caret" (accessible text cursor position changed:
156  *                         editable text only)
157  */
158
159 gchar*        atk_text_get_text                           (AtkText          *text,
160                                                            gint             start_offset,
161                                                            gint             end_offset);
162 gunichar      atk_text_get_character_at_offset            (AtkText          *text,
163                                                            gint             offset);
164 gchar*        atk_text_get_text_after_offset              (AtkText          *text,
165                                                            gint             offset,
166                                                            AtkTextBoundary  boundary_type,
167                                                            gint             *startOffset,
168                                                            gint             *endOffset);
169 gchar*        atk_text_get_text_at_offset                 (AtkText          *text,
170                                                            gint             offset,
171                                                            AtkTextBoundary  boundary_type,
172                                                            gint             *startOffset,
173                                                            gint             *endOffset);
174 gchar*        atk_text_get_text_before_offset             (AtkText          *text,
175                                                            gint             offset,
176                                                            AtkTextBoundary  boundary_type,
177                                                            gint             *startOffset,
178                                                            gint             *endOffset);
179 gint          atk_text_get_caret_offset                   (AtkText          *text);
180 void          atk_text_get_character_extents              (AtkText          *text,
181                                                            gint             offset,
182                                                            gint             *x,
183                                                            gint             *y,
184                                                            gint             *length,
185                                                            gint             *width,
186                                                            AtkXYCoords      coords);
187 AtkAttributeSet* atk_text_ref_run_attributes              (AtkText          *text,
188                                                            gint             offset,
189                                                            gint             *start_offset,
190                                                            gint             *end_offset);
191 gint          atk_text_get_character_count                (AtkText          *text);
192 gint          atk_text_get_offset_at_point                (AtkText          *text,
193                                                            gint             x,
194                                                            gint             y,
195                                                            AtkXYCoords      coords);
196 gint          atk_text_get_n_selections                   (AtkText          *text);
197 gchar*        atk_text_get_selection                      (AtkText          *text,
198                                                            gint             selection_num,
199                                                            gint             *start_offset,
200                                                            gint             *end_offset);
201 gboolean      atk_text_add_selection                      (AtkText          *text,
202                                                            gint             start_offset,
203                                                            gint             end_offset);
204 gboolean      atk_text_remove_selection                   (AtkText          *text,
205                                                            gint             selection_num);
206 gboolean      atk_text_set_selection                      (AtkText          *text,
207                                                            gint             selection_num,
208                                                            gint             start_offset,
209                                                            gint             end_offset);
210 gboolean      atk_text_set_caret_offset                   (AtkText          *text,
211                                                            gint             offset);
212 void          AtkAttributeSet_free                        (AtkAttributeSet  *attrib_set);
213
214 #ifdef __cplusplus
215 }
216 #endif /* __cplusplus */
217
218
219 #endif /* __ATK_TEXT_H__ */