void TreeTable::_SetNodeExpanded(TreeTableNode* node, bool expanded, bool expandAncestors) { if (expanded && expandAncestors && node != fRootNode) _SetNodeExpanded(node->Parent(), true, true); ExpandOrCollapse(node->Row(), expanded); }
void PackageListView::AddPackage(const PackageInfoRef& package) { PackageRow* packageRow = _FindRow(package); // forget about it if this package is already in the listview if (packageRow != NULL) return; BAutolock _(fModelLock); // create the row for this package packageRow = new PackageRow(package, fPackageListener); // add the row, parent may be NULL (add at top level) AddRow(packageRow); // make sure the row is initially expanded ExpandOrCollapse(packageRow, true); fItemCountView->SetItemCount(CountRows()); }
PartitionListRow* PartitionListView::AddSpace(partition_id parentID, partition_id id, off_t offset, off_t size) { // the parent should already be in the listview PartitionListRow* parent = FindRow(parentID); if (!parent) return NULL; // create the row for this partition PartitionListRow* partitionrow = new PartitionListRow(parentID, id, offset, size); // find a proper insertion index based on the on-disk offset int32 index = _InsertIndexForOffset(parent, offset); // add the row, parent may be NULL (add at top level) AddRow(partitionrow, index, parent); // make sure the row is initially expanded ExpandOrCollapse(partitionrow, true); return partitionrow; }
PartitionListRow* PartitionListView::AddPartition(BPartition* partition) { PartitionListRow* partitionrow = FindRow(partition->ID()); // forget about it if this partition is already in the listview if (partitionrow != NULL) return partitionrow; // create the row for this partition partitionrow = new PartitionListRow(partition); // see if this partition has a parent, or should have // a parent (add it in this case) PartitionListRow* parent = NULL; if (partition->Parent() != NULL) { // check if it is in the listview parent = FindRow(partition->Parent()->ID()); // If parent of this partition is not yet in the list if (parent == NULL) { // add it parent = AddPartition(partition->Parent()); } } // find a proper insertion index based on the on-disk offset int32 index = _InsertIndexForOffset(parent, partition->Offset()); // add the row, parent may be NULL (add at top level) AddRow(partitionrow, index, parent); // make sure the row is initially expanded ExpandOrCollapse(partitionrow, true); return partitionrow; }
void BOutlineListView::Collapse(BListItem* item) { ExpandOrCollapse(item, false); }
void BOutlineListView::Expand(BListItem* item) { ExpandOrCollapse(item, true); }