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_get_run_attributes(), atk_text_get_default_attributes()
37 * and atk_editable_text_set_run_attributes()
39 typedef GSList AtkAttributeSet;
43 * @name: The attribute name. See the ATK_ATTRIBUTE macros, eg #ATK_ATTRIBUTE_LEFT_MARGIN for examples.
44 * @value: the value of the attribute, represented as a string. See the ATK_ATTRIBUTE macros, eg #ATK_ATTRIBUTE_LEFT_MARGIN for example.
46 * A string name/value pair representing a text attribute.
48 typedef struct _AtkAttribute AtkAttribute;
50 struct _AtkAttribute {
56 * ATK_ATTRIBUTE_LEFT_MARGIN:
58 * An #AtkAttribute name/value pair. The pixel width of the left margin
60 #define ATK_ATTRIBUTE_LEFT_MARGIN "left_margin"
63 * ATK_ATTRIBUTE_RIGHT_MARGIN:
65 * An #AtkAttribute name/value pair. The pixel width of the right margin
67 #define ATK_ATTRIBUTE_RIGHT_MARGIN "right_margin"
70 * ATK_ATTRIBUTE_INDENT:
72 * An #AtkAttribute name/value pair. The number of pixels that the text is indented
74 #define ATK_ATTRIBUTE_INDENT "indent"
77 * ATK_ATTRIBUTE_INVISIBLE:
79 * An #AtkAttribute name/value pair.
80 * Either "true" or "false" indicating whether text is visible or not
82 #define ATK_ATTRIBUTE_INVISIBLE "invisible"
85 * ATK_ATTRIBUTE_EDITABLE:
87 * An #AtkAttribute name/value pair.
88 * Either "true" or "false" indicating whether text is editable or not
90 #define ATK_ATTRIBUTE_EDITABLE "editable"
93 * ATK_ATTRIBUTE_PIXELS_ABOVE_LINES:
95 * An #AtkAttribute name/value pair.
96 * Pixels of blank space to leave above each newline-terminated line.
98 #define ATK_ATTRIBUTE_PIXELS_ABOVE_LINES "pixels_above_lines"
101 * ATK_ATTRIBUTE_PIXELS_BELOW_LINES:
103 * An #AtkAttribute name/value pair.
104 * Pixels of blank space to leave below each newline-terminated line.
106 #define ATK_ATTRIBUTE_PIXELS_BELOW_LINES "pixels_below_lines"
109 * ATK_ATTRIBUTE_PIXELS_INSIDE_WRAP:
111 * An #AtkAttribute name/value pair.
112 * Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
114 #define ATK_ATTRIBUTE_PIXELS_INSIDE_WRAP "pixels_inside_wrap"
117 * ATK_ATTRIBUTE_BG_FULL_HEIGHT:
119 * An #AtkAttribute name/value pair.
120 * "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.
122 #define ATK_ATTRIBUTE_BG_FULL_HEIGHT "bg_full_height"
125 * ATK_ATTRIBUTE_RISE:
127 * An #AtkAttribute name/value pair.
128 * Number of pixels that the characters are risen above the baseline
129 * The value is a string representation of an integer
131 #define ATK_ATTRIBUTE_RISE "rise"
134 * ATK_ATTRIBUTE_UNDERLINE:
136 * An #AtkAttribute name/value pair.
137 * "true" or "false" whether the text is underlined
139 #define ATK_ATTRIBUTE_UNDERLINE "underline"
142 * ATK_ATTRIBUTE_STRIKETHROUGH:
144 * An #AtkAttribute name/value pair.
145 * "true" or "false" whether the text is strikethrough
147 #define ATK_ATTRIBUTE_STRIKETHROUGH "strikethrough"
150 * ATK_ATTRIBUTE_SIZE:
152 * An #AtkAttribute name/value pair.
153 * The size of the characters.
154 * The value is a string representation of an integer
156 #define ATK_ATTRIBUTE_SIZE "size"
159 * ATK_ATTRIBUTE_SCALE:
161 * An #AtkAttribute name/value pair.
162 * The scale of the characters. The value is a string representation of a double
164 #define ATK_ATTRIBUTE_SCALE "scale"
167 * ATK_ATTRIBUTE_WEIGHT:
169 * An #AtkAttribute name/value pair.
170 * The weight of the characters. The value is a string representation of an integer
172 #define ATK_ATTRIBUTE_WEIGHT "weight"
175 * ATK_ATTRIBUTE_LANGUAGE:
177 * An #AtkAttribute name/value pair.
180 #define ATK_ATTRIBUTE_LANGUAGE "language"
183 * ATK_ATTRIBUTE_FAMILY_NAME:
185 * An #AtkAttribute name/value pair.
186 * The font family name
188 #define ATK_ATTRIBUTE_FAMILY_NAME "family_name"
191 * ATK_ATTRIBUTE_BG_COLOR:
193 * An #AtkAttribute name/value pair.
194 * The background color. The value is an RGB value of the format "%u,%u,%u"
196 #define ATK_ATTRIBUTE_BG_COLOR "bg_color"
199 * ATK_ATTRIBUTE_FG_COLOR:
201 * An #AtkAttribute name/value pair.
202 * The foreground color. The value is an RGB value of the format "%u,%u,%u"
204 #define ATK_ATTRIBUTE_FG_COLOR "fg_color"
207 * ATK_ATTRIBUTE_BG_STIPPLE:
209 * An #AtkAttribute name/value pair.
210 * "true" if a #GdkBitmap is set for stippling the background color.
212 #define ATK_ATTRIBUTE_BG_STIPPLE "bg_stipple"
215 * ATK_ATTRIBUTE_FG_STIPPLE:
217 * An #AtkAttribute name/value pair.
218 * "true" if a #GdkBitmap is set for stippling the foreground color.
220 #define ATK_ATTRIBUTE_FG_STIPPLE "fg_stipple"
223 * ATK_ATTRIBUTE_WRAP_MODE:
225 * An #AtkAttribute name/value pair.
226 * The wrap mode of the text, if any. Values are "none", "char" or "word"
228 #define ATK_ATTRIBUTE_WRAP_MODE "wrap_mode"
231 * ATK_ATTRIBUTE_DIRECTION:
233 * An #AtkAttribute name/value pair.
234 * The direction of the text, if set. Values are "none", "ltr" or "rtl"
236 #define ATK_ATTRIBUTE_DIRECTION "direction"
239 * ATK_ATTRIBUTE_JUSTIFICATION:
241 * An #AtkAttribute name/value pair.
242 * The justification of the text, if set. Values are "left", "right", "center" or "fill"
244 #define ATK_ATTRIBUTE_JUSTIFICATION "justification"
247 * ATK_ATTRIBUTE_STRETCH:
249 * An #AtkAttribute name/value pair.
250 * The stretch of the text, if set. Values are "ultra_condensed", "extra_condensed",
251 * or "ultra_expanded"
253 #define ATK_ATTRIBUTE_STRETCH "stretch"
256 * ATK_ATTRIBUTE_VARIANT:
258 * An #AtkAttribute name/value pair.
259 * The capitalization variant of the text, if set. Values are "normal" or "small_caps"
261 #define ATK_ATTRIBUTE_VARIANT "variant"
264 * ATK_ATTRIBUTE_STYLE:
266 * An #AtkAttribute name/value pair.
267 * The slant style of the text, if set. Values are "normal", "oblique" or "italic"
269 #define ATK_ATTRIBUTE_STYLE "slant_style"
271 #define ATK_TYPE_TEXT (atk_text_get_type ())
272 #define ATK_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT)
273 #define ATK_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText)
274 #define ATK_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface))
276 #ifndef _TYPEDEF_ATK_TEXT_
277 #define _TYPEDEF_ATK_TEXT_
278 typedef struct _AtkText AtkText;
280 typedef struct _AtkTextIface AtkTextIface;
284 *@ATK_TEXT_BOUNDARY_CHAR:
285 *@ATK_TEXT_BOUNDARY_WORD_START:
286 *@ATK_TEXT_BOUNDARY_WORD_END:
287 *@ATK_TEXT_BOUNDARY_SENTENCE_START:
288 *@ATK_TEXT_BOUNDARY_SENTENCE_END:
289 *@ATK_TEXT_BOUNDARY_LINE_START:
290 *@ATK_TEXT_BOUNDARY_LINE_END:
292 *Text boundary types used for specifying boundaries for regions of text
295 ATK_TEXT_BOUNDARY_CHAR,
296 ATK_TEXT_BOUNDARY_WORD_START,
297 ATK_TEXT_BOUNDARY_WORD_END,
298 ATK_TEXT_BOUNDARY_SENTENCE_START,
299 ATK_TEXT_BOUNDARY_SENTENCE_END,
300 ATK_TEXT_BOUNDARY_LINE_START,
301 ATK_TEXT_BOUNDARY_LINE_END
306 GTypeInterface parent;
308 gchar* (* get_text) (AtkText *text,
311 gchar* (* get_text_after_offset) (AtkText *text,
313 AtkTextBoundary boundary_type,
316 gchar* (* get_text_at_offset) (AtkText *text,
318 AtkTextBoundary boundary_type,
321 gunichar (* get_character_at_offset) (AtkText *text,
323 gchar* (* get_text_before_offset) (AtkText *text,
325 AtkTextBoundary boundary_type,
328 gint (* get_caret_offset) (AtkText *text);
329 AtkAttributeSet* (* get_run_attributes) (AtkText *text,
333 AtkAttributeSet* (* get_default_attributes) (AtkText *text);
334 void (* get_character_extents) (AtkText *text,
340 AtkCoordType coords);
341 gint (* get_character_count) (AtkText *text);
342 gint (* get_offset_at_point) (AtkText *text,
345 AtkCoordType coords);
346 gint (* get_n_selections) (AtkText *text);
347 gchar* (* get_selection) (AtkText *text,
351 gboolean (* add_selection) (AtkText *text,
354 gboolean (* remove_selection) (AtkText *text,
356 gboolean (* set_selection) (AtkText *text,
360 gboolean (* set_caret_offset) (AtkText *text,
366 void (* text_changed) (AtkText *text);
367 void (* caret_changed) (AtkText *text,
371 GType atk_text_get_type (void);
375 * Additional AtkObject properties used by AtkText:
376 * "accessible_text" (accessible text has changed)
377 * "accessible_caret" (accessible text cursor position changed:
378 * editable text only)
381 gchar* atk_text_get_text (AtkText *text,
384 gunichar atk_text_get_character_at_offset (AtkText *text,
386 gchar* atk_text_get_text_after_offset (AtkText *text,
388 AtkTextBoundary boundary_type,
391 gchar* atk_text_get_text_at_offset (AtkText *text,
393 AtkTextBoundary boundary_type,
396 gchar* atk_text_get_text_before_offset (AtkText *text,
398 AtkTextBoundary boundary_type,
401 gint atk_text_get_caret_offset (AtkText *text);
402 void atk_text_get_character_extents (AtkText *text,
408 AtkCoordType coords);
409 AtkAttributeSet* atk_text_get_run_attributes (AtkText *text,
413 AtkAttributeSet* atk_text_get_default_attributes (AtkText *text);
414 gint atk_text_get_character_count (AtkText *text);
415 gint atk_text_get_offset_at_point (AtkText *text,
418 AtkCoordType coords);
419 gint atk_text_get_n_selections (AtkText *text);
420 gchar* atk_text_get_selection (AtkText *text,
424 gboolean atk_text_add_selection (AtkText *text,
427 gboolean atk_text_remove_selection (AtkText *text,
429 gboolean atk_text_set_selection (AtkText *text,
433 gboolean atk_text_set_caret_offset (AtkText *text,
435 void atk_attribute_set_free (AtkAttributeSet *attrib_set);
439 #endif /* __cplusplus */
442 #endif /* __ATK_TEXT_H__ */