Re: Marshalling/Serialization Gtk::TextBuffer



Stephen,

there is no easy way of doing it. Last time I looked at
something similar, I think I saw some stuff in heavymole
(heavymole.sf.net) or maybe somewhere else.

Instead, I use Gtk::Label - it supports Pango text attribute
markup language:

label.set_use_markup ();
label.set_line_wrap ();

Glib::ustring s ("your utf-8 string here");

label.set_markup (s);

If you use libxml2 (or better libxml++), you can save/load utf-8 strings
just fine. I do it in my app, Granule, all the time. But make sure you 
install libxml++-2.6 or higher, not libxml++-1.0.

For example, see

http://cvs.sourceforge.net/viewcvs.py/granule/granule/src/Deck.cpp?rev=1.29&view=auto

search for "back_example" string.

hope this helps,
-Vlad

On Tue, 2004-11-09 at 12:50, Stephen Dennison wrote:
> I'm new to gtkmm and gtk in general and I've been looking around the
> net but I haven't found much on the topic of serializing gtk/gtkmm
> objects.  Specificially I need a way of serializing a Gtk::TextBuffer
> for a note making application that I'm working on.  I'd like to
> support basic formatting and unicode text, and the TextBuffer and a
> TextView seem to be a pretty good way of doing this.  Gtkmm was so
> easy that I've already got a basic gui with the components I need, but
> when it comes to actually saving the contents of the TextBuffer, all I
> can write out is the text (via the Gtk::TextBuffer::get_text
> function).
> 
> If anyone could provide links to documents or even book/article titles
> that I could look up, I'd greatly appreciate it.
> 
> Thanks.
> 
> --s.r.d.
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-- 
_____________________________________________________________
Vladislav Grinchenko       http://home.comcast.net/~3rdshift/
                                 e-mail: 3rdshift comcast net
                                                   
      Focus on quality, and productivity will follow.
_____________________________________________________________




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