michael@0: /* ATK - The Accessibility Toolkit for GTK+ michael@0: * Copyright 2001 Sun Microsystems Inc. michael@0: * michael@0: * This library is free software; you can redistribute it and/or michael@0: * modify it under the terms of the GNU Library General Public michael@0: * License as published by the Free Software Foundation; either michael@0: * version 2 of the License, or (at your option) any later version. michael@0: * michael@0: * This library is distributed in the hope that it will be useful, michael@0: * but WITHOUT ANY WARRANTY; without even the implied warranty of michael@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU michael@0: * Library General Public License for more details. michael@0: * michael@0: * You should have received a copy of the GNU Library General Public michael@0: * License along with this library; if not, write to the michael@0: * Free Software Foundation, Inc., 59 Temple Place - Suite 330, michael@0: * Boston, MA 02111-1307, USA. michael@0: */ michael@0: michael@0: michael@0: #ifndef __ATK_TEXT_H__ michael@0: #define __ATK_TEXT_H__ michael@0: michael@0: #include michael@0: #include michael@0: #include michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif /* __cplusplus */ michael@0: michael@0: /** michael@0: *AtkTextAttribute michael@0: *@ATK_TEXT_ATTR_INVALID: Invalid attribute michael@0: *@ATK_TEXT_ATTR_LEFT_MARGIN: The pixel width of the left margin michael@0: *@ATK_TEXT_ATTR_RIGHT_MARGIN: The pixel width of the right margin michael@0: *@ATK_TEXT_ATTR_INDENT: The number of pixels that the text is indented michael@0: *@ATK_TEXT_ATTR_INVISIBLE: Either "true" or "false" indicating whether text is visible or not michael@0: *@ATK_TEXT_ATTR_EDITABLE: Either "true" or "false" indicating whether text is editable or not michael@0: *@ATK_TEXT_ATTR_PIXELS_ABOVE_LINES: Pixels of blank space to leave above each newline-terminated line. michael@0: *@ATK_TEXT_ATTR_PIXELS_BELOW_LINES: Pixels of blank space to leave below each newline-terminated line. michael@0: *@ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP: Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph). michael@0: *@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. michael@0: *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline michael@0: *@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double" or "low" michael@0: *@ATK_TEXT_ATTR_STRIKETHROUGH: "true" or "false" whether the text is strikethrough michael@0: *@ATK_TEXT_ATTR_SIZE: The size of the characters. michael@0: *@ATK_TEXT_ATTR_SCALE: The scale of the characters. The value is a string representation of a double michael@0: *@ATK_TEXT_ATTR_WEIGHT: The weight of the characters. michael@0: *@ATK_TEXT_ATTR_LANGUAGE: The language used michael@0: *@ATK_TEXT_ATTR_FAMILY_NAME: The font family name michael@0: *@ATK_TEXT_ATTR_BG_COLOR: The background color. The value is an RGB value of the format "%u,%u,%u" michael@0: *@ATK_TEXT_ATTR_FG_COLOR:The foreground color. The value is an RGB value of the format "%u,%u,%u" michael@0: *@ATK_TEXT_ATTR_BG_STIPPLE: "true" if a #GdkBitmap is set for stippling the background color. michael@0: *@ATK_TEXT_ATTR_FG_STIPPLE: "true" if a #GdkBitmap is set for stippling the foreground color. michael@0: *@ATK_TEXT_ATTR_WRAP_MODE: The wrap mode of the text, if any. Values are "none", "char" or "word" michael@0: *@ATK_TEXT_ATTR_DIRECTION: The direction of the text, if set. Values are "none", "ltr" or "rtl" michael@0: *@ATK_TEXT_ATTR_JUSTIFICATION: The justification of the text, if set. Values are "left", "right", "center" or "fill" michael@0: *@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" michael@0: *@ATK_TEXT_ATTR_VARIANT: The capitalization variant of the text, if set. Values are "normal" or "small_caps" michael@0: *@ATK_TEXT_ATTR_STYLE: The slant style of the text, if set. Values are "normal", "oblique" or "italic" michael@0: *@ATK_TEXT_ATTR_LAST_DEFINED: not a valid text attribute, used for finding end of enumeration michael@0: * michael@0: * Describes the text attributes supported michael@0: **/ michael@0: typedef enum michael@0: { michael@0: ATK_TEXT_ATTR_INVALID = 0, michael@0: ATK_TEXT_ATTR_LEFT_MARGIN, michael@0: ATK_TEXT_ATTR_RIGHT_MARGIN, michael@0: ATK_TEXT_ATTR_INDENT, michael@0: ATK_TEXT_ATTR_INVISIBLE, michael@0: ATK_TEXT_ATTR_EDITABLE, michael@0: ATK_TEXT_ATTR_PIXELS_ABOVE_LINES, michael@0: ATK_TEXT_ATTR_PIXELS_BELOW_LINES, michael@0: ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP, michael@0: ATK_TEXT_ATTR_BG_FULL_HEIGHT, michael@0: ATK_TEXT_ATTR_RISE, michael@0: ATK_TEXT_ATTR_UNDERLINE, michael@0: ATK_TEXT_ATTR_STRIKETHROUGH, michael@0: ATK_TEXT_ATTR_SIZE, michael@0: ATK_TEXT_ATTR_SCALE, michael@0: ATK_TEXT_ATTR_WEIGHT, michael@0: ATK_TEXT_ATTR_LANGUAGE, michael@0: ATK_TEXT_ATTR_FAMILY_NAME, michael@0: ATK_TEXT_ATTR_BG_COLOR, michael@0: ATK_TEXT_ATTR_FG_COLOR, michael@0: ATK_TEXT_ATTR_BG_STIPPLE, michael@0: ATK_TEXT_ATTR_FG_STIPPLE, michael@0: ATK_TEXT_ATTR_WRAP_MODE, michael@0: ATK_TEXT_ATTR_DIRECTION, michael@0: ATK_TEXT_ATTR_JUSTIFICATION, michael@0: ATK_TEXT_ATTR_STRETCH, michael@0: ATK_TEXT_ATTR_VARIANT, michael@0: ATK_TEXT_ATTR_STYLE, michael@0: ATK_TEXT_ATTR_LAST_DEFINED michael@0: } AtkTextAttribute; michael@0: michael@0: AtkTextAttribute atk_text_attribute_register (const gchar *name); michael@0: michael@0: michael@0: #define ATK_TYPE_TEXT (atk_text_get_type ()) michael@0: #define ATK_IS_TEXT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_TEXT) michael@0: #define ATK_TEXT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_TEXT, AtkText) michael@0: #define ATK_TEXT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_TEXT, AtkTextIface)) michael@0: michael@0: #ifndef _TYPEDEF_ATK_TEXT_ michael@0: #define _TYPEDEF_ATK_TEXT_ michael@0: typedef struct _AtkText AtkText; michael@0: #endif michael@0: typedef struct _AtkTextIface AtkTextIface; michael@0: michael@0: /** michael@0: *AtkTextBoundary: michael@0: *@ATK_TEXT_BOUNDARY_CHAR: Boundary is the boundary between characters michael@0: * (including non-printing characters) michael@0: *@ATK_TEXT_BOUNDARY_WORD_START: Boundary is the start (i.e. first character) of a word. michael@0: *@ATK_TEXT_BOUNDARY_WORD_END: Boundary is the end (i.e. last character) of a word. michael@0: *@ATK_TEXT_BOUNDARY_SENTENCE_START: Boundary is the first character in a sentence. michael@0: *@ATK_TEXT_BOUNDARY_SENTENCE_END: Boundary is the last (terminal) character in a sentence; michael@0: * in languages which use "sentence stop" punctuation such as English, the boundary is thus the michael@0: * '.', '?', or similar terminal punctuation character. michael@0: *@ATK_TEXT_BOUNDARY_LINE_START: Boundary is the initial character of the content or a michael@0: * character immediately following a newline, linefeed, or return character. michael@0: *@ATK_TEXT_BOUNDARY_LINE_END: Boundary is the linefeed, or return character. michael@0: * michael@0: *Text boundary types used for specifying boundaries for regions of text michael@0: **/ michael@0: typedef enum { michael@0: ATK_TEXT_BOUNDARY_CHAR, michael@0: ATK_TEXT_BOUNDARY_WORD_START, michael@0: ATK_TEXT_BOUNDARY_WORD_END, michael@0: ATK_TEXT_BOUNDARY_SENTENCE_START, michael@0: ATK_TEXT_BOUNDARY_SENTENCE_END, michael@0: ATK_TEXT_BOUNDARY_LINE_START, michael@0: ATK_TEXT_BOUNDARY_LINE_END michael@0: } AtkTextBoundary; michael@0: michael@0: /** michael@0: * AtkTextRectangle: michael@0: * @x: The horizontal coordinate of a rectangle michael@0: * @y: The vertical coordinate of a rectangle michael@0: * @width: The width of a rectangle michael@0: * @height: The height of a rectangle michael@0: * michael@0: * A structure used to store a rectangle used by AtkText. michael@0: **/ michael@0: michael@0: typedef struct _AtkTextRectangle AtkTextRectangle; michael@0: michael@0: struct _AtkTextRectangle { michael@0: gint x; michael@0: gint y; michael@0: gint width; michael@0: gint height; michael@0: }; michael@0: michael@0: /** michael@0: * AtkTextRange: michael@0: * @bounds: A rectangle giving the bounds of the text range michael@0: * @start_offset: The start offset of a AtkTextRange michael@0: * @end_offset: The end offset of a AtkTextRange michael@0: * @content: The text in the text range michael@0: * michael@0: * A structure used to describe a text range. michael@0: **/ michael@0: typedef struct _AtkTextRange AtkTextRange; michael@0: michael@0: struct _AtkTextRange { michael@0: AtkTextRectangle bounds; michael@0: gint start_offset; michael@0: gint end_offset; michael@0: gchar* content; michael@0: }; michael@0: michael@0: /** michael@0: *AtkTextClipType michael@0: *@ATK_TEXT_CLIP_NONE: No clipping to be done michael@0: *@ATK_TEXT_CLIP_MIN: Text clipped by min coordinate is omitted michael@0: *@ATK_TEXT_CLIP_MAX: Text clipped by max coordinate is omitted michael@0: *@ATK_TEXT_CLIP_BOTH: Only text fully within mix/max bound is retained michael@0: * michael@0: *Describes the type of clipping required. michael@0: **/ michael@0: typedef enum { michael@0: ATK_TEXT_CLIP_NONE, michael@0: ATK_TEXT_CLIP_MIN, michael@0: ATK_TEXT_CLIP_MAX, michael@0: ATK_TEXT_CLIP_BOTH michael@0: } AtkTextClipType; michael@0: michael@0: struct _AtkTextIface michael@0: { michael@0: GTypeInterface parent; michael@0: michael@0: gchar* (* get_text) (AtkText *text, michael@0: gint start_offset, michael@0: gint end_offset); michael@0: gchar* (* get_text_after_offset) (AtkText *text, michael@0: gint offset, michael@0: AtkTextBoundary boundary_type, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gchar* (* get_text_at_offset) (AtkText *text, michael@0: gint offset, michael@0: AtkTextBoundary boundary_type, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gunichar (* get_character_at_offset) (AtkText *text, michael@0: gint offset); michael@0: gchar* (* get_text_before_offset) (AtkText *text, michael@0: gint offset, michael@0: AtkTextBoundary boundary_type, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gint (* get_caret_offset) (AtkText *text); michael@0: AtkAttributeSet* (* get_run_attributes) (AtkText *text, michael@0: gint offset, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: AtkAttributeSet* (* get_default_attributes) (AtkText *text); michael@0: void (* get_character_extents) (AtkText *text, michael@0: gint offset, michael@0: gint *x, michael@0: gint *y, michael@0: gint *width, michael@0: gint *height, michael@0: AtkCoordType coords); michael@0: gint (* get_character_count) (AtkText *text); michael@0: gint (* get_offset_at_point) (AtkText *text, michael@0: gint x, michael@0: gint y, michael@0: AtkCoordType coords); michael@0: gint (* get_n_selections) (AtkText *text); michael@0: gchar* (* get_selection) (AtkText *text, michael@0: gint selection_num, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gboolean (* add_selection) (AtkText *text, michael@0: gint start_offset, michael@0: gint end_offset); michael@0: gboolean (* remove_selection) (AtkText *text, michael@0: gint selection_num); michael@0: gboolean (* set_selection) (AtkText *text, michael@0: gint selection_num, michael@0: gint start_offset, michael@0: gint end_offset); michael@0: gboolean (* set_caret_offset) (AtkText *text, michael@0: gint offset); michael@0: michael@0: /* michael@0: * signal handlers michael@0: */ michael@0: void (* text_changed) (AtkText *text, michael@0: gint position, michael@0: gint length); michael@0: void (* text_caret_moved) (AtkText *text, michael@0: gint location); michael@0: void (* text_selection_changed) (AtkText *text); michael@0: michael@0: void (* text_attributes_changed) (AtkText *text); michael@0: michael@0: michael@0: void (* get_range_extents) (AtkText *text, michael@0: gint start_offset, michael@0: gint end_offset, michael@0: AtkCoordType coord_type, michael@0: AtkTextRectangle *rect); michael@0: michael@0: AtkTextRange** (* get_bounded_ranges) (AtkText *text, michael@0: AtkTextRectangle *rect, michael@0: AtkCoordType coord_type, michael@0: AtkTextClipType x_clip_type, michael@0: AtkTextClipType y_clip_type); michael@0: michael@0: michael@0: AtkFunction pad4; michael@0: }; michael@0: michael@0: GType atk_text_get_type (void); michael@0: michael@0: michael@0: /* michael@0: * Additional AtkObject properties used by AtkText: michael@0: * "accessible_text" (accessible text has changed) michael@0: * "accessible_caret" (accessible text cursor position changed: michael@0: * editable text only) michael@0: */ michael@0: michael@0: gchar* atk_text_get_text (AtkText *text, michael@0: gint start_offset, michael@0: gint end_offset); michael@0: gunichar atk_text_get_character_at_offset (AtkText *text, michael@0: gint offset); michael@0: gchar* atk_text_get_text_after_offset (AtkText *text, michael@0: gint offset, michael@0: AtkTextBoundary boundary_type, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gchar* atk_text_get_text_at_offset (AtkText *text, michael@0: gint offset, michael@0: AtkTextBoundary boundary_type, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gchar* atk_text_get_text_before_offset (AtkText *text, michael@0: gint offset, michael@0: AtkTextBoundary boundary_type, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gint atk_text_get_caret_offset (AtkText *text); michael@0: void atk_text_get_character_extents (AtkText *text, michael@0: gint offset, michael@0: gint *x, michael@0: gint *y, michael@0: gint *width, michael@0: gint *height, michael@0: AtkCoordType coords); michael@0: AtkAttributeSet* atk_text_get_run_attributes (AtkText *text, michael@0: gint offset, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: AtkAttributeSet* atk_text_get_default_attributes (AtkText *text); michael@0: gint atk_text_get_character_count (AtkText *text); michael@0: gint atk_text_get_offset_at_point (AtkText *text, michael@0: gint x, michael@0: gint y, michael@0: AtkCoordType coords); michael@0: gint atk_text_get_n_selections (AtkText *text); michael@0: gchar* atk_text_get_selection (AtkText *text, michael@0: gint selection_num, michael@0: gint *start_offset, michael@0: gint *end_offset); michael@0: gboolean atk_text_add_selection (AtkText *text, michael@0: gint start_offset, michael@0: gint end_offset); michael@0: gboolean atk_text_remove_selection (AtkText *text, michael@0: gint selection_num); michael@0: gboolean atk_text_set_selection (AtkText *text, michael@0: gint selection_num, michael@0: gint start_offset, michael@0: gint end_offset); michael@0: gboolean atk_text_set_caret_offset (AtkText *text, michael@0: gint offset); michael@0: void atk_text_get_range_extents (AtkText *text, michael@0: michael@0: gint start_offset, michael@0: gint end_offset, michael@0: AtkCoordType coord_type, michael@0: AtkTextRectangle *rect); michael@0: AtkTextRange** atk_text_get_bounded_ranges (AtkText *text, michael@0: AtkTextRectangle *rect, michael@0: AtkCoordType coord_type, michael@0: AtkTextClipType x_clip_type, michael@0: AtkTextClipType y_clip_type); michael@0: void atk_text_free_ranges (AtkTextRange **ranges); michael@0: void atk_attribute_set_free (AtkAttributeSet *attrib_set); michael@0: G_CONST_RETURN gchar* atk_text_attribute_get_name (AtkTextAttribute attr); michael@0: AtkTextAttribute atk_text_attribute_for_name (const gchar *name); michael@0: G_CONST_RETURN gchar* atk_text_attribute_get_value (AtkTextAttribute attr, michael@0: gint index_); michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif /* __cplusplus */ michael@0: michael@0: michael@0: #endif /* __ATK_TEXT_H__ */