Moved caret_moved and text_changed signals from AtkEditableText to AtkText.
[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 enum {
44   ATK_TEXT_BOUNDARY_CHAR,
45   ATK_TEXT_BOUNDARY_CURSOR_POS,
46   ATK_TEXT_BOUNDARY_WORD_START,
47   ATK_TEXT_BOUNDARY_WORD_END,
48   ATK_TEXT_BOUNDARY_SENTENCE_START,
49   ATK_TEXT_BOUNDARY_SENTENCE_END,
50   ATK_TEXT_BOUNDARY_LINE_START,
51   ATK_TEXT_BOUNDARY_LINE_END
52 } AtkTextBoundary;
53
54 struct _AtkTextIface
55 {
56   GTypeInterface parent;
57
58   gchar*         (* get_text)                     (AtkText          *text,
59                                                    gint             start_offset,
60                                                    gint             end_offset);
61   gchar*         (* get_text_after_offset)        (AtkText          *text,
62                                                    gint             offset,
63                                                    AtkTextBoundary  boundary_type);
64   gchar*         (* get_text_at_offset)           (AtkText          *text,
65                                                    gint             offset,
66                                                    AtkTextBoundary  boundary_type);
67   gunichar       (* get_character_at_offset)      (AtkText          *text,
68                                                    gint             offset);
69   gchar*         (* get_text_before_offset)       (AtkText          *text,
70                                                    gint             offset,
71                                                    AtkTextBoundary  boundary_type);
72   gint           (* get_caret_offset)             (AtkText          *text);
73   void           (* get_row_col_at_offset)        (AtkText          *text,
74                                                    gint             offset,
75                                                    gint             *row,
76                                                    gint             *col);
77   PangoAttrList* (* get_range_attributes)         (AtkText          *text,
78                                                    gint             start_offset,
79                                                    gint             end_offset);
80   void           (* get_character_extents)        (AtkText          *text,
81                                                    gint             offset,
82                                                    gint             *x,
83                                                    gint             *y,
84                                                    gint             *length,
85                                                    gint             *width);
86   gint           (* get_character_count)          (AtkText          *text);
87   gint           (* get_offset_at_point)          (AtkText          *text,
88                                                    gint             x,
89                                                    gint             y);
90   gchar*         (* get_selected_text)            (AtkText          *text);
91   void           (* get_selection_bounds)         (AtkText          *text,
92                                                    gint             *start_offset,
93                                                    gint             *end_offset);
94   gboolean       (* set_selection_bounds)         (AtkText          *text,
95                                                    gint             start_offset,
96                                                    gint             end_offset);
97   gboolean       (* set_caret_offset)             (AtkText          *text,
98                                                    gint             offset);
99   void           (* text_changed)                 (AtkText          *text);
100   void           (* caret_changed)                (AtkText          *text,
101                                                    gint             location);
102 };
103 GType            atk_text_get_type (void);
104
105
106 /*
107  * Additional AtkObject properties used by AtkText:
108  *    "accessible_text" (accessible text has changed)
109  *    "accessible_caret" (accessible text cursor position changed:
110  *                         editable text only)
111  */
112
113 gchar*        atk_text_get_text                           (AtkText          *text,
114                                                            gint             start_offset,
115                                                            gint             end_offset);
116 gunichar      atk_text_get_character_at_offset            (AtkText          *text,
117                                                            gint             offset);
118 gchar*        atk_text_get_text_after_offset              (AtkText          *text,
119                                                            gint             offset,
120                                                            AtkTextBoundary  boundary_type);
121 gchar*        atk_text_get_text_at_offset                 (AtkText          *text,
122                                                            gint             offset,
123                                                            AtkTextBoundary  boundary_type);
124 gchar*        atk_text_get_text_before_offset             (AtkText          *text,
125                                                            gint             offset,
126                                                            AtkTextBoundary  boundary_type);
127 gint          atk_text_get_caret_offset                   (AtkText          *text);
128 void          atk_text_get_row_col_at_offset              (AtkText          *text,
129                                                            gint             offset,
130                                                            gint             *row,
131                                                            gint             *col);
132 PangoAttrList* atk_text_get_range_attributes              (AtkText          *text,
133                                                            gint             start_offset,
134                                                            gint             end_offset);
135 void          atk_text_get_character_extents              (AtkText          *text,
136                                                            gint             offset,
137                                                            gint             *x,
138                                                            gint             *y,
139                                                            gint             *length,
140                                                            gint             *width);
141 gint          atk_text_get_character_count                (AtkText          *text);
142 gint          atk_text_get_offset_at_point                (AtkText          *text,
143                                                            gint             x,
144                                                            gint             y);
145 gchar*        atk_text_get_selected_text                  (AtkText          *text);
146 void          atk_text_get_selection_bounds               (AtkText          *text,
147                                                            gint             *start_offset,
148                                                            gint             *end_offset);
149 gboolean      atk_text_set_selection_bounds               (AtkText          *text,
150                                                            gint             start_offset,
151                                                            gint             end_offset);
152 gboolean      atk_text_set_caret_offset                   (AtkText          *text,
153                                                            gint             offset);
154
155 #ifdef __cplusplus
156 }
157 #endif /* __cplusplus */
158
159
160 #endif /* __ATK_TEXT_H__ */