The changes include:
[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 #define ATK_TYPE_TEXT                    (atk_text_get_type ())
33 #define ATK_IS_TEXT(obj)                 G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
34 #define ATK_TEXT(obj)                    G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
35 #define ATK_TEXT_GET_IFACE(obj)          (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
36
37 #ifndef _TYPEDEF_ATK_TEXT_
38 #define _TYPEDEF_ATK_TEXT_
39 typedef struct _AtkText AtkText;
40 #endif
41 typedef struct _AtkTextIface AtkTextIface;
42
43
44 /**
45  *AtkXYCoords:
46  *@ATK_XY_SCREEN: specifies xy coordinates relative to the screen
47  *@ATK_XY_WIDGET: specifies xy coordinates relative to the widgets window
48  *
49  *Specifies what type of coordinates are to be returned for functions that
50  *return position coordinates
51  **/
52 typedef enum {
53   ATK_XY_SCREEN,
54   ATK_XY_WIDGET
55 }AtkXYCoords;
56
57 /**
58  *AtkTextBoundary:
59  *@ATK_TEXT_BOUNDARY_CHAR:
60  *@ATK_TEXT_BOUNDARY_CURSOR_POS:
61  *@ATK_TEXT_BOUNDARY_WORD_START:
62  *@ATK_TEXT_BOUNDARY_WORD_END:
63  *@ATK_TEXT_BOUNDARY_SENTENCE_START:
64  *@ATK_TEXT_BOUNDARY_SENTENCE_END:
65  *@ATK_TEXT_BOUNDARY_LINE_START:
66  *@ATK_TEXT_BOUNDARY_LINE_END:
67  *
68  *Text boundary types used for specifying boundaries for regions of text
69  **/
70 typedef enum {
71   ATK_TEXT_BOUNDARY_CHAR,
72   ATK_TEXT_BOUNDARY_CURSOR_POS,
73   ATK_TEXT_BOUNDARY_WORD_START,
74   ATK_TEXT_BOUNDARY_WORD_END,
75   ATK_TEXT_BOUNDARY_SENTENCE_START,
76   ATK_TEXT_BOUNDARY_SENTENCE_END,
77   ATK_TEXT_BOUNDARY_LINE_START,
78   ATK_TEXT_BOUNDARY_LINE_END
79 } AtkTextBoundary;
80
81 struct _AtkTextIface
82 {
83   GTypeInterface parent;
84
85   gchar*         (* get_text)                     (AtkText          *text,
86                                                    gint             start_offset,
87                                                    gint             end_offset);
88   gchar*         (* get_text_after_offset)        (AtkText          *text,
89                                                    gint             offset,
90                                                    AtkTextBoundary  boundary_type);
91   gchar*         (* get_text_at_offset)           (AtkText          *text,
92                                                    gint             offset,
93                                                    AtkTextBoundary  boundary_type);
94   gunichar       (* get_character_at_offset)      (AtkText          *text,
95                                                    gint             offset);
96   gchar*         (* get_text_before_offset)       (AtkText          *text,
97                                                    gint             offset,
98                                                    AtkTextBoundary  boundary_type);
99   gint           (* get_caret_offset)             (AtkText          *text);
100   AtkAttributeSet* (* ref_run_attributes)         (AtkText          *text,
101                                                    gint             offset,
102                                                    gint             *start_offset,
103                                                    gint             *end_offset);
104   void           (* get_character_extents)        (AtkText          *text,
105                                                    gint             offset,
106                                                    gint             *x,
107                                                    gint             *y,
108                                                    gint             *length,
109                                                    gint             *width,
110                                                    AtkXYCoords      coords);
111   gint           (* get_character_count)          (AtkText          *text);
112   gint           (* get_offset_at_point)          (AtkText          *text,
113                                                    gint             x,
114                                                    gint             y,
115                                                    AtkXYCoords      coords);
116   gint           (* get_n_selections)             (AtkText          *text);
117   gchar*         (* get_selection)                (AtkText          *text,
118                                                    gint             selection_num,
119                                                    gint             *start_offset,
120                                                    gint             *end_offset);
121   gboolean       (* add_selection)                (AtkText          *text,
122                                                    gint             start_offset,
123                                                    gint             end_offset);
124   gboolean       (* remove_selection)             (AtkText          *text,
125                                                    gint             selection_num);
126   gboolean       (* set_selection)                (AtkText          *text,
127                                                    gint             selection_num,
128                                                    gint             start_offset,
129                                                    gint             end_offset);
130   gboolean       (* set_caret_offset)             (AtkText          *text,
131                                                    gint             offset);
132   void           (* text_changed)                 (AtkText          *text);
133   void           (* caret_changed)                (AtkText          *text,
134                                                    gint             location);
135 };
136 GType            atk_text_get_type (void);
137
138
139 /*
140  * Additional AtkObject properties used by AtkText:
141  *    "accessible_text" (accessible text has changed)
142  *    "accessible_caret" (accessible text cursor position changed:
143  *                         editable text only)
144  */
145
146 gchar*        atk_text_get_text                           (AtkText          *text,
147                                                            gint             start_offset,
148                                                            gint             end_offset);
149 gunichar      atk_text_get_character_at_offset            (AtkText          *text,
150                                                            gint             offset);
151 gchar*        atk_text_get_text_after_offset              (AtkText          *text,
152                                                            gint             offset,
153                                                            AtkTextBoundary  boundary_type);
154 gchar*        atk_text_get_text_at_offset                 (AtkText          *text,
155                                                            gint             offset,
156                                                            AtkTextBoundary  boundary_type);
157 gchar*        atk_text_get_text_before_offset             (AtkText          *text,
158                                                            gint             offset,
159                                                            AtkTextBoundary  boundary_type);
160 gint          atk_text_get_caret_offset                   (AtkText          *text);
161 void          atk_text_get_character_extents              (AtkText          *text,
162                                                            gint             offset,
163                                                            gint             *x,
164                                                            gint             *y,
165                                                            gint             *length,
166                                                            gint             *width,
167                                                            AtkXYCoords      coords);
168 AtkAttributeSet* atk_text_ref_run_attributes              (AtkText          *text,
169                                                            gint             offset,
170                                                            gint             *start_offset,
171                                                            gint             *end_offset);
172 gint          atk_text_get_character_count                (AtkText          *text);
173 gint          atk_text_get_offset_at_point                (AtkText          *text,
174                                                            gint             x,
175                                                            gint             y,
176                                                            AtkXYCoords      coords);
177 gint          atk_text_get_n_selections                   (AtkText          *text);
178 gchar*        atk_text_get_selection                      (AtkText          *text,
179                                                            gint             selection_num,
180                                                            gint             *start_offset,
181                                                            gint             *end_offset);
182 gboolean      atk_text_add_selection                      (AtkText          *text,
183                                                            gint             start_offset,
184                                                            gint             end_offset);
185 gboolean      atk_text_remove_selection                   (AtkText          *text,
186                                                            gint             selection_num);
187 gboolean      atk_text_set_selection                      (AtkText          *text,
188                                                            gint             selection_num,
189                                                            gint             start_offset,
190                                                            gint             end_offset);
191 gboolean      atk_text_set_caret_offset                   (AtkText          *text,
192                                                            gint             offset);
193
194 #ifdef __cplusplus
195 }
196 #endif /* __cplusplus */
197
198
199 #endif /* __ATK_TEXT_H__ */