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>
30 #endif /* __cplusplus */
35 * This is a singly-linked list (a #GSList) of #AtkAttribute. It is
36 * used by atk_text_ref_run_attributes() and atk_editable_text_set_run_attributes()
38 typedef GSList AtkAttributeSet;
42 * @name: The attribute name. See the ATK_ATTRIBUTE macros, eg #ATK_ATTRIBUTE_LEFT_MARGIN for examples.
43 * @value: the value of the attribute, represented as a string. See the ATK_ATTRIBUTE macros, eg #ATK_ATTRIBUTE_LEFT_MARGIN for example.
45 * A string name/value pair representing a text attribute.
47 typedef struct _AtkAttribute AtkAttribute;
49 struct _AtkAttribute {
55 * ATK_ATTRIBUTE_LEFT_MARGIN:
57 * An #AtkAttribute name/value pair. The pixel width of the left margin
59 #define ATK_ATTRIBUTE_LEFT_MARGIN "left_margin"
62 * ATK_ATTRIBUTE_RIGHT_MARGIN:
64 * An #AtkAttribute name/value pair. The pixel width of the right margin
66 #define ATK_ATTRIBUTE_RIGHT_MARGIN "right_margin"
69 * ATK_ATTRIBUTE_INDENT:
71 * An #AtkAttribute name/value pair. The number of pixels that the text is indented
73 #define ATK_ATTRIBUTE_INDENT "indent"
76 * ATK_ATTRIBUTE_INVISIBLE:
78 * An #AtkAttribute name/value pair.
79 * Either "true" or "false" indicating whether text is visible or not
81 #define ATK_ATTRIBUTE_INVISIBLE "invisible"
84 * ATK_ATTRIBUTE_EDITABLE:
86 * An #AtkAttribute name/value pair.
87 * Either "true" or "false" indicating whether text is editable or not
89 #define ATK_ATTRIBUTE_EDITABLE "editable"
92 * ATK_ATTRIBUTE_PIXELS_ABOVE_LINES:
94 * An #AtkAttribute name/value pair.
95 * Pixels of blank space to leave above each newline-terminated line.
97 #define ATK_ATTRIBUTE_PIXELS_ABOVE_LINES "pixels_above_lines"
100 * ATK_ATTRIBUTE_PIXELS_BELOW_LINES:
102 * An #AtkAttribute name/value pair.
103 * Pixels of blank space to leave below each newline-terminated line.
105 #define ATK_ATTRIBUTE_PIXELS_BELOW_LINES "pixels_below_lines"
108 * ATK_ATTRIBUTE_PIXELS_INSIDE_WRAP:
110 * An #AtkAttribute name/value pair.
111 * Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
113 #define ATK_ATTRIBUTE_PIXELS_INSIDE_WRAP "pixels_inside_wrap"
116 * ATK_ATTRIBUTE_BG_FULL_HEIGHT:
118 * An #AtkAttribute name/value pair.
119 * "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.
121 #define ATK_ATTRIBUTE_BG_FULL_HEIGHT "bg_full_height"
124 * ATK_ATTRIBUTE_RISE:
126 * An #AtkAttribute name/value pair.
127 * Number of pixels that the characters are risen above the baseline
128 * The value is a string representation of an integer
130 #define ATK_ATTRIBUTE_RISE "rise"
133 * ATK_ATTRIBUTE_UNDERLINE:
135 * An #AtkAttribute name/value pair.
136 * "true" or "false" whether the text is underlined
138 #define ATK_ATTRIBUTE_UNDERLINE "underline"
141 * ATK_ATTRIBUTE_STRIKETHROUGH:
143 * An #AtkAttribute name/value pair.
144 * "true" or "false" whether the text is strikethrough
146 #define ATK_ATTRIBUTE_STRIKETHROUGH "strikethrough"
149 * ATK_ATTRIBUTE_SIZE:
151 * An #AtkAttribute name/value pair.
152 * The size of the characters.
153 * The value is a string representation of an integer
155 #define ATK_ATTRIBUTE_SIZE "size"
158 * ATK_ATTRIBUTE_SCALE:
160 * An #AtkAttribute name/value pair.
161 * The scale of the characters. The value is a string representation of a double
163 #define ATK_ATTRIBUTE_SCALE "scale"
166 * ATK_ATTRIBUTE_WEIGHT:
168 * An #AtkAttribute name/value pair.
169 * The weight of the characters. The value is a string representation of an integer
171 #define ATK_ATTRIBUTE_WEIGHT "weight"
174 * ATK_ATTRIBUTE_LANGUAGE:
176 * An #AtkAttribute name/value pair.
179 #define ATK_ATTRIBUTE_LANGUAGE "language"
182 * ATK_ATTRIBUTE_FAMILY_NAME:
184 * An #AtkAttribute name/value pair.
185 * The font family name
187 #define ATK_ATTRIBUTE_FAMILY_NAME "family_name"
190 * ATK_ATTRIBUTE_BG_COLOR:
192 * An #AtkAttribute name/value pair.
193 * The background color. The value is an RGB value of the format "%u,%u,%u"
195 #define ATK_ATTRIBUTE_BG_COLOR "bg_color"
198 * ATK_ATTRIBUTE_FG_COLOR:
200 * An #AtkAttribute name/value pair.
201 * The foreground color. The value is an RGB value of the format "%u,%u,%u"
203 #define ATK_ATTRIBUTE_FG_COLOR "fg_color"
206 * ATK_ATTRIBUTE_BG_STIPPLE:
208 * An #AtkAttribute name/value pair.
209 * "true" if a #GdkBitmap is set for stippling the background color.
211 #define ATK_ATTRIBUTE_BG_STIPPLE "bg_stipple"
214 * ATK_ATTRIBUTE_FG_STIPPLE:
216 * An #AtkAttribute name/value pair.
217 * "true" if a #GdkBitmap is set for stippling the foreground color.
219 #define ATK_ATTRIBUTE_FG_STIPPLE "fg_stipple"
222 * ATK_ATTRIBUTE_WRAP_MODE:
224 * An #AtkAttribute name/value pair.
225 * The wrap mode of the text, if any. Values are "none", "char" or "word"
227 #define ATK_ATTRIBUTE_WRAP_MODE "wrap_mode"
230 * ATK_ATTRIBUTE_DIRECTION:
232 * An #AtkAttribute name/value pair.
233 * The direction of the text, if set. Values are "none", "ltr" or "rtl"
235 #define ATK_ATTRIBUTE_DIRECTION "direction"
238 * ATK_ATTRIBUTE_JUSTIFICATION:
240 * An #AtkAttribute name/value pair.
241 * The justification of the text, if set. Values are "left", "right", "center" or "fill"
243 #define ATK_ATTRIBUTE_JUSTIFICATION "justification"
246 * ATK_ATTRIBUTE_STRETCH:
248 * An #AtkAttribute name/value pair.
249 * The stretch of the text, if set. Values are "ultra_condensed", "extra_condensed",
250 * or "ultra_expanded"
252 #define ATK_ATTRIBUTE_STRETCH "stretch"
255 * ATK_ATTRIBUTE_VARIANT:
257 * An #AtkAttribute name/value pair.
258 * The capitalization variant of the text, if set. Values are "normal" or "small_caps"
260 #define ATK_ATTRIBUTE_VARIANT "variant"
263 * ATK_ATTRIBUTE_STYLE:
265 * An #AtkAttribute name/value pair.
266 * The slant style of the text, if set. Values are "normal", "oblique" or "italic"
268 #define ATK_ATTRIBUTE_STYLE "slant_style"
270 #define ATK_TYPE_TEXT (atk_text_get_type ())
271 #define ATK_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
272 #define ATK_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
273 #define ATK_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
275 #ifndef _TYPEDEF_ATK_TEXT_
276 #define _TYPEDEF_ATK_TEXT_
277 typedef struct _AtkText AtkText;
279 typedef struct _AtkTextIface AtkTextIface;
283 *@ATK_TEXT_BOUNDARY_CHAR:
284 *@ATK_TEXT_BOUNDARY_WORD_START:
285 *@ATK_TEXT_BOUNDARY_WORD_END:
286 *@ATK_TEXT_BOUNDARY_SENTENCE_START:
287 *@ATK_TEXT_BOUNDARY_SENTENCE_END:
288 *@ATK_TEXT_BOUNDARY_LINE_START:
289 *@ATK_TEXT_BOUNDARY_LINE_END:
291 *Text boundary types used for specifying boundaries for regions of text
294 ATK_TEXT_BOUNDARY_CHAR,
295 ATK_TEXT_BOUNDARY_WORD_START,
296 ATK_TEXT_BOUNDARY_WORD_END,
297 ATK_TEXT_BOUNDARY_SENTENCE_START,
298 ATK_TEXT_BOUNDARY_SENTENCE_END,
299 ATK_TEXT_BOUNDARY_LINE_START,
300 ATK_TEXT_BOUNDARY_LINE_END
305 GTypeInterface parent;
307 gchar* (* get_text) (AtkText *text,
310 gchar* (* get_text_after_offset) (AtkText *text,
312 AtkTextBoundary boundary_type,
315 gchar* (* get_text_at_offset) (AtkText *text,
317 AtkTextBoundary boundary_type,
320 gunichar (* get_character_at_offset) (AtkText *text,
322 gchar* (* get_text_before_offset) (AtkText *text,
324 AtkTextBoundary boundary_type,
327 gint (* get_caret_offset) (AtkText *text);
328 AtkAttributeSet* (* ref_run_attributes) (AtkText *text,
332 void (* get_character_extents) (AtkText *text,
338 AtkCoordType coords);
339 gint (* get_character_count) (AtkText *text);
340 gint (* get_offset_at_point) (AtkText *text,
343 AtkCoordType coords);
344 gint (* get_n_selections) (AtkText *text);
345 gchar* (* get_selection) (AtkText *text,
349 gboolean (* add_selection) (AtkText *text,
352 gboolean (* remove_selection) (AtkText *text,
354 gboolean (* set_selection) (AtkText *text,
358 gboolean (* set_caret_offset) (AtkText *text,
364 void (* text_changed) (AtkText *text);
365 void (* caret_changed) (AtkText *text,
369 GType atk_text_get_type (void);
373 * Additional AtkObject properties used by AtkText:
374 * "accessible_text" (accessible text has changed)
375 * "accessible_caret" (accessible text cursor position changed:
376 * editable text only)
379 gchar* atk_text_get_text (AtkText *text,
382 gunichar atk_text_get_character_at_offset (AtkText *text,
384 gchar* atk_text_get_text_after_offset (AtkText *text,
386 AtkTextBoundary boundary_type,
389 gchar* atk_text_get_text_at_offset (AtkText *text,
391 AtkTextBoundary boundary_type,
394 gchar* atk_text_get_text_before_offset (AtkText *text,
396 AtkTextBoundary boundary_type,
399 gint atk_text_get_caret_offset (AtkText *text);
400 void atk_text_get_character_extents (AtkText *text,
406 AtkCoordType coords);
407 AtkAttributeSet* atk_text_ref_run_attributes (AtkText *text,
411 gint atk_text_get_character_count (AtkText *text);
412 gint atk_text_get_offset_at_point (AtkText *text,
415 AtkCoordType coords);
416 gint atk_text_get_n_selections (AtkText *text);
417 gchar* atk_text_get_selection (AtkText *text,
421 gboolean atk_text_add_selection (AtkText *text,
424 gboolean atk_text_remove_selection (AtkText *text,
426 gboolean atk_text_set_selection (AtkText *text,
430 gboolean atk_text_set_caret_offset (AtkText *text,
432 void atk_attribute_set_free (AtkAttributeSet *attrib_set);
436 #endif /* __cplusplus */
439 #endif /* __ATK_TEXT_H__ */