/**
* Add the child object to this node.
*
* @param child - SPObject to be added
*/
void addChild(SPObject *child)
{
Gtk::TreeModel::Row row = *(panel->_store->append(*(getParentIter())));
child_watchers.emplace_back(new ObjectWatcher(panel, child, &row));
}
/**
* Get the parent TreeRow to this object
*/
Glib::RefPtr<Gtk::TreeNodeChildren> getParentIter()
{
if (row_ref) {
const Gtk::TreeRow row = **panel->_store->get_iter(row_ref->get_path());
return row->children();
}
// Get store iter (root) XXX Causes warning "returning reference to temporary"
return panel->_store->children();
}
/**
* Convert SPObject to TreeView Row, assuming the object is a child.
*
* @param child - The child object to find in this branch
*/
const Gtk::TreeRow* getChildIter(SPObject *child)
{
for (auto &iter : getParentIter()) {
Gtk::TreeModel::Row row = *iter;
if(row[panel->_model->_colObject] == child) {
return &(*iter);
}
}
return nullptr;
}
-
Connectez-vous pour ajouter un commentaire !