### Tutorial

« Menus | Text Widget »

## Tree and List Widget

1. The TreeModel Interface
2. Tree Selections
3. Creating a Model
4. Creating the View Component
5. A Simple Example

To create a tree or list widget in Inti you need to use the TreeModel interface in conjunction with the TreeView widget. This widget is designed around a Model/View/Controller design and consists of four major parts:

- the tree view widget - Gtk::TreeView
- the view column - Gtk::TreeViewColumn
- the cell renderers - Gtk::CellRenderer etc.
- and the model interface - Gtk::TreeModel

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.
The purpose of the cell renderers is to provide extensibility to the widget and to allow multiple ways of rendering the same type of data. For example, consider how to render a boolean variable. Should you render it as a string of "True" or "False", "On" or "Off", or should you render it as a checkbox?

« Menus | Index Top | Text Widget »