Re: cell word wrapping



On Thu, 2005-01-20 at 10:21 +0100, Torsten Schoenfeld wrote:
I've repeatedly looked at binding PangoAttrList in the past and always
concluded that it's way too hard for something that esoteric.  It's
completely binding-unfriendly API.

If that's the case then there really isn't need for the bother.

Kevin, what exactly do you need access to PangoAttrList for?

Vain attempts at making a CellRendererText that knows how to wrap-words.
I have no idea if it'll even do what I'd like it to do so it's not any
sort of priority. In order to adjust the attributes of Gtk2::Label or
Gtk2::CellRendererText you need to use a Gtk2::Pango::AttrList somehow.
The following example was my attempt at a column that wrapped it's text
(which obviously failed due to the AttrList not existing). If this
example would even work for making the cell's text wrap lines is a
mystery to me which is one of the main reasons why I'd say there's
little to no priority on binding the AttrList.

[code example from reply to muppet]
add_column_type
 Gtk2::Ex::Simple::List
  ( 'wrap_text',
    type     => 'Glib::Scalar',
    renderer => 'Gtk2::CellRendererText',
    attr     => sub {
                  my ( $treecol, $cell, $model, $iter, $col_num ) = @_;
                  my $info = $model->get( $iter, $col_num );
                  my $pal = new
                             Gtk2::Pango::AttrList
                              ( 'wrap-mode' => 'word' );
                  $cell->set_property( attributes => $pal );
                  $cell->set( markup => $info );
                }
  );
[/code]

If I can't make these cells wrap lines then so be it. I can live with
enormously long lines. (and no, using newlines is not an option as these
are marked up strings and calculating where to break the line would be a
small nightmare that I'd rather not have in my spare time.)

-- 
Kevin C. Krinke <kckrinke opendoorsoftware com>
Open Door Software Inc.




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