Tree and List Widget Overview3GTK LibraryTree and List Widget OverviewOverview of GtkTreeModel, GtkTreeView, and other associated widgetsOverview
To create a tree or list in GTK+, you need to use the GtkTreeModel interface, in
conjunction with the GtkTreeView widget.
This widget is designed around a
Model/View/Controller design and consists
of four major parts:
the tree view widget (GtkTreeView)the view column (GtkTreeViewColumn)the cell renderers (GtkCellRenderer etc.)and the model interface (GtkTreeModel)
The View is composed of the first three,
while the last is the Model. One of the
prime benefits of the MVC design is that multiple views can be
created of a single model. For example, a model mapping the file
system could be created for a file manager. Many views could be
created to display various parts of the file system, but only one
copy need be kept in memory.
Simple Example
Here is a simple example of using a GtkTreeView widget in context of the
other widgets. It simply creates a simple model and view, and
puts them together. Note that the model is never populated with
data — that is left as an exercise for the reader. More
information can be found on this in the GtkTreeModel section.