void VariablesView::TreeTableNodeExpandedChanged(TreeTable* table, const TreeTablePath& path, bool expanded) { if (expanded) { ModelNode* node = (ModelNode*)fVariableTableModel->NodeForPath(path); if (node == NULL) return; fVariableTableModel->NodeExpanded(node); // request the values of all children that don't have any yet // If the node only has a hidden child, directly load the child's // children's values. if (node->CountChildren() == 1) { ModelNode* child = node->ChildAt(0); if (child->IsHidden()) node = child; } // request the values for (int32 i = 0; ModelNode* child = node->ChildAt(i); i++) { if (child->IsPresentationNode()) continue; _RequestNodeValue(child); } } }
void* VariablesView::VariableTableModel::ChildAt(void* parent, int32 index) const { if (parent == this) return fNodes.ItemAt(index); // If the node only has a hidden child, pretend the node directly has the // child's children. ModelNode* modelNode = (ModelNode*)parent; int32 childCount = modelNode->CountChildren(); if (childCount == 1) { ModelNode* child = modelNode->ChildAt(0); if (child->IsHidden()) return child->ChildAt(index); } return modelNode->ChildAt(index); }