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



On Thu, 2003-12-18 at 07:15, Murray Cumming Comneon com wrote:
> > 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.

Actually, the policy is:

 - Object structures are default private
 - Other structures are default public

Subject to modification by /*< public >*/ or /*< private >*/ comments.

This is what gtk-doc does, and you can see that length is documented at:
 
http://developer.gnome.org/doc/API/2.0/pango/pango-Layout-Objects.html#PangoLayoutLine

(Not commenting on the code above ... it looks a bit odd to me.)

Regards,
						Owen





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