Documenting for any other interested on this.
Is the only way I managed to do make it work.
The concept is to create 3 columns
The first column has to be a user defined column
The 2nd and the 3rd hold the text and icon we want to join
We hide the 2nd and 3rd columns
We create our custom column that joins the 2nd and 3rd Columns
Tried to use Gtk3::CellRenderer as the renderer for the user defined render but it fails.
So had to declare a Textrender, and then clear the column attributes and recreate the attributes again.
Gtk3::SimpleList->add_column_type('image_text',
type => 'Glib::Scalar',
renderer => 'Gtk3::CellRendererText',
attr => sub {
my ($treecol, $cell, $model, $iter, $col_num) = @_;
my $pixrd = Gtk3::CellRendererPixbuf->new();
my $txtrd = Gtk3::CellRendererText->new();
$treecol->clear();
$treecol->pack_start($pixrd,0);
$treecol->pack_start($txtrd,1);
$treecol->add_attribute($pixrd,'pixbuf',1);
$treecol->add_attribute($txtrd,'markup',2);
}
);
# Create your model
my $slist = Gtk3::SimpleList->new (
'Text Field' => 'text_icon',
'text' => 'markup',
'icon' => 'pixbuf',
);
# Hide text and icon
my @col = $slist->get_columns;
$col[1]->set_visible(0);
$col[2]->set_visible(0);
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.