1. /**
  2. * Add the child object to this node.
  3. *
  4. * @param child - SPObject to be added
  5. */
  6. void addChild(SPObject *child)
  7. {
  8. Gtk::TreeModel::Row row = *(panel->_store->append(*(getParentIter())));
  9. child_watchers.emplace_back(new ObjectWatcher(panel, child, &row));
  10. }
  11. /**
  12. * Get the parent TreeRow to this object
  13. */
  14. Glib::RefPtr<Gtk::TreeNodeChildren> getParentIter()
  15. {
  16. if (row_ref) {
  17. const Gtk::TreeRow row = **panel->_store->get_iter(row_ref->get_path());
  18. return row->children();
  19. }
  20. // Get store iter (root) XXX Causes warning "returning reference to temporary"
  21. return panel->_store->children();
  22. }
  23. /**
  24. * Convert SPObject to TreeView Row, assuming the object is a child.
  25. *
  26. * @param child - The child object to find in this branch
  27. */
  28. const Gtk::TreeRow* getChildIter(SPObject *child)
  29. {
  30. for (auto &iter : getParentIter()) {
  31. Gtk::TreeModel::Row row = *iter;
  32. if(row[panel->_model->_colObject] == child) {
  33. return &(*iter);
  34. }
  35. }
  36. return nullptr;
  37. }
 
 

487

Pasted Text #11783

-

PasteBin

Lines
39
Words
124
Size
1.2 KB
Created
Revisions
2
Type
text/x-c
Public Domain (PD)
Please log in to leave a comment!