.\" 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::ComboBox 3pm" .TH Gtk2::ComboBox 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::ComboBox \- A widget used to choose from a list of items .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 9 \& # the easy way: \& $combobox = Gtk2::ComboBox\->new_text; \& foreach (@strings) { \& $combobox\->append_text ($_); \& } \& $combobox\->prepend_text ($another_string); \& $combobox\->insert_text ($index, $yet_another_string); \& $combobox\->remove_text ($index); \& $text = $combobox\->get_active_text; \& \& \& # the full\-featured way. \& # a combo box that shows stock ids and their images: \& use constant ID_COLUMN => 0; \& $model = Gtk2::ListStore\->new (\*(AqGlib::String\*(Aq); \& foreach (qw(gtk\-ok gtk\-cancel gtk\-yes gtk\-no gtk\-save gtk\-open)) { \& $model\->set ($model\->append, ID_COLUMN, $_); \& } \& $combo_box = Gtk2::ComboBox\->new ($model); \& # to display anything, you must pack cell renderers into \& # the combobox, which implements the Gtk2::CellLayout interface. \& $renderer = Gtk2::CellRendererPixbuf\->new; \& $combo_box\->pack_start ($renderer, FALSE); \& $combo_box\->add_attribute ($renderer, stock_id => ID_COLUMN); \& $renderer = Gtk2::CellRendererText\->new; \& $combo_box\->pack_start ($renderer, TRUE); \& $combo_box\->add_attribute ($renderer, text => ID_COLUMN); \& \& # select by index \& $combo_box\->set_active ($index); \& $active_index = $combo_box\->get_active; \& \& # or by iter \& $combo_box\->set_active_iter ($iter); \& $active_iter = $combo_box\->get_active_iter; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Gtk2::ComboBox is a widget that allows the user to choose from a list of valid choices. The ComboBox displays the selected choice. When activated, the ComboBox displays a popup which allows the user to make a new choice. .PP Unlike its predecessors Gtk2::Combo and Gtk2::OptionMenu, the Gtk2::ComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since ComboBox implements the Gtk2::CellLayout interface. The tree model holding the valid choices is not restricted to a flat list; it can be a real tree, and the popup will reflect the tree structure. .PP In addition to the model-view \s-1API,\s0 ComboBox offers a simple \s-1API\s0 which is suitable for text-only combo boxes, and hides the complexity of managing the data in a model. It consists of the methods \f(CW\*(C`new_text\*(C'\fR, \f(CW\*(C`append_text\*(C'\fR, \&\f(CW\*(C`insert_text\*(C'\fR, \f(CW\*(C`prepend_text\*(C'\fR, \f(CW\*(C`remove_text\*(C'\fR and \f(CW\*(C`get_active_text\*(C'\fR. .SH "HIERARCHY" .IX Header "HIERARCHY" .Vb 7 \& Glib::Object \& +\-\-\-\-Glib::InitiallyUnowned \& +\-\-\-\-Gtk2::Object \& +\-\-\-\-Gtk2::Widget \& +\-\-\-\-Gtk2::Container \& +\-\-\-\-Gtk2::Bin \& +\-\-\-\-Gtk2::ComboBox .Ve .SH "INTERFACES" .IX Header "INTERFACES" .Vb 4 \& Glib::Object::_Unregistered::AtkImplementorIface \& Gtk2::Buildable \& Gtk2::CellLayout \& Gtk2::CellEditable .Ve .SH "METHODS" .IX Header "METHODS" .SS "widget = Gtk2::ComboBox\->\fBnew\fP ($model=undef)" .IX Subsection "widget = Gtk2::ComboBox->new ($model=undef)" .IP "\(bu" 4 \&\f(CW$model\fR (Gtk2::TreeModel) .SS "widget = Gtk2::ComboBox\->\fBnew_text\fP" .IX Subsection "widget = Gtk2::ComboBox->new_text" .SS "widget = Gtk2::ComboBox\->\fBnew_with_model\fP ($model=undef)" .IX Subsection "widget = Gtk2::ComboBox->new_with_model ($model=undef)" .IP "\(bu" 4 \&\f(CW$model\fR (Gtk2::TreeModel) .ie n .SS "integer = $combo_box\->\fBget_active\fP" .el .SS "integer = \f(CW$combo_box\fP\->\fBget_active\fP" .IX Subsection "integer = $combo_box->get_active" .ie n .SS "treeiter = $combo_box\->\fBget_active_iter\fP" .el .SS "treeiter = \f(CW$combo_box\fP\->\fBget_active_iter\fP" .IX Subsection "treeiter = $combo_box->get_active_iter" .ie n .SS "$combo_box\->\fBset_active_iter\fP ($iter)" .el .SS "\f(CW$combo_box\fP\->\fBset_active_iter\fP ($iter)" .IX Subsection "$combo_box->set_active_iter ($iter)" .IP "\(bu" 4 \&\f(CW$iter\fR (Gtk2::TreeIter or undef) .ie n .SS "$combo_box\->\fBset_active\fP ($index)" .el .SS "\f(CW$combo_box\fP\->\fBset_active\fP ($index)" .IX Subsection "$combo_box->set_active ($index)" .IP "\(bu" 4 \&\f(CW$index\fR (integer) .ie n .SS "string = $combo_box\->\fBget_active_text\fP" .el .SS "string = \f(CW$combo_box\fP\->\fBget_active_text\fP" .IX Subsection "string = $combo_box->get_active_text" Since: gtk+ 2.6 .ie n .SS "boolean = $combo_box\->\fBget_add_tearoffs\fP" .el .SS "boolean = \f(CW$combo_box\fP\->\fBget_add_tearoffs\fP" .IX Subsection "boolean = $combo_box->get_add_tearoffs" Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBset_add_tearoffs\fP ($add_tearoffs)" .el .SS "\f(CW$combo_box\fP\->\fBset_add_tearoffs\fP ($add_tearoffs)" .IX Subsection "$combo_box->set_add_tearoffs ($add_tearoffs)" .IP "\(bu" 4 \&\f(CW$add_tearoffs\fR (boolean) .PP Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBappend_text\fP ($text)" .el .SS "\f(CW$combo_box\fP\->\fBappend_text\fP ($text)" .IX Subsection "$combo_box->append_text ($text)" .IP "\(bu" 4 \&\f(CW$text\fR (string) .ie n .SS "sensitivitytype = $combo_box\->\fBget_button_sensitivity\fP" .el .SS "sensitivitytype = \f(CW$combo_box\fP\->\fBget_button_sensitivity\fP" .IX Subsection "sensitivitytype = $combo_box->get_button_sensitivity" Since: gtk+ 2.14 .ie n .SS "$combo_box\->\fBset_button_sensitivity\fP ($sensitivity)" .el .SS "\f(CW$combo_box\fP\->\fBset_button_sensitivity\fP ($sensitivity)" .IX Subsection "$combo_box->set_button_sensitivity ($sensitivity)" .IP "\(bu" 4 \&\f(CW$sensitivity\fR (Gtk2::SensitivityType) .PP Since: gtk+ 2.14 .ie n .SS "integer = $combo_box\->\fBget_column_span_column\fP" .el .SS "integer = \f(CW$combo_box\fP\->\fBget_column_span_column\fP" .IX Subsection "integer = $combo_box->get_column_span_column" Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBset_column_span_column\fP ($column_span)" .el .SS "\f(CW$combo_box\fP\->\fBset_column_span_column\fP ($column_span)" .IX Subsection "$combo_box->set_column_span_column ($column_span)" .IP "\(bu" 4 \&\f(CW$column_span\fR (integer) .ie n .SS "boolean = $combo_box\->\fBget_focus_on_click\fP" .el .SS "boolean = \f(CW$combo_box\fP\->\fBget_focus_on_click\fP" .IX Subsection "boolean = $combo_box->get_focus_on_click" Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBset_focus_on_click\fP ($focus_on_click)" .el .SS "\f(CW$combo_box\fP\->\fBset_focus_on_click\fP ($focus_on_click)" .IX Subsection "$combo_box->set_focus_on_click ($focus_on_click)" .IP "\(bu" 4 \&\f(CW$focus_on_click\fR (boolean) .PP Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBinsert_text\fP ($position, $text)" .el .SS "\f(CW$combo_box\fP\->\fBinsert_text\fP ($position, \f(CW$text\fP)" .IX Subsection "$combo_box->insert_text ($position, $text)" .IP "\(bu" 4 \&\f(CW$position\fR (integer) .IP "\(bu" 4 \&\f(CW$text\fR (string) .ie n .SS "treemodel = $combo_box\->\fBget_model\fP" .el .SS "treemodel = \f(CW$combo_box\fP\->\fBget_model\fP" .IX Subsection "treemodel = $combo_box->get_model" .ie n .SS "$combo_box\->\fBset_model\fP ($model)" .el .SS "\f(CW$combo_box\fP\->\fBset_model\fP ($model)" .IX Subsection "$combo_box->set_model ($model)" .IP "\(bu" 4 \&\f(CW$model\fR (Gtk2::TreeModel or undef) .PP Note that setting \f(CW\*(C`undef\*(C'\fR for no model is new in Gtk 2.6. (Both here or via \f(CW\*(C`set_property\*(C'\fR.) .ie n .SS "$combo_box\->\fBpopdown\fP" .el .SS "\f(CW$combo_box\fP\->\fBpopdown\fP" .IX Subsection "$combo_box->popdown" .ie n .SS "$combo_box\->\fBpopup\fP" .el .SS "\f(CW$combo_box\fP\->\fBpopup\fP" .IX Subsection "$combo_box->popup" .ie n .SS "$combo_box\->\fBprepend_text\fP ($text)" .el .SS "\f(CW$combo_box\fP\->\fBprepend_text\fP ($text)" .IX Subsection "$combo_box->prepend_text ($text)" .IP "\(bu" 4 \&\f(CW$text\fR (string) .ie n .SS "$combo_box\->\fBremove_text\fP ($position)" .el .SS "\f(CW$combo_box\fP\->\fBremove_text\fP ($position)" .IX Subsection "$combo_box->remove_text ($position)" .IP "\(bu" 4 \&\f(CW$position\fR (integer) .ie n .SS "$combo_box\->\fBset_row_separator_func\fP ($func, $data=undef)" .el .SS "\f(CW$combo_box\fP\->\fBset_row_separator_func\fP ($func, \f(CW$data\fP=undef)" .IX Subsection "$combo_box->set_row_separator_func ($func, $data=undef)" .IP "\(bu" 4 \&\f(CW$func\fR (scalar) .IP "\(bu" 4 \&\f(CW$data\fR (scalar) .PP Since: gtk+ 2.6 .ie n .SS "integer = $combo_box\->\fBget_row_span_column\fP" .el .SS "integer = \f(CW$combo_box\fP\->\fBget_row_span_column\fP" .IX Subsection "integer = $combo_box->get_row_span_column" Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBset_row_span_column\fP ($row_span)" .el .SS "\f(CW$combo_box\fP\->\fBset_row_span_column\fP ($row_span)" .IX Subsection "$combo_box->set_row_span_column ($row_span)" .IP "\(bu" 4 \&\f(CW$row_span\fR (integer) .ie n .SS "string = $combo_box\->\fBget_title\fP" .el .SS "string = \f(CW$combo_box\fP\->\fBget_title\fP" .IX Subsection "string = $combo_box->get_title" Since: gtk+ 2.10 .ie n .SS "$combo_box\->\fBset_title\fP ($title)" .el .SS "\f(CW$combo_box\fP\->\fBset_title\fP ($title)" .IX Subsection "$combo_box->set_title ($title)" .IP "\(bu" 4 \&\f(CW$title\fR (string) .PP Since: gtk+ 2.10 .ie n .SS "integer = $combo_box\->\fBget_wrap_width\fP" .el .SS "integer = \f(CW$combo_box\fP\->\fBget_wrap_width\fP" .IX Subsection "integer = $combo_box->get_wrap_width" Since: gtk+ 2.6 .ie n .SS "$combo_box\->\fBset_wrap_width\fP ($width)" .el .SS "\f(CW$combo_box\fP\->\fBset_wrap_width\fP ($width)" .IX Subsection "$combo_box->set_wrap_width ($width)" .IP "\(bu" 4 \&\f(CW$width\fR (integer) .SH "PROPERTIES" .IX Header "PROPERTIES" .IP "'active' (integer : default \-1 : readable / writable / private)" 4 .IX Item "'active' (integer : default -1 : readable / writable / private)" The item which is currently active .IP "'add\-tearoffs' (boolean : default false : readable / writable / private)" 4 .IX Item "'add-tearoffs' (boolean : default false : readable / writable / private)" Whether dropdowns should have a tearoff menu item .ie n .IP "'button\-sensitivity' (Gtk2::SensitivityType : default ""auto"" : readable / writable / private)" 4 .el .IP "'button\-sensitivity' (Gtk2::SensitivityType : default ``auto'' : readable / writable / private)" 4 .IX Item "'button-sensitivity' (Gtk2::SensitivityType : default auto : readable / writable / private)" Whether the dropdown button is sensitive when the model is empty .IP "'column\-span\-column' (integer : default \-1 : readable / writable / private)" 4 .IX Item "'column-span-column' (integer : default -1 : readable / writable / private)" TreeModel column containing the column span values .IP "'entry\-text\-column' (integer : default \-1 : readable / writable / private)" 4 .IX Item "'entry-text-column' (integer : default -1 : readable / writable / private)" The column in the combo box's model to associate with strings from the entry if the combo was created with #GtkComboBox:has\-entry = \f(CW%TRUE\fR .IP "'focus\-on\-click' (boolean : default true : readable / writable / private)" 4 .IX Item "'focus-on-click' (boolean : default true : readable / writable / private)" Whether the combo box grabs focus when it is clicked with the mouse .IP "'has\-entry' (boolean : default false : readable / writable / construct-only / private)" 4 .IX Item "'has-entry' (boolean : default false : readable / writable / construct-only / private)" Whether combo box has an entry .IP "'has\-frame' (boolean : default true : readable / writable / private)" 4 .IX Item "'has-frame' (boolean : default true : readable / writable / private)" Whether the combo box draws a frame around the child .IP "'model' (Gtk2::TreeModel : default undef : readable / writable / private)" 4 .IX Item "'model' (Gtk2::TreeModel : default undef : readable / writable / private)" The model for the combo box .IP "'popup\-shown' (boolean : default false : readable / private)" 4 .IX Item "'popup-shown' (boolean : default false : readable / private)" Whether the combo's dropdown is shown .IP "'row\-span\-column' (integer : default \-1 : readable / writable / private)" 4 .IX Item "'row-span-column' (integer : default -1 : readable / writable / private)" TreeModel column containing the row span values .IP "'tearoff\-title' (string : default undef : readable / writable / private)" 4 .IX Item "'tearoff-title' (string : default undef : readable / writable / private)" A title that may be displayed by the window manager when the popup is torn-off .IP "'wrap\-width' (integer : default 0 : readable / writable / private)" 4 .IX Item "'wrap-width' (integer : default 0 : readable / writable / private)" Wrap width for laying out the items in a grid .SH "STYLE PROPERTIES" .IX Header "STYLE PROPERTIES" .IP "'appears\-as\-list' (boolean : default false : readable / private)" 4 .IX Item "'appears-as-list' (boolean : default false : readable / private)" Whether dropdowns should look like lists rather than menus .IP "'arrow\-size' (integer : default 15 : readable / private)" 4 .IX Item "'arrow-size' (integer : default 15 : readable / private)" The minimum size of the arrow in the combo box .ie n .IP "'shadow\-type' (Gtk2::ShadowType : default ""none"" : readable / private)" 4 .el .IP "'shadow\-type' (Gtk2::ShadowType : default ``none'' : readable / private)" 4 .IX Item "'shadow-type' (Gtk2::ShadowType : default none : readable / private)" Which kind of shadow to draw around the combo box .SH "SIGNALS" .IX Header "SIGNALS" .IP "\fBchanged\fR (Gtk2::ComboBox)" 4 .IX Item "changed (Gtk2::ComboBox)" .PD 0 .IP "\fBmove-active\fR (Gtk2::ComboBox, Gtk2::ScrollType)" 4 .IX Item "move-active (Gtk2::ComboBox, Gtk2::ScrollType)" .IP "boolean = \fBpopdown\fR (Gtk2::ComboBox)" 4 .IX Item "boolean = popdown (Gtk2::ComboBox)" .IP "\fBpopup\fR (Gtk2::ComboBox)" 4 .IX Item "popup (Gtk2::ComboBox)" .PD .SH "ENUMS AND FLAGS" .IX Header "ENUMS AND FLAGS" .SS "enum Gtk2::ScrollType" .IX Subsection "enum Gtk2::ScrollType" .IP "\(bu" 4 \&'none' / '\s-1GTK_SCROLL_NONE\s0' .IP "\(bu" 4 \&'jump' / '\s-1GTK_SCROLL_JUMP\s0' .IP "\(bu" 4 \&'step\-backward' / '\s-1GTK_SCROLL_STEP_BACKWARD\s0' .IP "\(bu" 4 \&'step\-forward' / '\s-1GTK_SCROLL_STEP_FORWARD\s0' .IP "\(bu" 4 \&'page\-backward' / '\s-1GTK_SCROLL_PAGE_BACKWARD\s0' .IP "\(bu" 4 \&'page\-forward' / '\s-1GTK_SCROLL_PAGE_FORWARD\s0' .IP "\(bu" 4 \&'step\-up' / '\s-1GTK_SCROLL_STEP_UP\s0' .IP "\(bu" 4 \&'step\-down' / '\s-1GTK_SCROLL_STEP_DOWN\s0' .IP "\(bu" 4 \&'page\-up' / '\s-1GTK_SCROLL_PAGE_UP\s0' .IP "\(bu" 4 \&'page\-down' / '\s-1GTK_SCROLL_PAGE_DOWN\s0' .IP "\(bu" 4 \&'step\-left' / '\s-1GTK_SCROLL_STEP_LEFT\s0' .IP "\(bu" 4 \&'step\-right' / '\s-1GTK_SCROLL_STEP_RIGHT\s0' .IP "\(bu" 4 \&'page\-left' / '\s-1GTK_SCROLL_PAGE_LEFT\s0' .IP "\(bu" 4 \&'page\-right' / '\s-1GTK_SCROLL_PAGE_RIGHT\s0' .IP "\(bu" 4 \&'start' / '\s-1GTK_SCROLL_START\s0' .IP "\(bu" 4 \&'end' / '\s-1GTK_SCROLL_END\s0' .SS "enum Gtk2::SensitivityType" .IX Subsection "enum Gtk2::SensitivityType" .IP "\(bu" 4 \&'auto' / '\s-1GTK_SENSITIVITY_AUTO\s0' .IP "\(bu" 4 \&'on' / '\s-1GTK_SENSITIVITY_ON\s0' .IP "\(bu" 4 \&'off' / '\s-1GTK_SENSITIVITY_OFF\s0' .SH "SEE ALSO" .IX Header "SEE ALSO" Gtk2, Glib::Object, Glib::InitiallyUnowned, Gtk2::Object, Gtk2::Widget, Gtk2::Container, Gtk2::Bin .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.