1
2@c %start of fragment
3
4@node GtkComboBox
5@chapter GtkComboBox
6A widget used to choose from a list of items
7
8@section Overview
9A @code{<gtk-combo-box>} is a widget that allows the user to choose from a list
10of valid choices. The @code{<gtk-combo-box>} displays the selected choice. When
11activated, the @code{<gtk-combo-box>} displays a popup which allows the user to
12make a new choice. The style in which the selected value is displayed, and the
13style of the popup is determined by the current theme. It may be similar to a
14@code{<gtk-option-menu>}, or similar to a Windows-style combo box.
15
16Unlike its predecessors @code{<gtk-combo>} and @code{<gtk-option-menu>}, the
17@code{<gtk-combo-box>} uses the model-view pattern; the list of valid choices is
18specified in the form of a tree model, and the display of the choices can be
19adapted to the data in the model by using cell renderers, as you would in a tree
20view. This is possible since @code{<gtk-combo-box>} implements the
21@code{<gtk-cell-layout>} interface. The tree model holding the valid choices is
22not restricted to a flat list, it can be a real tree, and the popup will reflect
23the tree structure.
24
25In addition to the model-view API, @code{<gtk-combo-box>} offers a simple API
26which is suitable for text-only combo boxes, and hides the complexity of
27managing the data in a model. It consists of the functions
28@code{gtk-combo-box-new-text}, @code{gtk-combo-box-append-text},
29@code{gtk-combo-box-insert-text}, @code{gtk-combo-box-prepend-text},
30@code{gtk-combo-box-remove-text} and @code{gtk-combo-box-get-active-text}.
31
32@section Usage
33@include defuns-gtkcombobox.xml.texi
34
35@c %end of fragment
36