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.
20 #if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
21 #error "Only <atk/atk.h> can be included directly."
24 #ifndef __ATK_TEXT_H__
25 #define __ATK_TEXT_H__
27 #include <glib-object.h>
28 #include <atk/atkobject.h>
29 #include <atk/atkutil.h>
35 *@ATK_TEXT_ATTR_INVALID: Invalid attribute
36 *@ATK_TEXT_ATTR_LEFT_MARGIN: The pixel width of the left margin
37 *@ATK_TEXT_ATTR_RIGHT_MARGIN: The pixel width of the right margin
38 *@ATK_TEXT_ATTR_INDENT: The number of pixels that the text is indented
39 *@ATK_TEXT_ATTR_INVISIBLE: Either "true" or "false" indicating whether text is visible or not
40 *@ATK_TEXT_ATTR_EDITABLE: Either "true" or "false" indicating whether text is editable or not
41 *@ATK_TEXT_ATTR_PIXELS_ABOVE_LINES: Pixels of blank space to leave above each newline-terminated line.
42 *@ATK_TEXT_ATTR_PIXELS_BELOW_LINES: Pixels of blank space to leave below each newline-terminated line.
43 *@ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP: Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
44 *@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.
45 *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline
46 *@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double", "low", or "error"
47 *@ATK_TEXT_ATTR_STRIKETHROUGH: "true" or "false" whether the text is strikethrough
48 *@ATK_TEXT_ATTR_SIZE: The size of the characters.
49 *@ATK_TEXT_ATTR_SCALE: The scale of the characters. The value is a string representation of a double
50 *@ATK_TEXT_ATTR_WEIGHT: The weight of the characters.
51 *@ATK_TEXT_ATTR_LANGUAGE: The language used
52 *@ATK_TEXT_ATTR_FAMILY_NAME: The font family name
53 *@ATK_TEXT_ATTR_BG_COLOR: The background color. The value is an RGB value of the format "%u,%u,%u"
54 *@ATK_TEXT_ATTR_FG_COLOR:The foreground color. The value is an RGB value of the format "%u,%u,%u"
55 *@ATK_TEXT_ATTR_BG_STIPPLE: "true" if a #GdkBitmap is set for stippling the background color.
56 *@ATK_TEXT_ATTR_FG_STIPPLE: "true" if a #GdkBitmap is set for stippling the foreground color.
57 *@ATK_TEXT_ATTR_WRAP_MODE: The wrap mode of the text, if any. Values are "none", "char", "word", or "word_char".
58 *@ATK_TEXT_ATTR_DIRECTION: The direction of the text, if set. Values are "none", "ltr" or "rtl"
59 *@ATK_TEXT_ATTR_JUSTIFICATION: The justification of the text, if set. Values are "left", "right", "center" or "fill"
60 *@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"
61 *@ATK_TEXT_ATTR_VARIANT: The capitalization variant of the text, if set. Values are "normal" or "small_caps"
62 *@ATK_TEXT_ATTR_STYLE: The slant style of the text, if set. Values are "normal", "oblique" or "italic"
63 *@ATK_TEXT_ATTR_LAST_DEFINED: not a valid text attribute, used for finding end of enumeration
65 * Describes the text attributes supported
69 ATK_TEXT_ATTR_INVALID = 0,
70 ATK_TEXT_ATTR_LEFT_MARGIN,
71 ATK_TEXT_ATTR_RIGHT_MARGIN,
73 ATK_TEXT_ATTR_INVISIBLE,
74 ATK_TEXT_ATTR_EDITABLE,
75 ATK_TEXT_ATTR_PIXELS_ABOVE_LINES,
76 ATK_TEXT_ATTR_PIXELS_BELOW_LINES,
77 ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP,
78 ATK_TEXT_ATTR_BG_FULL_HEIGHT,
80 ATK_TEXT_ATTR_UNDERLINE,
81 ATK_TEXT_ATTR_STRIKETHROUGH,
85 ATK_TEXT_ATTR_LANGUAGE,
86 ATK_TEXT_ATTR_FAMILY_NAME,
87 ATK_TEXT_ATTR_BG_COLOR,
88 ATK_TEXT_ATTR_FG_COLOR,
89 ATK_TEXT_ATTR_BG_STIPPLE,
90 ATK_TEXT_ATTR_FG_STIPPLE,
91 ATK_TEXT_ATTR_WRAP_MODE,
92 ATK_TEXT_ATTR_DIRECTION,
93 ATK_TEXT_ATTR_JUSTIFICATION,
94 ATK_TEXT_ATTR_STRETCH,
95 ATK_TEXT_ATTR_VARIANT,
97 ATK_TEXT_ATTR_LAST_DEFINED
100 AtkTextAttribute atk_text_attribute_register (const gchar *name);
103 #define ATK_TYPE_TEXT (atk_text_get_type ())
104 #define ATK_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
105 #define ATK_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
106 #define ATK_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
108 #ifndef _TYPEDEF_ATK_TEXT_
109 #define _TYPEDEF_ATK_TEXT_
110 typedef struct _AtkText AtkText;
112 typedef struct _AtkTextIface AtkTextIface;
116 *@ATK_TEXT_BOUNDARY_CHAR: Boundary is the boundary between characters
117 * (including non-printing characters)
118 *@ATK_TEXT_BOUNDARY_WORD_START: Boundary is the start (i.e. first character) of a word.
119 *@ATK_TEXT_BOUNDARY_WORD_END: Boundary is the end (i.e. last character) of a word.
120 *@ATK_TEXT_BOUNDARY_SENTENCE_START: Boundary is the first character in a sentence.
121 *@ATK_TEXT_BOUNDARY_SENTENCE_END: Boundary is the last (terminal) character in a sentence;
122 * in languages which use "sentence stop" punctuation such as English, the boundary is thus the
123 * '.', '?', or similar terminal punctuation character.
124 *@ATK_TEXT_BOUNDARY_LINE_START: Boundary is the initial character of the content or a
125 * character immediately following a newline, linefeed, or return character.
126 *@ATK_TEXT_BOUNDARY_LINE_END: Boundary is the linefeed, or return character.
128 *Text boundary types used for specifying boundaries for regions of text
131 ATK_TEXT_BOUNDARY_CHAR,
132 ATK_TEXT_BOUNDARY_WORD_START,
133 ATK_TEXT_BOUNDARY_WORD_END,
134 ATK_TEXT_BOUNDARY_SENTENCE_START,
135 ATK_TEXT_BOUNDARY_SENTENCE_END,
136 ATK_TEXT_BOUNDARY_LINE_START,
137 ATK_TEXT_BOUNDARY_LINE_END
142 * @x: The horizontal coordinate of a rectangle
143 * @y: The vertical coordinate of a rectangle
144 * @width: The width of a rectangle
145 * @height: The height of a rectangle
147 * A structure used to store a rectangle used by AtkText.
150 typedef struct _AtkTextRectangle AtkTextRectangle;
152 struct _AtkTextRectangle {
161 * @bounds: A rectangle giving the bounds of the text range
162 * @start_offset: The start offset of a AtkTextRange
163 * @end_offset: The end offset of a AtkTextRange
164 * @content: The text in the text range
166 * A structure used to describe a text range.
168 typedef struct _AtkTextRange AtkTextRange;
170 struct _AtkTextRange {
171 AtkTextRectangle bounds;
177 GType atk_text_range_get_type (void);
181 *@ATK_TEXT_CLIP_NONE: No clipping to be done
182 *@ATK_TEXT_CLIP_MIN: Text clipped by min coordinate is omitted
183 *@ATK_TEXT_CLIP_MAX: Text clipped by max coordinate is omitted
184 *@ATK_TEXT_CLIP_BOTH: Only text fully within mix/max bound is retained
186 *Describes the type of clipping required.
197 GTypeInterface parent;
199 gchar* (* get_text) (AtkText *text,
202 gchar* (* get_text_after_offset) (AtkText *text,
204 AtkTextBoundary boundary_type,
207 gchar* (* get_text_at_offset) (AtkText *text,
209 AtkTextBoundary boundary_type,
212 gunichar (* get_character_at_offset) (AtkText *text,
214 gchar* (* get_text_before_offset) (AtkText *text,
216 AtkTextBoundary boundary_type,
219 gint (* get_caret_offset) (AtkText *text);
220 AtkAttributeSet* (* get_run_attributes) (AtkText *text,
224 AtkAttributeSet* (* get_default_attributes) (AtkText *text);
225 void (* get_character_extents) (AtkText *text,
231 AtkCoordType coords);
232 gint (* get_character_count) (AtkText *text);
233 gint (* get_offset_at_point) (AtkText *text,
236 AtkCoordType coords);
237 gint (* get_n_selections) (AtkText *text);
238 gchar* (* get_selection) (AtkText *text,
242 gboolean (* add_selection) (AtkText *text,
245 gboolean (* remove_selection) (AtkText *text,
247 gboolean (* set_selection) (AtkText *text,
251 gboolean (* set_caret_offset) (AtkText *text,
257 void (* text_changed) (AtkText *text,
260 void (* text_caret_moved) (AtkText *text,
262 void (* text_selection_changed) (AtkText *text);
264 void (* text_attributes_changed) (AtkText *text);
267 void (* get_range_extents) (AtkText *text,
270 AtkCoordType coord_type,
271 AtkTextRectangle *rect);
273 AtkTextRange** (* get_bounded_ranges) (AtkText *text,
274 AtkTextRectangle *rect,
275 AtkCoordType coord_type,
276 AtkTextClipType x_clip_type,
277 AtkTextClipType y_clip_type);
283 GType atk_text_get_type (void);
287 * Additional AtkObject properties used by AtkText:
288 * "accessible_text" (accessible text has changed)
289 * "accessible_caret" (accessible text cursor position changed:
290 * editable text only)
293 gchar* atk_text_get_text (AtkText *text,
296 gunichar atk_text_get_character_at_offset (AtkText *text,
298 gchar* atk_text_get_text_after_offset (AtkText *text,
300 AtkTextBoundary boundary_type,
303 gchar* atk_text_get_text_at_offset (AtkText *text,
305 AtkTextBoundary boundary_type,
308 gchar* atk_text_get_text_before_offset (AtkText *text,
310 AtkTextBoundary boundary_type,
313 gint atk_text_get_caret_offset (AtkText *text);
314 void atk_text_get_character_extents (AtkText *text,
320 AtkCoordType coords);
321 AtkAttributeSet* atk_text_get_run_attributes (AtkText *text,
325 AtkAttributeSet* atk_text_get_default_attributes (AtkText *text);
326 gint atk_text_get_character_count (AtkText *text);
327 gint atk_text_get_offset_at_point (AtkText *text,
330 AtkCoordType coords);
331 gint atk_text_get_n_selections (AtkText *text);
332 gchar* atk_text_get_selection (AtkText *text,
336 gboolean atk_text_add_selection (AtkText *text,
339 gboolean atk_text_remove_selection (AtkText *text,
341 gboolean atk_text_set_selection (AtkText *text,
345 gboolean atk_text_set_caret_offset (AtkText *text,
347 void atk_text_get_range_extents (AtkText *text,
351 AtkCoordType coord_type,
352 AtkTextRectangle *rect);
353 AtkTextRange** atk_text_get_bounded_ranges (AtkText *text,
354 AtkTextRectangle *rect,
355 AtkCoordType coord_type,
356 AtkTextClipType x_clip_type,
357 AtkTextClipType y_clip_type);
358 void atk_text_free_ranges (AtkTextRange **ranges);
359 void atk_attribute_set_free (AtkAttributeSet *attrib_set);
360 G_CONST_RETURN gchar* atk_text_attribute_get_name (AtkTextAttribute attr);
361 AtkTextAttribute atk_text_attribute_for_name (const gchar *name);
362 G_CONST_RETURN gchar* atk_text_attribute_get_value (AtkTextAttribute attr,
367 #endif /* __ATK_TEXT_H__ */