Main Page Widgets Namespaces Book

# Gtk::TreeModelColumnRecord Class Reference
[TreeView Classes]

Typedefed as TreeModel::ColumnRecord. More...

List of all members.

## Public Member Functions

| TreeModelColumnRecord ()
virtual | ~TreeModelColumnRecord ()
void | add (TreeModelColumnBase& column)
| Adds a TreeModelColumn to this record.
unsigned int | size () const
const GType* | types () const

## Detailed Description

Typedefed as TreeModel::ColumnRecord.

Keeps a record of TreeModelColumns. ColumnRecord objects are used to setup a new TreeModel (or rather, an implementation of the model, like Gtk::ListStore or Gtk::TreeStore). It is convenient to do that by deriving from TreeModel::ColumnRecord:

     class MyModelColumns : public Gtk::TreeModel::ColumnRecord
     {
     public:
       Gtk::TreeModelColumn<Glib::ustring>                filename;
       Gtk::TreeModelColumn<Glib::ustring>                description;
       Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> >  thumbnail;

       MyModelColumns() { add(filename); add(description); add(thumbnail); }
     };

An instance of `MyModelColumns` should be passed to ListStore::create() or TreeStore::create(). The members `filename`, `description` and `thumbnail` can then be used with Gtk::TreeRow::operator[]() to specify the column you're interested in.

Neither TreeModel::ColumnRecord nor the TreeModelColumns contain any real data -- it's merely a description of what type is stored in which column of a TreeModel. Thus it's absolutely legal to use a statically allocated TreeModel::ColumnRecord (as long as you make sure it's instantiated after Gtk::Main), even when creating multiple models from it.

## Constructor & Destructor Documentation

Gtk::TreeModelColumnRecord::TreeModelColumnRecord | ( |  | ) |

virtual Gtk::TreeModelColumnRecord::~TreeModelColumnRecord | ( |  | ) | `[virtual]`

## Member Function Documentation

void Gtk::TreeModelColumnRecord::add | ( | TreeModelColumnBase& | column | ) |

| Adds a TreeModelColumn to this record. add() not only registers the column, but also assigns a column index to it. Once registered, the TreeModelColumn is final, and you're free to pass it around by value.

unsigned int Gtk::TreeModelColumnRecord::size | ( |  | ) | const

const GType* Gtk::TreeModelColumnRecord::types | ( |  | ) | const

The documentation for this class was generated from the following file:

- treemodelcolumn.h