That's not really how this works. Instead:
- You associate the renderer with an e.g. boolean column:
column->add_property (*cell, "active",
your_column_record_instance.bool_col);
- You connect to the toggled() signal: cell->signal_toggled().connect
(sigc::mem_fun (*this, &YourClass::callback_toggled))
- In the handler you do something like:
void
callback_toggled (Glib::ustring const& string_path)
{
TreeIter iter = your_model->get_iter (string_path);
(*iter)[your_column_instance.bool_col] = !bool
((*iter)[your_column_instance.bool_col]));
}
Because, really, a cell renderer is in the first place only there to
represent data.
Having a "togglebutton cellrenderer" might be confusing at first because it
seems to imply that now the view can handle model data by itself, but in
fact for TreeView the model is read only.
Even in an "editing-done" callback for a CellRendererText, you are only
being supplied with the new text, and are still responsible for effectively
updating the model yourself (in the most simple case, analogous to the above
code, set the new text into the model column the relevant cell is
displaying).