本文整理汇总了C++中Row::SetContainer方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::SetContainer方法的具体用法?C++ Row::SetContainer怎么用?C++ Row::SetContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::SetContainer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void
nsTreeContentView::SerializeItem(Element* aContent, int32_t aParentIndex,
int32_t* aIndex, nsTArray<UniquePtr<Row>>& aRows)
{
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters))
return;
aRows.AppendElement(MakeUnique<Row>(aContent, aParentIndex));
Row* row = aRows.LastElement().get();
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
nsGkAtoms::_true, eCaseMatters)) {
row->SetContainer(true);
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
nsGkAtoms::_true, eCaseMatters)) {
row->SetOpen(true);
nsIContent* child =
nsTreeUtils::GetImmediateChild(aContent, nsGkAtoms::treechildren);
if (child && child->IsXULElement()) {
// Now, recursively serialize our child.
int32_t count = aRows.Length();
int32_t index = 0;
Serialize(child, aParentIndex + *aIndex + 1, &index, aRows);
row->mSubtreeSize += aRows.Length() - count;
}
else
row->SetEmpty(true);
} else if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::empty,
nsGkAtoms::_true, eCaseMatters)) {
row->SetEmpty(true);
}
}
}
示例2: if
void
nsTreeContentView::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
int32_t aNameSpaceID,
nsAtom* aAttribute,
int32_t aModType,
const nsAttrValue* aOldValue)
{
// Lots of codepaths under here that do all sorts of stuff, so be safe.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
// Make sure this notification concerns us.
// First check the tag to see if it's one that we care about.
if (mBoxObject && (aElement == mRoot || aElement == mBody)) {
mBoxObject->ClearStyleAndImageCaches();
mBoxObject->Invalidate();
}
// We don't consider non-XUL nodes.
nsIContent* parent = nullptr;
if (!aElement->IsXULElement() ||
((parent = aElement->GetParent()) && !parent->IsXULElement())) {
return;
}
if (!aElement->IsAnyOfXULElements(nsGkAtoms::treecol,
nsGkAtoms::treeitem,
nsGkAtoms::treeseparator,
nsGkAtoms::treerow,
nsGkAtoms::treecell)) {
return;
}
// If we have a legal tag, go up to the tree/select and make sure
// that it's ours.
for (nsIContent* element = aElement; element != mBody; element = element->GetParent()) {
if (!element)
return; // this is not for us
if (element->IsXULElement(nsGkAtoms::tree))
return; // this is not for us
}
// Handle changes of the hidden attribute.
if (aAttribute == nsGkAtoms::hidden &&
aElement->IsAnyOfXULElements(nsGkAtoms::treeitem,
nsGkAtoms::treeseparator)) {
bool hidden = aElement->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters);
int32_t index = FindContent(aElement);
if (hidden && index >= 0) {
// Hide this row along with its children.
int32_t count = RemoveRow(index);
if (mBoxObject)
mBoxObject->RowCountChanged(index, -count);
}
else if (!hidden && index < 0) {
// Show this row along with its children.
nsCOMPtr<nsIContent> parent = aElement->GetParent();
if (parent) {
InsertRowFor(parent, aElement);
}
}
return;
}
if (aElement->IsXULElement(nsGkAtoms::treecol)) {
if (aAttribute == nsGkAtoms::properties) {
if (mBoxObject) {
nsCOMPtr<nsITreeColumns> cols;
mBoxObject->GetColumns(getter_AddRefs(cols));
if (cols) {
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aElement);
nsCOMPtr<nsITreeColumn> col;
cols->GetColumnFor(element, getter_AddRefs(col));
mBoxObject->InvalidateColumn(col);
}
}
}
}
else if (aElement->IsXULElement(nsGkAtoms::treeitem)) {
int32_t index = FindContent(aElement);
if (index >= 0) {
Row* row = mRows[index].get();
if (aAttribute == nsGkAtoms::container) {
bool isContainer =
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::container,
nsGkAtoms::_true, eCaseMatters);
row->SetContainer(isContainer);
if (mBoxObject)
mBoxObject->InvalidateRow(index);
}
else if (aAttribute == nsGkAtoms::open) {
bool isOpen =
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::open,
nsGkAtoms::_true, eCaseMatters);
bool wasOpen = row->IsOpen();
//.........这里部分代码省略.........