Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

366 lignes
18 KiB

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