4 #include <gtk/gtkobject.h>
9 #endif /* __cplusplus */
11 typedef struct _GtkTextIter GtkTextIter;
12 typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
13 typedef struct _GtkTextTagTable GtkTextTagTable;
22 typedef struct _GtkTextAttributes GtkTextAttributes;
24 #define GTK_TYPE_TEXT_TAG (gtk_text_tag_get_type ())
25 #define GTK_TEXT_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_TAG, GtkTextTag))
26 #define GTK_TEXT_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_TAG, GtkTextTagClass))
27 #define GTK_IS_TEXT_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_TAG))
28 #define GTK_IS_TEXT_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_TAG))
29 #define GTK_TEXT_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_TAG, GtkTextTagClass))
31 typedef struct _GtkTextTag GtkTextTag;
32 typedef struct _GtkTextTagClass GtkTextTagClass;
36 GObject parent_instance;
38 GtkTextTagTable *table;
40 char *name; /* Name of this tag. This field is actually
41 * a pointer to the key from the entry in
42 * tkxt->tagTable, so it needn't be freed
44 int priority; /* Priority of this tag within widget. 0
45 * means lowest priority. Exactly one tag
46 * has each integer value between 0 and
49 * Information for displaying text with this tag. The information
50 * belows acts as an override on information specified by lower-priority
51 * tags. If no value is specified, then the next-lower-priority tag
52 * on the text determins the value. The text widget itself provides
53 * defaults if no tag specifies an override.
56 GtkTextAttributes *values;
58 /* Flags for whether a given value is set; if a value is unset, then
59 * this tag does not affect it.
61 guint bg_color_set : 1;
62 guint bg_stipple_set : 1;
63 guint fg_color_set : 1;
66 guint variant_set : 1;
68 guint stretch_set : 1;
70 guint fg_stipple_set : 1;
71 guint justify_set : 1;
72 guint left_margin_set : 1;
75 guint strikethrough_set : 1;
76 guint right_margin_set : 1;
77 guint pixels_above_lines_set : 1;
78 guint pixels_below_lines_set : 1;
79 guint pixels_inside_wrap_set : 1;
81 guint underline_set : 1;
82 guint wrap_mode_set : 1;
83 guint bg_full_height_set : 1;
84 guint invisible_set : 1;
85 guint editable_set : 1;
86 guint language_set : 1;
92 struct _GtkTextTagClass {
93 GObjectClass parent_class;
95 gint (* event) (GtkTextTag *tag,
96 GObject *event_object, /* widget, canvas item, whatever */
97 GdkEvent *event, /* the event itself */
98 const GtkTextIter *iter); /* location of event in buffer */
101 GType gtk_text_tag_get_type (void) G_GNUC_CONST;
102 GtkTextTag *gtk_text_tag_new (const gchar *name);
103 gint gtk_text_tag_get_priority (GtkTextTag *tag);
104 void gtk_text_tag_set_priority (GtkTextTag *tag,
106 gint gtk_text_tag_event (GtkTextTag *tag,
107 GObject *event_object,
109 const GtkTextIter *iter);
112 * Style object created by folding a set of tags together
115 typedef struct _GtkTextAppearance GtkTextAppearance;
117 struct _GtkTextAppearance
121 GdkBitmap *bg_stipple;
122 GdkBitmap *fg_stipple;
124 /* super/subscript rise, can be negative */
127 guint underline : 4; /* PangoUnderline */
128 guint strikethrough : 1;
130 /* Whether to use background-related values; this is irrelevant for
131 * the values struct when in a tag, but is used for the composite
132 * values struct; it's true if any of the tags being composited
133 * had background stuff set.
137 /* These are only used when we are actually laying out and rendering
138 * a paragraph; not when a GtkTextAppearance is part of a
141 guint inside_selection : 1;
145 struct _GtkTextAttributes
149 GtkTextAppearance appearance;
151 GtkJustification justify;
152 GtkTextDirection direction;
154 /* Individual chunks of this can be set/unset as a group */
155 PangoFontDescription font;
163 gint pixels_above_lines;
165 gint pixels_below_lines;
167 gint pixels_inside_wrap;
171 GtkWrapMode wrap_mode; /* How to handle wrap-around for this tag.
172 * Must be GTK_WRAPMODE_CHAR,
173 * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
181 /* Background is fit to full line height rather than
182 * baseline +/- ascent/descent (font height)
184 guint bg_full_height : 1;
186 /* can edit this text */
189 /* colors are allocated etc. */
198 GtkTextAttributes* gtk_text_attributes_new (void);
199 GtkTextAttributes* gtk_text_attributes_copy (GtkTextAttributes *src);
200 void gtk_text_attributes_copy_values (GtkTextAttributes *src,
201 GtkTextAttributes *dest);
202 void gtk_text_attributes_unref (GtkTextAttributes *values);
203 void gtk_text_attributes_ref (GtkTextAttributes *values);
208 #endif /* __cplusplus */