Add two new relations ATK_RELATION_NODE_CHILDREN and
[atk.git] / atk / atktext.h
blobb8a9a445a6d928496ff3167f1424c25b8f6fae8e
1 /* ATK - The Accessibility Toolkit for GTK+
2 * Copyright 2001 Sun Microsystems Inc.
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.
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.
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.
21 #ifndef __ATK_TEXT_H__
22 #define __ATK_TEXT_H__
24 #include <glib-object.h>
25 #include <atk/atkobject.h>
26 #include <atk/atkutil.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
32 /**
33 * AtkAttributeSet:
35 * This is a singly-linked list (a #GSList) of #AtkAttribute. It is
36 * used by atk_text_get_run_attributes(), atk_text_get_default_attributes()
37 * and atk_editable_text_set_run_attributes()
38 **/
39 typedef GSList AtkAttributeSet;
41 /**
42 * AtkAttribute:
43 * @name: The attribute name. Call atk_text_attr_get_name()
44 * @value: the value of the attribute, represented as a string.
45 * Call atk_text_attr_get_value() for those which are strings.
46 * For values which are numbers, the string representation of the number
47 * is in value.
49 * A string name/value pair representing a text attribute.
50 **/
51 typedef struct _AtkAttribute AtkAttribute;
53 struct _AtkAttribute {
54 gchar* name;
55 gchar* value;
58 /**
59 *AtkTextAttribute
60 *@ATK_TEXT_ATTR_LEFT_MARGIN: The pixel width of the left margin
61 *@ATK_TEXT_ATTR_RIGHT_MARGIN: The pixel width of the right margin
62 *@ATK_TEXT_ATTR_INDENT: The number of pixels that the text is indented
63 *@ATK_TEXT_ATTR_INVISIBLE: Either "true" or "false" indicating whether text is visible or not
64 *@ATK_TEXT_ATTR_EDITABLE: Either "true" or "false" indicating whether text is editable or not
65 *@ATK_TEXT_ATTR_PIXELS_ABOVE_LINES: Pixels of blank space to leave above each newline-terminated line.
66 *@ATK_TEXT_ATTR_PIXELS_BELOW_LINES: Pixels of blank space to leave below each newline-terminated line.
67 *@ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP: Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
68 *@ATK_TEXT_ATTR_BG_FULL_HEIGHT: "true" or "false" whether to make the background color for each character the height of the highest font used on the current line, or the height of the font used for the current character.
69 *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline
70 *@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double" or "low"
71 *@ATK_TEXT_ATTR_STRIKETHROUGH: "true" or "false" whether the text is strikethrough
72 *@ATK_TEXT_ATTR_SIZE: The size of the characters.
73 *@ATK_TEXT_ATTR_SCALE: The scale of the characters. The value is a string representation of a double
74 *@ATK_TEXT_ATTR_WEIGHT: The weight of the characters.
75 *@ATK_TEXT_ATTR_LANGUAGE: The language used
76 *@ATK_TEXT_ATTR_FAMILY_NAME: The font family name
77 *@ATK_TEXT_ATTR_BG_COLOR: The background color. The value is an RGB value of the format "%u,%u,%u"
78 *@ATK_TEXT_ATTR_FG_COLOR:The foreground color. The value is an RGB value of the format "%u,%u,%u"
79 *@ATK_TEXT_ATTR_BG_STIPPLE: "true" if a #GdkBitmap is set for stippling the background color.
80 *@ATK_TEXT_ATTR_FG_STIPPLE: "true" if a #GdkBitmap is set for stippling the foreground color.
81 *@ATK_TEXT_ATTR_WRAP_MODE: The wrap mode of the text, if any. Values are "none", "char" or "word"
82 *@ATK_TEXT_ATTR_DIRECTION: The direction of the text, if set. Values are "none", "ltr" or "rtl"
83 *@ATK_TEXT_ATTR_JUSTIFICATION: The justification of the text, if set. Values are "left", "right", "center" or "fill"
84 *@ATK_TEXT_ATTR_STRETCH: The stretch of the text, if set. Values are "ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" or "ultra_expanded"
85 *@ATK_TEXT_ATTR_VARIANT: The capitalization variant of the text, if set. Values are "normal" or "small_caps"
86 *@ATK_TEXT_ATTR_STYLE: The slant style of the text, if set. Values are "normal", "oblique" or "italic"
88 * Describes the text attributes supported
89 **/
90 typedef enum
92 ATK_TEXT_ATTR_LEFT_MARGIN,
93 ATK_TEXT_ATTR_RIGHT_MARGIN,
94 ATK_TEXT_ATTR_INDENT,
95 ATK_TEXT_ATTR_INVISIBLE,
96 ATK_TEXT_ATTR_EDITABLE,
97 ATK_TEXT_ATTR_PIXELS_ABOVE_LINES,
98 ATK_TEXT_ATTR_PIXELS_BELOW_LINES,
99 ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP,
100 ATK_TEXT_ATTR_BG_FULL_HEIGHT,
101 ATK_TEXT_ATTR_RISE,
102 ATK_TEXT_ATTR_UNDERLINE,
103 ATK_TEXT_ATTR_STRIKETHROUGH,
104 ATK_TEXT_ATTR_SIZE,
105 ATK_TEXT_ATTR_SCALE,
106 ATK_TEXT_ATTR_WEIGHT,
107 ATK_TEXT_ATTR_LANGUAGE,
108 ATK_TEXT_ATTR_FAMILY_NAME,
109 ATK_TEXT_ATTR_BG_COLOR,
110 ATK_TEXT_ATTR_FG_COLOR,
111 ATK_TEXT_ATTR_BG_STIPPLE,
112 ATK_TEXT_ATTR_FG_STIPPLE,
113 ATK_TEXT_ATTR_WRAP_MODE,
114 ATK_TEXT_ATTR_DIRECTION,
115 ATK_TEXT_ATTR_JUSTIFICATION,
116 ATK_TEXT_ATTR_STRETCH,
117 ATK_TEXT_ATTR_VARIANT,
118 ATK_TEXT_ATTR_STYLE
119 } AtkTextAttribute;
121 #define ATK_TYPE_TEXT (atk_text_get_type ())
122 #define ATK_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
123 #define ATK_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
124 #define ATK_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
126 #ifndef _TYPEDEF_ATK_TEXT_
127 #define _TYPEDEF_ATK_TEXT_
128 typedef struct _AtkText AtkText;
129 #endif
130 typedef struct _AtkTextIface AtkTextIface;
133 *AtkTextBoundary:
134 *@ATK_TEXT_BOUNDARY_CHAR:
135 *@ATK_TEXT_BOUNDARY_WORD_START:
136 *@ATK_TEXT_BOUNDARY_WORD_END:
137 *@ATK_TEXT_BOUNDARY_SENTENCE_START:
138 *@ATK_TEXT_BOUNDARY_SENTENCE_END:
139 *@ATK_TEXT_BOUNDARY_LINE_START:
140 *@ATK_TEXT_BOUNDARY_LINE_END:
142 *Text boundary types used for specifying boundaries for regions of text
144 typedef enum {
145 ATK_TEXT_BOUNDARY_CHAR,
146 ATK_TEXT_BOUNDARY_WORD_START,
147 ATK_TEXT_BOUNDARY_WORD_END,
148 ATK_TEXT_BOUNDARY_SENTENCE_START,
149 ATK_TEXT_BOUNDARY_SENTENCE_END,
150 ATK_TEXT_BOUNDARY_LINE_START,
151 ATK_TEXT_BOUNDARY_LINE_END
152 } AtkTextBoundary;
154 struct _AtkTextIface
156 GTypeInterface parent;
158 gchar* (* get_text) (AtkText *text,
159 gint start_offset,
160 gint end_offset);
161 gchar* (* get_text_after_offset) (AtkText *text,
162 gint offset,
163 AtkTextBoundary boundary_type,
164 gint *start_offset,
165 gint *end_offset);
166 gchar* (* get_text_at_offset) (AtkText *text,
167 gint offset,
168 AtkTextBoundary boundary_type,
169 gint *start_offset,
170 gint *end_offset);
171 gunichar (* get_character_at_offset) (AtkText *text,
172 gint offset);
173 gchar* (* get_text_before_offset) (AtkText *text,
174 gint offset,
175 AtkTextBoundary boundary_type,
176 gint *start_offset,
177 gint *end_offset);
178 gint (* get_caret_offset) (AtkText *text);
179 AtkAttributeSet* (* get_run_attributes) (AtkText *text,
180 gint offset,
181 gint *start_offset,
182 gint *end_offset);
183 AtkAttributeSet* (* get_default_attributes) (AtkText *text);
184 void (* get_character_extents) (AtkText *text,
185 gint offset,
186 gint *x,
187 gint *y,
188 gint *width,
189 gint *height,
190 AtkCoordType coords);
191 gint (* get_character_count) (AtkText *text);
192 gint (* get_offset_at_point) (AtkText *text,
193 gint x,
194 gint y,
195 AtkCoordType coords);
196 gint (* get_n_selections) (AtkText *text);
197 gchar* (* get_selection) (AtkText *text,
198 gint selection_num,
199 gint *start_offset,
200 gint *end_offset);
201 gboolean (* add_selection) (AtkText *text,
202 gint start_offset,
203 gint end_offset);
204 gboolean (* remove_selection) (AtkText *text,
205 gint selection_num);
206 gboolean (* set_selection) (AtkText *text,
207 gint selection_num,
208 gint start_offset,
209 gint end_offset);
210 gboolean (* set_caret_offset) (AtkText *text,
211 gint offset);
214 * signal handlers
216 void (* text_changed) (AtkText *text);
217 void (* caret_changed) (AtkText *text,
218 gint location);
221 GType atk_text_get_type (void);
225 * Additional AtkObject properties used by AtkText:
226 * "accessible_text" (accessible text has changed)
227 * "accessible_caret" (accessible text cursor position changed:
228 * editable text only)
231 gchar* atk_text_get_text (AtkText *text,
232 gint start_offset,
233 gint end_offset);
234 gunichar atk_text_get_character_at_offset (AtkText *text,
235 gint offset);
236 gchar* atk_text_get_text_after_offset (AtkText *text,
237 gint offset,
238 AtkTextBoundary boundary_type,
239 gint *start_offset,
240 gint *end_offset);
241 gchar* atk_text_get_text_at_offset (AtkText *text,
242 gint offset,
243 AtkTextBoundary boundary_type,
244 gint *start_offset,
245 gint *end_offset);
246 gchar* atk_text_get_text_before_offset (AtkText *text,
247 gint offset,
248 AtkTextBoundary boundary_type,
249 gint *start_offset,
250 gint *end_offset);
251 gint atk_text_get_caret_offset (AtkText *text);
252 void atk_text_get_character_extents (AtkText *text,
253 gint offset,
254 gint *x,
255 gint *y,
256 gint *width,
257 gint *height,
258 AtkCoordType coords);
259 AtkAttributeSet* atk_text_get_run_attributes (AtkText *text,
260 gint offset,
261 gint *start_offset,
262 gint *end_offset);
263 AtkAttributeSet* atk_text_get_default_attributes (AtkText *text);
264 gint atk_text_get_character_count (AtkText *text);
265 gint atk_text_get_offset_at_point (AtkText *text,
266 gint x,
267 gint y,
268 AtkCoordType coords);
269 gint atk_text_get_n_selections (AtkText *text);
270 gchar* atk_text_get_selection (AtkText *text,
271 gint selection_num,
272 gint *start_offset,
273 gint *end_offset);
274 gboolean atk_text_add_selection (AtkText *text,
275 gint start_offset,
276 gint end_offset);
277 gboolean atk_text_remove_selection (AtkText *text,
278 gint selection_num);
279 gboolean atk_text_set_selection (AtkText *text,
280 gint selection_num,
281 gint start_offset,
282 gint end_offset);
283 gboolean atk_text_set_caret_offset (AtkText *text,
284 gint offset);
285 void atk_attribute_set_free (AtkAttributeSet *attrib_set);
286 G_CONST_RETURN gchar* atk_attribute_get_name (AtkTextAttribute attr);
287 G_CONST_RETURN gchar* atk_attribute_get_value (AtkTextAttribute attr,
288 gint index);
290 #ifdef __cplusplus
292 #endif /* __cplusplus */
295 #endif /* __ATK_TEXT_H__ */