本文整理汇总了C++中nsSplitterFrame::AddMargin方法的典型用法代码示例。如果您正苦于以下问题:C++ nsSplitterFrame::AddMargin方法的具体用法?C++ nsSplitterFrame::AddMargin怎么用?C++ nsSplitterFrame::AddMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsSplitterFrame
的用法示例。
在下文中一共展示了nsSplitterFrame::AddMargin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: state
nsresult
nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mOuter, NS_OK);
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
if (!mouseEvent)
return NS_OK;
PRUint16 button = 0;
mouseEvent->GetButton(&button);
// only if left button
if (button != 0)
return NS_OK;
if (mOuter->GetContent()->
AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
nsGkAtoms::_true, eCaseMatters))
return NS_OK;
mParentBox = mOuter->GetParentBox();
if (!mParentBox)
return NS_OK;
// get our index
nsPresContext* outerPresContext = mOuter->PresContext();
const nsFrameList& siblingList(mParentBox->PrincipalChildList());
PRInt32 childIndex = siblingList.IndexOf(mOuter);
// if it's 0 (or not found) then stop right here.
// It might be not found if we're not in the parent's primary frame list.
if (childIndex <= 0)
return NS_OK;
PRInt32 childCount = siblingList.GetLength();
// if it's the last index then we need to allow for resizeafter="grow"
if (childIndex == childCount - 1 && GetResizeAfter() != Grow)
return NS_OK;
nsRefPtr<nsRenderingContext> rc =
outerPresContext->PresShell()->GetReferenceRenderingContext();
NS_ENSURE_TRUE(rc, NS_ERROR_FAILURE);
nsBoxLayoutState state(outerPresContext, rc);
mCurrentPos = 0;
mPressed = true;
mDidDrag = false;
EnsureOrient();
bool isHorizontal = !mOuter->IsHorizontal();
ResizeType resizeBefore = GetResizeBefore();
ResizeType resizeAfter = GetResizeAfter();
delete[] mChildInfosBefore;
delete[] mChildInfosAfter;
mChildInfosBefore = new nsSplitterInfo[childCount];
mChildInfosAfter = new nsSplitterInfo[childCount];
// create info 2 lists. One of the children before us and one after.
PRInt32 count = 0;
mChildInfosBeforeCount = 0;
mChildInfosAfterCount = 0;
nsIFrame* childBox = mParentBox->GetChildBox();
while (nullptr != childBox)
{
nsIContent* content = childBox->GetContent();
nsIDocument* doc = content->OwnerDoc();
PRInt32 dummy;
nsIAtom* atom = doc->BindingManager()->ResolveTag(content, &dummy);
// skip over any splitters
if (atom != nsGkAtoms::splitter) {
nsSize prefSize = childBox->GetPrefSize(state);
nsSize minSize = childBox->GetMinSize(state);
nsSize maxSize = nsBox::BoundsCheckMinMax(minSize, childBox->GetMaxSize(state));
prefSize = nsBox::BoundsCheck(minSize, prefSize, maxSize);
mOuter->AddMargin(childBox, minSize);
mOuter->AddMargin(childBox, prefSize);
mOuter->AddMargin(childBox, maxSize);
nscoord flex = childBox->GetFlex(state);
nsMargin margin(0,0,0,0);
childBox->GetMargin(margin);
nsRect r(childBox->GetRect());
r.Inflate(margin);
// We need to check for hidden attribute too, since treecols with
// the hidden="true" attribute are not really hidden, just collapsed
if (!content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::fixed,
nsGkAtoms::_true, eCaseMatters) &&
!content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
nsGkAtoms::_true, eCaseMatters)) {
if (count < childIndex && (resizeBefore != Flex || flex > 0)) {
mChildInfosBefore[mChildInfosBeforeCount].childElem = content;
mChildInfosBefore[mChildInfosBeforeCount].min = isHorizontal ? minSize.width : minSize.height;
mChildInfosBefore[mChildInfosBeforeCount].max = isHorizontal ? maxSize.width : maxSize.height;
//.........这里部分代码省略.........