Re: 4 TextBuffer questions




----- Original Message ----- From: "Benoît Touron" <b touron citb bull net>
To: "gtkmm-list" <gtkmm-list gnome org>
Sent: Monday, January 24, 2005 2:08 PM
Subject: 4 TextBuffer questions


Hi !

I am using a TextView/TextBuffer to display text with color.
How can I copy a substring of my TextBuffer into another TextBuffer, keeping the original colors ? The result of the get_text method does not seem to contain informations about the tags.

iterator Gtk::TextBuffer::insert ( const iterator& pos, const iterator& range_begin, const iterator& range_end ) Copies text, tags, and pixbufs between range_start and range_end and inserts the copy at pos. If range_start and range_end are in a different buffer from pos then the two buffers must share the same tag table.

Another question: How can I add an antry to the default context menu of the TextView (cut/paste/...). I need to add specific actions when the user right-clicks in the TextView.

Overide virtual void Gtk::TextView::on_populate_popup  (Menu*  menu)
but that's just a guess, never tried that myself.

Third : how can I add a bar on the left side of a TextView, to display additionnal informations (like bookmarks) ?

place any widget next to the textview that you find suitable to display that info. (maybe a treeview).

Last (but not least) : How can I highlight the current line ? I could apply a tag with the background color set to yellow, but only the characters would be highlighted. The background behind the text would remain white, which would not look very nice.

As i understand you want to highlight the line over the full width of the textview even if the text on that line is not the full width?, i'm not sure if that is possible, maybe you should use the treeview widget instead.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]