本文整理汇总了C++中Row::SetEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::SetEmpty方法的具体用法?C++ Row::SetEmpty怎么用?C++ Row::SetEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::SetEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
//.........这里部分代码省略.........
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();
if (! isOpen && wasOpen)
CloseContainer(index);
else if (isOpen && ! wasOpen)
OpenContainer(index);
}
else if (aAttribute == nsGkAtoms::empty) {
bool isEmpty =
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::empty,
nsGkAtoms::_true, eCaseMatters);
row->SetEmpty(isEmpty);
if (mBoxObject)
mBoxObject->InvalidateRow(index);
}
}
}
else if (aElement->IsXULElement(nsGkAtoms::treeseparator)) {
int32_t index = FindContent(aElement);
if (index >= 0) {
if (aAttribute == nsGkAtoms::properties && mBoxObject) {
mBoxObject->InvalidateRow(index);
}
}
}
else if (aElement->IsXULElement(nsGkAtoms::treerow)) {
if (aAttribute == nsGkAtoms::properties) {
nsCOMPtr<nsIContent> parent = aElement->GetParent();
if (parent) {
int32_t index = FindContent(parent);
if (index >= 0 && mBoxObject) {
mBoxObject->InvalidateRow(index);
}
}
}
}
else if (aElement->IsXULElement(nsGkAtoms::treecell)) {
if (aAttribute == nsGkAtoms::properties ||
aAttribute == nsGkAtoms::mode ||
aAttribute == nsGkAtoms::src ||
aAttribute == nsGkAtoms::value ||
aAttribute == nsGkAtoms::label) {
nsIContent* parent = aElement->GetParent();
if (parent) {
nsCOMPtr<nsIContent> grandParent = parent->GetParent();
if (grandParent && grandParent->IsXULElement()) {
int32_t index = FindContent(grandParent);
if (index >= 0 && mBoxObject) {
// XXX Should we make an effort to invalidate only cell ?
mBoxObject->InvalidateRow(index);
}
}
}
}
}
}
示例3: if
void
nsTreeContentView::ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
int32_t /* unused */)
{
NS_ASSERTION(aChild, "null ptr");
// Make sure this notification concerns us.
// First check the tag to see if it's one that we care about.
nsIAtom *childTag = aChild->Tag();
// Don't allow non-XUL nodes.
if (!aChild->IsXUL() || !aContainer->IsXUL())
return;
if (childTag != nsGkAtoms::treeitem &&
childTag != nsGkAtoms::treeseparator &&
childTag != nsGkAtoms::treechildren &&
childTag != nsGkAtoms::treerow &&
childTag != 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 = aContainer; element != mBody; element = element->GetParent()) {
if (!element)
return; // this is not for us
nsIAtom *parentTag = element->Tag();
if (element->IsXUL() && parentTag == nsGkAtoms::tree)
return; // this is not for us
}
// Lots of codepaths under here that do all sorts of stuff, so be safe.
nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
if (childTag == nsGkAtoms::treechildren) {
int32_t index = FindContent(aContainer);
if (index >= 0) {
Row* row = mRows[index];
row->SetEmpty(false);
if (mBoxObject)
mBoxObject->InvalidateRow(index);
if (row->IsContainer() && row->IsOpen()) {
int32_t count = EnsureSubtree(index);
if (mBoxObject)
mBoxObject->RowCountChanged(index + 1, count);
}
}
}
else if (childTag == nsGkAtoms::treeitem ||
childTag == nsGkAtoms::treeseparator) {
InsertRowFor(aContainer, aChild);
}
else if (childTag == nsGkAtoms::treerow) {
int32_t index = FindContent(aContainer);
if (index >= 0 && mBoxObject)
mBoxObject->InvalidateRow(index);
}
else if (childTag == nsGkAtoms::treecell) {
nsCOMPtr<nsIContent> parent = aContainer->GetParent();
if (parent) {
int32_t index = FindContent(parent);
if (index >= 0 && mBoxObject)
mBoxObject->InvalidateRow(index);
}
}
}