GtkTextMark *tagStart, *tagEnd;
GtkTextIter start, end;
tagStart = gtk_text_buffer_create_mark (buffer,"tagStart", iter, 1);
gtk_text_buffer_insert (buffer, iter, txt, -1);
tagEnd = gtk_text_buffer_get_insert(buffer);
applyTags (buffer, tag, tagStart, tagEnd);
Where:
void applyTags (GtkTextBuffer *buffer, gchar *tag, GtkTextMark *tagStart, GtkTextMark *tagEnd) {
GtkTextIter start, end;
gtk_text_buffer_get_iter_at_mark(buffer,&start,tagStart);
gtk_text_buffer_get_iter_at_mark(buffer,&end,tagEnd);
gtk_text_buffer_apply_tag_by_name (buffer,tag, &start,&end);
}
At the moment single tags are fine, ie bold but it might be necessary to nest tags, ie bold-underline. The next question is, should I pass a string of tag names, or a linked-list? I'll think about this one tomorrow!
No comments:
Post a Comment