role: new role ATK_ROLE_TITLE_BAR
[platform/upstream/atk.git] / atk / atktext.h
index 31b15cd..dd73200 100755 (executable)
@@ -17,6 +17,9 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined (__ATK_H_INSIDE__) && !defined (ATK_COMPILATION)
+#error "Only <atk/atk.h> can be included directly."
+#endif
 
 #ifndef __ATK_TEXT_H__
 #define __ATK_TEXT_H__
 #include <atk/atkobject.h>
 #include <atk/atkutil.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
 /**
- *AtkTextAttribute
+ *AtkTextAttribute:
  *@ATK_TEXT_ATTR_INVALID: Invalid attribute
  *@ATK_TEXT_ATTR_LEFT_MARGIN: The pixel width of the left margin
  *@ATK_TEXT_ATTR_RIGHT_MARGIN: The pixel width of the right margin
@@ -42,7 +43,7 @@ extern "C" {
  *@ATK_TEXT_ATTR_PIXELS_INSIDE_WRAP: Pixels of blank space to leave between wrapped lines inside the same newline-terminated line (paragraph).
  *@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.
  *@ATK_TEXT_ATTR_RISE: Number of pixels that the characters are risen above the baseline
- *@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double" or "low"
+ *@ATK_TEXT_ATTR_UNDERLINE: "none", "single", "double", "low", or "error"
  *@ATK_TEXT_ATTR_STRIKETHROUGH: "true" or "false" whether the text is strikethrough 
  *@ATK_TEXT_ATTR_SIZE: The size of the characters. 
  *@ATK_TEXT_ATTR_SCALE: The scale of the characters. The value is a string representation of a double 
@@ -53,7 +54,7 @@ extern "C" {
  *@ATK_TEXT_ATTR_FG_COLOR:The foreground color. The value is an RGB value of the format "%u,%u,%u"
  *@ATK_TEXT_ATTR_BG_STIPPLE: "true" if a #GdkBitmap is set for stippling the background color.
  *@ATK_TEXT_ATTR_FG_STIPPLE: "true" if a #GdkBitmap is set for stippling the foreground color.
- *@ATK_TEXT_ATTR_WRAP_MODE: The wrap mode of the text, if any. Values are "none", "char" or "word" 
+ *@ATK_TEXT_ATTR_WRAP_MODE: The wrap mode of the text, if any. Values are "none", "char", "word", or "word_char".
  *@ATK_TEXT_ATTR_DIRECTION: The direction of the text, if set. Values are "none", "ltr" or "rtl" 
  *@ATK_TEXT_ATTR_JUSTIFICATION: The justification of the text, if set. Values are "left", "right", "center" or "fill" 
  *@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"
@@ -110,17 +111,27 @@ typedef struct _AtkText AtkText;
 #endif
 typedef struct _AtkTextIface AtkTextIface;
 
+
 /**
  *AtkTextBoundary:
- *@ATK_TEXT_BOUNDARY_CHAR:
- *@ATK_TEXT_BOUNDARY_WORD_START:
- *@ATK_TEXT_BOUNDARY_WORD_END:
- *@ATK_TEXT_BOUNDARY_SENTENCE_START:
- *@ATK_TEXT_BOUNDARY_SENTENCE_END:
- *@ATK_TEXT_BOUNDARY_LINE_START:
- *@ATK_TEXT_BOUNDARY_LINE_END:
+ *@ATK_TEXT_BOUNDARY_CHAR: Boundary is the boundary between characters
+ * (including non-printing characters)
+ *@ATK_TEXT_BOUNDARY_WORD_START: Boundary is the start (i.e. first character) of a word.
+ *@ATK_TEXT_BOUNDARY_WORD_END: Boundary is the end (i.e. last
+ * character) of a word.
+ *@ATK_TEXT_BOUNDARY_SENTENCE_START: Boundary is the first character in a sentence.
+ *@ATK_TEXT_BOUNDARY_SENTENCE_END: Boundary is the last (terminal)
+ * character in a sentence; in languages which use "sentence stop"
+ * punctuation such as English, the boundary is thus the '.', '?', or
+ * similar terminal punctuation character.
+ *@ATK_TEXT_BOUNDARY_LINE_START: Boundary is the initial character of the content or a
+ * character immediately following a newline, linefeed, or return character.
+ *@ATK_TEXT_BOUNDARY_LINE_END: Boundary is the linefeed, or return
+ * character.
  *
- *Text boundary types used for specifying boundaries for regions of text
+ * Text boundary types used for specifying boundaries for regions of text.
+ * This enumerationis deprecated since 2.9.4 and should not be used. Use
+ * AtkTextGranularity with #atk_text_get_string_at_offset instead.
  **/
 typedef enum {
   ATK_TEXT_BOUNDARY_CHAR,
@@ -133,6 +144,34 @@ typedef enum {
 } AtkTextBoundary;
 
 /**
+ *AtkTextGranularity:
+ *@ATK_TEXT_GRANULARITY_CHAR: Granularity is defined by the boundaries between characters
+ * (including non-printing characters)
+ *@ATK_TEXT_GRANULARITY_WORD: Granularity is defined by the boundaries of a word,
+ * starting at the beginning of the current word and finishing at the beginning of
+ * the following one, if present.
+ *@ATK_TEXT_GRANULARITY_SENTENCE: Granularity is defined by the boundaries of a sentence,
+ * starting at the beginning of the current sentence and finishing at the beginning of
+ * the following one, if present.
+ *@ATK_TEXT_GRANULARITY_LINE: Granularity is defined by the boundaries of a line,
+ * starting at the beginning of the current line and finishing at the beginning of
+ * the following one, if present.
+ *@ATK_TEXT_GRANULARITY_PARAGRAPH: Granularity is defined by the boundaries of a paragraph,
+ * starting at the beginning of the current paragraph and finishing at the beginning of
+ * the following one, if present.
+ *
+ * Text granularity types used for specifying the granularity of the region of
+ * text we are interested in.
+ **/
+typedef enum {
+  ATK_TEXT_GRANULARITY_CHAR,
+  ATK_TEXT_GRANULARITY_WORD,
+  ATK_TEXT_GRANULARITY_SENTENCE,
+  ATK_TEXT_GRANULARITY_LINE,
+  ATK_TEXT_GRANULARITY_PARAGRAPH
+} AtkTextGranularity;
+
+/**
  * AtkTextRectangle:
  * @x: The horizontal coordinate of a rectangle
  * @y: The vertical coordinate of a rectangle
@@ -169,8 +208,10 @@ struct _AtkTextRange {
   gchar* content;
 };
 
+GType atk_text_range_get_type (void);
+
 /**
- *AtkTextClipType
+ *AtkTextClipType:
  *@ATK_TEXT_CLIP_NONE: No clipping to be done
  *@ATK_TEXT_CLIP_MIN: Text clipped by min coordinate is omitted
  *@ATK_TEXT_CLIP_MAX: Text clipped by max coordinate is omitted
@@ -185,6 +226,22 @@ typedef enum {
     ATK_TEXT_CLIP_BOTH
 } AtkTextClipType;
 
+/**
+ * AtkTextIface:
+ * @get_text_after_offset: Gets specified text. This virtual function
+ *   is deprecated and it should not be overridden.
+ * @get_text_at_offset: Gets specified text. This virtual function
+ *   is deprecated and it should not be overridden.
+ * @get_text_before_offset: Gets specified text. This virtual function
+ *   is deprecated and it should not be overridden.
+ * @get_string_at_offset: Gets a portion of the text exposed through
+ *   an AtkText according to a given offset and a specific
+ *   granularity, along with the start and end offsets defining the
+ *   boundaries of such a portion of text.
+ * @text_changed: the signal handler which is executed when there is a
+ *   text change. This virtual function is deprecated sice 2.9.4 and
+ *   it should not be overriden.
+ */
 struct _AtkTextIface
 {
   GTypeInterface parent;
@@ -268,9 +325,12 @@ struct _AtkTextIface
                                                    AtkCoordType     coord_type,
                                                    AtkTextClipType  x_clip_type,
                                                    AtkTextClipType  y_clip_type);
 
-  AtkFunction    pad4;
+  gchar*         (* get_string_at_offset)         (AtkText            *text,
+                                                   gint               offset,
+                                                   AtkTextGranularity granularity,
+                                                   gint               *start_offset,
+                                                   gint               *end_offset);
 };
 
 GType            atk_text_get_type (void);
