/usr/lib/perl5/Gtk2/CellLayout.pod is in libgtk2-perl-doc 2:1.249-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | =head1 NAME
Gtk2::CellLayout - wrapper for GtkCellLayout
=cut
=for position SYNOPSIS
=head1 SYNOPSIS
# This is an abstract interface; the CellLayout interface is
# implemented by concrete classes like ComboBox and TreeViewColumn.
# See the discussion for details on creating your own CellLayout.
# This synopsis assumes you already have an instance in $cell_layout.
# Add a cell renderer that shows the pixbuf in column 2 of the
# associated TreeModel. It will take up only the necessary space
# ("expand" => FALSE).
my $cell = Gtk2::CellRendererPixbuf->new ();
$cell_layout->pack_start ($cell, FALSE);
$cell_layout->add_attribute ($cell, pixbuf => 2);
# Add another cell renderer that gets the "text" property from
# column 3 of the associated TreeModel, and takes up all remaining
# horizontal space ("expand" => TRUE).
my $cell = Gtk2::CellRendererText->new ();
$cell_layout->pack_start ($cell, TRUE);
$cell_layout->add_attribute ($cell, text => 3);
=cut
=for position DESCRIPTION
=head1 DESCRIPTION
Gtk2::CellLayout is an interface to be implemented by all objects which
want to provide a Gtk2::TreeViewColumn-like API for packing cells,
setting attributes and data funcs.
=cut
=head1 HIERARCHY
Glib::Interface
+----Gtk2::CellLayout
=cut
=head1 METHODS
=head2 $cell_layout-E<gt>B<add_attribute> ($cell, $attribute, $column)
=over
=item * $cell (Gtk2::CellRenderer)
=item * $attribute (string)
=item * $column (integer)
=back
Adds an attribute mapping to the list in I<$cell_layout>. The I<$column> is
the column of the model from which to get a value, and the I<$attribute> is
the property of I<$cell> to be set from the value. So, for example, if
column 2 of the model contains strings, you could have the "text" attribute
of a Gtk2::CellRendererText get its values from column 2.
=head2 $cell_layout-E<gt>B<set_attributes> ($cell, ...)
=over
=item * $cell (Gtk2::CellRenderer)
=item * ... (list) list of property name and column number pairs.
=back
Sets the pairs in the I<...> list as the attributes of I<$cell_layout>, as
with repeated calls to C<add_attribute>. All existing attributes are removed,
and replaced with the new attributes.
=head2 $cell_layout-E<gt>B<set_cell_data_func> ($cell, $func, $func_data=undef)
=over
=item * $cell (Gtk2::CellRenderer)
=item * $func (scalar)
=item * $func_data (scalar)
=back
Sets up I<$cell_layout> to call I<$func> to set up attributes of I<$cell>,
instead of the standard attribute mapping. I<$func> may be undef to remove
an older callback. I<$func> will receive these parameters:
=over
=item $cell_layout The cell layout instance
=item $cell The cell renderer to set up
=item $model The tree model
=item $iter TreeIter of the row for which to set the values
=item $data The I<$func_data> passed to C<set_cell_data_func>
=back
=head2 list = $cell_layout-E<gt>B<get_cells>
Fetch all of the cell renderers which have been added to I<$cell_layout>.
Note that if there are no cells this functions returns 'undef' instead of an
empty list.
Since: gtk+ 2.12
=head2 $cell_layout-E<gt>B<clear>
Unsets all the mappings on all renderers on I<$cell_layout> and removes all
renderers attached to it.
=head2 $cell_layout-E<gt>B<clear_attributes> ($cell)
=over
=item * $cell (Gtk2::CellRenderer)
=back
Clears all existing attributes previously set with for I<$cell> with
C<add_attribute> or C<set_attributes>.
=head2 $cell_layout-E<gt>B<pack_end> ($cell, $expand)
=over
=item * $cell (Gtk2::CellRenderer)
=item * $expand (boolean)
=back
Like C<pack_start>, but adds from the end of the layout instead of the
beginning.
=head2 $cell_layout-E<gt>B<pack_start> ($cell, $expand)
=over
=item * $cell (Gtk2::CellRenderer)
=item * $expand (boolean)
=back
Packs I<$cell> into the beginning of I<$cell_layout>. If I<$expand> is false,
then I<$cell> is allocated no more space than it needs. Any unused space is
divided evenly between cells for which I<$expand> is true.
=head2 $cell_layout-E<gt>B<reorder> ($cell, $position)
=over
=item * $cell (Gtk2::CellRenderer)
=item * $position (integer)
=back
Re-insert I<$cell> at I<$position>. I<$cell> must already be packed into
I<$cell_layout>.
=cut
=for position post_methods
=head1 CREATING A CUSTOM CELL LAYOUT
GTK+ provides several CellLayout implementations, such as Gtk2::TreeViewColumn
and Gtk2::ComboBox. To create your own object that implements the CellLayout
interface and therefore can be used to display CellRenderers, you need to
add Gtk2::CellLayout to your class's "interfaces" list, like this:
package MyLayout;
use Gtk2;
use Glib::Object::Subclass
Gtk2::Widget::,
interfaces => [ Gtk2::CellLayout:: ],
;
This will cause perl to call several virtual methods with ALL_CAPS_NAMES
when GTK+ attempts to perform certain actions. You simply provide (or
override) those methods with perl code. The methods map rather directly
to the object interface, so it should be easy to figure out what they
should do. Those methods are:
=over
=item PACK_START ($cell_layout, $cell, $expand)
=item PACK_END ($cell_layout, $cell, $expand)
=item CLEAR ($cell_layout)
=item ADD_ATTRIBUTE ($cell_layout, $cell, $attribute, $column)
=item SET_CELL_DATA_FUNC ($cell_layout, $cell, $func, $data)
=item CLEAR_ATTRIBUTES ($cell_layout, $cell)
=item REORDER ($cell_layout, $cell, $position)
=item list = GET_CELLS ($cell_layout)
=back
=cut
=head1 SEE ALSO
L<Gtk2>, L<Glib::Interface>
=cut
=head1 COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team.
This software is licensed under the LGPL. See L<Gtk2> for a full notice.
=cut
|