RE: [gtkmm] Can this be done with gtkmm?



> I am writing a Label capable of wrapping itself in order 
> not to be wider than X pixels. Can you please help me clean 
> up the code of extract_text_of_line() in order to use only 
> gtkmm (currently I am using 
> PangoLayoutLine *)?
[snip]
>                 Glib::ustring 
> extract_text_of_line(Glib::RefPtr<Pango::LayoutLine> aLayoutLine, 
>                                                    
> Glib::ustring aText){
>                         PangoLayoutLine * lPtr = aLayoutLine->gobj();
>                         const char * lText = aText.c_str();
>                         string s = "";
>                         for (int i=0; i< lPtr->length; i++){
>                                 char c = 
> lText[(lPtr->start_index) + i];
>                                 s+=c;
>                         }
>                         return s;

You are using the PangoLayoutLine::length struct field:
http://developer.gnome.org/doc/API/2.2/pango/pango-Layout-Objects.html#Pango
LayoutLine

By default, struct fields are private (you should not use them) unless the
documentation says otherwise. If the GTK+ developers say that this field
should be accessed directly, then we will wrap it in gtkmm 2.4.

Murray Cumming
www.murrayc.com
murrayc usa net 



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