@@ -288,21 +348,29 @@ gchar*        atk_text_get_text                           (AtkText          *tex
                                                            gint             end_offset);
 gunichar      atk_text_get_character_at_offset            (AtkText          *text,
                                                            gint             offset);
+G_DEPRECATED_FOR(atk_text_get_string_at_offset)
 gchar*        atk_text_get_text_after_offset              (AtkText          *text,
                                                            gint             offset,
                                                            AtkTextBoundary  boundary_type,
                                                           gint             *start_offset,
                                                           gint             *end_offset);
+G_DEPRECATED_FOR(atk_text_get_string_at_offset)
 gchar*        atk_text_get_text_at_offset                 (AtkText          *text,
                                                            gint             offset,
                                                            AtkTextBoundary  boundary_type,
                                                           gint             *start_offset,
                                                           gint             *end_offset);
+G_DEPRECATED_FOR(atk_text_get_string_at_offset)
 gchar*        atk_text_get_text_before_offset             (AtkText          *text,
                                                            gint             offset,
                                                            AtkTextBoundary  boundary_type,
                                                           gint             *start_offset,
                                                           gint             *end_offset);
+gchar*        atk_text_get_string_at_offset               (AtkText            *text,
+                                                           gint               offset,
+                                                           AtkTextGranularity granularity,
+                                                           gint               *start_offset,
+                                                           gint               *end_offset);
 gint          atk_text_get_caret_offset                   (AtkText          *text);
 void          atk_text_get_character_extents              (AtkText          *text,
                                                            gint             offset,
@@ -350,14 +418,11 @@ AtkTextRange**  atk_text_get_bounded_ranges               (AtkText          *tex
                                                            AtkTextClipType  y_clip_type);
 void          atk_text_free_ranges                        (AtkTextRange     **ranges);
 void         atk_attribute_set_free                      (AtkAttributeSet  *attrib_set);
-G_CONST_RETURN gchar*  atk_text_attribute_get_name        (AtkTextAttribute attr);
+const gchar*  atk_text_attribute_get_name                 (AtkTextAttribute attr);
 AtkTextAttribute       atk_text_attribute_for_name        (const gchar      *name);
-G_CONST_RETURN gchar*  atk_text_attribute_get_value       (AtkTextAttribute attr,
+const gchar*  atk_text_attribute_get_value                (AtkTextAttribute attr,
                                                            gint             index_);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
 
 #endif /* __ATK_TEXT_H__ */