4 #include <gtk/gtkobject.h>
9 #endif /* __cplusplus */
11 typedef struct _GtkTextIter GtkTextIter;
12 typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
13 typedef struct _GtkTextTagTable GtkTextTagTable;
15 typedef struct _GtkTextAttributes GtkTextAttributes;
17 #define GTK_TYPE_TEXT_TAG (gtk_text_tag_get_type ())
18 #define GTK_TEXT_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_TEXT_TAG, GtkTextTag))
19 #define GTK_TEXT_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_TEXT_TAG, GtkTextTagClass))
20 #define GTK_IS_TEXT_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_TEXT_TAG))
21 #define GTK_IS_TEXT_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_TAG))
22 #define GTK_TEXT_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TEXT_TAG, GtkTextTagClass))
24 typedef struct _GtkTextTag GtkTextTag;
25 typedef struct _GtkTextTagClass GtkTextTagClass;
29 GObject parent_instance;
31 GtkTextTagTable *table;
33 char *name; /* Name of this tag. This field is actually
34 * a pointer to the key from the entry in
35 * tkxt->tagTable, so it needn't be freed
37 int priority; /* Priority of this tag within widget. 0
38 * means lowest priority. Exactly one tag
39 * has each integer value between 0 and
42 * Information for displaying text with this tag. The information
43 * belows acts as an override on information specified by lower-priority
44 * tags. If no value is specified, then the next-lower-priority tag
45 * on the text determins the value. The text widget itself provides
46 * defaults if no tag specifies an override.
49 GtkTextAttributes *values;
51 /* Flags for whether a given value is set; if a value is unset, then
52 * this tag does not affect it.
54 guint bg_color_set : 1;
55 guint bg_stipple_set : 1;
56 guint fg_color_set : 1;
59 guint variant_set : 1;
61 guint stretch_set : 1;
63 guint fg_stipple_set : 1;
64 guint justification_set : 1;
65 guint left_margin_set : 1;
68 guint strikethrough_set : 1;
69 guint right_margin_set : 1;
70 guint pixels_above_lines_set : 1;
71 guint pixels_below_lines_set : 1;
72 guint pixels_inside_wrap_set : 1;
74 guint underline_set : 1;
75 guint wrap_mode_set : 1;
76 guint bg_full_height_set : 1;
77 guint invisible_set : 1;
78 guint editable_set : 1;
79 guint language_set : 1;
85 struct _GtkTextTagClass
87 GObjectClass parent_class;
89 gboolean (* event) (GtkTextTag *tag,
90 GObject *event_object, /* widget, canvas item, whatever */
91 GdkEvent *event, /* the event itself */
92 const GtkTextIter *iter); /* location of event in buffer */
95 GType gtk_text_tag_get_type (void) G_GNUC_CONST;
96 GtkTextTag *gtk_text_tag_new (const gchar *name);
97 gint gtk_text_tag_get_priority (GtkTextTag *tag);
98 void gtk_text_tag_set_priority (GtkTextTag *tag,
100 gboolean gtk_text_tag_event (GtkTextTag *tag,
101 GObject *event_object,
103 const GtkTextIter *iter);
106 * Style object created by folding a set of tags together
109 typedef struct _GtkTextAppearance GtkTextAppearance;
111 struct _GtkTextAppearance
115 GdkBitmap *bg_stipple;
116 GdkBitmap *fg_stipple;
118 /* super/subscript rise, can be negative */
121 guint underline : 4; /* PangoUnderline */
122 guint strikethrough : 1;
124 /* Whether to use background-related values; this is irrelevant for
125 * the values struct when in a tag, but is used for the composite
126 * values struct; it's true if any of the tags being composited
127 * had background stuff set.
131 /* These are only used when we are actually laying out and rendering
132 * a paragraph; not when a GtkTextAppearance is part of a
135 guint inside_selection : 1;
139 struct _GtkTextAttributes
143 GtkTextAppearance appearance;
145 GtkJustification justification;
146 GtkTextDirection direction;
148 /* Individual chunks of this can be set/unset as a group */
149 PangoFontDescription font;
157 gint pixels_above_lines;
159 gint pixels_below_lines;
161 gint pixels_inside_wrap;
165 GtkWrapMode wrap_mode; /* How to handle wrap-around for this tag.
166 * Must be GTK_WRAPMODE_CHAR,
167 * GTK_WRAPMODE_NONE, GTK_WRAPMODE_WORD
175 /* Background is fit to full line height rather than
176 * baseline +/- ascent/descent (font height)
178 guint bg_full_height : 1;
180 /* can edit this text */
183 /* colors are allocated etc. */
192 GtkTextAttributes* gtk_text_attributes_new (void);
193 GtkTextAttributes* gtk_text_attributes_copy (GtkTextAttributes *src);
194 void gtk_text_attributes_copy_values (GtkTextAttributes *src,
195 GtkTextAttributes *dest);
196 void gtk_text_attributes_unref (GtkTextAttributes *values);
197 void gtk_text_attributes_ref (GtkTextAttributes *values);
202 #endif /* __cplusplus */