.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Gtk2::CellLayout 3pm" .TH Gtk2::CellLayout 3pm "2019-09-16" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Gtk2::CellLayout \- wrapper for GtkCellLayout .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& # 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); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Gtk2::CellLayout is an interface to be implemented by all objects which want to provide a Gtk2::TreeViewColumn\-like \s-1API\s0 for packing cells, setting attributes and data funcs. .SH "HIERARCHY" .IX Header "HIERARCHY" .Vb 2 \& Glib::Interface \& +\-\-\-\-Gtk2::CellLayout .Ve .SH "METHODS" .IX Header "METHODS" .ie n .SS "$cell_layout\->\fBadd_attribute\fP ($cell, $attribute, $column)" .el .SS "\f(CW$cell_layout\fP\->\fBadd_attribute\fP ($cell, \f(CW$attribute\fP, \f(CW$column\fP)" .IX Subsection "$cell_layout->add_attribute ($cell, $attribute, $column)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .IP "\(bu" 4 \&\f(CW$attribute\fR (string) .IP "\(bu" 4 \&\f(CW$column\fR (integer) .PP Adds an attribute mapping to the list in \fI\f(CI$cell_layout\fI\fR. The \fI\f(CI$column\fI\fR is the column of the model from which to get a value, and the \fI\f(CI$attribute\fI\fR is the property of \fI\f(CI$cell\fI\fR to be set from the value. So, for example, if column 2 of the model contains strings, you could have the \*(L"text\*(R" attribute of a Gtk2::CellRendererText get its values from column 2. .ie n .SS "$cell_layout\->\fBset_attributes\fP ($cell, ...)" .el .SS "\f(CW$cell_layout\fP\->\fBset_attributes\fP ($cell, ...)" .IX Subsection "$cell_layout->set_attributes ($cell, ...)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .IP "\(bu" 4 \&... (list) list of property name and column number pairs. .PP Sets the pairs in the \fI...\fR list as the attributes of \fI\f(CI$cell_layout\fI\fR, as with repeated calls to \f(CW\*(C`add_attribute\*(C'\fR. All existing attributes are removed, and replaced with the new attributes. .ie n .SS "$cell_layout\->\fBset_cell_data_func\fP ($cell, $func, $func_data=undef)" .el .SS "\f(CW$cell_layout\fP\->\fBset_cell_data_func\fP ($cell, \f(CW$func\fP, \f(CW$func_data\fP=undef)" .IX Subsection "$cell_layout->set_cell_data_func ($cell, $func, $func_data=undef)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .IP "\(bu" 4 \&\f(CW$func\fR (scalar) .IP "\(bu" 4 \&\f(CW$func_data\fR (scalar) .PP Sets up \fI\f(CI$cell_layout\fI\fR to call \fI\f(CI$func\fI\fR to set up attributes of \fI\f(CI$cell\fI\fR, instead of the standard attribute mapping. \fI\f(CI$func\fI\fR may be undef to remove an older callback. \fI\f(CI$func\fI\fR will receive these parameters: .ie n .IP "$cell_layout The cell layout instance" 4 .el .IP "\f(CW$cell_layout\fR The cell layout instance" 4 .IX Item "$cell_layout The cell layout instance" .PD 0 .ie n .IP "$cell The cell renderer to set up" 4 .el .IP "\f(CW$cell\fR The cell renderer to set up" 4 .IX Item "$cell The cell renderer to set up" .ie n .IP "$model The tree model" 4 .el .IP "\f(CW$model\fR The tree model" 4 .IX Item "$model The tree model" .ie n .IP "$iter TreeIter of the row for which to set the values" 4 .el .IP "\f(CW$iter\fR TreeIter of the row for which to set the values" 4 .IX Item "$iter TreeIter of the row for which to set the values" .ie n .IP "$data The \fI\f(CI$func_data\fI\fR passed to ""set_cell_data_func""" 4 .el .IP "\f(CW$data\fR The \fI\f(CI$func_data\fI\fR passed to \f(CWset_cell_data_func\fR" 4 .IX Item "$data The $func_data passed to set_cell_data_func" .PD .ie n .SS "list = $cell_layout\->\fBget_cells\fP" .el .SS "list = \f(CW$cell_layout\fP\->\fBget_cells\fP" .IX Subsection "list = $cell_layout->get_cells" Fetch all of the cell renderers which have been added to \fI\f(CI$cell_layout\fI\fR. .PP Note that if there are no cells this functions returns 'undef' instead of an empty list. .PP Since: gtk+ 2.12 .ie n .SS "$cell_layout\->\fBclear\fP" .el .SS "\f(CW$cell_layout\fP\->\fBclear\fP" .IX Subsection "$cell_layout->clear" Unsets all the mappings on all renderers on \fI\f(CI$cell_layout\fI\fR and removes all renderers attached to it. .ie n .SS "$cell_layout\->\fBclear_attributes\fP ($cell)" .el .SS "\f(CW$cell_layout\fP\->\fBclear_attributes\fP ($cell)" .IX Subsection "$cell_layout->clear_attributes ($cell)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .PP Clears all existing attributes previously set with for \fI\f(CI$cell\fI\fR with \&\f(CW\*(C`add_attribute\*(C'\fR or \f(CW\*(C`set_attributes\*(C'\fR. .ie n .SS "$cell_layout\->\fBpack_end\fP ($cell, $expand)" .el .SS "\f(CW$cell_layout\fP\->\fBpack_end\fP ($cell, \f(CW$expand\fP)" .IX Subsection "$cell_layout->pack_end ($cell, $expand)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .IP "\(bu" 4 \&\f(CW$expand\fR (boolean) .PP Like \f(CW\*(C`pack_start\*(C'\fR, but adds from the end of the layout instead of the beginning. .ie n .SS "$cell_layout\->\fBpack_start\fP ($cell, $expand)" .el .SS "\f(CW$cell_layout\fP\->\fBpack_start\fP ($cell, \f(CW$expand\fP)" .IX Subsection "$cell_layout->pack_start ($cell, $expand)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .IP "\(bu" 4 \&\f(CW$expand\fR (boolean) .PP Packs \fI\f(CI$cell\fI\fR into the beginning of \fI\f(CI$cell_layout\fI\fR. If \fI\f(CI$expand\fI\fR is false, then \fI\f(CI$cell\fI\fR is allocated no more space than it needs. Any unused space is divided evenly between cells for which \fI\f(CI$expand\fI\fR is true. .ie n .SS "$cell_layout\->\fBreorder\fP ($cell, $position)" .el .SS "\f(CW$cell_layout\fP\->\fBreorder\fP ($cell, \f(CW$position\fP)" .IX Subsection "$cell_layout->reorder ($cell, $position)" .IP "\(bu" 4 \&\f(CW$cell\fR (Gtk2::CellRenderer) .IP "\(bu" 4 \&\f(CW$position\fR (integer) .PP Re-insert \fI\f(CI$cell\fI\fR at \fI\f(CI$position\fI\fR. \fI\f(CI$cell\fI\fR must already be packed into \&\fI\f(CI$cell_layout\fI\fR. .SH "CREATING A CUSTOM CELL LAYOUT" .IX Header "CREATING A CUSTOM CELL LAYOUT" \&\s-1GTK+\s0 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 \*(L"interfaces\*(R" list, like this: .PP .Vb 6 \& package MyLayout; \& use Gtk2; \& use Glib::Object::Subclass \& Gtk2::Widget::, \& interfaces => [ Gtk2::CellLayout:: ], \& ; .Ve .PP This will cause perl to call several virtual methods with \s-1ALL_CAPS_NAMES\s0 when \s-1GTK+\s0 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: .ie n .IP "\s-1PACK_START\s0 ($cell_layout, $cell, $expand)" 4 .el .IP "\s-1PACK_START\s0 ($cell_layout, \f(CW$cell\fR, \f(CW$expand\fR)" 4 .IX Item "PACK_START ($cell_layout, $cell, $expand)" .PD 0 .ie n .IP "\s-1PACK_END\s0 ($cell_layout, $cell, $expand)" 4 .el .IP "\s-1PACK_END\s0 ($cell_layout, \f(CW$cell\fR, \f(CW$expand\fR)" 4 .IX Item "PACK_END ($cell_layout, $cell, $expand)" .IP "\s-1CLEAR\s0 ($cell_layout)" 4 .IX Item "CLEAR ($cell_layout)" .ie n .IP "\s-1ADD_ATTRIBUTE\s0 ($cell_layout, $cell, $attribute, $column)" 4 .el .IP "\s-1ADD_ATTRIBUTE\s0 ($cell_layout, \f(CW$cell\fR, \f(CW$attribute\fR, \f(CW$column\fR)" 4 .IX Item "ADD_ATTRIBUTE ($cell_layout, $cell, $attribute, $column)" .ie n .IP "\s-1SET_CELL_DATA_FUNC\s0 ($cell_layout, $cell, $func, $data)" 4 .el .IP "\s-1SET_CELL_DATA_FUNC\s0 ($cell_layout, \f(CW$cell\fR, \f(CW$func\fR, \f(CW$data\fR)" 4 .IX Item "SET_CELL_DATA_FUNC ($cell_layout, $cell, $func, $data)" .ie n .IP "\s-1CLEAR_ATTRIBUTES\s0 ($cell_layout, $cell)" 4 .el .IP "\s-1CLEAR_ATTRIBUTES\s0 ($cell_layout, \f(CW$cell\fR)" 4 .IX Item "CLEAR_ATTRIBUTES ($cell_layout, $cell)" .ie n .IP "\s-1REORDER\s0 ($cell_layout, $cell, $position)" 4 .el .IP "\s-1REORDER\s0 ($cell_layout, \f(CW$cell\fR, \f(CW$position\fR)" 4 .IX Item "REORDER ($cell_layout, $cell, $position)" .IP "list = \s-1GET_CELLS\s0 ($cell_layout)" 4 .IX Item "list = GET_CELLS ($cell_layout)" .PD .SH "SEE ALSO" .IX Header "SEE ALSO" Gtk2, Glib::Interface .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2003\-2011 by the gtk2\-perl team. .PP This software is licensed under the \s-1LGPL.\s0 See Gtk2 for a full notice.