Bumping manifests a=b2g-bump
[gecko.git] / other-licenses / atk-1.0 / atk / atktext.h
blob191e231fbc751395986d905c582ed6d20c8013d1
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 *AtkTextAttribute
34 *@ATK_TEXT_ATTR_INVALID: Invalid attribute
35 *@ATK_TEXT_ATTR_LEFT_MARGIN: The pixel width of the left margin
36 *@ATK_TEXT_ATTR_RIGHT_MARGIN: The pixel width of the right margin
37 *@ATK_TEXT_ATTR_INDENT: The number of pixels that the text is indented
38 *@ATK_TEXT_ATTR_INVISIBLE: Either "true" or "false" indicating whether text is visible or not
39 *@ATK_TEXT_ATTR_EDITABLE: Either "true" or "false" indicating whether text is editable or not
40 *@ATK_TEXT_ATTR_PIXELS_ABOVE_LINES: Pixels of blank space to leave above each newline-terminated line.
41 *@ATK_TEXT_ATTR_PIXELS_BELOW_LINES: Pixels of blank space to leave below each newline-terminated line.
42 *@ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP: Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
43 *@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.
44 *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline
45 *@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double" or "low"
46 *@ATK_TEXT_ATTR_STRIKETHROUGH: "true" or "false" whether the text is strikethrough
47 *@ATK_TEXT_ATTR_SIZE: The size of the characters.
48 *@ATK_TEXT_ATTR_SCALE: The scale of the characters. The value is a string representation of a double
49 *@ATK_TEXT_ATTR_WEIGHT: The weight of the characters.
50 *@ATK_TEXT_ATTR_LANGUAGE: The language used
51 *@ATK_TEXT_ATTR_FAMILY_NAME: The font family name
52 *@ATK_TEXT_ATTR_BG_COLOR: The background color. The value is an RGB value of the format "%u,%u,%u"
53 *@ATK_TEXT_ATTR_FG_COLOR:The foreground color. The value is an RGB value of the format "%u,%u,%u"
54 *@ATK_TEXT_ATTR_BG_STIPPLE: "true" if a #GdkBitmap is set for stippling the background color.
55 *@ATK_TEXT_ATTR_FG_STIPPLE: "true" if a #GdkBitmap is set for stippling the foreground color.
56 *@ATK_TEXT_ATTR_WRAP_MODE: The wrap mode of the text, if any. Values are "none", "char" or "word"
57 *@ATK_TEXT_ATTR_DIRECTION: The direction of the text, if set. Values are "none", "ltr" or "rtl"
58 *@ATK_TEXT_ATTR_JUSTIFICATION: The justification of the text, if set. Values are "left", "right", "center" or "fill"
59 *@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"
60 *@ATK_TEXT_ATTR_VARIANT: The capitalization variant of the text, if set. Values are "normal" or "small_caps"
61 *@ATK_TEXT_ATTR_STYLE: The slant style of the text, if set. Values are "normal", "oblique" or "italic"
62 *@ATK_TEXT_ATTR_LAST_DEFINED: not a valid text attribute, used for finding end of enumeration
64 * Describes the text attributes supported
65 **/
66 typedef enum
68 ATK_TEXT_ATTR_INVALID = 0,
69 ATK_TEXT_ATTR_LEFT_MARGIN,
70 ATK_TEXT_ATTR_RIGHT_MARGIN,
71 ATK_TEXT_ATTR_INDENT,
72 ATK_TEXT_ATTR_INVISIBLE,
73 ATK_TEXT_ATTR_EDITABLE,
74 ATK_TEXT_ATTR_PIXELS_ABOVE_LINES,
75 ATK_TEXT_ATTR_PIXELS_BELOW_LINES,
76 ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP,
77 ATK_TEXT_ATTR_BG_FULL_HEIGHT,
78 ATK_TEXT_ATTR_RISE,
79 ATK_TEXT_ATTR_UNDERLINE,
80 ATK_TEXT_ATTR_STRIKETHROUGH,
81 ATK_TEXT_ATTR_SIZE,
82 ATK_TEXT_ATTR_SCALE,
83 ATK_TEXT_ATTR_WEIGHT,
84 ATK_TEXT_ATTR_LANGUAGE,
85 ATK_TEXT_ATTR_FAMILY_NAME,
86 ATK_TEXT_ATTR_BG_COLOR,
87 ATK_TEXT_ATTR_FG_COLOR,
88 ATK_TEXT_ATTR_BG_STIPPLE,
89 ATK_TEXT_ATTR_FG_STIPPLE,
90 ATK_TEXT_ATTR_WRAP_MODE,
91 ATK_TEXT_ATTR_DIRECTION,
92 ATK_TEXT_ATTR_JUSTIFICATION,
93 ATK_TEXT_ATTR_STRETCH,
94 ATK_TEXT_ATTR_VARIANT,
95 ATK_TEXT_ATTR_STYLE,
96 ATK_TEXT_ATTR_LAST_DEFINED
97 } AtkTextAttribute;
99 AtkTextAttribute atk_text_attribute_register (const gchar *name);
102 #define ATK_TYPE_TEXT (atk_text_get_type ())
103 #define ATK_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
104 #define ATK_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
105 #define ATK_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
107 #ifndef _TYPEDEF_ATK_TEXT_
108 #define _TYPEDEF_ATK_TEXT_
109 typedef struct _AtkText AtkText;
110 #endif
111 typedef struct _AtkTextIface AtkTextIface;
114 *AtkTextBoundary:
115 *@ATK_TEXT_BOUNDARY_CHAR: Boundary is the boundary between characters
116 * (including non-printing characters)
117 *@ATK_TEXT_BOUNDARY_WORD_START: Boundary is the start (i.e. first character) of a word.
118 *@ATK_TEXT_BOUNDARY_WORD_END: Boundary is the end (i.e. last character) of a word.
119 *@ATK_TEXT_BOUNDARY_SENTENCE_START: Boundary is the first character in a sentence.
120 *@ATK_TEXT_BOUNDARY_SENTENCE_END: Boundary is the last (terminal) character in a sentence;
121 * in languages which use "sentence stop" punctuation such as English, the boundary is thus the
122 * '.', '?', or similar terminal punctuation character.
123 *@ATK_TEXT_BOUNDARY_LINE_START: Boundary is the initial character of the content or a
124 * character immediately following a newline, linefeed, or return character.
125 *@ATK_TEXT_BOUNDARY_LINE_END: Boundary is the linefeed, or return character.
127 *Text boundary types used for specifying boundaries for regions of text
129 typedef enum {
130 ATK_TEXT_BOUNDARY_CHAR,
131 ATK_TEXT_BOUNDARY_WORD_START,
132 ATK_TEXT_BOUNDARY_WORD_END,
133 ATK_TEXT_BOUNDARY_SENTENCE_START,
134 ATK_TEXT_BOUNDARY_SENTENCE_END,
135 ATK_TEXT_BOUNDARY_LINE_START,
136 ATK_TEXT_BOUNDARY_LINE_END
137 } AtkTextBoundary;
140 * AtkTextRectangle:
141 * @x: The horizontal coordinate of a rectangle
142 * @y: The vertical coordinate of a rectangle
143 * @width: The width of a rectangle
144 * @height: The height of a rectangle
146 * A structure used to store a rectangle used by AtkText.
149 typedef struct _AtkTextRectangle AtkTextRectangle;
151 struct _AtkTextRectangle {
152 gint x;
153 gint y;
154 gint width;
155 gint height;
159 * AtkTextRange:
160 * @bounds: A rectangle giving the bounds of the text range
161 * @start_offset: The start offset of a AtkTextRange
162 * @end_offset: The end offset of a AtkTextRange
163 * @content: The text in the text range
165 * A structure used to describe a text range.
167 typedef struct _AtkTextRange AtkTextRange;
169 struct _AtkTextRange {
170 AtkTextRectangle bounds;
171 gint start_offset;
172 gint end_offset;
173 gchar* content;
177 *AtkTextClipType
178 *@ATK_TEXT_CLIP_NONE: No clipping to be done
179 *@ATK_TEXT_CLIP_MIN: Text clipped by min coordinate is omitted
180 *@ATK_TEXT_CLIP_MAX: Text clipped by max coordinate is omitted
181 *@ATK_TEXT_CLIP_BOTH: Only text fully within mix/max bound is retained
183 *Describes the type of clipping required.
185 typedef enum {
186 ATK_TEXT_CLIP_NONE,
187 ATK_TEXT_CLIP_MIN,
188 ATK_TEXT_CLIP_MAX,
189 ATK_TEXT_CLIP_BOTH
190 } AtkTextClipType;
192 struct _AtkTextIface
194 GTypeInterface parent;
196 gchar* (* get_text) (AtkText *text,
197 gint start_offset,
198 gint end_offset);
199 gchar* (* get_text_after_offset) (AtkText *text,
200 gint offset,
201 AtkTextBoundary boundary_type,
202 gint *start_offset,
203 gint *end_offset);
204 gchar* (* get_text_at_offset) (AtkText *text,
205 gint offset,
206 AtkTextBoundary boundary_type,
207 gint *start_offset,
208 gint *end_offset);
209 gunichar (* get_character_at_offset) (AtkText *text,
210 gint offset);
211 gchar* (* get_text_before_offset) (AtkText *text,
212 gint offset,
213 AtkTextBoundary boundary_type,
214 gint *start_offset,
215 gint *end_offset);
216 gint (* get_caret_offset) (AtkText *text);
217 AtkAttributeSet* (* get_run_attributes) (AtkText *text,
218 gint offset,
219 gint *start_offset,
220 gint *end_offset);
221 AtkAttributeSet* (* get_default_attributes) (AtkText *text);
222 void (* get_character_extents) (AtkText *text,
223 gint offset,
224 gint *x,
225 gint *y,
226 gint *width,
227 gint *height,
228 AtkCoordType coords);
229 gint (* get_character_count) (AtkText *text);
230 gint (* get_offset_at_point) (AtkText *text,
231 gint x,
232 gint y,
233 AtkCoordType coords);
234 gint (* get_n_selections) (AtkText *text);
235 gchar* (* get_selection) (AtkText *text,
236 gint selection_num,
237 gint *start_offset,
238 gint *end_offset);
239 gboolean (* add_selection) (AtkText *text,
240 gint start_offset,
241 gint end_offset);
242 gboolean (* remove_selection) (AtkText *text,
243 gint selection_num);
244 gboolean (* set_selection) (AtkText *text,
245 gint selection_num,
246 gint start_offset,
247 gint end_offset);
248 gboolean (* set_caret_offset) (AtkText *text,
249 gint offset);
252 * signal handlers
254 void (* text_changed) (AtkText *text,
255 gint position,
256 gint length);
257 void (* text_caret_moved) (AtkText *text,
258 gint location);
259 void (* text_selection_changed) (AtkText *text);
261 void (* text_attributes_changed) (AtkText *text);
264 void (* get_range_extents) (AtkText *text,
265 gint start_offset,
266 gint end_offset,
267 AtkCoordType coord_type,
268 AtkTextRectangle *rect);
270 AtkTextRange** (* get_bounded_ranges) (AtkText *text,
271 AtkTextRectangle *rect,
272 AtkCoordType coord_type,
273 AtkTextClipType x_clip_type,
274 AtkTextClipType y_clip_type);
277 AtkFunction pad4;
280 GType atk_text_get_type (void);
284 * Additional AtkObject properties used by AtkText:
285 * "accessible_text" (accessible text has changed)
286 * "accessible_caret" (accessible text cursor position changed:
287 * editable text only)
290 gchar* atk_text_get_text (AtkText *text,
291 gint start_offset,
292 gint end_offset);
293 gunichar atk_text_get_character_at_offset (AtkText *text,
294 gint offset);
295 gchar* atk_text_get_text_after_offset (AtkText *text,
296 gint offset,
297 AtkTextBoundary boundary_type,
298 gint *start_offset,
299 gint *end_offset);
300 gchar* atk_text_get_text_at_offset (AtkText *text,
301 gint offset,
302 AtkTextBoundary boundary_type,
303 gint *start_offset,
304 gint *end_offset);
305 gchar* atk_text_get_text_before_offset (AtkText *text,
306 gint offset,
307 AtkTextBoundary boundary_type,
308 gint *start_offset,
309 gint *end_offset);
310 gint atk_text_get_caret_offset (AtkText *text);
311 void atk_text_get_character_extents (AtkText *text,
312 gint offset,
313 gint *x,
314 gint *y,
315 gint *width,
316 gint *height,
317 AtkCoordType coords);
318 AtkAttributeSet* atk_text_get_run_attributes (AtkText *text,
319 gint offset,
320 gint *start_offset,
321 gint *end_offset);
322 AtkAttributeSet* atk_text_get_default_attributes (AtkText *text);
323 gint atk_text_get_character_count (AtkText *text);
324 gint atk_text_get_offset_at_point (AtkText *text,
325 gint x,
326 gint y,
327 AtkCoordType coords);
328 gint atk_text_get_n_selections (AtkText *text);
329 gchar* atk_text_get_selection (AtkText *text,
330 gint selection_num,
331 gint *start_offset,
332 gint *end_offset);
333 gboolean atk_text_add_selection (AtkText *text,
334 gint start_offset,
335 gint end_offset);
336 gboolean atk_text_remove_selection (AtkText *text,
337 gint selection_num);
338 gboolean atk_text_set_selection (AtkText *text,
339 gint selection_num,
340 gint start_offset,
341 gint end_offset);
342 gboolean atk_text_set_caret_offset (AtkText *text,
343 gint offset);
344 void atk_text_get_range_extents (AtkText *text,
346 gint start_offset,
347 gint end_offset,
348 AtkCoordType coord_type,
349 AtkTextRectangle *rect);
350 AtkTextRange** atk_text_get_bounded_ranges (AtkText *text,
351 AtkTextRectangle *rect,
352 AtkCoordType coord_type,
353 AtkTextClipType x_clip_type,
354 AtkTextClipType y_clip_type);
355 void atk_text_free_ranges (AtkTextRange **ranges);
356 void atk_attribute_set_free (AtkAttributeSet *attrib_set);
357 G_CONST_RETURN gchar* atk_text_attribute_get_name (AtkTextAttribute attr);
358 AtkTextAttribute atk_text_attribute_for_name (const gchar *name);
359 G_CONST_RETURN gchar* atk_text_attribute_get_value (AtkTextAttribute attr,
360 gint index_);
362 #ifdef __cplusplus
364 #endif /* __cplusplus */
367 #endif /* __ATK_TEXT_H__ */