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